use of com.sun.identity.sm.ServiceSchema in project OpenAM by OpenRock.
the class LogConfigReader method newStatusIsInactive.
private boolean newStatusIsInactive() {
SSOToken ssoToken;
try {
ssoToken = getSSOToken();
} catch (SSOException ssoe) {
debug.error("LogConfigReader:newStatusIsInactive:" + "Could not get proper SSOToken", ssoe);
return false;
}
try {
ServiceSchemaManager schemaManager = new ServiceSchemaManager("iPlanetAMLoggingService", ssoToken);
ServiceSchema smsLogSchema = schemaManager.getGlobalSchema();
Map sss = smsLogSchema.getAttributeDefaults();
String key = LogConstants.LOG_STATUS_ATTR;
String value = CollectionHelper.getMapAttr(sss, key);
if ((value == null) || (value.length() == 0)) {
value = "ACTIVE";
}
return (value.equalsIgnoreCase("INACTIVE"));
} catch (Exception e) {
debug.error("LogConfigReader:newStatusIsInactive:" + "error reading Log Status attribute: " + e.getMessage());
}
return false;
}
use of com.sun.identity.sm.ServiceSchema in project OpenAM by OpenRock.
the class UserIdRepo method getOrgConfig.
static ServiceConfig getOrgConfig(SSOToken adminToken) throws SMSException, SSOException {
ServiceConfigManager svcCfgMgr = new ServiceConfigManager(IdConstants.REPO_SERVICE, adminToken);
ServiceConfig cfg = svcCfgMgr.getOrganizationConfig("", null);
Map values = new HashMap();
if (cfg == null) {
OrganizationConfigManager orgCfgMgr = new OrganizationConfigManager(adminToken, "/");
ServiceSchemaManager schemaMgr = new ServiceSchemaManager(IdConstants.REPO_SERVICE, adminToken);
ServiceSchema orgSchema = schemaMgr.getOrganizationSchema();
Set attrs = orgSchema.getAttributeSchemas();
for (Iterator iter = attrs.iterator(); iter.hasNext(); ) {
AttributeSchema as = (AttributeSchema) iter.next();
values.put(as.getName(), as.getDefaultValues());
}
cfg = orgCfgMgr.addServiceConfig(IdConstants.REPO_SERVICE, values);
}
return cfg;
}
use of com.sun.identity.sm.ServiceSchema in project OpenAM by OpenRock.
the class AMLogTest method setbufferSizer.
private void setbufferSizer(String statusVal, String buffSize) throws SSOException, SMSException {
SSOToken adminSSOToken = getAdminSSOToken();
ServiceSchemaManager mgr = new ServiceSchemaManager("iPlanetAMLoggingService", adminSSOToken);
ServiceSchema globalSchema = mgr.getSchema(SchemaType.GLOBAL);
{
AttributeSchema status = globalSchema.getAttributeSchema("iplanet-am-logging-time-buffering-status");
Set<String> set = new HashSet<String>(2);
set.add(statusVal);
status.setDefaultValues(set);
}
{
AttributeSchema bufferSize = globalSchema.getAttributeSchema("iplanet-am-logging-buffer-size");
Set<String> set = new HashSet<String>(2);
set.add(buffSize);
bufferSize.setDefaultValues(set);
}
}
use of com.sun.identity.sm.ServiceSchema in project OpenAM by OpenRock.
the class SchemaTest method setAttributeAny.
@Parameters({ "subschema" })
@Test(groups = { "schema", "set-attr-any", "attribute-schema-ops", "subschema" }, dependsOnMethods = { "addAttributeSchema" })
public void setAttributeAny(String subschema) throws CLIException, SMSException, SSOException {
Object[] params = { subschema };
entering("setAttributeAny", params);
String[] args = (subschema.length() == 0) ? new String[9] : new String[11];
args[0] = "set-attr-any";
args[1] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME;
args[2] = TEST_SERVICE;
args[3] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SCHEMA_TYPE;
args[4] = "global";
args[5] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.ATTRIBUTE_SCHEMA;
args[6] = "mock-add";
args[7] = CLIConstants.PREFIX_ARGUMENT_LONG + ModifyAttributeSchemaAny.ARGUMENT_ANY;
args[8] = "admin";
if (subschema.length() > 0) {
args[9] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SUBSCHEMA_NAME;
args[10] = subschema;
}
CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
cmdManager.addToRequestQueue(req);
try {
cmdManager.serviceRequestQueue();
ServiceSchemaManager mgr = new ServiceSchemaManager(TEST_SERVICE, getAdminSSOToken());
ServiceSchema serviceSchema = mgr.getGlobalSchema();
if (subschema.length() > 0) {
serviceSchema = serviceSchema.getSubSchema(subschema);
}
AttributeSchema as = serviceSchema.getAttributeSchema("mock-add");
assert (as.getAny().equals("admin"));
exiting("setAttributeAny");
} catch (CLIException e) {
this.log(Level.SEVERE, "setAttributeAny", e.getMessage());
throw e;
} catch (SMSException e) {
this.log(Level.SEVERE, "setAttributeAny", e.getMessage());
throw e;
} catch (SSOException e) {
this.log(Level.SEVERE, "setAttributeAny", e.getMessage());
throw e;
}
}
use of com.sun.identity.sm.ServiceSchema in project OpenAM by OpenRock.
the class SchemaTest method addAttributeSchema.
@Parameters({ "subschema" })
@Test(groups = { "schema", "add-attrs", "subschema" })
public void addAttributeSchema(String subschema) throws CLIException, SMSException, SSOException {
Object[] params = { subschema };
entering("addAttributeSchema", params);
String[] args = (subschema.length() > 0) ? new String[9] : new String[7];
args[0] = "add-attrs";
args[1] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME;
args[2] = TEST_SERVICE;
args[3] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SCHEMA_TYPE;
args[4] = "global";
args[5] = CLIConstants.PREFIX_ARGUMENT_LONG + AddAttributeSchema.ARGUMENT_SCHEMA_FILES;
args[6] = MOCK_DIR + "/addAttributeSchema.xml";
if (subschema.length() > 0) {
args[7] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SUBSCHEMA_NAME;
args[8] = subschema;
}
CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
cmdManager.addToRequestQueue(req);
try {
cmdManager.serviceRequestQueue();
ServiceSchemaManager mgr = new ServiceSchemaManager(TEST_SERVICE, getAdminSSOToken());
ServiceSchema serviceSchema = mgr.getGlobalSchema();
if (subschema.length() > 0) {
serviceSchema = serviceSchema.getSubSchema(subschema);
}
AttributeSchema as = serviceSchema.getAttributeSchema("mock-add");
assert (as != null);
exiting("addAttributeSchema");
} catch (CLIException e) {
this.log(Level.SEVERE, "addAttributeSchema", e.getMessage(), params);
throw e;
} catch (SMSException e) {
this.log(Level.SEVERE, "addAttributeSchema", e.getMessage(), params);
throw e;
} catch (SSOException e) {
this.log(Level.SEVERE, "addAttributeSchema", e.getMessage(), params);
throw e;
}
}
Aggregations