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

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


        return new Builder<Contribution>() {
            public Contribution build(final Context ec) {
                final Contribution c = ec.cf.createContribution();
                c.setURI(uri);
                c.setLocation(loc);
                c.setModelResolver(new ExtensibleModelResolver(c, ec.mrep, ec.fep));
                for(Builder<Artifact> a: artifacts)
                    c.getArtifacts().add(a.build(ec));
                return c;
            }
        };
View Full Code Here


        //initialize contribution based on it's metadata if available
        Contribution contribution = readContributionMetadata(locationURL);

        // Create contribution model resolver
        if (modelResolver == null) {
            modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories);
        }

        if (modelResolver instanceof ExtensibleModelResolver) {
            ((ExtensibleModelResolver)modelResolver).setDomainResolver(domainResolver);
        }
View Full Code Here

    public void loadContribution(String compositeURL, String sourceURI, String sourceURL) throws Exception {
      init();

        // Create workspace model
        workspace = workspaceFactory.createWorkspace();
        workspace.setModelResolver(new ExtensibleModelResolver(workspace, modelResolvers, modelFactories));

        // Read the sample store contribution
        URI artifactURI = URI.create(sourceURI);
        //URL contributionURL = FileHelper.toFile(new URL(sourceURL)).toURI().toURL();
        URL artifactURL = new File(sourceURL).toURI().toURL();
View Full Code Here

    public void readContribution(String compositeURL, String sourceURI, String sourceURL) throws Exception {
      init();

        // Create workspace model
        workspace = workspaceFactory.createWorkspace();
        workspace.setModelResolver(new ExtensibleModelResolver(workspace, modelResolvers, modelFactories));

        // Read the sample store contribution
        URI artifactURI = URI.create(sourceURI);
        //URL contributionURL = FileHelper.toFile(new URL(sourceURL)).toURI().toURL();
        URL artifactURL = new File(sourceURL).toURI().toURL();
View Full Code Here

        Contribution contribution = contributionFactory.createContribution();
        contribution.setURI(contributionURI.toString());
        if (contributionURL != null) {
            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 {
            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());

                    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 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

        wsdlFactory = new DefaultWSDLFactory();
        factories.addFactory(wsdlFactory);
        javax.wsdl.factory.WSDLFactory wsdl4jFactory = javax.wsdl.factory.WSDLFactory.newInstance();
        factories.addFactory(wsdlFactory);
        factories.addFactory(wsdl4jFactory);
        resolver = new ExtensibleModelResolver(contribution, modelResolvers, factories, null);
        contribution.setModelResolver(resolver);
        modelResolvers.addResolver(WSDLDefinition.class, WSDLModelResolver.class);
        modelResolvers.addResolver(XSDefinition.class, XSDModelResolver.class);
       
        processor = new WSDLDocumentProcessor(factories);
View Full Code Here

        ModelResolverExtensionPoint resolvers = new DefaultModelResolverExtensionPoint();
        resolvers.addResolver(ClassReference.class, ClassReferenceModelResolver.class);
       
        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
       
        resolver = new ExtensibleModelResolver(null, resolvers, factories, null);
    }
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

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.