Package org.apache.tuscany.sca.policy

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


        return null;
    }
   
    private SCABinding createSCABinding() {
        SCABinding scaBinding = scaBindingFactory.createSCABinding();
        IntentAttachPointType bindingType = intentAttachPointTypeFactory.createBindingType();
        bindingType.setName(BINDING_SCA_QNAME);
        bindingType.setUnresolved(true);
        ((PolicySetAttachPoint)scaBinding).setType(bindingType);
       
        return scaBinding;
    }
View Full Code Here


    public IntentAttachPointType read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
        QName type = getQName(reader, TYPE);
       
        if ( type != null ) {
            if ( type.getLocalPart().startsWith(BINDING) ) {
                IntentAttachPointType bindingType = attachPointTypeFactory.createBindingType();
                bindingType.setName(type);
                bindingType.setUnresolved(true);
               
                readAlwaysProvidedIntents(bindingType, reader);
                readMayProvideIntents(bindingType, reader);
                return bindingType;
            } else if ( type.getLocalPart().startsWith(IMPLEMENTATION) ) {
                IntentAttachPointType implType = attachPointTypeFactory.createImplementationType();
                implType.setName(type);
                implType.setUnresolved(true);
               
                readAlwaysProvidedIntents(implType, reader);
                readMayProvideIntents(implType, reader);
                return implType;
            } else {
View Full Code Here

    }
   
    protected void computeIntentsForOperations(OperationsConfigurator opConfigurator,
                                               IntentAttachPoint intentAttachPoint,
                                               List<Intent> parentIntents) throws PolicyValidationException {
        IntentAttachPointType attachPointType = intentAttachPoint.getType();
       
        boolean found = false;
        for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) {
            //expand profile intents specified on operations
            expandProfileIntents(confOp.getRequiredIntents());
View Full Code Here

                                                  PolicySetAttachPoint policySetAttachPoint)
                                                                        throws PolicyValidationException {
        //String appliesTo = null;
        //String scdlFragment = "";
        HashMap<QName, PolicySet> policySetTable = new HashMap<QName, PolicySet>();
        IntentAttachPointType attachPointType = policySetAttachPoint.getType();
       
        for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) {
            //validate policysets specified for the attachPoint
            for (PolicySet policySet : confOp.getPolicySets()) {
                if ( !policySet.isUnresolved() ) {
                    //appliesTo = policySet.getAppliesTo();
       
                    //if (!PolicyValidationUtils.isPolicySetApplicable(scdlFragment, appliesTo, attachPointType)) {
                    if (!applicablePolicySets.contains(policySet)) {
                        throw new PolicyValidationException("Policy Set '" + policySet.getName()
                                + " specified for operation " + confOp.getName() 
                            + "' does not constrain extension type  "
                            + attachPointType.getName());
       
                    }
                } else {
                    throw new PolicyValidationException("Policy Set '" + policySet.getName()
                            + " specified for operation " + confOp.getName() 
View Full Code Here

                                    setName(new QName(namespace,
                                                      ((QualifiedIntent)intent).getQualifiableIntent().getName().getLocalPart()));
                        }
                        intentTable.put(intent.getName(), intent);
                    } else if ( artifact instanceof BindingTypeImpl ) {
                        IntentAttachPointType bindingType = (IntentAttachPointType)artifact;
                        bindingTypesTable.put(bindingType.getName(), bindingType);
                    } else if ( artifact instanceof ImplementationTypeImpl ) {
                        IntentAttachPointType implType = (IntentAttachPointType)artifact;
                        implTypesTable.put(implType.getName(), implType);
                    }
                   
                    if ( artifact != null ) {
                        resolver.addModel(artifact);
                    }
View Full Code Here

        //testing to ensure that inclusion of referred policy sets has not happened
        PolicySet basicAuthMsgProtSecurityPolicySet = policySetTable.get(basicAuthMsgProtSecurity);
        assertTrue(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
        assertTrue(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().isEmpty());
       
        IntentAttachPointType wsBindingType = bindingTypesTable.get(wsBinding);
        assertNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNull(wsBindingType.getMayProvideIntents().get(0).getDescription());
       
        IntentAttachPointType javaImplType = implTypesTable.get(javaImpl);
        assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNull(javaImplType.getMayProvideIntents().get(0).getDescription());
       
        for ( Intent intent : intentTable.values() ) {
            staxProcessor.resolve(intent, resolver);
        }
       
        for ( PolicySet policySet : policySetTable.values() ) {
            staxProcessor.resolve(policySet, resolver);
        }
       
        for IntentAttachPointType bindingType : bindingTypesTable.values() ) {
            staxProcessor.resolve(bindingType, resolver);
        }
       
        for ( IntentAttachPointType implType : implTypesTable.values() ) {
            staxProcessor.resolve(implType, resolver);
        }
       
       
       
        //testing if policy intents have been linked have property been linked up
        assertNotNull(profileIntent.getRequiredIntents().get(0).getDescription());
        assertNotNull(qualifiedIntent.getQualifiableIntent().getDescription());
        assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
        assertNotNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
       
        //testing if policysets have been properly linked up with intents
        assertFalse(secureMessagingPolicySet.isUnresolved());
        assertNotNull(secureMessagingPolicySet.getMappedPolicies().get(intentTable.get(confidentiality)));
        assertNotNull(secureMessagingPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_transport)));
       
        //testing if intent maps have been properly mapped to policies
        assertFalse(securityPolicySet.isUnresolved());
        assertNotNull(securityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality)));
        assertNotNull(securityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_message)));
       
        //testing for inclusion of referred policysets
        assertFalse(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
        assertFalse(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().isEmpty());
        assertNotNull(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_transport)));
       
        assertNotNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNotNull(wsBindingType.getMayProvideIntents().get(0).getDescription());
       
        assertNotNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNotNull(javaImplType.getMayProvideIntents().get(0).getDescription());
    }
