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");
}
}
Aggregations