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

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


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

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

        // Remove the contribution from the in-memory repository
        contributionService.remove("http://contribution-multiple/helloworld");
        contributionService.remove("http://contribution-multiple/helloworld_one");
        contributionService.remove("http://contribution-multiple/helloworld_two");

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


    protected void setUp(String contributionJarName) throws Exception {
       
        scaDomain = new EmbeddedSCADomain(EmbeddedSCADomain.class.getClassLoader(), "http://localhost");
        scaDomain.start();
        ContributionService contributionService = scaDomain.getContributionService();
        String folderName = "../test-bundles/target/";
        String supplychainJarName = contributionJarName;
        URL supplyChainURL = new File(folderName + supplychainJarName).toURI().toURL();
       
        Contribution contribution = contributionService.contribute("SupplyChain", supplyChainURL, false);
        for (Composite deployable : contribution.getDeployables() ) {
            scaDomain.getDomainComposite().getIncludes().add(deployable);
            scaDomain.buildComposite(deployable);
        }
       
View Full Code Here

        }

        ExtensibleURLArtifactProcessor documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors, monitor);

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

           
            // add the top level composite into the composite activator
            nodeRuntime.getCompositeActivator().setDomainComposite(nodeComposite);                    

            // add a contribution to the domain
            ContributionService contributionService = nodeRuntime.getContributionService();         

            // find the current directory as a URL. This is where our contribution
            // will come from
            URL contributionURL = Thread.currentThread().getContextClassLoader().getResource(nodeName + "/");

            // Contribute the SCA application
            Contribution contribution = contributionService.contribute("http://calculator", contributionURL, null, false);
            appComposite = contribution.getDeployables().get(0);

            // Add the deployable composite to the domain
            nodeComposite.getIncludes().add(appComposite);
            nodeRuntime.buildComposite(appComposite);
View Full Code Here

        // Find if any contribution JARs already available locally on the classpath
        Map<String, URL> localContributions = localContributions();

        // Load the specified contributions
        ContributionService contributionService = runtime.getContributionService();
        List<Contribution> contributions = new ArrayList<Contribution>();
        for (Contribution contribution : configuration.getContributions()) {
          URI uri = createURI(contribution.getLocation());
            if (uri.getScheme() == null) {
                uri = new File(contribution.getLocation()).toURI();
            }
            URL contributionURL = uri.toURL();

            // Extract contribution file name
            String file = contributionURL.getPath();
            int i = file.lastIndexOf('/');
            if (i != -1 && i < file.length() - 1) {
                file = file.substring(i + 1);

                // If we find the local contribution file on the classpath, use it in
                // place of the original contribution URL
                URL localContributionURL = localContributions.get(file);
                if (localContributionURL != null) {
                    contributionURL = localContributionURL;
                }
            }

            // Load the contribution
            logger.log(Level.INFO, "Loading contribution: " + contributionURL);
            contributions.add(contributionService.contribute(contribution.getURI(), contributionURL, false));
            analyseProblems();
        }
       
        // Resolve the metadata within the context of the first contribution
        Contribution mainContribution = contributions.get(contributions.size() - 1);
View Full Code Here

        String url = myClassLoader.getResource("test.txt").toString();
        url = url.substring(0, url.length()-8);
       
        // Contribute the SCA contribution
        TestModelResolver myResolver = new TestModelResolver(myClassLoader);
        ContributionService contributionService = domain.getContributionService();
        Contribution contribution = contributionService.contribute("http://test/contribution", new URL(url), myResolver, false);
        assertNotNull(contribution);
       
        // Decide which SCA composite I want to deploy
        Composite myComposite = myResolver.getComposite(new QName("http://sample/crud", "crud"));
       
        // Add the deployable composite to the domain
        EmbeddedSCADomain.DomainCompositeHelper domainHelper = domain.getDomainCompositeHelper();
        domainHelper.addComposite(myComposite);

        // Activate the SCA Domain
        domainHelper.activateDomain();

        // Start the components in my composite
        domainHelper.startComponent(domainHelper.getComponent("CRUDServiceComponent"));
       
        // At this point the domain contains my contribution, my composite and
        // it's started, my application code can start using it
       
        // Get the CRUDServiceComponent service
        CRUD service = domain.getService(CRUD.class, "CRUDServiceComponent");
       
        // Invoke the service
        String id = service.create("ABC");
        Object result = service.retrieve(id);
        assertEquals("ABC", result);
        service.update(id, "EFG");
        result = service.retrieve(id);
        assertEquals("EFG", result);
        service.delete(id);
        result = service.retrieve(id);
        assertNull(result);
       
        // Stop my composite
        domainHelper.stopComposite(myComposite);
       
        // Remove my composite
        domainHelper.removeComposite(myComposite);
       
        // Remove my contribution
        contributionService.remove("http://test/contribution");
       
        // Stop the domain
        domain.stop();
    }
View Full Code Here

            // start a local domain to run management components
            management = new EmbeddedSCADomain(cl, "management");  
            management.start();
           
            // add management composite to the management domain
            ContributionService contributionService = management.getContributionService();
            URL contributionURL = Thread.currentThread().getContextClassLoader().getResource("management/");
           
            if ( contributionURL != null){
                System.err.println(contributionURL.toString());
                Contribution contribution = contributionService.contribute("http://management",
                                                                           contributionURL,
                                                                           null, //resolver,
                                                                           false);
                Composite composite = contribution.getDeployables().get(0);
                management.getDomainComposite().getIncludes().add(composite);
View Full Code Here

   
    protected void loadContribution(String domainName, URL contributionURL)
      throws ActivationException {       
        try {       
            // Get ready to add contributions to the domain
            ContributionService contributionService = domain.getContributionService();
           
            // Contribute the SCA application
            Contribution contribution = contributionService.contribute("http://calculator",
                                                          contributionURL,
                                                          null, //resolver,
                                                          false);
            Composite composite = contribution.getDeployables().get(0);
           
View Full Code Here

        // Start the domain
        domain.start();

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

        File contribLocation = new File("./target/classes/");
        URL contributionURL = contribLocation.toURL();
        contribution = contributionService.contribute("http://contribution", contributionURL, false);
        for (Composite deployable : contribution.getDeployables()) {
            domain.getDomainComposite().getIncludes().add(deployable);
            domain.getCompositeBuilder().build(deployable);
        }
View Full Code Here

        }
    }

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

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

        // Stop Components from my composite
        for (Composite deployable : contribution.getDeployables() ) {
            domain.getCompositeActivator().stop(deployable);
            domain.getCompositeActivator().deactivate(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.