Package org.apache.tuscany.sca.assembly.xml

Examples of org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor


                // Read the composite model
                StAXArtifactProcessor<Composite> compositeProcessor = artifactProcessors.getProcessor(Composite.class);
                // URL compositeURL = new URL(compositeURI);
                logger.log(Level.INFO, "Loading composite: " + compositeURI);

                CompositeDocumentProcessor compositeDocProcessor =
                    (CompositeDocumentProcessor)documentProcessors.getProcessor(Composite.class);
                composite =
                    compositeDocProcessor.read(URI.create(compositeURI), new ByteArrayInputStream(compositeContent
                        .getBytes("UTF-8")));

                analyzeProblems();

                configuration.setComposite(composite);
View Full Code Here


        // Create URL artifact processor extension point
        URLArtifactProcessorExtensionPoint documentProcessors =
            registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);

        // Create and register document processors for SCA assembly XML
        documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, validatingInputFactory));
        documentProcessors.addArtifactProcessor(new ComponentTypeDocumentProcessor(staxProcessor, validatingInputFactory));
        documentProcessors.addArtifactProcessor(new ConstrainingTypeDocumentProcessor(staxProcessor, validatingInputFactory));

        // Create and register document processor for definitions.xml
        //TODO No XMLSchema validation for definitions.xml for now
View Full Code Here

                // Read the composite model
                StAXArtifactProcessor<Composite> compositeProcessor = artifactProcessors.getProcessor(Composite.class);
                // URL compositeURL = new URL(compositeURI);
                logger.log(Level.INFO, "Loading composite: " + compositeURI);

                CompositeDocumentProcessor compositeDocProcessor =
                    (CompositeDocumentProcessor)documentProcessors.getProcessor(Composite.class);
                composite =
                    compositeDocProcessor.read(URI.create(compositeURI), new ByteArrayInputStream(compositeContent
                        .getBytes("UTF-8")));

                analyzeProblems();

                configuration.setComposite(composite);
View Full Code Here

        // The following was copied from RuntimeBuilder to fix TUSCANY-3171
        XMLInputFactory validatingInputFactory = modelFactories.getFactory(ValidatingXMLInputFactory.class);
        documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class);
        //documentBuilderFactory.setNamespaceAware(true);
        urlProcessors.getProcessor(Composite.class);
        urlProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, validatingInputFactory,
                                                                          documentBuilderFactory, policyDefinitions, monitor));
   
        // Create contribution processor
        modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
        contributionProcessor = new ContributionContentProcessor(extensionPoints, monitor, policyDefinitionsResolver, policyDefinitions);
View Full Code Here

        // Create and register document processors for SCA assembly XML
        DocumentBuilderFactory documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class);
        documentBuilderFactory.setNamespaceAware(true);
        documentProcessors.getProcessor(Composite.class);
        documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, validatingInputFactory,
                                                                               documentBuilderFactory, policyDefinitions, monitor));

        // Create Model Resolver extension point
        ModelResolverExtensionPoint modelResolvers = registry.getExtensionPoint(ModelResolverExtensionPoint.class);
View Full Code Here

        DocumentBuilderFactory documentBuilderFactory = AccessController.doPrivileged(new PrivilegedAction<DocumentBuilderFactory>() {
            public DocumentBuilderFactory run() {
                return DocumentBuilderFactory.newInstance();
            }
        });          
        documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, validatingInputFactory, documentBuilderFactory, policyDefinitions, monitor));

        // Create Model Resolver extension point
        ModelResolverExtensionPoint modelResolvers = registry.getExtensionPoint(ModelResolverExtensionPoint.class);

        // Create contribution package processor extension point
View Full Code Here

        DocumentBuilderFactory documentBuilderFactory = AccessController.doPrivileged(new PrivilegedAction<DocumentBuilderFactory>() {
            public DocumentBuilderFactory run() {
                return DocumentBuilderFactory.newInstance();
            }
        });          
        documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, validatingInputFactory, documentBuilderFactory, policyDefinitions, monitor));

        // Create Model Resolver extension point
        ModelResolverExtensionPoint modelResolvers = registry.getExtensionPoint(ModelResolverExtensionPoint.class);

        // Create contribution package processor extension point
