Package org.apache.tuscany.sca.definitions

Examples of org.apache.tuscany.sca.definitions.Definitions


            // about what the appliesTo field means and it's hard to get here from the
            // binder so until we sort out the appliesTo question this code isn't used
                      
            CompositeContext compositeContext = ((RuntimeComponent)epr.getComponent()).getComponentContext().getCompositeContext();
            Composite domainComposite = compositeContext.getDomainComposite();
            Definitions systemDefinitions = compositeContext.getSystemDefinitions();
           
            if (systemDefinitions == null ||
                (systemDefinitions.getPolicySets().isEmpty() &&
                 systemDefinitions.getExternalAttachments().isEmpty()) ) {
                return;
            }
           
            // temporarily add the endpoint binding to the reference model so that the
            // XPath expression can be evaluated correctly
View Full Code Here


        is.close();
        assertNotNull(composite);
       
        URL url = getClass().getResource("test_definitions.xml");
        URI uri = URI.create("test_definitions.xml");
        Definitions scaDefns = (Definitions)policyDefinitionsProcessor.read(null, uri, url);
        assertNotNull(scaDefns);
       
        policyDefinitionsProcessor.resolve(scaDefns, resolver);
       
        staxProcessor.resolve(composite, resolver);
View Full Code Here

        Composite composite = (Composite)staxProcessor.read(reader);
        is.close();
       
        URL url = getClass().getResource("test_definitions.xml");
        URI uri = URI.create("test_definitions.xml");
        Definitions scaDefns = (Definitions)policyDefinitionsProcessor.read(null, uri, url);
        assertNotNull(scaDefns);
       
        policyDefinitionsProcessor.resolve(scaDefns, resolver);
       
        staxProcessor.resolve(composite, resolver);
View Full Code Here

            }

            //urlStream = createInputStream(url);
            XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);

            Definitions definitions = definitionsFactory.createDefinitions();
            int event = reader.getEventType();
            while (reader.hasNext()) {
                event = reader.next();

                // We only deal with the root element
View Full Code Here

        this.definitionsFactory = factoryExtensionPoint.getFactory(DefinitionsFactory.class);
    }

    public Definitions read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
        QName name = null;
        Definitions definitions = null;
        String targetNamespace = null;

        while (reader.hasNext()) {
            int event = reader.getEventType();
            switch (event) {
                case START_ELEMENT: {
                    name = reader.getName();
                    if (DEFINITIONS_QNAME.equals(name)) {
                        definitions = definitionsFactory.createDefinitions();
                        targetNamespace = reader.getAttributeValue(null, TARGET_NAMESPACE);
                        definitions.setTargetNamespace(targetNamespace);
                    } else {
                        Object extension = extensionProcessor.read(reader);
                        if (extension != null) {
                            if (extension instanceof Intent) {
                                Intent intent = (Intent)extension;
                                intent.setName(new QName(targetNamespace, intent.getName().getLocalPart()));
                                definitions.getIntents().add(intent);
                                for (Intent i : intent.getQualifiedIntents()) {
                                    i.setName(new QName(targetNamespace, i.getName().getLocalPart()));
                                }
                            } else if (extension instanceof PolicySet) {
                                PolicySet policySet = (PolicySet)extension;
                                policySet.setName(new QName(targetNamespace, policySet.getName().getLocalPart()));
                                definitions.getPolicySets().add(policySet);
                            } else if (extension instanceof Binding) {
                                Binding binding = (Binding)extension;
                                definitions.getBindings().add(binding);
                            } else if (extension instanceof BindingType) {
                                definitions.getBindingTypes().add((BindingType)extension);
                            } else if (extension instanceof ImplementationType) {
                                definitions.getImplementationTypes().add((ImplementationType)extension);
                            }
                        }
                        break;
                    }
                }
View Full Code Here

            loadDefinitionsDocuments();
            URLArtifactProcessorExtensionPoint processors =
                registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
            URLArtifactProcessor<Definitions> processor = processors.getProcessor(Definitions.class);
            for (URL url : documents) {
                Definitions def;
                try {
                    def = processor.read(null, DEFINITIONS_URI, url);
                    definitions.add(def);
                } catch (ContributionReadException e) {
                    logger.log(Level.SEVERE, e.getMessage(), e);
View Full Code Here

        InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
        Composite composite = staxProcessor.read(is, Composite.class);
       
        URL url = getClass().getResource("test_definitions.xml");
        URI uri = URI.create("test_definitions.xml");
        Definitions scaDefns = (Definitions)policyDefinitionsProcessor.read(null, uri, url);
        assertNotNull(scaDefns);
        policyDefinitionsProcessor.resolve(scaDefns, resolver);
       
        staxProcessor.resolve(composite, resolver);
        compositeBuilder.build(composite, null, monitor);
View Full Code Here

    public void testPolicyIntents() throws Exception {
        ModelResolver resolver = new TestModelResolver(getClass().getClassLoader());
       
        URL url = getClass().getResource("definitions.xml");
        URI uri = URI.create("definitions.xml");
        Definitions scaDefns = policyDefinitionsProcessor.read(null, uri, url);
               
        InputStream is = getClass().getResourceAsStream("Calculator.composite");
        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
        Composite composite = (Composite)staxProcessor.read(reader);
        assertNotNull(composite);
View Full Code Here

    public void testPolicySets() throws Exception {
        ModelResolver resolver = new TestModelResolver(getClass().getClassLoader());
       
        URL url = getClass().getResource("definitions_with_policysets.xml");
        URI uri = URI.create("definitions_with_policysets.xml");
        Definitions policyDefinitions = policyDefinitionsProcessor.read(null, uri, url);
               
        InputStream is = getClass().getResourceAsStream("Calculator.composite");
        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
        Composite composite = (Composite)staxProcessor.read(reader);
        assertNotNull(composite);
       
        for ( Component component : composite.getComponents() ) {
            for ( PolicySet policySet : policyDefinitions.getPolicySets() ) {
                component.getPolicySets().add(policySet);
            }
        }
       
        staxProcessor.resolve(policyDefinitions, resolver);
View Full Code Here

        Composite composite = (Composite)documentProcessor.read(null, uri, url);
        assertNotNull(composite);

        url = getClass().getResource("test_definitions.xml");
        uri = URI.create("test_definitions.xml");
        Definitions scaDefns = (Definitions)policyDefinitionsProcessor.read(null, uri, url);
        assertNotNull(scaDefns);

        preResolvePolicyTests(composite);
        documentProcessor.resolve(scaDefns, resolver);
        documentProcessor.resolve(composite, resolver);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.definitions.Definitions

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.