use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class DisplayOptionsUtils method getServiceConfiguration.
/**
* Returns a map of attribute name to its values of a service configuration.
*/
private static Map getServiceConfiguration(SSOToken ssoToken, String serviceName, SchemaType type) throws SMSException, SSOException {
Map attrMap = Collections.EMPTY_MAP;
if (type != SchemaType.POLICY) {
ServiceSchemaManager scm = new ServiceSchemaManager(serviceName, ssoToken);
attrMap = scm.getSchema(type).getAttributeDefaults();
}
return attrMap;
}
use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class PropertiesFinder method getProperty.
public static String getProperty(String propertyName, AttributeStruct ast) {
String value = null;
SSOToken adminToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
try {
ServiceSchemaManager ssm = new ServiceSchemaManager(ast.serviceName, adminToken);
if (ssm.getRevisionNumber() >= ast.revisionNumber) {
ServiceSchema ss = ssm.getGlobalSchema();
if (ss != null) {
AttributeSchema as = ss.getAttributeSchema(ast.attributeName);
if (as != null) {
Set values = as.getDefaultValues();
if ((values != null) && !values.isEmpty()) {
value = (String) values.iterator().next();
}
}
}
}
} catch (SSOException ex) {
// ignore: Service may not be present.
} catch (SMSException ex) {
// ignore: Service may not be present.
}
return value;
}
use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class PossibleLocales method getChoiceValues.
/**
* Returns a map of locales to its localized name.
*
* @return a map of locales to its localized name.
*/
public Map getChoiceValues() {
Map map = new HashMap();
/*
* provides a blank value because preferred locale attribute value can
* be blanked.
*/
map.put("", "-");
ServiceSchemaManager mgr = getG11NServiceSchemaManager();
Set values = DEFAULT_LOCALES;
if (mgr != null) {
AttributeSchema attributeSchema = getLocaleCharsetMappingAttributeSchema(mgr);
if (attributeSchema != null) {
values = attributeSchema.getDefaultValues();
}
}
if ((values != null) && !values.isEmpty()) {
for (Iterator iter = values.iterator(); iter.hasNext(); ) {
String locale = parseLocaleCharsetValue((String) iter.next());
if ((locale != null) && (locale.length() > 0)) {
map.put(locale, locale);
}
}
}
return map;
}
use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class AgentConfiguration method getServiceResourceBundle.
public static ResourceBundle getServiceResourceBundle(Locale locale) throws SMSException, SSOException {
SSOToken adminToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
ServiceSchemaManager ssm = new ServiceSchemaManager(IdConstants.AGENT_SERVICE, adminToken);
String rbName = ssm.getI18NFileName();
return ResourceBundle.getBundle(rbName, locale);
}
use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class AddPluginInterface 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 i18nKey = getStringOptionValue(ARGUMENT_I18N_KEY);
String interfaceName = getStringOptionValue(ARGUMENT_INTERFACE_NAME);
String pluginName = getStringOptionValue(ARGUMENT_PLUGIN_NAME);
ServiceSchemaManager ssm = getServiceSchemaManager();
IOutput outputWriter = getOutputWriter();
try {
String[] params = { serviceName, pluginName };
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_ADD_PLUGIN_INTERFACE", params);
ssm.addPluginInterface(pluginName, interfaceName, i18nKey);
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_ADD_PLUGIN_INTERFACE", params);
outputWriter.printlnMessage(MessageFormat.format(getResourceString("add-plugin-interface-succeed"), (Object[]) params));
} catch (SSOException e) {
String[] args = { serviceName, pluginName, e.getMessage() };
debugError("AddPluginInterface.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_ADD_PLUGIN_INTERFACE", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} catch (SMSException e) {
String[] args = { serviceName, pluginName, e.getMessage() };
debugError("AddPluginInterface.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_ADD_PLUGIN_INTERFACE", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
Aggregations