Search in sources :

Example 21 with ServiceSchemaManager

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

the class ComplianceServicesImpl method isComplianceUserDeletionEnabled.

/**
     * Method which checks if Compliance User Deletion is enabled
     * 
     * @return true if Compliance User Deletion is enabled
     * @exception AMException
     *                if an error is encountered
     */
public static boolean isComplianceUserDeletionEnabled() throws AMException {
    try {
        if (gsc == null) {
            ServiceSchemaManager scm = new ServiceSchemaManager(ADMINISTRATION_SERVICE, internalToken);
            gsc = scm.getGlobalSchema();
        }
        Map attrMap = gsc.getReadOnlyAttributeDefaults();
        Set values = (Set) attrMap.get(COMPLIANCE_USER_DELETION_ATTR);
        boolean enabled = false;
        if (values == null || values.isEmpty()) {
            enabled = false;
        } else {
            String val = (String) values.iterator().next();
            enabled = (val.equalsIgnoreCase("true"));
        }
        if (debug.messageEnabled()) {
            debug.message("Compliance.isComplianceUserDeletionEnabled = " + enabled);
        }
        return enabled;
    } catch (SMSException ex) {
        debug.error(AMSDKBundle.getString("359"), ex);
        throw new AMException(AMSDKBundle.getString("359"), "359");
    } catch (SSOException ex) {
        debug.error(AMSDKBundle.getString("359"), ex);
        throw new AMException(AMSDKBundle.getString("359"), "359");
    }
}
Also used : HashSet(java.util.HashSet) AttrSet(com.iplanet.services.ldap.AttrSet) Set(java.util.Set) SMSException(com.sun.identity.sm.SMSException) AMException(com.iplanet.am.sdk.AMException) SSOException(com.iplanet.sso.SSOException) HashMap(java.util.HashMap) Map(java.util.Map) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 22 with ServiceSchemaManager

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

the class EventService method isAMSDKConfigured.

