use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.
the class UpgradeUtils method addSubConfig.
/**
* Adds SubConfiguration to an existing subconfiguration in a service.
*
* @param serviceName the service name
* @param parentConfigName the name of parent sub configuration.
* @param subConfigName the subconfig name
* @param subConfigID the subconfig id
* @param attrValues a map of attribute value pairs to be added to the
* subconfig.
* @param priority the priority value
* @throws UpgradeException if there is an error.
*/
public static void addSubConfig(String serviceName, String parentConfigName, String subConfigName, String subConfigID, Map attrValues, int priority) throws UpgradeException {
String classMethod = "UpgradeUtils:addSubConfig";
try {
ServiceConfigManager scm = new ServiceConfigManager(serviceName, ssoToken);
ServiceConfig sc = scm.getGlobalConfig(null);
ServiceConfig sc1 = sc.getSubConfig(parentConfigName);
if (sc != null) {
sc1.addSubConfig(subConfigName, subConfigID, priority, attrValues);
} else {
debug.error(classMethod + "Error adding sub cofiguration" + subConfigName);
throw new UpgradeException("Error adding subconfig");
}
} catch (SSOException ssoe) {
throw new UpgradeException(classMethod + "invalid sso token");
} catch (SMSException sm) {
debug.error(classMethod + "Error loading subconfig", sm);
throw new UpgradeException(classMethod + "error adding subconfig");
}
}
use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.
the class UpgradeUtils method addSubConfiguration.
/**
* Adds SubConfiguration to a service.
*
* @param serviceName the service name
* @param svcConfigName the service config
* @param subConfigName the subconfig name
* @param subConfigID the subconfig id
* @param attrValues a map of attribute value pairs to be added to the
* subconfig.
* @param priority the priority value
* @throws UpgradeException if there is an error.
*/
public static void addSubConfiguration(String serviceName, String svcConfigName, String subConfigName, String subConfigID, Map attrValues, int priority) throws UpgradeException {
String classMethod = "UpgradeUtils:addSubConfiguration";
try {
ServiceConfigManager scm = new ServiceConfigManager(serviceName, ssoToken);
ServiceConfig sc = scm.getGlobalConfig(null);
if (sc != null) {
sc.addSubConfig(subConfigName, subConfigID, priority, attrValues);
} else {
debug.error(classMethod + "Error adding sub cofiguration " + subConfigName);
throw new UpgradeException("Error adding subconfig");
}
} catch (SSOException ssoe) {
throw new UpgradeException("invalid sso token");
} catch (SMSException sm) {
debug.error(classMethod + "Error loading subconfig", sm);
throw new UpgradeException("error adding subconfig");
}
}
use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.
the class UpgradeUtils method addSubConfigAttributeDefaultValues.
/**
* Adds defaults values to service sub-configuration
*
* @param serviceName the service name
* @param sunServiceID set of sunservice identifiers for sub-configuration
* @param realm the realm name
* @param subConfigName the sub-configuration name
* @param attributeName the attribute name
* @param defaultValues set of default values to be updated.
*/
public static void addSubConfigAttributeDefaultValues(String serviceName, Set sunServiceID, String realm, String subConfigName, String attributeName, Set defaultValues) {
String classMethod = "UpgradeUtils:addSubConfigAttributeDefaultValues : ";
try {
Set oldVal = new HashSet();
ServiceConfigManager scm = getServiceConfigManager(serviceName);
ServiceConfig sc = scm.getOrganizationConfig(realm, null);
ServiceConfig subConfig = sc.getSubConfig(subConfigName);
String serviceID = getSunServiceID(subConfig);
if (sunServiceID.contains(serviceID)) {
Set valSet = getExistingValues(subConfig, attributeName, defaultValues);
defaultValues.removeAll(valSet);
subConfig.replaceAttributeValues(attributeName, oldVal, defaultValues);
}
} catch (SSOException ssoe) {
debug.error(classMethod + "Invalid SSOToken", ssoe);
} catch (SMSException sme) {
debug.error(classMethod + "Error adding values ", sme);
}
}
use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.
the class UpgradeUtils method getServiceConfigManager.
/**
* Returns the <code>ServiceConfigManager</code> for a service.
*
* @param serviceName the service name
* @param ssoToken the admin SSOToken.
* @return the <code>ServiceConfigManager</code> of the service.
*/
protected static ServiceConfigManager getServiceConfigManager(String serviceName, SSOToken ssoToken) {
String classMethod = "UpgradeUtils:getServiceConfigManager : ";
ServiceConfigManager scm = null;
if (serviceName != null) {
try {
scm = new ServiceConfigManager(serviceName, ssoToken);
} catch (SSOException e) {
debug.error(classMethod, e);
} catch (SMSException e) {
debug.error(classMethod, e);
}
}
return scm;
}
use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.
the class IdRepoAttributeValidatorManager method initializeListeners.
private void initializeListeners() {
// Add listeners to Service Schema and Config Managers
if (debug.messageEnabled()) {
debug.message("IdRepoAttributeValidatorManager." + "initializeListeners: setting up ServiceListener");
}
SSOToken adminToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
try {
// Initialize schema objects
idRepoServiceConfigManager = new ServiceConfigManager(adminToken, IdConstants.REPO_SERVICE, "1.0");
idRepoServiceConfigManager.addListener(this);
} catch (SMSException smse) {
debug.error("IdRepoAttributeValidatorManager.initializeListeners:", smse);
} catch (SSOException ssoe) {
debug.error("IdRepoAttributeValidatorManager.initializeListeners:", ssoe);
}
}
Aggregations