Search in sources :

Example 31 with ServiceSchemaManager

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

the class SMDiscoveryServiceModelImpl method addMoreAttributeSchemasForModification.

protected void addMoreAttributeSchemasForModification(Set attributeSchemas) {
    super.addMoreAttributeSchemasForModification(attributeSchemas);
    ServiceSchemaManager mgr = getServiceSchemaManager();
    try {
        ServiceSchema global = mgr.getSchema(SchemaType.GLOBAL);
        attributeSchemas.add(global.getAttributeSchema(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF));
    } catch (SMSException e) {
        debug.error("SMDiscoveryServiceModelImpl.addMoreAttributeSchemasForModification", e);
    }
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) SMSException(com.sun.identity.sm.SMSException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 32 with ServiceSchemaManager

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

the class SMDiscoveryServiceModelImpl method getDiscoEntry.

/**
     * Returns resource offering entry stored in the model map for a given
     * type.
     *
     * @param dynamic value to indicate if it is a dynamic or not.
     * @return resource offering entry stored in the model map for a given
     * type.
     */
public Set getDiscoEntry(boolean dynamic) {
    Set set = null;
    if (dynamic) {
    // TO FIX
    } else {
        ServiceSchemaManager mgr = getServiceSchemaManager();
        try {
            ServiceSchema schema = mgr.getSchema(SchemaType.GLOBAL);
            AttributeSchema as = schema.getAttributeSchema(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
            set = as.getDefaultValues();
        } catch (SMSException e) {
            debug.error("SMDiscoveryServiceModelImpl.getDiscoEntry", e);
        }
    }
    return set;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) SMSException(com.sun.identity.sm.SMSException) AttributeSchema(com.sun.identity.sm.AttributeSchema) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 33 with ServiceSchemaManager

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

the class MAPModelBase method getServiceResourceBundle.

private void getServiceResourceBundle() {
    try {
        ServiceSchemaManager scm = new ServiceSchemaManager(mapServiceName, getUserSSOToken());
        String name = scm.getI18NFileName();
        if ((name != null) && (name.length() > 0)) {
            serviceResourceBundle = AMResBundleCacher.getBundle(name, getUserLocale());
        }
    } catch (SMSException e) {
        debug.warning("MAPModelBase.getServiceResourceBundle", e);
    } catch (SSOException e) {
        debug.warning("MAPModelBase.getServiceResourceBundle", e);
    }
}
Also used : SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 34 with ServiceSchemaManager

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

the class SCModelBase method initializeSchemaManager.

/*
    * Establishes the ServiceSchemaManager connection for future operations.
    */
private void initializeSchemaManager() {
    String error = null;
    try {
        manager = new ServiceSchemaManager(getServiceName(), getUserSSOToken());
    } catch (SSOException e) {
        error = e.getMessage();
    } catch (SMSException e) {
        error = e.getMessage();
    }
    if (error != null && debug.warningEnabled()) {
        debug.warning("couldn't initialize schema manager for " + getServiceName());
        debug.warning("reason: " + error);
    }
}
Also used : SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 35 with ServiceSchemaManager

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

the class SCUtils method getLocalizedServiceName.

public static String getLocalizedServiceName(String serviceName, Locale locale) throws SMSException, SSOException, MissingResourceException {
    String localizedName = null;
    ServiceSchemaManager mgr = new ServiceSchemaManager(serviceName, adminSSOToken);
    ResourceBundle rb = ResourceBundle.getBundle(mgr.getI18NFileName(), locale);
    Set types = mgr.getSchemaTypes();
    if (!types.isEmpty()) {
        SchemaType type = (SchemaType) types.iterator().next();
        ServiceSchema schema = mgr.getSchema(type);
        if (schema != null) {
            String i18nKey = schema.getI18NKey();
            if ((i18nKey != null) && (i18nKey.trim().length() > 0)) {
                localizedName = rb.getString(i18nKey);
            }
        }
    }
    return localizedName;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) ResourceBundle(java.util.ResourceBundle) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager) SchemaType(com.sun.identity.sm.SchemaType)

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