Package org.apache.tuscany.sca.policy

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


    }
   
    public void determineApplicableBindingPolicySets(Contract source, Contract target) throws PolicyComputationException {
        for (Binding aBinding : source.getBindings()) {
            if (aBinding instanceof PolicySetAttachPoint) {
                PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)aBinding;
                IntentAttachPointType bindingType = policiedBinding.getType();

                // add the target component's intents to the reference binding
                if (target != null) {
                    for (Intent intent : target.getRequiredIntents()) {
                        if (!policiedBinding.getRequiredIntents().contains(intent)) {
                            for (QName constrained : intent.getConstrains()) {
                                if (bindingType != null && bindingType.getName().getNamespaceURI()
                                    .equals(constrained.getNamespaceURI())
                                    && bindingType.getName().getLocalPart().startsWith(constrained
                                        .getLocalPart())) {
                                    policiedBinding.getRequiredIntents().add(intent);
                                    break;
                                }
                            }
                        }
                    }
                }
               
                //trim intents specified in operations.  First check for policysets specified on the operation
                //and then in the parent implementation
                if ( aBinding instanceof OperationsConfigurator ) {
                    OperationsConfigurator opConfigurator = (OperationsConfigurator)aBinding;
                   
                    for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) {
                        trimProvidedIntents(confOp.getRequiredIntents(), confOp.getPolicySets());
                        trimProvidedIntents(confOp.getRequiredIntents(), policiedBinding.getPolicySets());
                    }
                }

                trimProvidedIntents(policiedBinding.getRequiredIntents(), policiedBinding
                    .getPolicySets());

                // determine additional policysets that match remaining intents
                // TODO: resolved to domain policy registry and attach suitable
                // policy sets to the binding
View Full Code Here


        return null;
    }
   
    private void configureSecurity(ConfigurationContext configContext) 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

            if (ps.getName().equals(TransactionPolicy.NAME)) {
                implementationPolicy = (TransactionPolicy)ps.getPolicies().get(0);
            }
        }
        if (binding instanceof PolicySetAttachPoint) {
            PolicySetAttachPoint pap = (PolicySetAttachPoint)binding;
            for (PolicySet ps : pap.getPolicySets()) {
                if (ps.getName().equals(TransactionPolicy.NAME)) {
                    interactionPolicy = (TransactionPolicy)ps.getPolicies().get(0);

                }
            }
View Full Code Here

        Map<QName, PolicyHandler> availablePolicyHandlers =
            PolicySetHandlerUtil.getPolicyHandlers(Thread.currentThread().getContextClassLoader(),
                                                    "org.apache.tuscany.sca.policy.PolicySetHandlers");
        if ( implementation instanceof PolicySetAttachPoint ) {
            PolicyHandler aHandler = null;
            PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)implementation;
            for ( PolicySet policySet : policiedImpl.getPolicySets() ) {
                if ( ( aHandler = availablePolicyHandlers.get(policySet.getName()) ) != null ) {
                    aHandler.setApplicablePolicySet(policySet);
                    policyHandlers.put(policySet, aHandler);
                } else {
                    //FIXME : maybe there must be a warning thrown here
View Full Code Here

   
       
    private void determineApplicableBindingPolicySets(Contract source, Contract target) {
        for ( Binding aBinding : source.getBindings() ) {
            if ( aBinding instanceof PolicySetAttachPoint ) {
                PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)aBinding;
                IntentAttachPointType bindingType = policiedBinding.getType();
               
                //add the target component's intents to the reference binding
                if ( target != null ) {
                    for ( Intent intent : target.getRequiredIntents() ) {
                        if ( !policiedBinding.getRequiredIntents().contains(intent) ) {
                            for (QName constrained : intent.getConstrains()) {
                                if (bindingType != null && bindingType.getName().getNamespaceURI().equals(constrained
                                    .getNamespaceURI()) && bindingType.getName().getLocalPart()
                                    .startsWith(constrained.getLocalPart())) {
                                    policiedBinding.getRequiredIntents().add(intent);
                                    break;
                                }
                            }
                        }
                    }
                }
               
                trimProvidedIntents(policiedBinding.getRequiredIntents(), policiedBinding.getPolicySets());
               
                //determine additional policysets that match remaining intents
                //TODO: resolved to domain policy registry and attach suitable policy sets to the binding
                //for now using the SCA Definitions instead of registry
                //if there are intents that are not provided by any policy set throw a warning
View Full Code Here

        }
    }
   
    private void determineApplicableImplementationPolicySets(Component component) {
        if ( component.getImplementation() instanceof PolicySetAttachPoint ) {
            PolicySetAttachPoint policiedImplementation = (PolicySetAttachPoint)component.getImplementation();
            IntentAttachPointType implType = policiedImplementation.getType();
               
            trimProvidedIntents(policiedImplementation.getRequiredIntents(), policiedImplementation.getPolicySets());
               
            //determine additional policysets that match remaining intents
            //if there are intents that are not provided by any policy set throw a warning
            //TODO: resolved to domain policy registry and attach suitable policy sets to the implementation
            //...for now using the SCA Definitions instead of registry
View Full Code Here

        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

   
    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

        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

        return null;
    }
   
    private void configureSecurity(ConfigurationContext configContext) 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

TOP

Related Classes of org.apache.tuscany.sca.policy.PolicySetAttachPoint

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.