Search in sources :

Example 71 with ServiceSchemaManager

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

the class AMDCTree method dcNodeAttributes.

private static Set dcNodeAttributes() throws AMException {
    try {
        if (gsc == null) {
            ServiceSchemaManager scm = new ServiceSchemaManager(ADMINISTRATION_SERVICE, (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance()));
            gsc = scm.getGlobalSchema();
        }
        Map attrMap = gsc.getAttributeDefaults();
        Set values = (Set) attrMap.get(DCT_ATTRIBUTE_LIST_ATTR);
        if (values == null) {
            if (debug.messageEnabled()) {
                debug.message("DCTree.dcNodeAttributes = null");
            }
            return Collections.EMPTY_SET;
        } else {
            if (debug.messageEnabled()) {
                debug.message("DCTree.dcNodeAttributes = " + values.toString());
            }
            return values;
        }
    } catch (SMSException ex) {
        debug.error(AMSDKBundle.getString("908"), ex);
        throw new AMException(AMSDKBundle.getString("908"), "908");
    } catch (SSOException ex) {
        debug.error(AMSDKBundle.getString("902"), ex);
        throw new AMException(AMSDKBundle.getString("902"), "902");
    }
}
Also used : AttrSet(com.iplanet.services.ldap.AttrSet) Set(java.util.Set) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) HashMap(java.util.HashMap) Map(java.util.Map) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 72 with ServiceSchemaManager

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

the class AMCompliance method isAdminGroupsEnabled.

/**
     * Method which checks if Admin Groups need to be created for an
     * organization.
     * @param orgDN organization dn
     * @return true if Admin Groups need to be created
     * @exception AMException if an error is encountered
     */
protected static boolean isAdminGroupsEnabled(String orgDN) throws AMException {
    if (!isUnderRootSuffix(orgDN)) {
        return false;
    }
    try {
        if (AMDCTree.gsc == null) {
            ServiceSchemaManager scm = new ServiceSchemaManager(ADMINISTRATION_SERVICE, (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance()));
            AMDCTree.gsc = scm.getGlobalSchema();
        }
        Map attrMap = AMDCTree.gsc.getReadOnlyAttributeDefaults();
        Set values = (Set) attrMap.get(ADMIN_GROUPS_ENABLED_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.isAdminGroupsEnabled = " + enabled);
        }
        return enabled;
    } catch (SMSException ex) {
        debug.error(AMSDKBundle.getString("357"), ex);
        throw new AMException(AMSDKBundle.getString("357"), "357");
    } catch (SSOException ex) {
        debug.error(AMSDKBundle.getString("357"), ex);
        throw new AMException(AMSDKBundle.getString("357"), "357");
    }
//return compl.isAdminGroupsEnabled(orgDN);
}
Also used : Set(java.util.Set) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) HashMap(java.util.HashMap) Map(java.util.Map) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 73 with ServiceSchemaManager

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

the class EntryEventListener method getDynamicAttributeNames.

private Set getDynamicAttributeNames(String serviceName) {
    Set attrNames = Collections.EMPTY_SET;
    try {
        ServiceSchemaManager sm = new ServiceSchemaManager(serviceName, internalToken);
        ServiceSchema sschema = sm.getSchema(SchemaType.DYNAMIC);
        attrNames = sschema.getAttributeSchemaNames();
    } catch (SMSException smse) {
        if (debug.warningEnabled()) {
            debug.warning("EntryEventListener.entryChanged(): " + "caught SMSException: ", smse);
        }
    } catch (SSOException ssoe) {
        if (debug.warningEnabled()) {
            debug.error("EntryEventListener.entryChanged(): " + "caught SSOException: ", ssoe);
        }
    }
    return attrNames;
}
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 74 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 75 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)

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