use of com.sun.identity.sm.SMSException in project OpenAM by OpenRock.
the class ResourceTypeConfigurationImpl method getResourceTypesData.
@Override
public Map<String, Map<String, Set<String>>> getResourceTypesData(Subject subject, String realm) throws EntitlementException {
final Map<String, Map<String, Set<String>>> configData = new HashMap<String, Map<String, Set<String>>>();
try {
final ServiceConfig subOrgConfig = resourceTypeServiceConfig.getOrgConfig(subject, realm).getSubConfig(CONFIG_RESOURCE_TYPES);
if (subOrgConfig == null) {
return configData;
}
final Set<String> uuids = subOrgConfig.getSubConfigNames();
for (String uuid : uuids) {
configData.put(uuid, subOrgConfig.getSubConfig(uuid).getAttributesForRead());
}
} catch (SMSException ex) {
PrivilegeManager.debug.error("ResourceTypeConfiguration.getResourceTypesData", ex);
throw new EntitlementException(RESOURCE_TYPE_RETRIEVAL_ERROR, ex, realm);
} catch (SSOException ex) {
PrivilegeManager.debug.error("ResourceTypeConfiguration.getResourceTypesData", ex);
throw new EntitlementException(RESOURCE_TYPE_RETRIEVAL_ERROR, ex, realm);
}
return configData;
}
use of com.sun.identity.sm.SMSException in project OpenAM by OpenRock.
the class ResourceTypeServiceConfig method getOrgConfig.
/**
* Get the organization configuration for the sunEntitlementService service.
* @param subject The subject used to retrieve the SSO token.
* @param realm The realm from which to retrieve it.
* @return The organization configuration, which is guaranteed to not be null.
* @throws SMSException If the sub configuration could not be read.
* @throws SSOException If the Admin token could not be found.
*/
ServiceConfig getOrgConfig(Subject subject, String realm) throws SMSException, SSOException {
final SSOToken token = getSSOToken(subject);
if (token == null) {
throw new SSOException("Could not find Admin token.");
}
ServiceConfig orgConfig = new ServiceConfigManager(SERVICE_NAME, token).getOrganizationConfig(realm, null);
if (orgConfig == null) {
throw new SMSException("Configuration '" + SERVICE_NAME + "' in realm '" + realm + "' could not be retrieved.");
}
return orgConfig;
}
use of com.sun.identity.sm.SMSException in project OpenAM by OpenRock.
the class ScriptConfigurationDataStore method get.
@Override
public Set<ScriptConfiguration> get(QueryFilter<String> queryFilter) throws ScriptException {
final Set<ScriptConfiguration> scriptConfigurations = new LinkedHashSet<>();
try {
ServiceConfig config = getSubOrgConfig();
Set<String> uuids = config.getSubConfigNames();
for (String uuid : uuids) {
if (queryFilter.accept(new ServiceConfigQueryFilterVisitor(), config.getSubConfig(uuid))) {
scriptConfigurations.add(get(uuid));
}
}
config = getSubGlobalConfig();
uuids = config.getSubConfigNames();
for (String uuid : uuids) {
if (queryFilter.accept(new ServiceConfigQueryFilterVisitor(), config.getSubConfig(uuid))) {
scriptConfigurations.add(get(uuid));
}
}
} catch (SMSException | SSOException e) {
throw createAndLogError(logger, RETRIEVE_ALL_FAILED, e, realm);
} catch (UnsupportedOperationException e) {
throw createAndLogError(logger, ScriptErrorCode.valueOf(e.getMessage()), e);
}
return scriptConfigurations;
}
use of com.sun.identity.sm.SMSException in project OpenAM by OpenRock.
the class ScriptConfigurationDataStore method getAll.
@Override
public Set<ScriptConfiguration> getAll() throws ScriptException {
final Set<ScriptConfiguration> scriptConfigurations = new LinkedHashSet<>();
try {
ServiceConfig config = getSubOrgConfig();
Set<String> uuids = config.getSubConfigNames();
for (String uuid : uuids) {
scriptConfigurations.add(scriptConfigurationFromMap(uuid, config.getSubConfig(uuid).getAttributesForRead()));
}
config = getSubGlobalConfig();
uuids = config.getSubConfigNames();
for (String uuid : uuids) {
scriptConfigurations.add(scriptConfigurationFromMap(uuid, config.getSubConfig(uuid).getAttributesForRead()));
}
} catch (SSOException | SMSException e) {
throw createAndLogError(logger, RETRIEVE_ALL_FAILED, e, realm);
}
return scriptConfigurations;
}
use of com.sun.identity.sm.SMSException in project OpenAM by OpenRock.
the class ScriptConfigurationDataStore method get.
@Override
public ScriptConfiguration get(String uuid) throws ScriptException {
try {
ServiceConfig config = getSubOrgConfig();
if (config.getSubConfigNames().contains(uuid)) {
return scriptConfigurationFromMap(uuid, config.getSubConfig(uuid).getAttributesForRead());
}
config = getSubGlobalConfig();
if (config.getSubConfigNames().contains(uuid)) {
return scriptConfigurationFromMap(uuid, config.getSubConfig(uuid).getAttributesForRead());
}
} catch (SSOException | SMSException e) {
throw createAndLogError(logger, RETRIEVE_FAILED, e, uuid, realm);
}
throw createAndLogError(logger, SCRIPT_UUID_NOT_FOUND, uuid, realm);
}
Aggregations