Search in sources :

Example 16 with ServerGroup

use of com.iplanet.services.ldap.ServerGroup in project OpenAM by OpenRock.

the class SsoServerSvcMgmtSvcImpl method init.

private void init(SnmpMib myMib, MBeanServer server) {
    if (debug == null) {
        debug = Debug.getInstance("amMonitoring");
    }
    String classMethod = "SsoServerSvcMgmtSvcImpl.init:";
    boolean dsEmbedded = Agent.getDsIsEmbedded();
    String dirSSL = SystemProperties.get(Constants.AM_DIRECTORY_SSL_ENABLED);
    String dsType = "embedded";
    if (!dsEmbedded) {
        dsType = "remote";
    }
    try {
        DSConfigMgr dscm = DSConfigMgr.getDSConfigMgr();
        ServerGroup sgrp = dscm.getServerGroup("sms");
        Collection slist = sgrp.getServersList();
        StringBuffer sbp1 = new StringBuffer("DSConfigMgr:\n");
        int port = 0;
        String svr = null;
        for (Iterator it = slist.iterator(); it.hasNext(); ) {
            Server sobj = (Server) it.next();
            svr = sobj.getServerName();
            port = sobj.getPort();
            if (debug.messageEnabled()) {
                sbp1.append("  svrname = ").append(svr).append(", port = ").append(port).append("\n");
            }
        }
        if (debug.messageEnabled()) {
            debug.message(classMethod + sbp1.toString());
        }
        ServerInstance si = dscm.getServerInstance(LDAPUser.Type.AUTH_BASIC);
        String bindDN = si.getAuthID();
        String orgDN = si.getBaseDN();
        boolean siStat = si.getActiveStatus();
        String conntype = si.getConnectionType().toString();
        if (debug.messageEnabled()) {
            sbp1 = new StringBuffer("ServerInstance:\n");
            sbp1.append("  bindDN = ").append(bindDN).append("\n").append("  orgDN = ").append(orgDN).append("\n").append("  active status = ").append(siStat).append("\n").append("  conn type = ").append(conntype).append("\n");
            debug.message(classMethod + sbp1.toString());
        }
        SvcMgmtRepositoryType = dsType;
        SvcMgmtStatus = "operational";
        if (!siStat) {
            SvcMgmtStatus = "dormant";
        }
        SvcMgmtRepositorySSL = dirSSL;
        SvcMgmtRepositoryOrgDN = orgDN;
        SvcMgmtRepositoryBindDN = bindDN;
        String portS = "0";
        try {
            portS = Integer.toString(port);
        } catch (NumberFormatException nex) {
            debug.error(classMethod + "port retrieved invalid (" + port + ": " + nex.getMessage());
        }
        SvcMgmtRepositoryHostPort = portS;
    } catch (Exception d) {
        debug.error(classMethod + "trying to get Directory Server Config");
    }
}
Also used : ServerGroup(com.iplanet.services.ldap.ServerGroup) Server(com.iplanet.services.ldap.Server) MBeanServer(javax.management.MBeanServer) Iterator(java.util.Iterator) DSConfigMgr(com.iplanet.services.ldap.DSConfigMgr) Collection(java.util.Collection) ServerInstance(com.iplanet.services.ldap.ServerInstance)

Aggregations

ServerGroup (com.iplanet.services.ldap.ServerGroup)16 ServerInstance (com.iplanet.services.ldap.ServerInstance)11 DSConfigMgr (com.iplanet.services.ldap.DSConfigMgr)8 Test (org.testng.annotations.Test)8 Server (com.iplanet.services.ldap.Server)6 LDAPServiceException (com.iplanet.services.ldap.LDAPServiceException)4 ServerConfigurationFactory (org.forgerock.openam.sm.ServerConfigurationFactory)3 SystemProperties (com.iplanet.am.util.SystemProperties)2 IOException (java.io.IOException)2 Collection (java.util.Collection)2 Iterator (java.util.Iterator)2 Properties (java.util.Properties)2 MBeanServer (javax.management.MBeanServer)2 LDAPURL (org.forgerock.openam.ldap.LDAPURL)2 Connection (org.forgerock.opendj.ldap.Connection)2 ConnectionFactory (org.forgerock.opendj.ldap.ConnectionFactory)2 Matchers.anyString (org.mockito.Matchers.anyString)2 SSOToken (com.iplanet.sso.SSOToken)1 CLIException (com.sun.identity.cli.CLIException)1 IOutput (com.sun.identity.cli.IOutput)1