Examples of PolicySetAttachPoint


Examples of org.apache.tuscany.sca.policy.PolicySetAttachPoint

                if (binding instanceof IntentAttachPoint) {
                    IntentAttachPoint policiedBinding = (IntentAttachPoint)binding;
                    resolveIntents(policiedBinding.getRequiredIntents(), resolver);
                }
                if (binding instanceof PolicySetAttachPoint) {
                    PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)binding;
                    resolvePolicySets(policiedBinding.getPolicySets(), resolver);
                    //validate if attached policysets apply to the binding
                    validatePolicySets(contract, policiedBinding);
                }
                if (binding instanceof OperationsConfigurator) {
                    OperationsConfigurator opConfigurator = (OperationsConfigurator)binding;
                    for (ConfiguredOperation confOp : opConfigurator.getConfiguredOperations()) {
                        resolveIntents(confOp.getRequiredIntents(), resolver);
                        resolvePolicySets(confOp.getPolicySets(), resolver);
                    }
                }
            }

            // Resolve callback bindings
            if (contract.getCallback() != null) {
                resolveIntents(contract.getCallback().getRequiredIntents(), resolver);
                resolvePolicySets(contract.getCallback().getPolicySets(), resolver);
                //inherit the contract's policy intents and policysets
                addInheritedIntents(contract.getRequiredIntents(), contract.getCallback().getRequiredIntents());
                addInheritedPolicySets(contract.getPolicySets(), contract.getCallback().getPolicySets());
               
                for (int i = 0, n = contract.getCallback().getBindings().size(); i < n; i++) {
                    Binding binding = contract.getCallback().getBindings().get(i);
                    extensionProcessor.resolve(binding, resolver);

                    if (binding instanceof IntentAttachPoint) {
                        IntentAttachPoint policiedBinding = (IntentAttachPoint)binding;
                        resolveIntents(policiedBinding.getRequiredIntents(), resolver);
                    }
                    if (binding instanceof PolicySetAttachPoint) {
                        PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)binding;
                        resolvePolicySets(policiedBinding.getPolicySets(), resolver);
                        validatePolicySets(contract.getCallback(), policiedBinding);
                    }
                    if (binding instanceof OperationsConfigurator) {
                        OperationsConfigurator opConfigurator = (OperationsConfigurator)binding;
                        for (ConfiguredOperation confOp : opConfigurator.getConfiguredOperations()) {
View Full Code Here

Examples of org.apache.tuscany.sca.policy.PolicySetAttachPoint

        wsBinding.setURI(uri);
    }
   
    private void engageModules() throws AxisFault {
        if ( wsBinding instanceof PolicySetAttachPoint ) {
            PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
            if ( policiedBinding.getPolicySets().size() > 0 ) {
                //TODO: need to verify if one of the policies are concerned with security
                AxisModule m = new AxisModule("rampart");
                m.setFileName(wsBinding.getClass().getClassLoader().getResource("rampart-1.2.mar"));
                configContext.getAxisConfiguration().addModule(m);
                configContext.getAxisConfiguration().engageModule(m, configContext.getAxisConfiguration());
View Full Code Here

Examples of org.apache.tuscany.sca.policy.PolicySetAttachPoint

   
    private PolicySet getPolicySet(QName intentName){
        PolicySet returnPolicySet = null;
       
        if ( wsBinding instanceof PolicySetAttachPoint ) {
            PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
            for ( PolicySet policySet : policiedBinding.getPolicySets() ) {
                for (Intent intent : policySet.getProvidedIntents()){
                    if ( intent.getName().equals(intentName) ){
                        returnPolicySet = policySet;
                        break;
                    }
View Full Code Here

Examples of org.apache.tuscany.sca.policy.PolicySetAttachPoint

        return returnPolicySet;
    }
   
    private void configureSecurity() throws AxisFault {
        if ( wsBinding instanceof PolicySetAttachPoint ) {
            PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
            Parameter configParam = null;
            Axis2ConfigParamPolicy axis2ConfigParamPolicy = null;
            for ( PolicySet policySet : policiedBinding.getPolicySets() ) {
                for ( Object policy : policySet.getPolicies() ) {
                    if ( policy instanceof Axis2ConfigParamPolicy ) {
                        axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy;
                        for ( String paramName : axis2ConfigParamPolicy.getParamElements().keySet() ) {
                            configParam = new Parameter(paramName,
View Full Code Here

Examples of org.apache.tuscany.sca.policy.PolicySetAttachPoint

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

Examples of org.apache.tuscany.sca.policy.PolicySetAttachPoint

                if (implementation.isUnresolved()) {
                    extensionProcessor.resolve(implementation, resolver);
                    if (!implementation.isUnresolved()) {
                        //resolve policies
                        if ( implementation instanceof PolicySetAttachPoint ) {
                            PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)implementation;
                            resolveIntents(policiedImpl.getRequiredIntents(), resolver);
                            PolicyValidationUtils.validateIntents(policiedImpl, policiedImpl.getType());
                           
                            resolvePolicySets(policiedImpl.getPolicySets(), resolver);
                            PolicyValidationUtils.validatePolicySets(policiedImpl);
                           
                            if ( implementation instanceof OperationsConfigurator ) {
                                OperationsConfigurator opsConfigurator = (OperationsConfigurator)implementation;
                                for ( ConfiguredOperation implOp : opsConfigurator.getConfiguredOperations() ) {
                                    resolveIntents(implOp.getRequiredIntents(), resolver);
                                    PolicyValidationUtils.validateIntents(implOp, policiedImpl.getType());
                                   
                                    resolvePolicySets(implOp.getPolicySets(), resolver);
                                    PolicyValidationUtils.validatePolicySets(implOp,
                                                                             policiedImpl.getType(),
                                                                             policiedImpl.getApplicablePolicySets());
                                }
                            }
                           
                            for ( Service service : implementation.getServices() ) {
                                resolveIntents(service.getRequiredIntents(), resolver);
View Full Code Here

Examples of org.apache.tuscany.sca.policy.PolicySetAttachPoint

                        resolveIntents(policiedBinding.getRequiredIntents(), resolver);
                        PolicyValidationUtils.validateIntents(policiedBinding, policiedBinding.getType());
                    }
                   
                    if (binding instanceof PolicySetAttachPoint) {
                        PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)binding;
                        resolvePolicySets(policiedBinding.getPolicySets(), resolver);
                        //validate if attached policysets apply to the binding
                        resolvePolicySets(policiedBinding.getApplicablePolicySets(), resolver);
                        //inherit the applicable policysets from parent contract as whatever applies to that
                        //applies to the binding as well
                        addInheritedPolicySets(contract.getApplicablePolicySets(), policiedBinding.getApplicablePolicySets());
                        PolicyValidationUtils.validatePolicySets(policiedBinding);
                    }
                   
                    if (binding instanceof OperationsConfigurator) {
                        OperationsConfigurator opConfigurator = (OperationsConfigurator)binding;
                        for (ConfiguredOperation confOp : opConfigurator.getConfiguredOperations()) {
                            resolveIntents(confOp.getRequiredIntents(), resolver);
                            PolicyValidationUtils.validateIntents(confOp, ((PolicySetAttachPoint)binding).getType());
                           
                            resolvePolicySets(confOp.getPolicySets(), resolver);
                            resolvePolicySets(confOp.getApplicablePolicySets(), resolver);
                            //inherit the applicable policysets from parent binding as whatever applies to that
                            //applies to the binding as well
                            addInheritedPolicySets(((PolicySetAttachPoint)binding).getApplicablePolicySets(),
                                                   confOp.getApplicablePolicySets());
                            PolicyValidationUtils.validatePolicySets(confOp, ((PolicySetAttachPoint)binding).getType());
                        }
                    }
                }
   
                // Resolve callback bindings
                if (contract.getCallback() != null) {
                    resolveIntents(contract.getCallback().getRequiredIntents(), resolver);
                    resolvePolicySets(contract.getCallback().getPolicySets(), resolver);
                    resolvePolicySets(contract.getCallback().getApplicablePolicySets(), resolver);
                    //inherit the contract's policy intents and policysets
                    addInheritedPolicySets(contract.getApplicablePolicySets(), contract.getCallback().getApplicablePolicySets());
                   
                    for (int i = 0, n = contract.getCallback().getBindings().size(); i < n; i++) {
                        Binding binding = contract.getCallback().getBindings().get(i);
                        extensionProcessor.resolve(binding, resolver);
   
                        if (binding instanceof IntentAttachPoint) {
                            IntentAttachPoint policiedBinding = (IntentAttachPoint)binding;
                           
                            if ( policiedBinding.getType().isUnresolved() ) {
                                IntentAttachPointType resolved =
                                    resolver.resolveModel(IntentAttachPointType.class,
                                                          policiedBinding.getType());
                                policiedBinding.setType(resolved);
                            }
                           
                            resolveIntents(policiedBinding.getRequiredIntents(), resolver);
                            PolicyValidationUtils.validateIntents(policiedBinding, policiedBinding.getType());
                        }
                       
                        if (binding instanceof PolicySetAttachPoint) {
                            PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)binding;
                            resolvePolicySets(policiedBinding.getPolicySets(), resolver);
                            //validate if attached policysets apply to the binding
                            resolvePolicySets(policiedBinding.getApplicablePolicySets(), resolver);
                            //inherit the applicable policysets from parent contract as whatever applies to that
                            //applies to the binding as well
                            addInheritedPolicySets(contract.getApplicablePolicySets(), policiedBinding.getApplicablePolicySets());
                            PolicyValidationUtils.validatePolicySets(policiedBinding);
                        }
                       
                        if (binding instanceof OperationsConfigurator) {
                            OperationsConfigurator opConfigurator = (OperationsConfigurator)binding;
View Full Code Here

Examples of org.apache.tuscany.sca.policy.PolicySetAttachPoint

    public static PolicySet getPolicySet(Binding wsBinding, QName intentName) {
        PolicySet returnPolicySet = null;

        if (wsBinding instanceof PolicySetAttachPoint) {
            PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
            for (PolicySet policySet : policiedBinding.getPolicySets()) {
                for (Intent intent : policySet.getProvidedIntents()) {
                    if (intent.getName().equals(intentName)) {
                        returnPolicySet = policySet;
                        break;
                    }
View Full Code Here

Examples of org.apache.tuscany.sca.policy.PolicySetAttachPoint

                                                 List<PolicySet> inheritedApplicablePolicySets,
                                                 ModelResolver resolver) throws ContributionResolveException,
                                                                                 PolicyValidationException
                                                        {
        if ( implementation instanceof PolicySetAttachPoint ) {
            PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)implementation;
           
            policiedImpl.getApplicablePolicySets().addAll(inheritedApplicablePolicySets);
           
            resolveIntents(policiedImpl.getRequiredIntents(), resolver);
            PolicyValidationUtils.validateIntents(policiedImpl, policiedImpl.getType());
           
            resolvePolicySets(policiedImpl.getPolicySets(), resolver);
            resolvePolicySets(policiedImpl.getApplicablePolicySets(), resolver);
           
            PolicyValidationUtils.validatePolicySets(policiedImpl);
           
            if ( implementation instanceof OperationsConfigurator ) {
                for ( ConfiguredOperation implConfOp : ((OperationsConfigurator)implementation).getConfiguredOperations() ) {
                    resolveIntents(implConfOp.getRequiredIntents(), resolver);
                    PolicyValidationUtils.validateIntents(implConfOp, policiedImpl.getType());
                   
                    resolvePolicySets(implConfOp.getPolicySets(), resolver);
                    resolvePolicySets(implConfOp.getApplicablePolicySets(), resolver);
                    //add the inherited applicablePolicysets
                    addInheritedPolicySets(policiedImpl.getApplicablePolicySets(), implConfOp.getApplicablePolicySets());
                   
                    PolicyValidationUtils.validatePolicySets(implConfOp, policiedImpl.getType());
                   
                    PolicyComputationUtils.addDefaultPolicies(
                                            ((PolicySetAttachPoint)implementation).getRequiredIntents(),
                                            ((PolicySetAttachPoint)implementation).getPolicySets(),
                                            implConfOp.getRequiredIntents(),
View Full Code Here

Examples of org.apache.tuscany.sca.policy.PolicySetAttachPoint

     */
    private void readPolicySets(Object attachPoint, Operation operation, XMLStreamReader reader) {
        if (!(attachPoint instanceof PolicySetAttachPoint)) {
            return;
        }
        PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)attachPoint;
        String value = reader.getAttributeValue(null, POLICY_SETS);
        if (value != null) {
            List<PolicySet> policySets = policySetAttachPoint.getPolicySets();
            for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
                QName qname = getQNameValue(reader, tokens.nextToken());
                PolicySet policySet = policyFactory.createPolicySet();
                policySet.setName(qname);
                if (operation != null) {
                    //FIXME Don't we need to handle policySet specification
                    // on an operation basis?
                    //policySet.getOperations().add(operation);
                }
                policySets.add(policySet);
            }
        }
       
        value = reader.getAttributeValue(SCA10_TUSCANY_NS, APPLICABLE_POLICY_SETS);
        if (value != null) {
            List<PolicySet> applicablePolicySets = policySetAttachPoint.getApplicablePolicySets();
            for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
                QName qname = getQNameValue(reader, tokens.nextToken());
                PolicySet policySet = policyFactory.createPolicySet();
                policySet.setName(qname);
                if (operation != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.