RuntimeComponent component = wire.getTarget().getComponent();
if (component != null && component.getImplementation() instanceof JavaImplementation) {
JavaImplementation javaImpl = (JavaImplementation)component.getImplementation();
if (javaImpl instanceof PolicySetAttachPoint) {
PolicyHandler policyHandler = null;
List<PolicyHandler> implPolicyHandlers = new ArrayList<PolicyHandler>();
PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)javaImpl;
try {
//for ( PolicySet policySet : policiedImpl.getPolicySets() ) {
for (PolicySet policySet : component.getPolicySets()) {
policyHandler =
PolicyHandlerUtils.findPolicyHandler(policySet, javaImpl.getPolicyHandlerClassNames());
if (policyHandler != null) {
policyHandler.setUp(javaImpl);
implPolicyHandlers.add(policyHandler);
} else {
//FIXME: to be removed after the PolicyHandler story has crystalized..
//maybe replace with exception then...
logger.warning("No PolicyHandler registered for PolicySet - " + policySet.getName());
}
}
List<PolicyHandler> applicablePolicyHandlers = null;
for (InvocationChain chain : wire.getInvocationChains()) {
applicablePolicyHandlers = new ArrayList<PolicyHandler>();
if (javaImpl instanceof OperationsConfigurator) {
String operationName = chain.getTargetOperation().getName();
OperationsConfigurator opConfigurator = (OperationsConfigurator)component;
for (ConfiguredOperation confOp : opConfigurator.getConfiguredOperations()) {
if (confOp.getName().equals(operationName)) {
for (PolicySet policySet : confOp.getPolicySets()) {
policyHandler =
PolicyHandlerUtils.findPolicyHandler(policySet, javaImpl
.getPolicyHandlerClassNames());
if (policyHandler != null) {
policyHandler.setUp(javaImpl);
applicablePolicyHandlers.add(policyHandler);
} else {
logger.warning("No PolicyHandler registered for " + policySet);
}
}