Package org.apache.tuscany.sca.definitions

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


        ModelResolver resolver = new TestModelResolver(getClass().getClassLoader());
       
        URL url = getClass().getResource("definitions.xml");
        URI uri = URI.create("definitions.xml");
        scaDefnDocProcessor.setDomainModelResolver(resolver);
        SCADefinitions scaDefns = scaDefnDocProcessor.read(null, uri, url);
               
        CompositeProcessor compositeProcessor = new CompositeProcessor(new ContributionFactoryImpl(), assemblyFactory, policyFactory, mapper, staxProcessor);
        InputStream is = getClass().getResourceAsStream("Calculator.composite");
        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
        Composite composite = compositeProcessor.read(reader);
View Full Code Here


        InputStream urlStream = null;
        try {
            urlStream = url.openStream();
            XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
            reader.nextTag();
            SCADefinitions scaDefns = (SCADefinitions)extensionProcessor.read(reader);
           
            return scaDefns;
        } catch (XMLStreamException e) {
            throw new ContributionReadException(e);
        } catch (IOException e) {
View Full Code Here

        this.definitionsResolver = modelResolver;
    }

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

        // Read the composite document
        while (reader.hasNext()) {
            int event = reader.getEventType();
            switch (event) {
                case START_ELEMENT: {
                    name = reader.getName();
                    if ( SCA_DEFINITIONS_QNAME.equals(name)) {
                        definitions = new SCADefinitionsImpl();
                        definitions.setTargetNamespace(reader.getAttributeValue(null, TARGET_NAMESPACE));
                    } else {
                        Object extension = extensionProcessor.read(reader);
                        if (extension != null) {
                            if ( extension instanceof Intent ) {
                                definitions.getPolicyIntents().add((Intent)extension);
                            } else if ( extension instanceof PolicySet ) {
                                definitions.getPolicySets().add((PolicySet)extension);
                            } 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);
                                }
                            }
                           
                            if ( getDefinitionsResolver() != null ) {
                                getDefinitionsResolver().addModel(extension);
View Full Code Here

                }
            }
        }
       
        // Build the domain composite
        SCADefinitions aggregatedDefinitions = new SCADefinitionsImpl();
        for (SCADefinitions definition : policyDefinitions) {
            SCADefinitionsUtil.aggregateSCADefinitions(definition, aggregatedDefinitions);
        }
        CompositeBuilder compositeBuilder = new CompositeBuilderImpl(assemblyFactory, null, scaBindingFactory,
                                     intentAttachPointTypeFactory, documentBuilderFactory, transformerFactory,
View Full Code Here

            URLArtifactProcessor<SCADefinitions> definitionsProcessor =
                documentProcessors.getProcessor(SCADefinitions.class);
            SCADefinitionsProviderExtensionPoint scaDefnProviders =
                registry.getExtensionPoint(SCADefinitionsProviderExtensionPoint.class);

            SCADefinitions systemSCADefinitions = new SCADefinitionsImpl();
            SCADefinitions aSCADefn = null;
            for (SCADefinitionsProvider aProvider : scaDefnProviders.getSCADefinitionsProviders()) {
                aSCADefn = aProvider.getSCADefinition();
                SCADefinitionsUtil.aggregateSCADefinitions(aSCADefn, systemSCADefinitions);
            }
View Full Code Here

        InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
        DocumentBuilderFactory documentBuilderFactory = factories.getFactory(DocumentBuilderFactory.class);
        TransformerFactory transformerFactory = factories.getFactory(TransformerFactory.class);
       
        //Create a composite builder
        SCADefinitions aggregatedDefinitions = new SCADefinitionsImpl();
        for ( SCADefinitions definition : ((List<SCADefinitions>)policyDefinitions) ) {
            SCADefinitionsUtil.aggregateSCADefinitions(definition, aggregatedDefinitions);
        }
        compositeBuilder = ReallySmallRuntimeBuilder.createCompositeBuilder(monitor,
                                                                            assemblyFactory,
View Full Code Here

        try {
            URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
            URLArtifactProcessor<SCADefinitions> definitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
            SCADefinitionsProviderExtensionPoint scaDefnProviders = registry.getExtensionPoint(SCADefinitionsProviderExtensionPoint.class);
           
            SCADefinitions systemSCADefinitions = new SCADefinitionsImpl();
            SCADefinitions aSCADefn = null;
            for ( SCADefinitionsProvider aProvider : scaDefnProviders.getSCADefinitionsProviders() ) {
               aSCADefn = aProvider.getSCADefinition();
               SCADefinitionsUtil.aggregateSCADefinitions(aSCADefn, systemSCADefinitions);
            }
           
View Full Code Here

        TransformerFactory transformerFactory = factories.getFactory(TransformerFactory.class);
        UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
        InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);

        //Create a composite builder
        SCADefinitions aggregatedDefinitions = new SCADefinitionsImpl();
        for (SCADefinitions definition : ((List<SCADefinitions>)policyDefinitions)) {
            SCADefinitionsUtil.aggregateSCADefinitions(definition, aggregatedDefinitions);
        }
        compositeBuilder =
            RuntimeBuilder.createCompositeBuilder(monitor,
View Full Code Here

            URLArtifactProcessor<SCADefinitions> definitionsProcessor =
                documentProcessors.getProcessor(SCADefinitions.class);
            SCADefinitionsProviderExtensionPoint scaDefnProviders =
                registry.getExtensionPoint(SCADefinitionsProviderExtensionPoint.class);

            SCADefinitions systemSCADefinitions = new SCADefinitionsImpl();
            SCADefinitions aSCADefn = null;
            for (SCADefinitionsProvider aProvider : scaDefnProviders.getSCADefinitionsProviders()) {
                aSCADefn = aProvider.getSCADefinition();
                SCADefinitionsUtil.aggregateSCADefinitions(aSCADefn, systemSCADefinitions);
            }
View Full Code Here

        // Add policy definitions to the list of policy definitions
        if (model instanceof SCADefinitions) {
            policyDefinitions.add((SCADefinitions)model);

            SCADefinitions definitions = (SCADefinitions)model;
            for (Intent intent : definitions.getPolicyIntents() ) {
                policyDefinitionsResolver.addModel(intent);
            }

            for (PolicySet policySet : definitions.getPolicySets() ) {
                policyDefinitionsResolver.addModel(policySet);
            }

            for (IntentAttachPointType attachPointType : definitions.getBindingTypes() ) {
                policyDefinitionsResolver.addModel(attachPointType);
            }

            for (IntentAttachPointType attachPointType : definitions.getImplementationTypes() ) {
                policyDefinitionsResolver.addModel(attachPointType);
            }
            for (Object binding : definitions.getBindings() ) {
                policyDefinitionsResolver.addModel(binding);
            }
        }
    }
View Full Code Here

TOP

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

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.