use of org.forgerock.openam.upgrade.UpgradeException in project OpenAM by OpenRock.
the class AbstractUpgradeStep method getRealmNames.
/**
* Returns the names of the realms available in the OpenAM configuration. The returned set is ordered, so the realm
* hierarchy maintained (i.e. subrealm precedes sub-subrealm).
*
* @return The set of realmnames available in OpenAM.
* @throws UpgradeException In case retrieving the realmnames was not successful.
*/
protected final Set<String> getRealmNames() throws UpgradeException {
try {
OrganizationConfigManager ocm = new OrganizationConfigManager(getAdminToken(), "/");
Set<String> realms = CollectionUtils.asOrderedSet("/");
realms.addAll(ocm.getSubOrganizationNames("*", true));
if (DEBUG.messageEnabled()) {
DEBUG.message("Discovered realms in the configuration: " + realms);
}
return realms;
} catch (SMSException smse) {
DEBUG.error("An error occurred while trying to retrieve the list of realms", smse);
throw new UpgradeException("Unable to retrieve realms from SMS");
}
}
use of org.forgerock.openam.upgrade.UpgradeException in project OpenAM by OpenRock.
the class AllowEvaluateForAgentsUpgradeStep method perform.
@Override
public void perform() throws UpgradeException {
try {
UpgradeProgress.reportStart(AUDIT_NEW_POLICY_START);
// Creates a new policy entry to represent the new agent privilege.
DEBUG.message("Creating new default privilege for agents called " + EVALUATE_POLICY);
String policy = AMSetupServlet.readFile(DELEGATION_POLICY_FILE);
policy = ServicesDefaultValues.tagSwap(policy, true);
PolicyUtils.createPolicies(manager, new ByteArrayInputStream(policy.getBytes()));
UpgradeProgress.reportEnd(AUDIT_UPGRADE_SUCCESS);
} catch (IOException ioE) {
UpgradeProgress.reportEnd(AUDIT_UPGRADE_FAIL);
throw new UpgradeException("Failed during the creation of a new privilege for agents", ioE);
} catch (SSOException ssoE) {
UpgradeProgress.reportEnd(AUDIT_UPGRADE_FAIL);
throw new UpgradeException("Failed during the creation of a new privilege for agents", ssoE);
} catch (PolicyException pE) {
UpgradeProgress.reportEnd(AUDIT_UPGRADE_FAIL);
throw new UpgradeException("Failed during the creation of a new privilege for agents", pE);
}
}
use of org.forgerock.openam.upgrade.UpgradeException in project OpenAM by OpenRock.
the class DelegationConfigUpgradeStep method initialize.
@Override
public void initialize() throws UpgradeException {
// Extract out all sub configurations from the delegation XML doc.
final Document delegationDocument = getDelegationDocument();
final NodeList configNodes = delegationDocument.getElementsByTagName(SMSUtils.SUB_CONFIG);
try {
initConfig();
// Check each permission/privilege config node against the service model.
for (int idx = 0; idx < configNodes.getLength(); idx++) {
final Node configNode = configNodes.item(idx);
final String id = getNodeAttributeValue(configNode, ID);
final String name = getNodeAttributeValue(configNode, NAME);
if (PERMISSION.equals(id)) {
checkPermission(name, configNode, permissionsConfig);
} else if (PRIVILEGE.equals(id)) {
checkPrivilege(name, configNode, privilegesConfig);
}
}
} catch (SSOException ssoE) {
throw new UpgradeException("Failed analysing the delegation delta", ssoE);
} catch (SMSException smsE) {
throw new UpgradeException("Failed analysing the delegation delta", smsE);
}
}
use of org.forgerock.openam.upgrade.UpgradeException in project OpenAM by OpenRock.
the class ScriptingSchemaStep method perform.
@Override
public void perform() throws UpgradeException {
try {
ServiceConfigManager configManager = new ServiceConfigManager(SCRIPTING_SERVICE_NAME, getAdminToken());
ServiceConfig globalConfig = configManager.getGlobalConfig(null);
upgradeEngineConfiguration(globalConfig);
upgradeScriptConfiguration(globalConfig);
} catch (SMSException | SSOException e) {
UpgradeProgress.reportEnd("upgrade.failed");
DEBUG.error("An error occurred while trying to upgrade the Scripting global settings", e);
throw new UpgradeException("Unable to upgrade Scripting global settings", e);
}
}
use of org.forgerock.openam.upgrade.UpgradeException in project OpenAM by OpenRock.
the class ScriptingSchemaStep method initialize.
@Override
public void initialize() throws UpgradeException {
try {
captureScriptedAuthModuleConfiguration();
captureDeviceIdMatchConfiguration();
} catch (ServiceNotFoundException e) {
DEBUG.message("Scripted auth modules not found. Nothing to upgrade", e);
} catch (SMSException | SSOException e) {
DEBUG.error("An error occurred while trying to look for upgradable global Scripting settings", e);
throw new UpgradeException("Unable to retrieve global Scripting settings", e);
}
}
Aggregations