Search in sources :

Example 36 with ServiceSchema

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

the class EntitiesModelImpl method getPropertiesViewBean.

/**
     * Returns properties view bean URL for an attribute schema.
     *
     * @param name Name of attribute schema.
     * @return properties view bean URL for an attribute schema.
     */
public String getPropertiesViewBean(String name) {
    String url = null;
    try {
        ServiceSchemaManager mgr = new ServiceSchemaManager(name, adminSSOToken);
        ServiceSchema schema = mgr.getSchema(SchemaType.USER);
        Set attributeSchemas = schema.getAttributeSchemas();
        for (Iterator i = attributeSchemas.iterator(); i.hasNext() && (url == null); ) {
            AttributeSchema as = (AttributeSchema) i.next();
            if (as.getName().equals(name)) {
                url = as.getPropertiesViewBeanURL();
            }
        }
    } catch (SMSException e) {
        debug.warning("EntitiesModelImpl.getDefaultValues", e);
    } catch (SSOException e) {
        debug.warning("EntitiesModelImpl.getDefaultValues", e);
    }
    return url;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) HashSet(java.util.HashSet) SMSException(com.sun.identity.sm.SMSException) Iterator(java.util.Iterator) AttributeSchema(com.sun.identity.sm.AttributeSchema) SSOException(com.iplanet.sso.SSOException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 37 with ServiceSchema

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

the class EntitiesModelImpl method hasAttributeSchema.

private boolean hasAttributeSchema(String serviceName, SchemaType type) {
    boolean hasAttributes = false;
    try {
        ServiceSchemaManager mgr = new ServiceSchemaManager(serviceName, getUserSSOToken());
        ServiceSchema schema = mgr.getSchema(type);
        if (schema != null) {
            Set attributeSchemas = schema.getAttributeSchemas();
            if ((attributeSchemas != null) && !attributeSchemas.isEmpty()) {
                hasAttributes = hasI18nKeys(attributeSchemas);
            }
        }
    } catch (SMSException e) {
        debug.warning("EntitiesModelImpl.hasAttributeSchema", e);
    } catch (SSOException e) {
        debug.warning("EntitiesModelImpl.hasAttributeSchema", e);
    }
    return hasAttributes;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) HashSet(java.util.HashSet) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 38 with ServiceSchema

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

the class EntitiesModelImpl method discardServicesWithoutAttributeSchema.

private void discardServicesWithoutAttributeSchema(Set serviceNames, AMIdentity amid) {
    for (Iterator iter = serviceNames.iterator(); iter.hasNext(); ) {
        String serviceName = (String) iter.next();
        String url = getServicePropertiesViewBeanURL(serviceName);
        if (url == null) {
            ServiceSchema serviceSchema = AMAdminUtils.getSchemaSchema(serviceName, amid.getType());
            Set attributes = serviceSchema.getAttributeSchemas();
            if ((attributes == null) || attributes.isEmpty()) {
                iter.remove();
            } else if (!hasI18nKeys(attributes)) {
                iter.remove();
            }
        }
    }
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) HashSet(java.util.HashSet) Iterator(java.util.Iterator)

Example 39 with ServiceSchema

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

the class AMSDKRepo method getDefaultAgentContainerName.

private String getDefaultAgentContainerName() {
    String gcName = "Agent";
    try {
        ServiceSchemaManager ssm = new ServiceSchemaManager(ADMIN_SERVICE, adminToken);
        if (ssm != null) {
            ServiceSchema ss = ssm.getGlobalSchema();
            if (ss != null) {
                Map attrs = ss.getAttributeDefaults();
                Set vals = (Set) attrs.get(AC_ATTR);
                if (vals != null && !vals.isEmpty())
                    gcName = (String) vals.iterator().next();
            }
        }
    } catch (SMSException smse) {
        debug.error("AMSDKRepo.getDefaultAC: SMSException: ", smse);
    } catch (SSOException ssoe) {
        debug.error("AMSDKRepo.getDefaultAC: SSOException", ssoe);
    }
    return gcName;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) HashSet(java.util.HashSet) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) Map(java.util.Map) HashMap(java.util.HashMap) CaseInsensitiveHashMap(com.sun.identity.common.CaseInsensitiveHashMap) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 40 with ServiceSchema

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

the class AMServiceUtils method getServiceAttributeNames.

/**
     * Get attribute names for the specified Service and Schema Type
     * 
     * @param token
     *            SSOToken a valid SSOToken
     * @param serviceName
     *            the service name
     * @param type
     *            the SchemaType
     * @return the Set of attribute names for that specified Service and Schema
     *         Type
     */
protected static Set getServiceAttributeNames(SSOToken token, String serviceName, SchemaType type) throws SMSException, SSOException {
    ServiceSchemaManager ssm = new ServiceSchemaManager(serviceName, token);
    ServiceSchema ss = null;
    try {
        ss = ssm.getSchema(type);
    } catch (SMSException sme) {
        if (debug.warningEnabled()) {
            debug.warning("AMServiceUtils.getServiceAttributeNames():" + " No schema defined for " + type);
        }
    }
    if ((ss == null) || (type == SchemaType.POLICY)) {
        return Collections.EMPTY_SET;
    }
    return ss.getAttributeSchemaNames();
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) SMSException(com.sun.identity.sm.SMSException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Aggregations

ServiceSchema (com.sun.identity.sm.ServiceSchema)216 SMSException (com.sun.identity.sm.SMSException)152 ServiceSchemaManager (com.sun.identity.sm.ServiceSchemaManager)131 SSOException (com.iplanet.sso.SSOException)117 Set (java.util.Set)101 AttributeSchema (com.sun.identity.sm.AttributeSchema)76 HashSet (java.util.HashSet)71 Map (java.util.Map)70 HashMap (java.util.HashMap)57 Iterator (java.util.Iterator)56 CLIException (com.sun.identity.cli.CLIException)46 SSOToken (com.iplanet.sso.SSOToken)27 IOutput (com.sun.identity.cli.IOutput)26 BeforeTest (org.testng.annotations.BeforeTest)22 CLIRequest (com.sun.identity.cli.CLIRequest)21 ByteString (org.forgerock.opendj.ldap.ByteString)21 AfterTest (org.testng.annotations.AfterTest)21 Test (org.testng.annotations.Test)21 Parameters (org.testng.annotations.Parameters)18 TreeSet (java.util.TreeSet)15