public SecurityScenarioData getCurrentScenario(String serviceName)
throws SecurityConfigException {
try {
SecurityScenarioData data = null;
AxisService service = axisConfig.getServiceForActivation(serviceName);
if (service == null) {
throw new SecurityConfigException("AxisService is Null");
}
String servicePath = RegistryResources.SERVICE_GROUPS
+ service.getAxisServiceGroup().getServiceGroupName()
+ RegistryResources.SERVICES + serviceName;
String policyResourcePath = servicePath + RegistryResources.POLICIES;
if (!registry.resourceExists(policyResourcePath)) {
return data;
}
/**
* First check whether there's a custom policy engaged from registry. If it is not
* the case, we check whether a default scenario is applied.
*/
Parameter param = service.getParameter(SecurityConstants.SECURITY_POLICY_PATH);
if (param != null) {
data = new SecurityScenarioData();
data.setPolicyRegistryPath((String) param.getValue());
data.setScenarioId(SecurityConstants.POLICY_FROM_REG_SCENARIO);
} else {
SecurityScenario scenario = this.readCurrentScenario(serviceName);
if (scenario != null) {
data = new SecurityScenarioData();
data.setCategory(scenario.getCategory());
data.setDescription(scenario.getDescription());
data.setScenarioId(scenario.getScenarioId());
data.setSummary(scenario.getSummary());
}
}
return data;
} catch (RegistryException e) {