Search in sources :

Example 41 with ServiceConfigManager

use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.

the class OpenAMSettingsImpl method getServiceConfig.

private ServiceConfig getServiceConfig(String realm) throws SMSException, SSOException {
    final SSOToken token = AccessController.doPrivileged(AdminTokenAction.getInstance());
    final ServiceConfigManager serviceConfigManager = new ServiceConfigManager(token, serviceName, serviceVersion);
    return serviceConfigManager.getOrganizationConfig(realm, null);
}
Also used : SSOToken(com.iplanet.sso.SSOToken) ServiceConfigManager(com.sun.identity.sm.ServiceConfigManager)

Example 42 with ServiceConfigManager

use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.

the class SMSConfigProvider method registerListener.

void registerListener(String source, ServiceListener listener) {
    ServiceConfigManager configManager = getConfigManager(source);
    configManager.addListener(listener);
}
Also used : ServiceConfigManager(com.sun.identity.sm.ServiceConfigManager)

Example 43 with ServiceConfigManager

use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.

the class SMSConfigProvider method getConfigManager.

private ServiceConfigManager getConfigManager(String source) {
    try {
        ServiceConfigManager configManager = configManageCache.get(source);
        if (configManager == null) {
            synchronized (configManageCache) {
                configManager = configManageCache.get(source);
                if (configManager == null) {
                    configManager = new ServiceConfigManager(ssoTokenPrivilegedAction.run(), source, SERVICE_VERSION);
                    configManageCache.put(source, configManager);
                }
            }
        }
        return configManager;
    } catch (SMSException | SSOException e) {
        throw new ConfigRetrievalException("Unable to retrieve config manager " + source, e);
    }
}
Also used : SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) ServiceConfigManager(com.sun.identity.sm.ServiceConfigManager)

Example 44 with ServiceConfigManager

use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.

the class RadiusServerGuiceModule method getRadiusServiceConfigManger.

/**
     * Guice provider for the ServiceConfigManager.
     *
     * @return a ServiceConfigurationManager that can be used
     * @throws RadiusLifecycleException - when the service config manager can not be obtained.
     */
@Provides
@Named("RadiusServer")
protected ServiceConfigManager getRadiusServiceConfigManger() throws RadiusLifecycleException {
    ServiceConfigManager mgr = null;
    // get a ServiceConfigManager for our service
    try {
        final SSOToken admTk = AccessController.doPrivileged(AdminTokenAction.getInstance());
        mgr = new ServiceConfigManager(RadiusServerConstants.RADIUS_SERVICE_NAME, admTk);
    } catch (final Exception e) {
        throw new RadiusLifecycleException("Could not obtain ServiceConfigManger for the RADIUS service.", e);
    }
    return mgr;
}
Also used : SSOToken(com.iplanet.sso.SSOToken) ServiceConfigManager(com.sun.identity.sm.ServiceConfigManager) Named(javax.inject.Named) Provides(com.google.inject.Provides)

Example 45 with ServiceConfigManager

use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.

the class SFOConfigValidator method processSFO.

