log.debug("Removing " + policyResourcePath);
if (!registry.resourceExists(policyResourcePath)) {
return;
}
SecurityScenario scenario = readCurrentScenario(serviceName);
if (scenario == null) {
return;
}
String secPolicyPath = servicePath + RegistryResources.POLICIES + scenario.getWsuId();
if (registry.resourceExists(secPolicyPath)) {
registry.delete(secPolicyPath);
}
String[] moduleNames = scenario.getModules().toArray(
new String[scenario.getModules().size()]);
// disengage modules
for (String moduleName : moduleNames) {
AxisModule module = service.getAxisConfiguration().getModule(moduleName);
service.disengageModule(module);
String modPath = RegistryResources.MODULES + module.getName() + "/" + module.getVersion();
registry.removeAssociation(servicePath, modPath,
RegistryResources.Associations.ENGAGED_MODULES);
}
// remove poicy
SecurityServiceAdmin admin = new SecurityServiceAdmin(axisConfig, registry);
admin.removeSecurityPolicyFromAllBindings(service, scenario.getWsuId());
String scenarioId = scenario.getScenarioId();
String resourceUri = SecurityConstants.SECURITY_POLICY + "/" + scenarioId;
// unpersist data
try {
boolean transactionStarted = Transaction.isStarted();