View Full Code Here

                                        composite.getExtensions().add(extension);
                                    }
                                }
                            } else if (extension instanceof Binding) {
                                if ( extension instanceof PolicySetAttachPoint ) {
                                    IntentAttachPointType bindingType = intentAttachPointTypeFactory.createBindingType();
                                    bindingType.setName(name);
                                    bindingType.setUnresolved(true);
                                    ((PolicySetAttachPoint)extension).setType(bindingType);
                                }
                                // <service><binding> and
                                // <reference><binding>
                                if (callback != null) {
                                    callback.getBindings().add((Binding)extension);
                                } else {
                                    if (contract != null) {
                                        contract.getBindings().add((Binding)extension);
                                    } else {
                                        if (name.getNamespaceURI().equals(SCA10_NS)) {
                                            throw new ContributionReadException(
                                                                                "Unexpected <binding> element found. It should appear inside a <service> or <reference> element");
                                        } else {
                                            composite.getExtensions().add(extension);
                                        }
                                    }
                                }

                            } else if (extension instanceof Implementation) {
                                if ( extension instanceof PolicySetAttachPoint ) {
                                    IntentAttachPointType implType = intentAttachPointTypeFactory.createImplementationType();
                                    implType.setName(name);
                                    implType.setUnresolved(true);
                                    ((PolicySetAttachPoint)extension).setType(implType);
                                }
                                // <component><implementation>
                                if (component != null) {
                                    component.setImplementation((Implementation)extension);
View Full Code Here

    public void determineApplicableBindingPolicySets(Contract source, Contract target) throws PolicyComputationException {
        List<Intent> intentsCopy = null;
        for (Binding aBinding : source.getBindings()) {
            if (aBinding instanceof PolicySetAttachPoint) {
                PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)aBinding;
                IntentAttachPointType bindingType = policiedBinding.getType();

               
                intentsCopy = new ArrayList<Intent>(policiedBinding.getRequiredIntents());
                // 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;
                                }
                            }
View Full Code Here

                                PolicySet policySet = (PolicySet)extension;
                                policySet.setName(new QName(targetNamespace,
                                                            policySet.getName().getLocalPart()));
                                definitions.getPolicySets().add(policySet);
                            } else if ( extension instanceof IntentAttachPointType ) {
                                IntentAttachPointType type = (IntentAttachPointType)extension;
                                if ( type.getName().getLocalPart().startsWith(BINDING)) {
                                    definitions.getBindingTypes().add((IntentAttachPointType)extension);
                                } else if ( type.getName().getLocalPart().startsWith(IMPLEMENTATION)) {
                                    definitions.getImplementationTypes().add((IntentAttachPointType)extension);
                                }
                            }
                            definitionsResolver.addModel(extension);
                        }
View Full Code Here

            PolicySet policySet = scaDefns.getPolicySets().get(count);
            extensionProcessor.resolve(policySet, resolver);
        }
       
        for (int count = 0, size = scaDefns.getBindingTypes().size(); count < size; count++) {
            IntentAttachPointType bindingType = scaDefns.getBindingTypes().get(count);
            extensionProcessor.resolve(bindingType, resolver);
        }
       
        for (int count = 0, size = scaDefns.getImplementationTypes().size(); count < size; count++) {
            IntentAttachPointType implType = scaDefns.getImplementationTypes().get(count);
            extensionProcessor.resolve(implType, resolver);
        }
    }
View Full Code Here

TOP

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

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.