Package org.apache.tuscany.sca.policy.util

Examples of org.apache.tuscany.sca.policy.util.PolicyHandler


       
        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 = getPolicyHandler(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...
                            System.out.println("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 = getPolicyHandler(policySet, javaImpl.getPolicyHandlerClassNames());
                                        policyHandler.setUp(javaImpl);
                                        applicablePolicyHandlers.add(policyHandler);
                                    }
                                    break;
                                }
                            }
View Full Code Here


   
    private PolicyHandler getPolicyHandler(PolicySet policySet,
                                           Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassNames)
                                throws IllegalAccessException, ClassNotFoundException, InstantiationException {
       
        PolicyHandler handler = null;
       
        for (ClassLoader classLoader : policyHandlerClassNames.keySet()) {
            for ( PolicyHandlerTuple handlerTuple : policyHandlerClassNames.get(classLoader) ) {
                for ( Intent intent : policySet.getProvidedIntents() ) {
                    if ( intent.getName().equals(handlerTuple.getProvidedIntentName())) {
                        for ( Object policy : policySet.getPolicies() ) {
                            if ( policy.getClass().getName().equals(handlerTuple.getPolicyModelClassName())) {
                                handler =
                                    (PolicyHandler)Class.forName(handlerTuple.getPolicyHandlerClassName(),
                                                                 true,
                                                                 classLoader).newInstance();
                                    handler.setApplicablePolicySet(policySet);
                                    return handler;
                            }
                        }
                    }
                }
View Full Code Here

        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);
                                        }
                                    }
View Full Code Here

    }

    private void createPolicyHandlers() throws IllegalAccessException, InstantiationException, ClassNotFoundException {
        if (wsBinding instanceof PolicySetAttachPoint) {
            PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
            PolicyHandler policyHandler = null;
            for (PolicySet policySet : policiedBinding.getPolicySets()) {
                policyHandler = PolicyHandlerUtils.findPolicyHandler(policySet, policyHandlerClassnames);
                if (policyHandler != null) {
                    policyHandler.setApplicablePolicySet(policySet);
                    policyHandlerList.add(policyHandler);
                }
            }
        }
    }
View Full Code Here

    private void createPolicyHandlers() throws IllegalAccessException,
                                                              InstantiationException,
                                                              ClassNotFoundException {
        if (wsBinding instanceof PolicySetAttachPoint) {
            PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
            PolicyHandler policyHandler = null;
            for (PolicySet policySet : policiedBinding.getPolicySets()) {
                policyHandler =
                    PolicyHandlerUtils.findPolicyHandler(policySet, policyHandlerClassnames);
                if (policyHandler != null) {
                    policyHandler.setApplicablePolicySet(policySet);
                    policyHandlerList.add(policyHandler);
                }
            }
        }
    }
View Full Code Here

    private void createPolicyHandlers() throws IllegalAccessException,
                                               InstantiationException,
                                               ClassNotFoundException {
        if (wsBinding instanceof PolicySetAttachPoint) {
            PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
            PolicyHandler policyHandler = null;
           
            for (PolicySet policySet : policiedBinding.getPolicySets()) {
                policyHandler =
                    PolicyHandlerUtils.findPolicyHandler(policySet, policyHandlerClassnames);
               
                if (policyHandler != null) {
                    policyHandler.setApplicablePolicySet(policySet);
                    policyHandlerList.add(policyHandler);
                }
            }
           
            // code to create policy handlers using a policy SPI based
View Full Code Here

    }

    private void createPolicyHandlers() throws IllegalAccessException, InstantiationException, ClassNotFoundException {
        if (wsBinding instanceof PolicySetAttachPoint) {
            PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
            PolicyHandler policyHandler = null;
            for (PolicySet policySet : policiedBinding.getPolicySets()) {
                policyHandler = PolicyHandlerUtils.findPolicyHandler(policySet, policyHandlerClassnames);
                if (policyHandler != null) {
                    policyHandler.setApplicablePolicySet(policySet);
                    policyHandlerList.add(policyHandler);
                }
            }
           
            // code to create policy handlers using the new policy SPI based
View Full Code Here

    }

    private void createPolicyHandlers() throws IllegalAccessException, InstantiationException, ClassNotFoundException {
        if (wsBinding instanceof PolicySetAttachPoint) {
            PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
            PolicyHandler policyHandler = null;
            for (PolicySet policySet : policiedBinding.getPolicySets()) {
                policyHandler = PolicyHandlerUtils.findPolicyHandler(policySet, policyHandlerClassnames);
                if (policyHandler != null) {
                    policyHandler.setApplicablePolicySet(policySet);
                    policyHandlerList.add(policyHandler);
                }
            }
        }
    }
View Full Code Here

    private void createPolicyHandlers() throws IllegalAccessException,
                                               InstantiationException,
                                               ClassNotFoundException {
        if (wsBinding instanceof PolicySetAttachPoint) {
            PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
            PolicyHandler policyHandler = null;
            for (PolicySet policySet : policiedBinding.getPolicySets()) {
                policyHandler =
                    PolicyHandlerUtils.findPolicyHandler(policySet, policyHandlerClassnames);
                if (policyHandler != null) {
                    policyHandler.setApplicablePolicySet(policySet);
                    policyHandlerList.add(policyHandler);
                }
            }
        }
    }
View Full Code Here

    private void createPolicyHandlers() throws IllegalAccessException,
                                               InstantiationException,
                                               ClassNotFoundException {
        if (wsBinding instanceof PolicySetAttachPoint) {
            PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
            PolicyHandler policyHandler = null;
           
            for (PolicySet policySet : policiedBinding.getPolicySets()) {
                policyHandler =
                    PolicyHandlerUtils.findPolicyHandler(policySet, policyHandlerClassnames);
               
                if (policyHandler != null) {
                    policyHandler.setApplicablePolicySet(policySet);
                    policyHandlerList.add(policyHandler);
                }
            }
           
            // code to create policy handlers using a policy SPI based
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.policy.util.PolicyHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.