use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class SetAttributeSchemaValidator 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 validator = getStringOptionValue(ARGUMENT_VALIDATOR);
ServiceSchema ss = getServiceSchema();
IOutput outputWriter = getOutputWriter();
try {
String[] params = { serviceName, schemaType, subSchemaName, attributeSchemaName, validator };
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_SET_ATTRIBUTE_SCHEMA_VALIDATOR", params);
AttributeSchema attrSchema = ss.getAttributeSchema(attributeSchemaName);
if (attrSchema == null) {
String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, validator, "attribute schema does not exist" };
attributeSchemaNoExist(attributeSchemaName, "FAILED_SET_ATTRIBUTE_SCHEMA_VALIDATOR", args);
}
attrSchema.setValidator(validator);
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_SET_ATTRIBUTE_SCHEMA_VALIDATOR", params);
outputWriter.printlnMessage(MessageFormat.format(getResourceString("attribute-schema-set-validator-succeed"), (Object[]) params));
} catch (SSOException e) {
String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, validator, e.getMessage() };
debugError("SetAttributeSchemaValidator.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_SET_ATTRIBUTE_SCHEMA_VALIDATOR", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} catch (SMSException e) {
String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, validator, e.getMessage() };
debugError("SetAttributeSchemaValidator.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_SET_ATTRIBUTE_SCHEMA_VALIDATOR", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class SetAttributeSchemaBooleanValues 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);
String trueValue = getStringOptionValue(ARGUMENT_TRUE_VALUE);
String trueI18nKey = getStringOptionValue(ARGUMENT_TRUE_I18N_KEY);
String falseValue = getStringOptionValue(ARGUMENT_FALSE_VALUE);
String falseI18nKey = getStringOptionValue(ARGUMENT_FALSE_I18N_KEY);
ServiceSchema ss = getServiceSchema();
IOutput outputWriter = getOutputWriter();
String[] params = { serviceName, schemaType, subSchemaName, attributeName };
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_SET_ATTRIBUTE_SCHEMA_BOOLEAN_VALUES", params);
try {
AttributeSchema attrSchema = ss.getAttributeSchema(attributeName);
if (attrSchema == null) {
String[] args = { serviceName, schemaType, subSchemaName, attributeName, "attribute schema does not exist" };
attributeSchemaNoExist(attributeName, "FAILED_SET_ATTRIBUTE_SCHEMA_BOOLEAN_VALUES", args);
}
attrSchema.setBooleanValues(trueValue, trueI18nKey, falseValue, falseI18nKey);
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_SET_ATTRIBUTE_SCHEMA_BOOLEAN_VALUES", params);
outputWriter.printlnMessage(MessageFormat.format(getResourceString("attribute-schema-set-boolean-values-succeed"), (Object[]) params));
} catch (SSOException e) {
String[] args = { serviceName, schemaType, subSchemaName, attributeName, e.getMessage() };
debugError("SetAttributeSchemaBooleanValues.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_SET_ATTRIBUTE_SCHEMA_BOOLEAN_VALUES", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} catch (SMSException e) {
String[] args = { serviceName, schemaType, subSchemaName, attributeName, e.getMessage() };
debugError("SetAttributeSchemaBooleanValues.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_SET_ATTRIBUTE_SCHEMA_BOOLEAN_VALUES", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class SetAttributeSchemaEndRange 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 range = getStringOptionValue(ARGUMENT_RANGE);
ServiceSchema ss = getServiceSchema();
IOutput outputWriter = getOutputWriter();
try {
String[] params = { serviceName, schemaType, subSchemaName, attributeSchemaName, range };
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_SET_ATTRIBUTE_SCHEMA_END_RANGE", params);
AttributeSchema attrSchema = ss.getAttributeSchema(attributeSchemaName);
if (attrSchema == null) {
String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, range, "attribute schema does not exist" };
attributeSchemaNoExist(attributeSchemaName, "FAILED_SET_ATTRIBUTE_SCHEMA_END_RANGE", args);
}
attrSchema.setEndRange(range);
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_SET_ATTRIBUTE_SCHEMA_END_RANGE", params);
outputWriter.printlnMessage(MessageFormat.format(getResourceString("attribute-schema-set-end-range-succeed"), (Object[]) params));
} catch (SSOException e) {
String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, range, e.getMessage() };
debugError("SetAttributeSchemaEndRange.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_SET_ATTRIBUTE_SCHEMA_END_RANGE", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} catch (SMSException e) {
String[] args = { serviceName, schemaType, subSchemaName, attributeSchemaName, range, e.getMessage() };
debugError("SetAttributeSchemaEndRange.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_SET_ATTRIBUTE_SCHEMA_END_RANGE", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class AgentsModelImpl method getTokenConversionTypes.
/**
* Returns Token Conversion Types.
*
* @return Token Conversion Types.
*/
public List getTokenConversionTypes() {
List choices = null;
AttributeSchema as = AMAdminUtils.getAttributeSchema(IdConstants.AGENT_SERVICE, SchemaType.ORGANIZATION, "WSPAgent", "TokenConversionType");
if (as != null) {
String[] choiceValues = as.getChoiceValues();
int sz = choiceValues.length;
choices = new ArrayList(sz);
for (int i = 0; i < sz; i++) {
choices.add(choiceValues[i]);
}
}
return (choices == null) ? Collections.EMPTY_LIST : choices;
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class SubConfigMeta method getServiceSchemaDefaultValues.
/**
* Returns default values of sub service schema of current sub schema. Map
* of attribute name (String) to attribute values (Set).
*
* @param name Name of sub schema.
* @throws SMSException if default values be determined.
*/
public Map getServiceSchemaDefaultValues(String name) throws SMSException {
Map defaultValues = new HashMap();
ServiceSchema ss = corrSchema.getSubSchema(name);
Set attributeSchemas = ss.getAttributeSchemas();
for (Iterator i = attributeSchemas.iterator(); i.hasNext(); ) {
AttributeSchema as = (AttributeSchema) i.next();
Set values = as.getDefaultValues();
if (values != null) {
defaultValues.put(as.getName(), values);
}
}
return defaultValues;
}
Aggregations