Package org.apache.tuscany.sca.contribution.resolver

Examples of org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver


            } finally {
                monitor.popContext();
            }
        }

        ExtensibleModelResolver modelResolver =
            new ExtensibleModelResolver(new Contributions(contributionList), modelResolvers, modelFactories);

        // now resolve and add the system contribution
        contributionProcessor.resolve(systemContribution, modelResolver, context);
        contributionList.add(systemContribution);
View Full Code Here


            } finally {
                monitor.popContext();
            }
        }

        ExtensibleModelResolver modelResolver =
            new ExtensibleModelResolver(new Contributions(contributionList), modelResolvers, modelFactories);

        // now resolve and add the system contribution
        contributionProcessor.resolve(systemContribution, modelResolver, context);
        contributionList.add(systemContribution);
View Full Code Here

       
        // Create contribution model
        Contribution contribution = contributionFactory.createContribution();
        contribution.setURI(contributionURI.toString());
        contribution.setLocation(contributionURL.toString());
        ModelResolver modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories);
        contribution.setModelResolver(modelResolver);
        contribution.setUnresolved(true);
       
        Monitor monitor = context.getMonitor();
        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());
   
                Artifact oldArtifact = context.setArtifact(artifact);
                try {
                    // Read each artifact
                    URL artifactLocationURL = null;
                    try {
                        artifactLocationURL = new URL(artifact.getLocation());
                    } catch(MalformedURLException e) {
                        //ignore
                    }
                   
                    Object model = artifactProcessor.read(contributionURL, URI.create(artifact.getURI()), artifactLocationURL, context);
                    if (model != null) {
                        artifact.setModel(model);
       
                        // Add the loaded model to the model resolver
                        modelResolver.addModel(model, context);
       
                        // Merge contribution metadata into the contribution model
                        if (model instanceof ContributionMetadata) {
                            contributionMetadata = true;
                            ContributionMetadata c = (ContributionMetadata)model;
View Full Code Here

       
        // Create contribution model
        Contribution contribution = contributionFactory.createContribution();
        contribution.setURI(contributionURI.toString());
        contribution.setLocation(contributionURL.toString());
        ModelResolver modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories);
        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;
        for (String artifactURI: scanner.getArtifacts(contributionURL)) {
            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);

                // Merge contribution metadata into the contribution model
                if (model instanceof Contribution) {
                    contributionMetadata = true;
                    Contribution c = (Contribution)model;
View Full Code Here

       
        // Create contribution model
        Contribution contribution = contributionFactory.createContribution();
        contribution.setURI(contributionURI.toString());
        contribution.setLocation(contributionURL.toString());
        ModelResolver modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories);
        contribution.setModelResolver(modelResolver);
        contribution.setUnresolved(true);

        // Create a contribution scanner
        ContributionScanner scanner;
View Full Code Here

        // Create contribution model resolver
        if (modelResolver == null) {
            //FIXME Remove this domain resolver, visibility of policy declarations should be handled by
            // the contribution import/export mechanism instead of this domainResolver hack.
            modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories, domainResolver);
        }

        //set contribution initial information
        contribution.setURI(contributionURI.toString());
        contribution.setLocation(locationURL.toString());
View Full Code Here

            ContributionRepository dummyRepository = new DummyContributionRepository(contributions);
            for (ContributionListener listener: contributionListeners) {
                listener.contributionAdded(dummyRepository, contribution);
            }
           
            ModelResolver modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories);
            contributionContentProcessor.resolve(contribution, modelResolver);
           
            return contribution;

        } catch (ContributionReadException e) {
View Full Code Here

        // Create contribution content processor
        URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
        contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class);
       
        // Get the model resolvers
        modelResolver = new ExtensibleModelResolver(null, extensionPoints);
              
        // Create a composite builder
        SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
        IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
        InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class);
View Full Code Here

        // Create contribution model resolver
        if (modelResolver == null) {
            //FIXME Remove this domain resolver, visibility of policy declarations should be handled by
            // the contribution import/export mechanism instead of this domainResolver hack.
            modelResolver = new ExtensibleModelResolver(contribution, extensionPoints, modelResolvers, modelFactories, policyDefinitionsResolver);
        }

        //set contribution initial information
        contribution.setURI(contributionURI);
        contribution.setLocation(locationURL.toString());
View Full Code Here

        // Get the domain composite items
        Entry<String, Item>[] domainEntries = domainCompositeCollection.getAll();
       
        // Populate the domain composite
        Workspace workspace = workspaceFactory.createWorkspace();
        workspace.setModelResolver(new ExtensibleModelResolver(workspace, extensionPoints));
       
        Map<String, Contribution> contributionMap = new HashMap<String, Contribution>();
        for (Entry<String, Item> domainEntry: domainEntries) {
           
            // Load the required contributions
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver

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.