use of com.sun.identity.sm.SMSException in project OpenAM by OpenRock.
the class ModifyInheritance 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 serviceName = getStringOptionValue(IArgument.SERVICE_NAME);
String schemaType = getStringOptionValue(IArgument.SCHEMA_TYPE);
String subSchemaName = getStringOptionValue(IArgument.SUBSCHEMA_NAME);
String inheritance = getStringOptionValue(ARGUMENT_INHERITANCE);
IOutput outputWriter = getOutputWriter();
String[] params = { serviceName, schemaType, subSchemaName };
ServiceSchema ss = getServiceSchema();
try {
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_MODIFY_INHERITANCE_SUB_SCHEMA", params);
ss.setInheritance(inheritance);
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_MODIFY_INHERITANCE_SUB_SCHEMA", params);
outputWriter.printlnMessage(MessageFormat.format(getResourceString("modify-inheritance-succeed"), (Object[]) params));
} catch (SSOException e) {
String[] args = { serviceName, schemaType, subSchemaName, e.getMessage() };
debugError("ModifyInheritance.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_MODIFY_INHERITANCE_SUB_SCHEMA", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} catch (SMSException e) {
String[] args = { serviceName, schemaType, subSchemaName, e.getMessage() };
debugError("ModifyInheritance.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_MODIFY_INHERITANCE_SUB_SCHEMA", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
use of com.sun.identity.sm.SMSException in project OpenAM by OpenRock.
the class ModifySubConfiguration method modifySubConfigToRealm.
private void modifySubConfigToRealm(String realmName, String serviceName, String subConfigName, Map attrValues, String operation) throws CLIException {
SSOToken adminSSOToken = getAdminSSOToken();
IOutput outputWriter = getOutputWriter();
String[] params = { realmName, subConfigName, serviceName };
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_MODIFY_SUB_CONFIGURATION_IN_REALM", params);
try {
ServiceConfigManager scm = new ServiceConfigManager(serviceName, adminSSOToken);
ServiceConfig sc = scm.getOrganizationConfig(realmName, null);
if (sc == null) {
sc = scm.createOrganizationConfig(realmName, null);
}
modifySubConfig(sc, subConfigName, attrValues, operation);
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_MODIFY_SUB_CONFIGURATION_IN_REALM", params);
outputWriter.printlnMessage(MessageFormat.format(getResourceString("modify-sub-configuration-to-realm-succeed"), (Object[]) params));
} catch (SSOException e) {
String[] args = { realmName, subConfigName, serviceName, e.getMessage() };
debugError("ModifySubConfiguration.modifySubConfigToRealm", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_MODIFY_SUB_CONFIGURATIONT_IN_REALM", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} catch (SMSException e) {
String[] args = { realmName, subConfigName, serviceName, e.getMessage() };
debugError("ModifySubConfiguration.modifySubConfigToRealm", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_MODIFY_SUB_CONFIGURATIONT_IN_REALM", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
use of com.sun.identity.sm.SMSException in project OpenAM by OpenRock.
the class ModifySubConfiguration method modifySubConfigRoot.
private void modifySubConfigRoot(String serviceName, String subConfigName, Map attrValues, String operation) throws CLIException {
SSOToken adminSSOToken = getAdminSSOToken();
IOutput outputWriter = getOutputWriter();
String[] params = { subConfigName, serviceName };
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_MODIFY_SUB_CONFIGURATION", params);
try {
ServiceConfigManager scm = new ServiceConfigManager(serviceName, adminSSOToken);
ServiceConfig sc = scm.getGlobalConfig(null);
modifySubConfig(sc, subConfigName, attrValues, operation);
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_MODIFY_SUB_CONFIGURATION", params);
outputWriter.printlnMessage(MessageFormat.format(getResourceString("modify-sub-configuration-succeed"), (Object[]) params));
} catch (SSOException e) {
String[] args = { subConfigName, serviceName, e.getMessage() };
debugError("ModifySubConfiguration.addSubConfigToRoot", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_MODIFY_SUB_CONFIGURATION", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} catch (SMSException e) {
String[] args = { subConfigName, serviceName, e.getMessage() };
debugError("ModifySubConfiguration.addSubConfigToRoot", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_MODIFY_SUB_CONFIGURATION", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
use of com.sun.identity.sm.SMSException in project OpenAM by OpenRock.
the class RemoveAttributeDefaults 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);
Set attributeNames = new HashSet();
attributeNames.addAll(rc.getOption(IArgument.ATTRIBUTE_NAMES));
ServiceSchema ss = getServiceSchema();
IOutput outputWriter = getOutputWriter();
try {
String[] params = { serviceName, schemaType, subSchemaName, attributeNames.toString() };
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_REMOVE_SCHEMA_ATTR_DEFAULTS", params);
ss.removeAttributeDefaults(attributeNames);
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_REMOVE_SCHEMA_ATTR_DEFAULTS", params);
outputWriter.printlnMessage(MessageFormat.format(getResourceString("schema-remove-attribute-defaults-succeed"), (Object[]) params));
} catch (SSOException e) {
String[] args = { serviceName, schemaType, subSchemaName, attributeNames.toString(), e.getMessage() };
debugError("RemoveAttributeDefaults.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_REMOVE_SCHEMA_ATTR_DEFAULTS", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} catch (SMSException e) {
String[] args = { serviceName, schemaType, subSchemaName, attributeNames.toString(), e.getMessage() };
debugError("RemoveAttributeDefaults.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_REMOVE_SCHEMA_ATTR_DEFAULTS", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
use of com.sun.identity.sm.SMSException in project OpenAM by OpenRock.
the class RemoveAttributeSchemaChoiceValues 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 attributeName = getStringOptionValue(IArgument.ATTRIBUTE_NAME);
List choiceValues = (List) rc.getOption(IArgument.CHOICE_VALUES);
ServiceSchema ss = getServiceSchema();
IOutput outputWriter = getOutputWriter();
String[] params = { serviceName, schemaType, subSchemaName, attributeName };
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_REMOVE_ATTRIBUTE_SCHEMA_CHOICE_VALUE", params);
try {
AttributeSchema attrSchema = ss.getAttributeSchema(attributeName);
if (attrSchema == null) {
String[] args = { serviceName, schemaType, subSchemaName, attributeName, "attribute schema does not exist" };
attributeSchemaNoExist(attributeName, "FAILED_REMOVE_ATTRIBUTE_SCHEMA_CHOICE_VALUE", args);
}
for (Iterator i = choiceValues.iterator(); i.hasNext(); ) {
String choiceValue = (String) i.next();
attrSchema.removeChoiceValue(choiceValue);
}
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_REMOVE_ATTRIBUTE_SCHEMA_CHOICE_VALUE", params);
outputWriter.printlnMessage(MessageFormat.format(getResourceString("attribute-schema-remove-choice-value-succeed"), (Object[]) params));
} catch (SSOException e) {
String[] args = { serviceName, schemaType, subSchemaName, attributeName, e.getMessage() };
debugError("RemoveAttributeSchemaChoiceValues.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_REMOVE_ATTRIBUTE_SCHEMA_CHOICE_VALUE", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} catch (SMSException e) {
String[] args = { serviceName, schemaType, subSchemaName, attributeName, e.getMessage() };
debugError("RemoveAttributeSchemaChoiceValues.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_REMOVE_ATTRIBUTE_SCHEMA_CHOICE_VALUE", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
Aggregations