private void processSFO(SSOToken ssoToken) {
    boolean isSessionFailoverEnabled = false;
    String sessionStoreUserName = null;
    String sessionStorePassword = null;
    HashMap clusterMemberMap = new HashMap();
    // in milli-second
    int connectionMaxWaitTime = 5000;
    String jdbcDriverClass = null;
    String sessionRepositoryURL = null;
    int minPoolSize = 8;
    int maxPoolSize = 32;
    // in milli-second
    int maxWaitTimeForConstraint = 6000;
    boolean isPropertyNotificationEnabled = false;
    Set notificationProperties;
    toolOutWriter.printMessage("sfo-validate-cfg-prop");
    try {
        ServiceConfigManager scm = new ServiceConfigManager(amSessionService, ssoToken);
        ServiceConfig serviceConfig = scm.getGlobalConfig(null);
        String subCfgName = SiteConfiguration.getSiteIdByURL(ssoToken, getSessionServerURL());
        ServiceConfig subConfig = serviceConfig.getSubConfig(subCfgName);
        String[] params = { getSessionServerURL() };
        if (subConfig != null) {
            Map sessionAttrs = subConfig.getAttributes();
            boolean sfoEnabled = Boolean.valueOf(CollectionHelper.getMapAttr(sessionAttrs, CoreTokenConstants.IS_SFO_ENABLED, "false")).booleanValue();
            if (sfoEnabled) {
                isSessionFailoverEnabled = true;
                toolOutWriter.printMessage("sfo-cfg-enabled", params);
                sessionStoreUserName = CollectionHelper.getMapAttr(sessionAttrs, SESSION_STORE_USERNAME, "amsvrusr");
                sessionStorePassword = CollectionHelper.getMapAttr(sessionAttrs, SESSION_STORE_PASSWORD, "password");
                connectionMaxWaitTime = Integer.parseInt(CollectionHelper.getMapAttr(sessionAttrs, CONNECT_MAX_WAIT_TIME, "5000"));
                jdbcDriverClass = CollectionHelper.getMapAttr(sessionAttrs, JDBC_DRIVER_CLASS, "");
                sessionRepositoryURL = CollectionHelper.getMapAttr(sessionAttrs, IPLANET_AM_SESSION_REPOSITORY_URL, "");
                validateClusterList(sessionRepositoryURL);
                minPoolSize = Integer.parseInt(CollectionHelper.getMapAttr(sessionAttrs, MIN_POOL_SIZE, "8"));
                maxPoolSize = Integer.parseInt(CollectionHelper.getMapAttr(sessionAttrs, MAX_POOL_SIZE, "32"));
                toolOutWriter.printMessage("sfo-cfg-prop-details");
                String[] params1 = { sessionStoreUserName, sessionRepositoryURL, Integer.toString(connectionMaxWaitTime), Integer.toString(minPoolSize), Integer.toString(maxPoolSize) };
                toolOutWriter.printMessage("sfo-cfg-params", params1);
            } else {
                toolOutWriter.printMessage("sfo-cfg-not-enabled", params);
            }
        } else {
            toolOutWriter.printMessage("sfo-cfg-not-enabled", params);
        }
    } catch (Exception ex) {
        toolOutWriter.printError("sfo-cfg-prop-notfound");
        toolOutWriter.printStatusMsg(false, "sfo-validate-cfg-prop");
        Debug.getInstance(DEBUG_NAME).error("SFOConfigValidator.processSFO: " + "Exception in validating sfo configuration " + "information", ex);
    }
}
Also used : Set(java.util.Set) HashMap(java.util.HashMap) ServiceConfig(com.sun.identity.sm.ServiceConfig) HashMap(java.util.HashMap) Map(java.util.Map) ServiceConfigManager(com.sun.identity.sm.ServiceConfigManager)

Aggregations

ServiceConfigManager (com.sun.identity.sm.ServiceConfigManager)163 ServiceConfig (com.sun.identity.sm.ServiceConfig)123 SMSException (com.sun.identity.sm.SMSException)116 SSOException (com.iplanet.sso.SSOException)107 SSOToken (com.iplanet.sso.SSOToken)53 Set (java.util.Set)50 Map (java.util.Map)31 HashMap (java.util.HashMap)29 HashSet (java.util.HashSet)28 CLIException (com.sun.identity.cli.CLIException)17 Iterator (java.util.Iterator)16 ServiceSchemaManager (com.sun.identity.sm.ServiceSchemaManager)15 UpgradeException (org.forgerock.openam.upgrade.UpgradeException)13 ServiceNotFoundException (com.sun.identity.sm.ServiceNotFoundException)12 ByteString (org.forgerock.opendj.ldap.ByteString)12 JsonValue (org.forgerock.json.JsonValue)10 IOException (java.io.IOException)9 InternalServerErrorException (org.forgerock.json.resource.InternalServerErrorException)9 IOutput (com.sun.identity.cli.IOutput)8 PolicyException (com.sun.identity.policy.PolicyException)7