Search in sources :

Example 1 with JMXConnectorConfig

use of com.sun.appserv.management.config.JMXConnectorConfig in project Payara by payara.

the class NodeAgentConfigTest method sanityCheck.

private void sanityCheck(final NodeAgentConfig na) {
    final JMXConnectorConfig jmx = na.getJMXConnectorConfig();
    final String startServers = na.getStartServersInStartup();
    na.setStartServersInStartup(startServers);
    final String name = na.getSystemJMXConnectorName();
    na.setSystemJMXConnectorName(name);
}
Also used : JMXConnectorConfig(com.sun.appserv.management.config.JMXConnectorConfig)

Example 2 with JMXConnectorConfig

use of com.sun.appserv.management.config.JMXConnectorConfig in project Payara by payara.

the class TestMain method getNodeAgentConnections.

public Map<String, AppserverConnectionSource> getNodeAgentConnections(final DomainRoot domainRoot, final PropertyGetter getter) {
    final NodeAgentsConfig nacs = domainRoot.getDomainConfig().getNodeAgentsConfig();
    if (nacs == null)
        return null;
    final Map<String, NodeAgentConfig> nodeAgentConfigs = nacs.getNodeAgentConfigMap();
    final Map<String, AppserverConnectionSource> nodeAgentConnections = new HashMap<String, AppserverConnectionSource>();
    println("");
    println("Contacting node agents...");
    for (final NodeAgentConfig nodeAgentConfig : nodeAgentConfigs.values()) {
        final String nodeAgentName = nodeAgentConfig.getName();
        final JMXConnectorConfig connConfig = nodeAgentConfig.getJMXConnectorConfig();
        final AttributeResolverHelper r = new AttributeResolverHelper(connConfig);
        if (!r.resolveBoolean("Enabled")) {
            println(nodeAgentName + ": DISABLED CONNECTOR");
            continue;
        }
        final String address = connConfig.getAddress();
        final int port = r.resolveInt("Port");
        final boolean tlsEnabled = r.resolveBoolean("SecurityEnabled");
        final String protocol = connConfig.getProtocol();
        if (!RMI_PROTOCOL_IN_CONFIG.equals(protocol)) {
            println(nodeAgentName + ": UNSUPPORTED CONNECTOR PROTOCOL: " + protocol);
            continue;
        }
        // See if we can connect
        try {
            final AppserverConnectionSource asConn = _getConnectionSource(getter, address, port);
            final MBeanServerConnection conn = asConn.getMBeanServerConnection(false);
            final boolean alive = conn.isRegistered(JMXUtil.getMBeanServerDelegateObjectName());
            assert (alive);
            nodeAgentConnections.put(nodeAgentName, asConn);
            println(nodeAgentName + ": ALIVE");
        } catch (Exception e) {
            println("Node agent " + nodeAgentConfig.getName() + " could not be contacted: " + e.getClass().getName());
            println(nodeAgentName + ": COULD NOT BE CONTACTED");
            continue;
        }
    }
    println("");
    return nodeAgentConnections;
}
Also used : HashMap(java.util.HashMap) JMXConnectorConfig(com.sun.appserv.management.config.JMXConnectorConfig) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) NodeAgentsConfig(com.sun.appserv.management.config.NodeAgentsConfig) AppserverConnectionSource(com.sun.appserv.management.client.AppserverConnectionSource) NodeAgentConfig(com.sun.appserv.management.config.NodeAgentConfig) AttributeResolverHelper(com.sun.appserv.management.helper.AttributeResolverHelper) MBeanServerConnection(javax.management.MBeanServerConnection)

Example 3 with JMXConnectorConfig

use of com.sun.appserv.management.config.JMXConnectorConfig in project Payara by payara.

the class JMXConnectorConfigTest method ensureDefaultInstance.

public static JMXConnectorConfig ensureDefaultInstance(final AdminServiceConfig adminServiceConfig) {
    JMXConnectorConfig result = adminServiceConfig.getJMXConnectorConfigMap().get(getDefaultInstanceName());
    if (result == null) {
        final SecurityServiceConfig securityServiceConfig = getConfigConfig(adminServiceConfig).getSecurityServiceConfig();
        final AuthRealmConfig defaultAuthRealm = AuthRealmConfigTest.ensureDefaultInstance(securityServiceConfig);
        result = createInstance(getDefaultInstanceName(), ADDRESS, DEFAULT_PORT, defaultAuthRealm, OPTIONAL);
    }
    return result;
}
Also used : AuthRealmConfig(com.sun.appserv.management.config.AuthRealmConfig) SecurityServiceConfig(com.sun.appserv.management.config.SecurityServiceConfig) JMXConnectorConfig(com.sun.appserv.management.config.JMXConnectorConfig)

Example 4 with JMXConnectorConfig

use of com.sun.appserv.management.config.JMXConnectorConfig in project Payara by payara.

the class JMXConnectorConfigTest method testCreateSSL.

public void testCreateSSL() throws Exception {
    if (!checkNotOffline("testCreateSSL")) {
        return;
    }
    final String NAME = "JMXConnectorConfigTest-testCreateSSL";
    try {
        removeEx(NAME);
        final JMXConnectorConfig newConfig = (JMXConnectorConfig) createProgeny(NAME, null);
        final Map<String, JMXConnectorConfig> jmxConnectors = getAdminServiceConfig().getJMXConnectorConfigMap();
        final JMXConnectorConfig jmxConnector = (JMXConnectorConfig) jmxConnectors.get(NAME);
        assert jmxConnector != null;
        assert jmxConnector == newConfig;
        final String CERT_NICKNAME = NAME + "Cert";
        final SSLConfig ssl = jmxConnector.createSSLConfig(CERT_NICKNAME, null);
        assert ssl != null;
        assert ssl.getCertNickname().equals(CERT_NICKNAME);
        jmxConnector.removeSSLConfig();
    } finally {
        remove(NAME);
    }
}
Also used : SSLConfig(com.sun.appserv.management.config.SSLConfig) JMXConnectorConfig(com.sun.appserv.management.config.JMXConnectorConfig)

Aggregations

JMXConnectorConfig (com.sun.appserv.management.config.JMXConnectorConfig)4 AppserverConnectionSource (com.sun.appserv.management.client.AppserverConnectionSource)1 AuthRealmConfig (com.sun.appserv.management.config.AuthRealmConfig)1 NodeAgentConfig (com.sun.appserv.management.config.NodeAgentConfig)1 NodeAgentsConfig (com.sun.appserv.management.config.NodeAgentsConfig)1 SSLConfig (com.sun.appserv.management.config.SSLConfig)1 SecurityServiceConfig (com.sun.appserv.management.config.SecurityServiceConfig)1 AttributeResolverHelper (com.sun.appserv.management.helper.AttributeResolverHelper)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 MBeanServerConnection (javax.management.MBeanServerConnection)1