Search in sources :

Example 6 with ServiceSchemaModificationWrapper

use of org.forgerock.openam.upgrade.ServiceSchemaModificationWrapper in project OpenAM by OpenRock.

the class ServiceSchemaModifications method createServiceModifications.

/**
     * This will use the service schemas to find any upgrade handlers registered for the service and
     * populate the NewServiceWrapper's ServiceSchemaModificationWrappers.
     * @param newSchemaMap The service schemas representing the service.
     * @throws UpgradeException If an upgrade error occurs.
     */
private void createServiceModifications(Map<String, ServiceSchemaImpl> newSchemaMap) throws UpgradeException {
    try {
        final Map<String, ServiceSchemaModificationWrapper> serviceSchemaMap = new HashMap<String, ServiceSchemaModificationWrapper>();
        for (Map.Entry<String, ServiceSchemaImpl> newAttrSchemaEntry : newSchemaMap.entrySet()) {
            final ServiceSchemaModificationWrapper attributesAdded = getServiceModificationsRecursive(newAttrSchemaEntry.getKey(), newAttrSchemaEntry.getValue());
            if (attributesAdded.hasBeenModified()) {
                serviceSchemaMap.put(newAttrSchemaEntry.getKey(), attributesAdded);
            }
        }
        newServiceWrapper = new NewServiceWrapper(serviceName, serviceSchemaMap, serviceSchemaDoc);
    } catch (SMSException smse) {
        UpgradeUtils.debug.error("Error whilst determining schema changes for service: " + serviceName, smse);
        throw new UpgradeException(smse.getMessage(), smse);
    }
}
Also used : UpgradeException(org.forgerock.openam.upgrade.UpgradeException) ServiceSchemaModificationWrapper(org.forgerock.openam.upgrade.ServiceSchemaModificationWrapper) HashMap(java.util.HashMap) NewServiceWrapper(org.forgerock.openam.upgrade.NewServiceWrapper) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

ServiceSchemaModificationWrapper (org.forgerock.openam.upgrade.ServiceSchemaModificationWrapper)6 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 Map (java.util.Map)3 Set (java.util.Set)3 ServiceSchemaUpgradeWrapper (org.forgerock.openam.upgrade.ServiceSchemaUpgradeWrapper)2 UpgradeException (org.forgerock.openam.upgrade.UpgradeException)2 NewServiceWrapper (org.forgerock.openam.upgrade.NewServiceWrapper)1 SchemaUpgradeWrapper (org.forgerock.openam.upgrade.SchemaUpgradeWrapper)1 SubSchemaUpgradeWrapper (org.forgerock.openam.upgrade.SubSchemaUpgradeWrapper)1