Search in sources :

Example 66 with ServiceSchemaManager

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

the class AMCommonNameGenerator method initialize.

private void initialize() {
    try {
        serviceSchemaManager = new ServiceSchemaManager(G11N_SERVICE_NAME, adminSSOToken);
        serviceConfigManager = new ServiceConfigManager(G11N_SERVICE_NAME, adminSSOToken);
        //listener for org
        serviceConfigManager.addListener(this);
        //listener for global
        serviceSchemaManager.addListener(this);
    } catch (SMSException smse) {
        debug.error("AMCommonNameGenerator.initManager", smse);
    } catch (SSOException ssoe) {
        debug.error("AMCommonNameGenerator.initManager", ssoe);
    }
}
Also used : SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager) ServiceConfigManager(com.sun.identity.sm.ServiceConfigManager)

Example 67 with ServiceSchemaManager

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

the class AMModelBase method isAMSDKEnabled.

/**
     * Returns <code>true</code> if server is running with <code>AMSDK</code>
     * repo enabled.
     * 
     * @return <code>true</code> if server is running with <code>AMSDK</code>
     * repo enabled.
     */
public boolean isAMSDKEnabled() {
    try {
        ServiceSchemaManager schemaMgr = new ServiceSchemaManager(IdConstants.REPO_SERVICE, AMAdminUtils.getSuperAdminSSOToken());
        ServiceSchema orgSchema = schemaMgr.getOrganizationSchema();
        Set names = orgSchema.getSubSchemaNames();
        return (names != null) && names.contains("amSDK");
    } catch (SMSException e) {
        debug.error("AMModelBase.isAMSDKEnabled", e);
        return false;
    } catch (SSOException e) {
        debug.error("AMModelBase.isAMSDKEnabled", e);
        return false;
    }
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) Set(java.util.Set) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 68 with ServiceSchemaManager

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

the class AMAdminUtils method getSchemaSchema.

/**
     * Returns service schema for an IdType.
     *
     * @param serviceName Name of Service.
     * @param idType IdType.
     * @return service schema for an IdType.
     */
public static ServiceSchema getSchemaSchema(String serviceName, IdType idType) {
    ServiceSchema serviceSchema = null;
    SSOToken adminSSOToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
    try {
        ServiceSchemaManager mgr = new ServiceSchemaManager(serviceName, adminSSOToken);
        serviceSchema = mgr.getSchema(idType.getName());
    } catch (SSOException e) {
        debug.warning("AMAdminUtils.getAttributeSchemas", e);
    } catch (SMSException e) {
        debug.warning("AMAdminUtils.getAttributeSchemas", e);
    }
    return serviceSchema;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) SSOToken(com.iplanet.sso.SSOToken) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 69 with ServiceSchemaManager

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

the class AMModelBase method getServiceSchemaManager.

/**
     * Gets service schema manager, we cache instance of this manager per
     * HTTP request
     *
     * @param name of service
     * @return service schema manager
     * @throws SSOException when SSO token is invalid
     * @throws SMSException when we are unable to retrieve the service
     *         schema manager
     */
protected ServiceSchemaManager getServiceSchemaManager(String name) throws SSOException, SMSException {
    ServiceSchemaManager mgr = (ServiceSchemaManager) mapSvcSchemaMgrs.get(name);
    if (mgr == null) {
        mgr = new ServiceSchemaManager(name, getUserSSOToken());
        mapSvcSchemaMgrs.put(name, mgr);
    }
    return mgr;
}
Also used : ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 70 with ServiceSchemaManager

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

the class AMModelBase method getServiceResourceBundle.

protected ResourceBundle getServiceResourceBundle(String serviceName) {
    ResourceBundle rb = null;
    try {
        ServiceSchemaManager mgr = new ServiceSchemaManager(serviceName, ssoToken);
        String rbName = mgr.getI18NFileName();
        if ((rbName != null) && (rbName.trim().length() > 0)) {
            rb = AMResBundleCacher.getBundle(rbName, locale);
        }
    } catch (SSOException e) {
        debug.warning("AMModelBase.getServiceResourceBundle", e);
    } catch (SMSException e) {
        debug.warning("AMModelBase.getServiceResourceBundle", e);
    }
    return rb;
}
Also used : SMSException(com.sun.identity.sm.SMSException) ResourceBundle(java.util.ResourceBundle) SSOException(com.iplanet.sso.SSOException) 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