//configuration has changed such as class name or a global ACI.
newHandlerClass = newConfiguration.getJavaClass();
String oldHandlerClass = currentConfiguration.getJavaClass();
//Check if moving from not enabled to enabled state.
if(!enabledOld) {
AccessControlHandler oldHandler =
accessControlHandler.getAndSet(getHandler(newHandlerClass,
newConfiguration, true,
true));
oldHandler.finalizeAccessControlHandler();
} else {
//Check if the class name is being changed.
if(!newHandlerClass.equals(oldHandlerClass)) {
AccessControlHandler oldHandler =
accessControlHandler.getAndSet(getHandler(newHandlerClass,
newConfiguration, true, true));
oldHandler.finalizeAccessControlHandler();
} else {
//Some other attribute has changed, try to get a new non-initialized
//handler, but keep the old handler.
getHandler(newHandlerClass,newConfiguration, false, false);
}
}
} else if (enabledOld && (! enabledNew)) {
//Access control has been disabled, switch to the default handler and
//finalize the old handler.
newHandlerClass = DefaultAccessControlHandler.class.getName();
AccessControlHandler oldHandler =
accessControlHandler.getAndSet(getHandler(newHandlerClass,
newConfiguration, false, true));
oldHandler.finalizeAccessControlHandler();
}
}
// Switch in the local configuration.
currentConfiguration = newConfiguration;
}