private static boolean isAMSDKConfigured() {
    boolean isAMSDKConfigured = false;
    boolean configTime = isDuringConfigurationTime();
    logger.message("EventService.getListenerList(): {}: {}", Constants.SYS_PROPERTY_INSTALL_TIME, configTime);
    if (!configTime) {
        try {
            ServiceSchemaManager scm = new ServiceSchemaManager(AccessController.doPrivileged(AdminTokenAction.getInstance()), IdConstants.REPO_SERVICE, "1.0");
            ServiceSchema idRepoSubSchema = scm.getOrganizationSchema();
            Set idRepoPlugins = idRepoSubSchema.getSubSchemaNames();
            if (idRepoPlugins.contains("amSDK")) {
                isAMSDKConfigured = true;
            }
        } catch (SMSException ex) {
            logger.warning("EventService.getListenerList() - Unable to obtain idrepo service", ex);
        } catch (SSOException ex) {
        // Should not happen, ignore the exception
        }
    }
    return isAMSDKConfigured;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 23 with ServiceSchemaManager

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

the class SchemaCommand method getServiceSchemaManager.

protected ServiceSchemaManager getServiceSchemaManager(String serviceName) throws CLIException {
    ServiceSchemaManager mgr = null;
    SSOToken adminSSOToken = getAdminSSOToken();
    if (serviceName != null) {
        try {
            mgr = new ServiceSchemaManager(serviceName, adminSSOToken);
        } catch (SSOException e) {
            debugError("SchemaCommand.getServiceSchemaManager", e);
            throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
        } catch (SMSException e) {
            debugError("SchemaCommand.getServiceSchemaManager", e);
            throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
        }
    }
    return mgr;
}
Also used : SSOToken(com.iplanet.sso.SSOToken) SMSException(com.sun.identity.sm.SMSException) CLIException(com.sun.identity.cli.CLIException) SSOException(com.iplanet.sso.SSOException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 24 with ServiceSchemaManager

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

the class SmsRequestHandler method addServersRoutes.

private void addServersRoutes(ServiceManager sm, Map<String, Map<SmsRouteTree, Set<RouteMatcher<Request>>>> serviceRoutes) throws SSOException, SMSException {
    ServiceSchemaManager ssm = sm.getSchemaManager(ISAuthConstants.PLATFORM_SERVICE_NAME, DEFAULT_VERSION);
    Set<RouteMatcher<Request>> rootRoutes = new HashSet<>();
    serviceRoutes.get(ISAuthConstants.PLATFORM_SERVICE_NAME).put(routeTree, rootRoutes);
    addServersRoutes(ssm, rootRoutes, ConfigurationBase.CONFIG_SERVERS, ConfigurationBase.SUBSCHEMA_SERVER);
}
Also used : RouteMatcher(org.forgerock.services.routing.RouteMatcher) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager) HashSet(java.util.HashSet)

Example 25 with ServiceSchemaManager

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

the class ConfigMonitoring method getMonServiceAttrs.

private int getMonServiceAttrs() {
    String classMethod = "ConfigMonitoring.getMonServiceAttrs: ";
    try {
        ServiceSchemaManager schemaManager = new ServiceSchemaManager("iPlanetAMMonitoringService", ssoToken);
        ServiceSchema smsMonSchema = schemaManager.getGlobalSchema();
        Map monAttrs = smsMonSchema.getAttributeDefaults();
        boolean monEna = Boolean.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-enabled")).booleanValue();
        if (!monEna) {
            if (debug.warningEnabled()) {
                debug.warning(classMethod + "monitoring is disabled");
            }
            return -1;
        }
        boolean httpEna = Boolean.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-http-enabled")).booleanValue();
        int httpPort = Integer.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-http-port"));
        String authFilePath = CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-authfile-path");
        int rmiPort = Integer.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-rmi-port"));
        boolean rmiEna = Boolean.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-rmi-enabled")).booleanValue();
        int snmpPort = Integer.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-snmp-port"));
        boolean snmpEna = Boolean.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-snmp-enabled")).booleanValue();
        int policyWindow = Integer.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-policy-window"));
        int sessionWindow = Integer.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-session-window"));
        if (debug.messageEnabled()) {
            debug.message(classMethod + "\n" + "     monitoring enabled = " + monEna + "\n" + "     monitoring auth filepath = " + authFilePath + "\n" + "     httpPort = " + httpPort + "\n" + "     httpPort enabled = " + httpEna + "\n" + "     rmiPort = " + rmiPort + "\n" + "     rmiPort enabled = " + rmiEna + "\n" + "     snmpPort = " + snmpPort + "\n" + "     snmpPort enabled = " + snmpEna + "\n" + "     policy eval window size = " + policyWindow + "\n" + "     session eval window size = " + sessionWindow + "\n");
        }
        SSOServerMonConfig sMonInfo = new SSOServerMonConfig.SSOServerMonInfoBuilder(monEna).htmlPort(httpPort).htmlAuthFile(authFilePath).snmpPort(snmpPort).rmiPort(rmiPort).monHtmlEnabled(httpEna).monRmiEnabled(rmiEna).monSnmpEnabled(snmpEna).policyWindowSize(policyWindow).sessionWindowSize(sessionWindow).build();
        int i = Agent.startAgent(sMonInfo);
        if (i != 0) {
            if (debug.warningEnabled()) {
                debug.warning(classMethod + "Monitoring Agent not started (" + i + ")");
            }
            return (i);
        }
    } catch (Exception ex) {
        debug.error(classMethod + "error reading Monitoring attributes: ", ex);
        return (Agent.MON_READATTRS_PROBLEM);
    }
    return 0;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) SSOServerMonConfig(com.sun.identity.monitoring.SSOServerMonConfig) HashMap(java.util.HashMap) Map(java.util.Map) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager) IdRepoException(com.sun.identity.idm.IdRepoException) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) AMConfigurationException(com.sun.identity.authentication.config.AMConfigurationException)

Aggregations

ServiceSchemaManager (com.sun.identity.sm.ServiceSchemaManager)209 SMSException (com.sun.identity.sm.SMSException)146 ServiceSchema (com.sun.identity.sm.ServiceSchema)131 SSOException (com.iplanet.sso.SSOException)119 Set (java.util.Set)87 HashSet (java.util.HashSet)60 Map (java.util.Map)56 HashMap (java.util.HashMap)49 AttributeSchema (com.sun.identity.sm.AttributeSchema)46 SSOToken (com.iplanet.sso.SSOToken)43 Iterator (java.util.Iterator)40 CLIException (com.sun.identity.cli.CLIException)33 BeforeTest (org.testng.annotations.BeforeTest)27 AfterTest (org.testng.annotations.AfterTest)26 Test (org.testng.annotations.Test)26 CLIRequest (com.sun.identity.cli.CLIRequest)25 Parameters (org.testng.annotations.Parameters)18 ServiceConfigManager (com.sun.identity.sm.ServiceConfigManager)15 TreeSet (java.util.TreeSet)12 ByteString (org.forgerock.opendj.ldap.ByteString)11