Search in sources :

Example 86 with ServiceSchemaManager

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

the class AuthUtils method getGlobalAttributes.

/**
      * Returns <code>Map</code> attributes
      *
      * @param serviceName Service Name
      * @return <code>Map</code> of global attributes.
      */
public static Map getGlobalAttributes(String serviceName) {
    Map attrs = null;
    try {
        SSOToken dUserToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
        ServiceSchemaManager scm = new ServiceSchemaManager(serviceName, dUserToken);
        ServiceSchema schema = scm.getGlobalSchema();
        if (schema != null) {
            attrs = schema.getAttributeDefaults();
        }
    } catch (SMSException smsExp) {
        utilDebug.error("AuthUtils.getGlobalAttributes: SMS Error", smsExp);
    } catch (SSOException ssoExp) {
        utilDebug.error("AuthUtils.getGlobalAttributes: SSO Error", ssoExp);
    }
    if (utilDebug.messageEnabled()) {
        utilDebug.message("AuthUtils.getGlobalAttributes: attrs=" + attrs);
    }
    return attrs;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) SSOToken(com.iplanet.sso.SSOToken) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) Map(java.util.Map) HashMap(java.util.HashMap) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 87 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 88 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 89 with ServiceSchemaManager

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

the class AuthD method initPlatformServiceGlobalSettings.

/**
     * Initialized platform service global attributes
     * @throws SMSException if it fails to initialize platform service
     * @throws SSOException if admin <code>SSOToken</code> is not valid 
     */
private void initPlatformServiceGlobalSettings() throws SMSException, SSOException {
    ServiceSchemaManager scm = new ServiceSchemaManager(ISAuthConstants.PLATFORM_SERVICE_NAME, ssoAuthSession);
    updatePlatformServiceGlobals(scm);
    new AuthConfigMonitor(scm);
}
Also used : ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 90 with ServiceSchemaManager

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

the class AuthD method initAuthConfigGlobalSettings.

/**
     * Initialize the AuthConfiguration global attributes.
     * @throws SMSException if it fails to get auth service for name
     * @throws SSOException if admin <code>SSOToken</code> is not valid 
     * @throws Exception
     */
private void initAuthConfigGlobalSettings() throws Exception {
    ServiceSchemaManager scm = new ServiceSchemaManager(ISAuthConstants.AUTHCONFIG_SERVICE_NAME, ssoAuthSession);
    updateAuthConfigGlobals(scm);
    new AuthConfigMonitor(scm);
}
Also used : ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

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