Package org.apache.tuscany.sca.contribution.service

Examples of org.apache.tuscany.sca.contribution.service.ContributionService


        //Start the domain
        domain.start();

        // Contribute the SCA contribution
        ContributionService contributionService = domain.getContributionService();

        File javaContribLocation = new File("../export-java/target/classes");
        URL javaContribURL = javaContribLocation.toURL();
        javaContribution = contributionService.contribute("http://import-export/export-java", javaContribURL, false);
        for (Composite deployable : javaContribution.getDeployables() ) {
            domain.getDomainComposite().getIncludes().add(deployable);
            domain.buildComposite(deployable);
        }

        File helloWorldContribLocation = new File("./target/classes/");
        URL helloWorldContribURL = helloWorldContribLocation.toURL();
        helloWorldContribution = contributionService.contribute("http://import-export/helloworld", helloWorldContribURL, false);
        for (Composite deployable : helloWorldContribution.getDeployables() ) {
            domain.getDomainComposite().getIncludes().add(deployable);
            domain.buildComposite(deployable);
        }
View Full Code Here


        assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
    }

  @Override
    public void tearDown() throws Exception {
        ContributionService contributionService = domain.getContributionService();

        // Remove the contribution from the in-memory repository
        contributionService.remove("http://import-export/helloworld");
        contributionService.remove("http://import-export/export-java");

        // Stop Components from my composite
        for (Composite deployable : helloWorldContribution.getDeployables() ) {
            domain.getCompositeActivator().stop(deployable);
            domain.getCompositeActivator().deactivate(deployable);
View Full Code Here

        // Start the domain
        domain.start();

        // Contribute the SCA contribution
        ContributionService contributionService = domain.getContributionService();

        ModelResolver helloResolver = new ModelResolverImpl(cl);
        File helloContrib = new File("./target/classes/");
        URL helloURL = helloContrib.toURL();
        Contribution consumerContribution =
            contributionService.contribute("http://import-export/hello", helloURL, helloResolver, false);
        Composite consumerComposite = consumerContribution.getDeployables().get(0);
        domain.getDomainComposite().getIncludes().add(consumerComposite);
        domain.buildComposite(consumerComposite);

        // Start Components from my composite
View Full Code Here

        }
       
       

        // Contribute the given contribution to an in-memory repository
        ContributionService contributionService = runtime.getContributionService();
        URL contributionURL;
        try {
            contributionURL = getContributionLocation(applicationClassLoader, contributionLocation, this.composites);
            if (contributionURL != null) {
                // Make sure the URL is correctly encoded (for example, escape the space characters)
                contributionURL = contributionURL.toURI().toURL();
            }
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
        }

        try {
            String contributionURI = FileHelper.getName(contributionURL.getPath());
            if (contributionURI == null || contributionURI.length() == 0) {
                contributionURI = contributionURL.toString();
            }
            contribution = contributionService.contribute(contributionURI, contributionURL, false);
        } catch (ContributionException e) {
            throw new ServiceRuntimeException(e);
        } catch (IOException e) {
            throw new ServiceRuntimeException(e);
        }

        // Create an in-memory domain level composite
        AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
        domainComposite = assemblyFactory.createComposite();
        domainComposite.setName(new QName(Constants.SCA10_NS, "domain"));
        domainComposite.setURI(domainURI);

        //when the deployable composites were specified when initializing the runtime
        if (composites != null && composites.length > 0 && composites[0].length() > 0) {
            // Include all specified deployable composites in the SCA domain
            Map<String, Composite> compositeArtifacts = new HashMap<String, Composite>();
            for (DeployedArtifact artifact : contribution.getArtifacts()) {
                if (artifact.getModel() instanceof Composite) {
                    compositeArtifacts.put(artifact.getURI(), (Composite)artifact.getModel());
                }
            }
            for (String compositePath : composites) {
                Composite composite = compositeArtifacts.get(compositePath);
                if (composite == null) {
                    throw new ServiceRuntimeException("Composite not found: " + compositePath);
                }
                domainComposite.getIncludes().add(composite);
            }
        } else {
            // in this case, a sca-contribution.xml should have been specified
            for (Composite composite : contribution.getDeployables()) {
                domainComposite.getIncludes().add(composite);
            }

        }
       
        //update the runtime for all SCA Definitions processed from the contribution..
        //so that the policyset determination done during 'build' has the all the defined
        //intents and policysets
        runtime.updateSCADefinitions(contributionService.getContributionSCADefinitions());

        // Build the SCA composites
        for (Composite composite : domainComposite.getIncludes()) {
            try {
                runtime.buildComposite(composite);
View Full Code Here

                throw new ServiceRuntimeException(e);
            }
        }

        // Remove the contribution from the in-memory repository
        ContributionService contributionService = runtime.getContributionService();
        try {
            contributionService.remove(contribution.getURI());
        } catch (ContributionException e) {
            throw new ServiceRuntimeException(e);
        }

        // Stop the runtime
View Full Code Here

        assertEquals("Hello Smith", helloWorldService_one.getGreetings("Smith"));

    }

    public void tearDown() throws Exception {
        ContributionService contributionService = domain.getContributionService();

        // Remove the contribution from the in-memory repository
        contributionService.remove("http://import-export/export-composite");
        contributionService.remove("http://import-export/helloworld_one");

        // Stop Components from my composite
        for (Composite deployable : helloWorldContribution_one.getDeployables()) {
            domain.getCompositeActivator().stop(deployable);
            domain.getCompositeActivator().deactivate(deployable);
View Full Code Here

        //Start the domain
        domain.start();

        // Contribute the SCA contribution
        ContributionService contributionService = domain.getContributionService();

        File wsdlContribLocation = new File("../export-wsdl/target/classes");
        URL wsdlContribURL = wsdlContribLocation.toURL();
        wsdlContribution = contributionService.contribute("http://import-export/export-wsdl", wsdlContribURL, false);
        for (Composite deployable : wsdlContribution.getDeployables() ) {
            domain.getDomainComposite().getIncludes().add(deployable);
            domain.buildComposite(deployable);
        }

        File helloWorldContribLocation = new File("./target/classes/");
        URL helloWorldContribURL = helloWorldContribLocation.toURL();
        consumerContribution = contributionService.contribute("http://import-export/helloworld", helloWorldContribURL, false);
        for (Composite deployable : consumerContribution.getDeployables() ) {
            domain.getDomainComposite().getIncludes().add(deployable);
            domain.buildComposite(deployable);
        }
View Full Code Here

        assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
    }

    @Override
    public void tearDown() throws Exception {
        ContributionService contributionService = domain.getContributionService();

        // Remove the contribution from the in-memory repository
        contributionService.remove("http://import-export/helloworld");
        contributionService.remove("http://import-export/export-wsdl");

        // Stop Components from my composite
        for (Composite deployable : consumerContribution.getDeployables() ) {
            domain.getCompositeActivator().stop(deployable);
            domain.getCompositeActivator().deactivate(deployable);
View Full Code Here

        }

        ExtensibleURLArtifactProcessor documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);

        // Create the contribution service
        ContributionService contributionService =
            new ContributionServiceImpl(repository, packageProcessor, documentProcessor, staxProcessor,
                                        contributionListener, domainModelResolver, modelResolvers, modelFactories,
                                        assemblyFactory, contributionFactory, inputFactory);
        return contributionService;
    }
View Full Code Here

        //Start the domain
        domain.start();

        // Contribute the SCA contribution
        ContributionService contributionService = domain.getContributionService();

        File compositeContribLocation = new File("../export-composite/target/classes");
        URL compositeContribURL = compositeContribLocation.toURL();
        compositeContribution =
            contributionService.contribute("http://import-export/export-composite", compositeContribURL, false);
        for (Composite deployable : compositeContribution.getDeployables()) {
            domain.getDomainComposite().getIncludes().add(deployable);
            domain.buildComposite(deployable);
        }

        File helloWorldContribLocation = new File("./target/classes/");
        URL helloWorldContribURL = helloWorldContribLocation.toURL();
        helloWorldContribution =
            contributionService.contribute("http://import-export/helloworld", helloWorldContribURL, false);
        for (Composite deployable : helloWorldContribution.getDeployables()) {
            domain.getDomainComposite().getIncludes().add(deployable);
            domain.buildComposite(deployable);
        }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.contribution.service.ContributionService

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.