Search in sources :

Example 71 with ServiceSchema

use of com.sun.identity.sm.ServiceSchema 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 72 with ServiceSchema

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

the class ModifyAttributeSchemaI18nKey method handleRequest.

/**
     * Services a Commandline Request.
     *
     * @param rc Request Context.
     * @throws CLIException if the request cannot serviced.
     */
public void handleRequest(RequestContext rc) throws CLIException {
    super.handleRequest(rc);
    ldapLogin();
    String schemaType = getStringOptionValue(IArgument.SCHEMA_TYPE);
    String serviceName = getStringOptionValue(IArgument.SERVICE_NAME);
    String subSchemaName = getStringOptionValue(IArgument.SUBSCHEMA_NAME);
    String attributeSchemaName = getStringOptionValue(IArgument.ATTRIBUTE_SCHEMA);
    String i18nkey = getStringOptionValue(ARGUMENT_I18N_KEY);
    ServiceSchema ss = getServiceSchema();
    IOutput outputWriter = getOutputWriter();
    try {
        String[] params = { serviceName, schemaType, subSchemaName, attributeSchemaName, i18nkey };
        writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_MODIFY_ATTRIBUTE_SCHEMA_I18N_KEY", params);
        AttributeSchema attrSchema = ss.getAttributeSchema(attributeSchemaName);
        if (attrSchema == null) {
            String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, i18nkey, "attribute schema does not exist" };
            attributeSchemaNoExist(attributeSchemaName, "FAILED_MODIFY_ATTRIBUTE_SCHEMA_I18N_KEY", args);
        }
        attrSchema.setI18NKey(i18nkey);
        writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_MODIFY_ATTRIBUTE_SCHEMA_I18N_KEY", params);
        outputWriter.printlnMessage(MessageFormat.format(getResourceString("attribute-schema-modify-i18n-key-succeed"), (Object[]) params));
    } catch (SSOException e) {
        String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, i18nkey, e.getMessage() };
        debugError("ModifyAttributeSchemaI18nKey.handleRequest", e);
        writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_MODIFY_ATTRIBUTE_SCHEMA_I18N_KEY", args);
        throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
    } catch (SMSException e) {
        String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, i18nkey, e.getMessage() };
        debugError("ModifyAttributeSchemaI18nKey.handleRequest", e);
        writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_MODIFY_ATTRIBUTE_SCHEMA_I18N_KEY", args);
        throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
    }
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) SMSException(com.sun.identity.sm.SMSException) IOutput(com.sun.identity.cli.IOutput) AttributeSchema(com.sun.identity.sm.AttributeSchema) CLIException(com.sun.identity.cli.CLIException) SSOException(com.iplanet.sso.SSOException)

Example 73 with ServiceSchema

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

the class ModifyAttributeSchemaPropertiesViewBeanURL method handleRequest.

/**
     * Services a Commandline Request.
     *
     * @param rc Request Context.
     * @throws CLIException if the request cannot serviced.
     */
public void handleRequest(RequestContext rc) throws CLIException {
    super.handleRequest(rc);
    ldapLogin();
    String schemaType = getStringOptionValue(IArgument.SCHEMA_TYPE);
    String serviceName = getStringOptionValue(IArgument.SERVICE_NAME);
    String subSchemaName = getStringOptionValue(IArgument.SUBSCHEMA_NAME);
    String attributeSchemaName = getStringOptionValue(IArgument.ATTRIBUTE_SCHEMA);
    String url = getStringOptionValue(ARGUMENT_URL);
    ServiceSchema ss = getServiceSchema();
    IOutput outputWriter = getOutputWriter();
    try {
        String[] params = { serviceName, schemaType, subSchemaName, attributeSchemaName, url };
        writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_MODIFY_ATTRIBUTE_SCHEMA_PROPERTIES_VIEW_BEAN_URL", params);
        AttributeSchema attrSchema = ss.getAttributeSchema(attributeSchemaName);
        if (attrSchema == null) {
            String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, url, "attribute schema does not exist" };
            attributeSchemaNoExist(attributeSchemaName, "FAILED_MODIFY_ATTRIBUTE_SCHEMA_PROPERTIES_VIEW_BEAN_URL", args);
        }
        attrSchema.setPropertiesViewBeanUR(url);
        writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_MODIFY_ATTRIBUTE_SCHEMA_PROPERTIES_VIEW_BEAN_URL", params);
        outputWriter.printlnMessage(MessageFormat.format(getResourceString("attribute-schema-modify-properties-view-bean-url-key-succeed"), (Object[]) params));
    } catch (SSOException e) {
        String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, url, e.getMessage() };
        debugError("ModifyAttributeSchemaPropertiesViewBeanURL.handleRequest", e);
        writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_MODIFY_ATTRIBUTE_SCHEMA_PROPERTIES_VIEW_BEAN_URL", args);
        throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
    } catch (SMSException e) {
        String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, url, e.getMessage() };
        debugError("ModifyAttributeSchemaPropertiesViewBeanURL.handleRequest", e);
        writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_MODIFY_ATTRIBUTE_SCHEMA_PROPERTIES_VIEW_BEAN_URL", args);
        throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
    }
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) SMSException(com.sun.identity.sm.SMSException) IOutput(com.sun.identity.cli.IOutput) AttributeSchema(com.sun.identity.sm.AttributeSchema) CLIException(com.sun.identity.cli.CLIException) SSOException(com.iplanet.sso.SSOException)

