throws ModuleMgtException {
AxisService service = axisConfig.getServiceForActivation(serviceName);
if (service == null) {
log.error("Service " + serviceName + "cannnot be found!");
throw new ModuleMgtException(ModuleMgtException.ERROR, ModuleMgtMessageKeys.SERVICE_NOT_FOUND);
}
AxisOperation operation = service.getOperation(new QName(operationName));
if (operation == null) {
log.error("Operation " + operationName + "cannnot be found!");
throw new ModuleMgtException(ModuleMgtException.ERROR, ModuleMgtMessageKeys.OPERATION_NOT_FOUND);
}
AxisModule module = axisConfig.getModule(moduleId);
if (module == null) {
log.error("Module " + moduleId + "cannnot be found!");
throw new ModuleMgtException(ModuleMgtException.ERROR, ModuleMgtMessageKeys.OPERATION_NOT_FOUND);
}
if (axisConfig.isEngaged(module)) {
throw new ModuleMgtException(ModuleMgtException.WARNING, ModuleMgtMessageKeys.ALREADY_ENGAGED_GLOBALLY);
}
AxisServiceGroup axisServiceGroup = service.getAxisServiceGroup();
if (axisServiceGroup.isEngaged(module)) {
// Module is already engaged so just return the value;
throw new ModuleMgtException(ModuleMgtException.WARNING, ModuleMgtMessageKeys.ALREADY_ENGAGED_SERVICE_GROUP);
}
if (service.isEngaged(module)) {
// Module is already engaged so just return the value;
throw new ModuleMgtException(ModuleMgtException.WARNING, ModuleMgtMessageKeys.ALREADY_ENGAGED_SERVICE);
}
if (operation.isEngaged(module)) {
// Module is already engaged so just return the value;
throw new ModuleMgtException(ModuleMgtException.WARNING, ModuleMgtMessageKeys.ALREADY_ENGAGED_OPERATION);
}
try {
if (RAHAS_MODULE_NAME.equalsIgnoreCase(module.getName())) {
AxisModule rampartModule = axisConfig.getModule(RAMPART_MODULE_NAME);
if (rampartModule == null) {
throw new ModuleMgtException(ModuleMgtException.WARNING, ModuleMgtMessageKeys.RAHAS_RAMPART_NOT_FOUND);
}
if (!operation.isEngaged(rampartModule)) {
pf.getOperationPM().engageModuleForOperation(rampartModule, operation);
operation.disengageModule(rampartModule);
operation.engageModule(rampartModule);
}
}
pf.getOperationPM().engageModuleForOperation(module, operation);
operation.disengageModule(module);
operation.engageModule(module);
} catch (Exception e) {
String msg = "Error occured while engaging the module " + moduleId + " to "
+ operationName;
log.error(msg, e);
throw new ModuleMgtException(e, ModuleMgtException.ERROR, ModuleMgtMessageKeys.ERROR_ENGAGE);
}
return true;
}