ConfigMonitoring.java revision 80ca0b9f5ad61b2335af25d4dcf25a04ebfcbc91
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * Copyright (c) 2009 Sun Microsystems Inc. All Rights Reserved
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * The contents of this file are subject to the terms
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * of the Common Development and Distribution License
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * (the License). You may not use this file except in
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * compliance with the License.
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * You can obtain a copy of the License at
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * See the License for the specific language governing
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * permission and limitations under the License.
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * When distributing Covered Code, include this CDDL
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * Header Notice in each file and include the License file
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * If applicable, add the following below the CDDL Header,
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * with the fields enclosed by brackets [] replaced by
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * your own identifying information:
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * $Id: ConfigMonitoring.java,v 1.6 2009/12/23 23:50:21 bigfatrat Exp $
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * Portions Copyrighted 2011-2012 ForgeRock Inc
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport com.iplanet.dpro.session.service.SessionService;
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport com.sun.identity.authentication.config.AMAuthenticationInstance;
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport com.sun.identity.authentication.config.AMAuthenticationManager;
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport com.sun.identity.authentication.config.AMConfigurationException;
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport com.sun.identity.common.configuration.AgentConfiguration;
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport com.sun.identity.common.configuration.SiteConfiguration;
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport com.sun.identity.idm.AMIdentityRepository;
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport com.sun.identity.monitoring.SSOServerRealmInfo;
98edafaa1060580ef39bce8710345d9fe25b5b04Jaco Joosteimport com.sun.identity.monitoring.SSOServerMonConfig;
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport com.sun.identity.security.AdminTokenAction;
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport com.sun.identity.shared.datastruct.CollectionHelper;
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport com.sun.identity.sm.OrganizationConfigManager;
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport com.sun.identity.sm.ServiceSchemaManager;
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * This class gathers the configuration information for the
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * monitoring service, which is initially started in WebtopNaming.java
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * Configuration information can be gathered after Session services
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * have started up.
abecb4c15c1d3057f88dbae1db109e9b51fe1c35Jaco Jooste * in AMLoginModule.java, the requested realm/org (i.e., in the
abecb4c15c1d3057f88dbae1db109e9b51fe1c35Jaco Jooste * "?realm=xxx" parameter) is not available, so realm-specific
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * auth module statistics can't be updated. leave the code
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * to gather the realms' auth module instances in, but don't
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * call it for now.
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster private boolean skipGettingAuthModules = true;
abecb4c15c1d3057f88dbae1db109e9b51fe1c35Jaco Jooste * this method is called by AMSetupServlet, when it's done
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * configuring the OpenSSO server after deployment. it's also
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * called by the MonitoringConfiguration load-on-startup servlet
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * when the OpenSSO server is restarted any time after being
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * configured. it completes the configuring of the monitoring
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * agent with the config information that requires an SSOToken
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * to retrieve. there is another part of the configuration supplied
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * to the agent by WebtopNaming.
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
boolean isSessFOEnabled = false;
int i = getMonServiceAttrs();
if (!skipGettingAuthModules) {
} catch (SMSException e) {
srInfo =
} catch (SMSException e) {
} catch (SMSException e) {
} catch (AMConfigurationException e) {
e.getMessage());
return aMods;
sb2 =
} catch (AMConfigurationException e) {
e.getMessage());
return insts;
} catch (IdRepoException e) {
e.getMessage());
} catch (SSOException e) {
e.getMessage());
return supportedTypes;
private void getAgentTypes() {
* to AgentsModelImpl.java:getAgentNames(...)
} catch (IdRepoException e) {
e.getMessage());
} catch (SSOException e) {
e.getMessage());
* this is similar to AgentsModelImpl.java:getAgentGroupNames(...)
} catch (IdRepoException e) {
e.getMessage());
} catch (SSOException e) {
e.getMessage());
private void getAgentsAndGroupsInfo (
* to AgentsModelImpl.java:getAgentNames(...)
} catch (IdRepoException e) {
e.getMessage());
} catch (SSOException e) {
e.getMessage());
* aid.getName() => name of the agent/agentgroup
* aid.getAttribute(com.sun.identity.agents.config.login.url) =>
* aid.getAttribute(com.sun.identity.agents.config.agenturi.prefix) =>
} catch (IdRepoException e) {
} catch (SSOException e) {
} catch (IdRepoException e) {
} catch (SSOException e) {
boolean isAgentOnly)
* aid.getName() => name of the agent/agentgroup
* com.sun.identity.agents.config.login.url (already)
* "WebAgent" -> get com.sun.identity.agents.config.login.url (ok)
* "J2EEAgent" -> get com.sun.identity.agents.config.login.url (ok)
* aid.getAttribute(com.sun.identity.agents.config.login.url) =>
* aid.getAttribute(com.sun.identity.agents.config.agenturi.prefix) =>
} catch (IdRepoException e) {
return null;
} catch (SSOException e) {
return null;
* and com.sun.identity.agents.config.login.url for both
if (isAgentOnly) {
} catch (IdRepoException e) {
} catch (SSOException e) {
return attrMap;
private int getMonServiceAttrs() {
new ServiceSchemaManager(
boolean monEna =
if (!monEna) {
boolean httpEna =
int httpPort =
int rmiPort =
boolean rmiEna =
int snmpPort =
boolean snmpEna =