Examples of ExtensionType


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

   
    protected void removeConstrainedIntents(PolicySubject subject, BuilderContext context) {
        List<Intent> intents = subject.getRequiredIntents();
       
        // Remove the intents whose @contrains do not include the current element
        ExtensionType extensionType = subject.getExtensionType();
        if(extensionType != null){
            List<Intent> copy = new ArrayList<Intent>(intents);
            for (Intent i : copy) {
              List<ExtensionType> constrainedTypes = i.getConstrainedTypes();
              if (( constrainedTypes.size() == 0 ) && ( i.getQualifiableIntent() != null ) ) 
                constrainedTypes = i.getQualifiableIntent().getConstrainedTypes();
             
                if (constrainedTypes.size() > 0){
                    boolean constraintFound = false;
                    for (ExtensionType constrainedType : constrainedTypes){
                        if (constrainedType.getType().equals(extensionType.getType()) ||
                            constrainedType.getType().equals(extensionType.getBaseType())){
                            constraintFound = true;
                            break;
                        }
                    }
                    if(!constraintFound){
View Full Code Here

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

            }
           
            if (!intentMatched){             

                // Need to check the ExtensionType to see if the intent is provided there. If not, throw an error
                ExtensionType type = subject.getExtensionType();

                if ( type != null ) {
                    // The ExtensionType on the subject only has the binding name. The one in the system
                    // definitions will have the mayProvide/alwaysProvides values
                    if (type.getType().getLocalPart().startsWith("implementation")) {
                        for ( ExtensionType et : context.getDefinitions().getImplementationTypes() ) {
                            if ( type.getType().equals(et.getType()) ) {
                                type = et;
                            }
                        }
                    } else {
                        for ( ExtensionType et : context.getDefinitions().getBindingTypes() ) {
                            if ( type.getType().equals(et.getType()) ) {
                                type = et;
                            }
                        }
                    }
                }

                if ( type == null || !type.getAlwaysProvidedIntents().contains(intent) && !type.getMayProvidedIntents().contains(intent)) {
                    // Reference side intents can still be resolved by the service binding, so we can only issue a
                    // warning here.
                    if ( subject instanceof EndpointReference ) {
                        warning(context.getMonitor(), "IntentNotSatisfiedAtBuild", subject, intent.getName(), subject.toString());
                    } else {
View Full Code Here

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

    public JavaImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {

        // Read an <implementation.java>
        JavaImplementation javaImplementation = javaFactory.createJavaImplementation();

        ExtensionType implType = policyFactory.createImplementationType();
        implType.setType(getArtifactType());
        implType.setUnresolved(true);
        javaImplementation.setType(implType);

        javaImplementation.setUnresolved(true);
        javaImplementation.setName(reader.getAttributeValue(null, CLASS));
View Full Code Here

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

        //testing to ensure that inclusion of referred policy sets has not happened
        PolicySet basicAuthMsgProtSecurityPolicySet = policySetTable.get(basicAuthMsgProtSecurity);
        assertTrue(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
        assertTrue(basicAuthMsgProtSecurityPolicySet.getIntentMaps().isEmpty());

        ExtensionType wsBindingType = bindingTypesTable.get(wsBinding);
        assertNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNull(wsBindingType.getMayProvidedIntents().get(0).getDescription());

        ExtensionType javaImplType = implTypesTable.get(javaImpl);
        assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNull(javaImplType.getMayProvidedIntents().get(0).getDescription());

        List<Intent> intents = new ArrayList<Intent>(intentTable.values());

        for (Intent intent : intents) {
            staxProcessor.resolve(intent, resolver);
        }

        for (PolicySet policySet : policySetTable.values()) {
            if (policySet.getReferencedPolicySets().isEmpty())
                staxProcessor.resolve(policySet, resolver);
        }

        for (PolicySet policySet : policySetTable.values()) {
            if (!policySet.getReferencedPolicySets().isEmpty())
                staxProcessor.resolve(policySet, resolver);
        }

        for (ExtensionType bindingType : bindingTypesTable.values()) {
            staxProcessor.resolve(bindingType, resolver);
        }

        for (ExtensionType 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());
        assertTrue(isRealizedBy(secureMessagingPolicySet, intentTable.get(confidentiality)));
        assertTrue(isRealizedBy(secureMessagingPolicySet, intentTable.get(confidentiality_transport)));

        //testing if intent maps have been properly mapped to policies
        assertFalse(securityPolicySet.isUnresolved());
        assertTrue(isRealizedBy(securityPolicySet, intentTable.get(confidentiality)));
        assertTrue(isRealizedBy(securityPolicySet, intentTable.get(confidentiality_message)));

        //testing for inclusion of referred policysets
        assertFalse(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
        assertFalse(basicAuthMsgProtSecurityPolicySet.getIntentMaps().isEmpty());
        assertTrue(isRealizedBy(basicAuthMsgProtSecurityPolicySet, intentTable.get(confidentiality_transport)));

        assertNotNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNotNull(wsBindingType.getMayProvidedIntents().get(0).getDescription());

        assertNotNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNotNull(javaImplType.getMayProvidedIntents().get(0).getDescription());
    }
View Full Code Here

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

                .equals(extensionType.getType())) {
                // HACK: Mark sca:binding and sca:implementation as resolved
                extensionType.setUnresolved(false);
                resolvedTypes.add(extensionType);
            } else {
                ExtensionType resolved = resolver.resolveModel(ExtensionType.class, extensionType);
                if (!resolved.isUnresolved() || resolved != extensionType) {
                    resolvedTypes.add(resolved);
                } else {
                    warn("ConstrainedTypeNotFound", intent, extensionType, intent);
                }
            }
View Full Code Here

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

        String value = reader.getAttributeValue(null, CONSTRAINS);
        if (value != null) {
            List<ExtensionType> constrainedTypes = policyIntent.getConstrainedTypes();
            for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
                QName qname = getQNameValue(reader, tokens.nextToken());
                ExtensionType extensionType = policyFactory.createExtensionType();
                extensionType.setType(qname);
                constrainedTypes.add(extensionType);
            }
        }
    }
View Full Code Here

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

    public ExtensionType read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
        QName extType = getArtifactType();
        QName type = getQName(reader, "type");

        if (type != null) {
            ExtensionType extensionType = null;
            if (BINDING_TYPE_QNAME.equals(extType)) {
                extensionType = policyFactory.createBindingType();
            } else if (IMPLEMENTATION_TYPE_QNAME.equals(extType)) {
                extensionType = policyFactory.createImplementationType();
            } else {
                error("UnrecognizedExtensionType", reader, type);
                return null;
                //throw new ContributionReadException("Unrecognized ExtensionType - " + type);
            }
            extensionType.setType(type);
            extensionType.setUnresolved(true);

            readAlwaysProvidedIntents(extensionType, reader);
            readMayProvideIntents(extensionType, reader);
            return extensionType;
View Full Code Here

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

        return SCABinding.class;
    }

    public SCABinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
        SCABinding scaBinding = scaBindingFactory.createSCABinding();
        ExtensionType bindingType = intentAttachPointTypeFactory.createBindingType();
        bindingType.setType(getArtifactType());
        bindingType.setUnresolved(true);
        ((PolicySubject)scaBinding).setType(bindingType);
       
        // Read policies
        policyProcessor.readPolicies(scaBinding, reader);
       
View Full Code Here

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

    static void determineApplicableBindingPolicySets(Contract source, Contract target) throws PolicyConfigurationException {
        List<Intent> intentsCopy = null;
        for (Binding aBinding : source.getBindings()) {
            if (aBinding instanceof PolicySubject) {
                PolicySubject policiedBinding = (PolicySubject)aBinding;
                ExtensionType 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 (ExtensionType constrained : intent.getConstrainedTypes()) {
                                if (bindingType != null && bindingType.getType().getNamespaceURI()
                                    .equals(constrained.getType().getNamespaceURI())
                                    && bindingType.getType().getLocalPart().startsWith(constrained
                                        .getType().getLocalPart())) {
                                    policiedBinding.getRequiredIntents().add(intent);
                                    break;
                                }
                            }
View Full Code Here

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

                                            composite.getExtensions().add(extension);
                                        }
                                    }
                                } else if (extension instanceof Binding) {
                                    if ( extension instanceof PolicySubject ) {
                                        ExtensionType bindingType = intentAttachPointTypeFactory.createBindingType();
                                        bindingType.setType(name);
                                        bindingType.setUnresolved(true);
                                        ((PolicySubject)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(SCA11_NS)) {
                                              error("UnexpectedBindingElement", extension);
                                                //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 PolicySubject ) {
                                        ExtensionType implType = intentAttachPointTypeFactory.createImplementationType();
                                        implType.setType(name);
                                        implType.setUnresolved(true);
                                        ((PolicySubject)extension).setType(implType);
                                    }
                                    // <component><implementation>
                                    if (component != null) {
                                        component.setImplementation((Implementation)extension);
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.