use of org.forgerock.openam.upgrade.UpgradeException in project OpenAM by OpenRock.
the class AllowEvaluateForAgentsUpgradeStep method initialize.
@Override
public void initialize() throws UpgradeException {
try {
// Does the policy already exist...
manager = new PolicyManager(getAdminToken(), HIDDEN_REALM);
applicable = manager.getPolicyNames(EVALUATE_POLICY).isEmpty();
} catch (SSOException ssoE) {
throw new UpgradeException("Failed to identify existing privileges", ssoE);
} catch (PolicyException pE) {
throw new UpgradeException("Failed to identify existing privileges", pE);
}
}
use of org.forgerock.openam.upgrade.UpgradeException in project OpenAM by OpenRock.
the class UpgradeEntitlementSubConfigsStep method addMissingResourceTypeUUIDs.
/**
* Clears the resourceType UUIDs currently associated with an application, then replaces them with
* the new set of resourceType UUIDs defined.
*
* @throws UpgradeException If there was an error while updating the application.
*/
private void addMissingResourceTypeUUIDs() throws UpgradeException {
for (final Map.Entry<String, Set<String>> entry : changedResourceTypeUUIDs.entrySet()) {
final String name = entry.getKey();
final Set<String> resourceTypeUUIDs = entry.getValue();
try {
UpgradeProgress.reportStart(AUDIT_MODIFIED_UUID_START, name);
if (DEBUG.messageEnabled()) {
DEBUG.message("Modifying application " + name + ": adding resourceType UUIDs: " + resourceTypeUUIDs);
}
final Application application = getApplication(name);
application.addAllResourceTypeUuids(resourceTypeUUIDs);
entitlementService.storeApplication(application);
UpgradeProgress.reportEnd(AUDIT_UPGRADE_SUCCESS);
} catch (EntitlementException ee) {
UpgradeProgress.reportEnd(AUDIT_UPGRADE_FAIL);
throw new UpgradeException(ee);
}
}
}
use of org.forgerock.openam.upgrade.UpgradeException in project OpenAM by OpenRock.
the class UpgradeEntitlementSubConfigsStep method addMissingApplications.
/**
* Adds missing applications.
*
* @throws UpgradeException
* should the processing of creating new applications fail
*/
private void addMissingApplications() throws UpgradeException {
for (final Node applicationNode : missingApps) {
final Map<String, Set<String>> keyValueMap = parseAttributeValuePairTags(applicationNode);
final String name = getNodeAttributeValue(applicationNode, NAME);
UpgradeProgress.reportStart(AUDIT_NEW_APPLICATION_START, name);
keyValueMap.put(NAME, Collections.singleton(name));
final String typeName = retrieveSingleValue(APPLICATION_TYPE, keyValueMap);
final ApplicationType applicationType = getType(typeName);
if (applicationType == null) {
UpgradeProgress.reportEnd(AUDIT_UPGRADE_FAIL);
throw new UpgradeException("Unknown requested application type " + typeName);
}
try {
DEBUG.message("Saving new entitlement application: " + name);
entitlementService.storeApplication(createApplication(applicationType, name, keyValueMap));
UpgradeProgress.reportEnd(AUDIT_UPGRADE_SUCCESS);
} catch (EntitlementException eE) {
UpgradeProgress.reportEnd(AUDIT_UPGRADE_FAIL);
throw new UpgradeException(eE);
} catch (InstantiationException ie) {
UpgradeProgress.reportEnd(AUDIT_UPGRADE_FAIL);
throw new UpgradeException(ie);
} catch (IllegalAccessException iae) {
UpgradeProgress.reportEnd(AUDIT_UPGRADE_FAIL);
throw new UpgradeException(iae);
}
}
}
use of org.forgerock.openam.upgrade.UpgradeException in project OpenAM by OpenRock.
the class UpgradeEntitlementSubConfigsStep method addMissingResourceTypes.
/**
* Adds any missing ResourceTypes.
*
* @throws UpgradeException If there was an error while adding a ResourceType
*/
private void addMissingResourceTypes() throws UpgradeException {
for (final Node typeNode : missingResourceTypes) {
final Map<String, Set<String>> keyValueMap = parseAttributeValuePairTags(typeNode);
final String uuid = getNodeAttributeValue(typeNode, NAME);
final String name = retrieveSingleValue(NAME, keyValueMap);
final ResourceType resourceType = resourceTypeFromMap(uuid, keyValueMap);
UpgradeProgress.reportStart(AUDIT_NEW_RESOURCE_TYPE_START, name);
try {
DEBUG.message("Saving standard resource type {} with UUID {}", name, uuid);
resourceTypeConfiguration.storeResourceType(getAdminSubject(), ROOT_REALM, resourceType);
UpgradeProgress.reportEnd(AUDIT_UPGRADE_SUCCESS);
} catch (EntitlementException eE) {
UpgradeProgress.reportEnd(AUDIT_UPGRADE_FAIL);
throw new UpgradeException(eE);
}
}
}
use of org.forgerock.openam.upgrade.UpgradeException in project OpenAM by OpenRock.
the class UpgradeEntitlementSubConfigsStep method addChangedCombiners.
/**
* Alter EntitlementCombiner references.
*
* @throws UpgradeException
*/
private void addChangedCombiners() throws UpgradeException {
for (final Map.Entry<String, String> entry : changedCombiners.entrySet()) {
final String name = entry.getKey();
final String combiner = entry.getValue();
try {
UpgradeProgress.reportStart(AUDIT_MODIFIED_COM_START, name);
if (DEBUG.messageEnabled()) {
DEBUG.message("Modifying application " + name + " ; setting combiner: " + combiner);
}
final Application application = getApplication(name);
application.setEntitlementCombinerName(EntitlementUtils.getEntitlementCombiner(combiner));
entitlementService.storeApplication(application);
UpgradeProgress.reportEnd(AUDIT_UPGRADE_SUCCESS);
} catch (EntitlementException ee) {
UpgradeProgress.reportEnd(AUDIT_UPGRADE_FAIL);
throw new UpgradeException(ee);
}
}
}
Aggregations