Example 74 with ServiceSchema

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

the class ModifyAttributeSchemaSyntax method handleRequest.

/**
     * Services a Commandline Request.
     *
     * @param rc Request Context.
     * @throws CLIException if the request cannot serviced.
     */
public void handleRequest(RequestContext rc) throws CLIException {
    super.handleRequest(rc);
    ldapLogin();
    String schemaType = getStringOptionValue(IArgument.SCHEMA_TYPE);
    String serviceName = getStringOptionValue(IArgument.SERVICE_NAME);
    String subSchemaName = getStringOptionValue(IArgument.SUBSCHEMA_NAME);
    String attributeSchemaName = getStringOptionValue(IArgument.ATTRIBUTE_SCHEMA);
    String syntax = getStringOptionValue(ARGUMENT_SYNTAX);
    ServiceSchema ss = getServiceSchema();
    IOutput outputWriter = getOutputWriter();
    try {
        String[] params = { serviceName, schemaType, subSchemaName, attributeSchemaName, syntax };
        writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_MODIFY_ATTRIBUTE_SCHEMA_SYNTAX", params);
        AttributeSchema attrSchema = ss.getAttributeSchema(attributeSchemaName);
        if (attrSchema == null) {
            String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, syntax, "attribute schema does not exist" };
            attributeSchemaNoExist(attributeSchemaName, "FAILED_MODIFY_ATTRIBUTE_SCHEMA_SYNTAX", args);
        }
        attrSchema.setSyntax(syntax);
        writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_MODIFY_ATTRIBUTE_SCHEMA_SYNTAX", params);
        outputWriter.printlnMessage(MessageFormat.format(getResourceString("attribute-schema-modify-syntax-succeed"), (Object[]) params));
    } catch (SSOException e) {
        String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, syntax, e.getMessage() };
        debugError("ModifyAttributeSchemaSyntax.handleRequest", e);
        writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_MODIFY_ATTRIBUTE_SCHEMA_SYNTAX", args);
        throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
    } catch (SMSException e) {
        String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, syntax, e.getMessage() };
        debugError("ModifyAttributeSchemaSyntax.handleRequest", e);
        writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_MODIFY_ATTRIBUTE_SCHEMA_SYNTAX", args);
        throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
    }
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) SMSException(com.sun.identity.sm.SMSException) IOutput(com.sun.identity.cli.IOutput) AttributeSchema(com.sun.identity.sm.AttributeSchema) CLIException(com.sun.identity.cli.CLIException) SSOException(com.iplanet.sso.SSOException)

Example 75 with ServiceSchema

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

the class ModifyAttributeSchemaUIType method handleRequest.

/**
     * Services a Commandline Request.
     *
     * @param rc Request Context.
     * @throws CLIException if the request cannot serviced.
     */
public void handleRequest(RequestContext rc) throws CLIException {
    super.handleRequest(rc);
    ldapLogin();
    String schemaType = getStringOptionValue(IArgument.SCHEMA_TYPE);
    String serviceName = getStringOptionValue(IArgument.SERVICE_NAME);
    String subSchemaName = getStringOptionValue(IArgument.SUBSCHEMA_NAME);
    String attributeSchemaName = getStringOptionValue(IArgument.ATTRIBUTE_SCHEMA);
    String uitype = getStringOptionValue(ARGUMENT_UI_TYPE);
    ServiceSchema ss = getServiceSchema();
    IOutput outputWriter = getOutputWriter();
    try {
        String[] params = { serviceName, schemaType, subSchemaName, attributeSchemaName, uitype };
        writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_MODIFY_ATTRIBUTE_SCHEMA_UI_TYPE", params);
        AttributeSchema attrSchema = ss.getAttributeSchema(attributeSchemaName);
        if (attrSchema == null) {
            String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, uitype, "attribute schema does not exist" };
            attributeSchemaNoExist(attributeSchemaName, "FAILED_MODIFY_ATTRIBUTE_SCHEMA_UI_TYPE", args);
        }
        attrSchema.setUIType(uitype);
        writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_MODIFY_ATTRIBUTE_SCHEMA_UI_TYPE", params);
        outputWriter.printlnMessage(MessageFormat.format(getResourceString("attribute-schema-modify-type-succeed"), (Object[]) params));
    } catch (SSOException e) {
        String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, uitype, e.getMessage() };
        debugError("ModifyAttributeSchemaUIType.handleRequest", e);
        writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_MODIFY_ATTRIBUTE_SCHEMA_UI_TYPE", args);
        throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
    } catch (SMSException e) {
        String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, uitype, e.getMessage() };
        debugError("ModifyAttributeSchemaUIType.handleRequest", e);
        writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_MODIFY_ATTRIBUTE_SCHEMA_UI_TYPE", args);
        throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
    }
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) SMSException(com.sun.identity.sm.SMSException) IOutput(com.sun.identity.cli.IOutput) AttributeSchema(com.sun.identity.sm.AttributeSchema) CLIException(com.sun.identity.cli.CLIException) SSOException(com.iplanet.sso.SSOException)

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