Package org.apache.tuscany.sca.contribution.scanner

Examples of org.apache.tuscany.sca.contribution.scanner.ContributionScanner


        monitor.pushContext("Contribution: " + contribution.getURI());

        Contribution old = context.setContribution(contribution);
        try {
            // Create a contribution scanner
            ContributionScanner scanner = scanners.getContributionScanner(contributionURL.getProtocol());
            if (scanner == null) {
                File file = toFile(contributionURL);
                if (file != null && file.isDirectory()) {
                    scanner = new DirectoryContributionScanner(contributionFactory);
                } else {
                    scanner = new JarContributionScanner(contributionFactory);
                }
            }
   
            // Scan the contribution and list the artifacts contained in it
            boolean contributionMetadata = false;
            List<Artifact> artifacts = scanner.scan(contribution);
            for (Artifact artifact : artifacts) {
                // Add the deployed artifact model to the contribution
                modelResolver.addModel(artifact, context);
               
                monitor.pushContext("Artifact: " + artifact.getURI());
View Full Code Here


        }
        contribution.setModelResolver(modelResolver);
        contribution.setUnresolved(true);

        // Create a contribution scanner
        ContributionScanner scanner;
        if ("file".equals(contributionURL.getProtocol()) && new File(contributionURL.getFile()).isDirectory()) {
            scanner = new DirectoryContributionScanner();
        } else {
            scanner = new JarContributionScanner();
        }

        // Scan the contribution and list the artifacts contained in it
        List<Artifact> artifacts = contribution.getArtifacts();
        boolean contributionMetadata = false;
        List<String> artifactURIs = scanner.getArtifacts(contributionURL);
        for (String artifactURI: artifactURIs) {
            URL artifactURL = scanner.getArtifactURL(contributionURL, artifactURI);

            // Add the deployed artifact model to the contribution
            Artifact artifact = this.contributionFactory.createArtifact();
            artifact.setURI(artifactURI);
            artifact.setLocation(artifactURL.toString());
View Full Code Here

        }
        contribution.setModelResolver(modelResolver);
        contribution.setUnresolved(true);

        // Create a contribution scanner
        ContributionScanner scanner;
        if ("file".equals(contributionURL.getProtocol()) && new File(contributionURL.getFile()).isDirectory()) {
            scanner = new DirectoryContributionScanner();
        } else {
            scanner = new JarContributionScanner();
        }

        // Scan the contribution and list the artifacts contained in it
        List<Artifact> artifacts = contribution.getArtifacts();
        boolean contributionMetadata = false;
        List<String> compositeURIs = new ArrayList<String>();
        List<String> artifactURIs = scanner.getArtifacts(contributionURL);
        for (String artifactURI: artifactURIs) {
            if (artifactURI.endsWith(COMPOSITE_FILE_EXTN)) {
          // TUSCANY-3561: need to process the composites last
                compositeURIs.add(artifactURI);
            } else {
                URL artifactURL = scanner.getArtifactURL(contributionURL, artifactURI);

                // Add the deployed artifact model to the contribution
                Artifact artifact = this.contributionFactory.createArtifact();
                artifact.setURI(artifactURI);
                artifact.setLocation(artifactURL.toString());
                artifacts.add(artifact);
                modelResolver.addModel(artifact);

                // Read each artifact
                Object model = artifactProcessor.read(contributionURL, URI.create(artifactURI), artifactURL);
                if (model != null) {
                    artifact.setModel(model);

                    // Add the loaded model to the model resolver
                    modelResolver.addModel(model);

                    // Add policy definitions to the list of policy definitions
                    if (policyDefinitionsResolver != null) {
                        addPolicyDefinitions(model);
                    }

                    // Merge contribution metadata into the contribution model
                    if (model instanceof ContributionMetadata) {
                        contributionMetadata = true;
                        ContributionMetadata c = (ContributionMetadata)model;
                        contribution.getImports().addAll(c.getImports());
                        contribution.getExports().addAll(c.getExports());
                        contribution.getDeployables().addAll(c.getDeployables());
                        contribution.getExtensions().addAll(c.getExtensions());
                        contribution.getAttributeExtensions().addAll(c.getAttributeExtensions());
                    }
                }
            }
        }

        // TUSCANY-3561: process the composites last
        for (String artifactURI : compositeURIs) {
            URL artifactURL = scanner.getArtifactURL(contributionURL, artifactURI);

            // Add the deployed artifact model to the contribution
            Artifact artifact = this.contributionFactory.createArtifact();
            artifact.setURI(artifactURI);
            artifact.setLocation(artifactURL.toString());
View Full Code Here

        monitor.pushContext("Contribution: " + contribution.getURI());

        Contribution old = context.setContribution(contribution);
        try {
            // Create a contribution scanner
            ContributionScanner scanner = scanners.getContributionScanner(contributionURL.getProtocol());
            if (scanner == null) {
                File file = toFile(contributionURL);
                if (file != null && file.isDirectory()) {
                    scanner = new DirectoryContributionScanner(contributionFactory);
                } else {
                    scanner = new JarContributionScanner(contributionFactory);
                }
            }
   
            // Scan the contribution and list the artifacts contained in it
            boolean contributionMetadata = false;
            List<Artifact> artifacts = scanner.scan(contribution);
            for (Artifact artifact : artifacts) {
                // Add the deployed artifact model to the contribution
                modelResolver.addModel(artifact, context);
               
                monitor.pushContext("Artifact: " + artifact.getURI());
View Full Code Here

        Contribution old = context.setContribution(contribution);
        try {
            if (contributionURL != null) {
                // Create a contribution scanner
                ContributionScanner scanner = scanners.getContributionScanner(contributionURL.getProtocol());
                if (scanner == null) {
                    File file = toFile(contributionURL);
                    if (file != null && file.isDirectory()) {
                        scanner = new DirectoryContributionScanner(contributionFactory);
                    } else {
                        scanner = new JarContributionScanner(contributionFactory);
                    }
                }

                // Scan the contribution and list the artifacts contained in it
                boolean contributionMetadata = false;
                List<Artifact> artifacts = scanner.scan(contribution);
                for (Artifact artifact : artifacts) {
                    // Add the deployed artifact model to the contribution
                    modelResolver.addModel(artifact, context);

                    monitor.pushContext("Artifact: " + artifact.getURI());
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.contribution.scanner.ContributionScanner

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.