}
public boolean disengageModuleForServiceGroup(String moduleId, String serviceGroupName)
throws ModuleMgtException {
AxisServiceGroup serviceGroup = axisConfig.getServiceGroup(serviceGroupName);
if (serviceGroup == null) {
log.error("Service group " + serviceGroupName + "cannnot be found!");
throw new ModuleMgtException(ModuleMgtException.ERROR, ModuleMgtMessageKeys.SERVICE_GROUP_NOT_FOUND);
}
AxisModule module = axisConfig.getModule(moduleId);
if (module == null) {
log.error("Module " + moduleId + " cannnot be found!");
throw new ModuleMgtException(ModuleMgtException.ERROR, ModuleMgtMessageKeys.MODULE_NOT_FOUND);
}
if (serviceGroup.isEngaged(module)) {
if (RAMPART_MODULE_NAME.equalsIgnoreCase(module.getName())) {
// Check whether it is possible to disengage Rampart
AxisModule rahasModule = axisConfig.getModule(RAHAS_MODULE_NAME);
if (serviceGroup.isEngaged(rahasModule)) {
throw new ModuleMgtException(ModuleMgtException.WARNING, ModuleMgtMessageKeys.RAHAS_RAMPART_DISENGAGE);
}
}
if (RAMPART_MODULE_NAME.equalsIgnoreCase(module.getName()) || RAHAS_MODULE_NAME.equalsIgnoreCase(module.getName())) {
// Check any of the services in the service group has a security scenario applied
// if there is a security scenario give a warning saying cannot disengage rampart
Iterator<AxisService> servicesIterator = serviceGroup.getServices();
while (servicesIterator.hasNext()) {
AxisService service = servicesIterator.next();
if (isRequiredForSecurityScenario(service.getName(),module.getName())) {
throw new ModuleMgtException(ModuleMgtException.WARNING,
ModuleMgtMessageKeys.SERVICES_WITH_SECURITY_SCENARIOS);
}
}
}
try {
pf.getServiceGroupPM().disengageModuleForServiceGroup(module, serviceGroup);
serviceGroup.disengageModule(module);
} catch (Exception e) {
log.error("Error occured while disengaging the module " + module, e);
throw new ModuleMgtException(e, ModuleMgtException.ERROR, ModuleMgtMessageKeys.ERROR_DISENGAGE);
}