View Full Code Here

        // Create and register document processors for SCA assembly XML
        DocumentBuilderFactory documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class);
        documentBuilderFactory.setNamespaceAware(true);
        documentProcessors.getProcessor(Composite.class);
        documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, validatingInputFactory,
                                                                               documentBuilderFactory, policyDefinitions, monitor));

        // Create Model Resolver extension point
        ModelResolverExtensionPoint modelResolvers = registry.getExtensionPoint(ModelResolverExtensionPoint.class);
View Full Code Here

        // Read the composite content after the contributions have been loaded, so that the
        // policySet definitions provided by the contributions are available (TUSCANY-3569)
        if (composite == null && compositeContent != null) {
            logger.log(Level.INFO, "Loading composite: " + configurationName);
            CompositeDocumentProcessor compositeDocProcessor =
                (CompositeDocumentProcessor)documentProcessors.getProcessor(Composite.class);
            composite =
                compositeDocProcessor.read(URI.create(configurationName), new ByteArrayInputStream(compositeContent
                    .getBytes("UTF-8")));
            analyzeProblems();
            configuration.setComposite(composite);
        }

        if(composite != null && composite.isUnresolved()) {
            ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
            Artifact compositeFile = contributionFactory.createArtifact();
            compositeFile.setUnresolved(true);
            compositeFile.setURI(composite.getURI());
            for (Contribution c : contributions) {
                ModelResolver resolver = c.getModelResolver();
                Artifact resolved = resolver.resolveModel(Artifact.class, compositeFile);
                if (resolved != null && resolved.isUnresolved() == false) {
                    composite = (Composite) resolved.getModel();
                    break;
                }
            }
        }

        // FIXME: This is a hack to get a list of deployable composites. By design, the deployment composite should
        // has been configured
        if (composite == null) {
            List<Composite> deployables = new ArrayList<Composite>();
            for (Contribution c : contributions) {
                deployables.addAll(c.getDeployables());
            }
            aggregate(deployables);
            configuration.setComposite(composite);
        }

        Contribution contribution = null;
        if (composite.getName() == null) {
            // Load the specified composite
            URL compositeURL;

            URI uri = createURI(configuration.getComposite().getURI());
            if (uri.getScheme() == null) {

                // If the composite URI is a relative URI, try to resolve it within the contributions
                contribution = contribution(contributions, uri.toString());
                if (contribution == null) {
                    throw new IllegalArgumentException("Composite is not found in contributions: " + uri);
                }
                compositeURL = new URL(location(contribution, uri.toString()));

            } else {

                // If the composite URI is an absolute URI, use it as is
                compositeURL = uri.toURL();
            }

            URLArtifactProcessor<Composite> compositeDocProcessor = documentProcessors.getProcessor(Composite.class);
            // Read the composite
            logger.log(Level.INFO, "Loading composite: " + compositeURL);
            // InputStream is = compositeURL.openStream();
            // XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
            try {
                composite = compositeDocProcessor.read(null, uri, compositeURL);
            } catch (ContributionReadException e) {
                // ignore - errors will be detected by analyzeProblems() call below
            }
            // reader.close();
View Full Code Here

        // The following was copied from RuntimeBuilder to fix TUSCANY-3171
        XMLInputFactory validatingInputFactory = modelFactories.getFactory(ValidatingXMLInputFactory.class);
        documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class);
        //documentBuilderFactory.setNamespaceAware(true);
        urlProcessors.getProcessor(Composite.class);
        urlProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, validatingInputFactory,
                                                                          documentBuilderFactory, policyDefinitions, monitor));
   
        // Create contribution processor
        modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
        contributionProcessor = new ContributionContentProcessor(extensionPoints, monitor, policyDefinitionsResolver, policyDefinitions);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor

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.