use of org.forgerock.openam.upgrade.UpgradeException in project OpenAM by OpenRock.
the class UpgradeCTSMaxConnectionsConfigurationStep method perform.
@Override
public void perform() throws UpgradeException {
try {
DEBUG.message("External CTS Configuration upgrading: {}", serversToUpdate);
helper.clearState();
for (Entry<String, String> ctsMaxConnectionsProperty : serversToUpdate.entrySet()) {
UpgradeProgress.reportStart(PROGRESS_REPORT, ctsMaxConnectionsProperty.getKey());
if (ServerConfiguration.DEFAULT_SERVER_CONFIG.equals(ctsMaxConnectionsProperty.getKey())) {
helper.getDefaultServerConfig(getAdminToken()).setCTSMaxConnections(ctsMaxConnectionsProperty.getValue());
} else {
helper.getServerConfigs(getAdminToken()).get(ctsMaxConnectionsProperty.getKey()).setCTSMaxConnections(ctsMaxConnectionsProperty.getValue());
}
UpgradeProgress.reportEnd(PROGRESS_SUCCESS);
}
UpgradeProgress.reportEnd(PROGRESS_SUCCESS);
} catch (Exception ex) {
DEBUG.error("Unable to upgrade External CTS properties", ex);
throw new UpgradeException(ex);
}
}
use of org.forgerock.openam.upgrade.UpgradeException in project OpenAM by OpenRock.
the class UpgradeEntitlementSubConfigsStep method addMissingApplicationTypes.
/**
* Add missing application types.
*
* @throws UpgradeException
* should the process of creating new application types fail
*/
private void addMissingApplicationTypes() throws UpgradeException {
for (final Node typeNode : missingApplicationTypes) {
final Map<String, Set<String>> keyValueMap = parseAttributeValuePairTags(typeNode);
final String name = getNodeAttributeValue(typeNode, NAME);
UpgradeProgress.reportStart(AUDIT_NEW_TYPE_START, name);
keyValueMap.put(NAME, Collections.singleton(name));
try {
DEBUG.message("Saving new entitlement application type: " + name);
entitlementService.storeApplicationType(createApplicationType(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 RemoveReferralsStep method cloneApplication.
private Application cloneApplication(Application application, String resourceTypeId) throws UpgradeException {
try {
Application newApplication = new Application(application.getName(), application.getApplicationType());
newApplication.setDescription(application.getDescription());
newApplication.setSubjects(application.getSubjects());
newApplication.setConditions(application.getConditions());
newApplication.setResourceComparator(application.getResourceComparatorClass());
newApplication.setSearchIndex(application.getSearchIndexClass());
newApplication.setSaveIndex(application.getSaveIndexClass());
newApplication.setEntitlementCombiner(application.getEntitlementCombinerClass());
newApplication.setAttributeNames(application.getAttributeNames());
newApplication.addAllResourceTypeUuids(singleton(resourceTypeId));
return newApplication;
} catch (InstantiationException | IllegalAccessException e) {
throw new UpgradeException(format("Failed to clone application %s", application.getName()), e);
}
}
use of org.forgerock.openam.upgrade.UpgradeException in project OpenAM by OpenRock.
the class RemoveReferralsStep method deleteExistingReferrals.
private void deleteExistingReferrals() throws UpgradeException {
try (Connection connection = getConnection()) {
for (DN referral : referralsToBeRemoved) {
UpgradeProgress.reportStart(AUDIT_REMOVING_REFERRAL_START, referral);
DeleteRequest request = LDAPRequests.newDeleteRequest(referral);
connection.delete(request);
UpgradeProgress.reportEnd(AUDIT_UPGRADE_SUCCESS);
}
} catch (DataLayerException | LdapException e) {
UpgradeProgress.reportEnd(AUDIT_UPGRADE_FAIL);
throw new UpgradeException("Failed to delete referrals", e);
}
}
use of org.forgerock.openam.upgrade.UpgradeException in project OpenAM by OpenRock.
the class RemoveReferralsStep method instateAssociatedResourceType.
private String instateAssociatedResourceType(String resourceTypeId, String sourceRealm, String destinationRealm) throws EntitlementException, UpgradeException {
Pair<String, String> key = Pair.of(destinationRealm, resourceTypeId);
if (clonedResourceTypes.containsKey(key)) {
return clonedResourceTypes.get(key);
}
ResourceType resourceType = resourceTypeService.getResourceType(getAdminSubject(), sourceRealm, resourceTypeId);
if (resourceType == null) {
throw new UpgradeException(format("Expected resource type %s in realm %s", resourceTypeId, sourceRealm));
}
ResourceType clonedResourceType = cloneResourceType(resourceType);
resourceTypeService.saveResourceType(getAdminSubject(), destinationRealm, clonedResourceType);
clonedResourceTypes.put(key, clonedResourceType.getUUID());
return clonedResourceType.getUUID();
}
Aggregations