use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class ComplianceServicesImpl method isComplianceUserDeletionEnabled.
/**
* Method which checks if Compliance User Deletion is enabled
*
* @return true if Compliance User Deletion is enabled
* @exception AMException
* if an error is encountered
*/
public static boolean isComplianceUserDeletionEnabled() throws AMException {
try {
if (gsc == null) {
ServiceSchemaManager scm = new ServiceSchemaManager(ADMINISTRATION_SERVICE, internalToken);
gsc = scm.getGlobalSchema();
}
Map attrMap = gsc.getReadOnlyAttributeDefaults();
Set values = (Set) attrMap.get(COMPLIANCE_USER_DELETION_ATTR);
boolean enabled = false;
if (values == null || values.isEmpty()) {
enabled = false;
} else {
String val = (String) values.iterator().next();
enabled = (val.equalsIgnoreCase("true"));
}
if (debug.messageEnabled()) {
debug.message("Compliance.isComplianceUserDeletionEnabled = " + enabled);
}
return enabled;
} catch (SMSException ex) {
debug.error(AMSDKBundle.getString("359"), ex);
throw new AMException(AMSDKBundle.getString("359"), "359");
} catch (SSOException ex) {
debug.error(AMSDKBundle.getString("359"), ex);
throw new AMException(AMSDKBundle.getString("359"), "359");
}
}
use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class EventService method isAMSDKConfigured.
private static boolean isAMSDKConfigured() {
boolean isAMSDKConfigured = false;
boolean configTime = isDuringConfigurationTime();
logger.message("EventService.getListenerList(): {}: {}", Constants.SYS_PROPERTY_INSTALL_TIME, configTime);
if (!configTime) {
try {
ServiceSchemaManager scm = new ServiceSchemaManager(AccessController.doPrivileged(AdminTokenAction.getInstance()), IdConstants.REPO_SERVICE, "1.0");
ServiceSchema idRepoSubSchema = scm.getOrganizationSchema();
Set idRepoPlugins = idRepoSubSchema.getSubSchemaNames();
if (idRepoPlugins.contains("amSDK")) {
isAMSDKConfigured = true;
}
} catch (SMSException ex) {
logger.warning("EventService.getListenerList() - Unable to obtain idrepo service", ex);
} catch (SSOException ex) {
// Should not happen, ignore the exception
}
}
return isAMSDKConfigured;
}
use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class SchemaCommand method getServiceSchemaManager.
protected ServiceSchemaManager getServiceSchemaManager(String serviceName) throws CLIException {
ServiceSchemaManager mgr = null;
SSOToken adminSSOToken = getAdminSSOToken();
if (serviceName != null) {
try {
mgr = new ServiceSchemaManager(serviceName, adminSSOToken);
} catch (SSOException e) {
debugError("SchemaCommand.getServiceSchemaManager", e);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} catch (SMSException e) {
debugError("SchemaCommand.getServiceSchemaManager", e);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
return mgr;
}
use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class SmsRequestHandler method addServersRoutes.
private void addServersRoutes(ServiceManager sm, Map<String, Map<SmsRouteTree, Set<RouteMatcher<Request>>>> serviceRoutes) throws SSOException, SMSException {
ServiceSchemaManager ssm = sm.getSchemaManager(ISAuthConstants.PLATFORM_SERVICE_NAME, DEFAULT_VERSION);
Set<RouteMatcher<Request>> rootRoutes = new HashSet<>();
serviceRoutes.get(ISAuthConstants.PLATFORM_SERVICE_NAME).put(routeTree, rootRoutes);
addServersRoutes(ssm, rootRoutes, ConfigurationBase.CONFIG_SERVERS, ConfigurationBase.SUBSCHEMA_SERVER);
}
use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class ConfigMonitoring method getMonServiceAttrs.
private int getMonServiceAttrs() {
String classMethod = "ConfigMonitoring.getMonServiceAttrs: ";
try {
ServiceSchemaManager schemaManager = new ServiceSchemaManager("iPlanetAMMonitoringService", ssoToken);
ServiceSchema smsMonSchema = schemaManager.getGlobalSchema();
Map monAttrs = smsMonSchema.getAttributeDefaults();
boolean monEna = Boolean.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-enabled")).booleanValue();
if (!monEna) {
if (debug.warningEnabled()) {
debug.warning(classMethod + "monitoring is disabled");
}
return -1;
}
boolean httpEna = Boolean.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-http-enabled")).booleanValue();
int httpPort = Integer.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-http-port"));
String authFilePath = CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-authfile-path");
int rmiPort = Integer.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-rmi-port"));
boolean rmiEna = Boolean.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-rmi-enabled")).booleanValue();
int snmpPort = Integer.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-snmp-port"));
boolean snmpEna = Boolean.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-snmp-enabled")).booleanValue();
int policyWindow = Integer.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-policy-window"));
int sessionWindow = Integer.valueOf(CollectionHelper.getMapAttr(monAttrs, "iplanet-am-monitoring-session-window"));
if (debug.messageEnabled()) {
debug.message(classMethod + "\n" + " monitoring enabled = " + monEna + "\n" + " monitoring auth filepath = " + authFilePath + "\n" + " httpPort = " + httpPort + "\n" + " httpPort enabled = " + httpEna + "\n" + " rmiPort = " + rmiPort + "\n" + " rmiPort enabled = " + rmiEna + "\n" + " snmpPort = " + snmpPort + "\n" + " snmpPort enabled = " + snmpEna + "\n" + " policy eval window size = " + policyWindow + "\n" + " session eval window size = " + sessionWindow + "\n");
}
SSOServerMonConfig sMonInfo = new SSOServerMonConfig.SSOServerMonInfoBuilder(monEna).htmlPort(httpPort).htmlAuthFile(authFilePath).snmpPort(snmpPort).rmiPort(rmiPort).monHtmlEnabled(httpEna).monRmiEnabled(rmiEna).monSnmpEnabled(snmpEna).policyWindowSize(policyWindow).sessionWindowSize(sessionWindow).build();
int i = Agent.startAgent(sMonInfo);
if (i != 0) {
if (debug.warningEnabled()) {
debug.warning(classMethod + "Monitoring Agent not started (" + i + ")");
}
return (i);
}
} catch (Exception ex) {
debug.error(classMethod + "error reading Monitoring attributes: ", ex);
return (Agent.MON_READATTRS_PROBLEM);
}
return 0;
}
Aggregations