Package org.apache.tuscany.sca.host.embedded.impl

Examples of org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain$DomainCompositeHelper


            // remote service reference code working.
           
            ClassLoader cl = EmbeddedNode.class.getClassLoader();
           
            // 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/");
View Full Code Here


       
        try {
            ClassLoader cl = EmbeddedNode.class.getClassLoader();
           
            // create and start the local domain
            domain = new EmbeddedSCADomain(cl, domainName);  
            domain.start();
        } catch(ActivationException ex) {
            throw ex;                    
        } catch(Exception ex) {
            throw new ActivationException(ex);
View Full Code Here

    @Override
    protected void setUp() throws Exception {
        // Create a test embedded SCA domain
        cl = getClass().getClassLoader();
        domain = new EmbeddedSCADomain(cl, "http://localhost");

        // Start the domain
        domain.start();

        // Contribute the SCA contribution
View Full Code Here

    public static String DEFULT_DOMAIN_NAME = "mydomain";

    public static EmbeddedSCADomain createDomain(String nodeName) throws Exception {
        ClassLoader cl = BaseTest.class.getClassLoader();
        EmbeddedSCADomain domain = null;

        try {
            // Create the distributed domain representation
            TestDistributedSCADomainImpl distributedDomain = new TestDistributedSCADomainImpl(DEFULT_DOMAIN_NAME);
            distributedDomain.setNodeName(nodeName);

            // create and start domainA
            domain = new EmbeddedSCADomain(cl, DEFULT_DOMAIN_NAME);
            domain.start();

            // add a contribution to the domain
            ContributionService contributionService = domain.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, //resolver,
                                                                       false);
            Composite composite = contribution.getDeployables().get(0);

            // Add the deployable composite to the domain
            domain.getDomainComposite().getIncludes().add(composite);
            domain.getCompositeBuilder().build(composite);

            distributedDomain.addDistributedDomainToBindings(composite);

            domain.getCompositeActivator().activate(composite);
        } catch (Exception ex) {
            System.err.println("Exception when creating domain " + ex.getMessage());
            ex.printStackTrace(System.err);
            throw ex;
        }  
View Full Code Here

            timeout = Long.parseLong(args[0]);
        }
       
        System.out.println("Starting the Sample SCA BigBank server...");
        ClassLoader cl = BigBankServer.class.getClassLoader();
        EmbeddedSCADomain domain = new EmbeddedSCADomain(cl, "http://localhost");

        //Start the domain
        domain.start();

        // Contribute the SCA contribution
        ContributionService contributionService = domain.getContributionService();
       
        URL javaContribURL = getContributionURL(SavingsAccountService.class);
        Contribution bigbankAcContribution = contributionService.contribute("http://bigbank-account", javaContribURL, false);
        for (Composite deployable : bigbankAcContribution.getDeployables()) {
            domain.getDomainComposite().getIncludes().add(deployable);
            domain.buildComposite(deployable);
        }
       
        URL bigbankContribUrl = getContributionURL(BigBankServer.class);
        Contribution bigbankContribution = contributionService.contribute("http://bigbank", bigbankContribUrl, false);
        for (Composite deployable : bigbankContribution.getDeployables()) {
            domain.getDomainComposite().getIncludes().add(deployable);
            domain.buildComposite(deployable);
        }


        //Start Components from  composite
        for (Composite deployable : bigbankAcContribution.getDeployables()) {
            domain.getCompositeActivator().activate(deployable);
            domain.getCompositeActivator().start(deployable);
        }

        for (Composite deployable : bigbankContribution.getDeployables()) {
            domain.getCompositeActivator().activate(deployable);
            domain.getCompositeActivator().start(deployable);
        }
       
        if (timeout < 0) {
            System.out.println("Press Enter to Exit...");
            System.in.read();
        } else {
            Thread.sleep(timeout);
        }
       
        contributionService.remove("http://bigbank-account");
        contributionService.remove("http://bigbank");

        // Stop Components from  composite
        for (Composite deployable : bigbankContribution.getDeployables()) {
            domain.getCompositeActivator().stop(deployable);
            domain.getCompositeActivator().deactivate(deployable);
        }

        domain.stop();

        domain.close();
       
       
        /*SCADomain domain = SCADomain.newInstance("BigBank.composite");

        if (timeout < 0) {
View Full Code Here

        this.supplyChainVersion = supplyChainVersion;
       
        Thread.currentThread().setContextClassLoader(parentClassLoader);
       
        //Create an embedded SCA domain
        domain = new EmbeddedSCADomain(parentClassLoader, "http://localhost");

        //Start the domain
        domain.start();

        this.contributionService = domain.getContributionService();
View Full Code Here

    @Override
    protected void setUp() throws Exception {
        // Create a test embedded SCA domain
        cl = getClass().getClassLoader();
        domain = new EmbeddedSCADomain(cl, "http://localhost");

        // Start the domain
        domain.start();

        // Contribute the SCA contribution
View Full Code Here

               
                if ( contributionURL != null ){
                    logger.log(Level.INFO, "Domain management configured from " + contributionURL);
                   
                    // start a local domain in order to talk to the logical domain
                    domainManagementRuntime = new EmbeddedSCADomain(domainClassLoader, domainURI);  
                    domainManagementRuntime.start();
               
                    // add node composite to the management domain
                    ContributionService contributionService = domainManagementRuntime.getContributionService();
                    Contribution contribution = null;
View Full Code Here

    }
   
    protected void setUpSCA() throws Exception {
        //Create a test embedded SCA domain
        ClassLoader cl = getClass().getClassLoader();
        domain = new EmbeddedSCADomain(cl, "http://localhost");

        //Start the domain
        domain.start();

        // Contribute the SCA contribution
View Full Code Here

    }
   
    protected void setUpSCA() throws Exception {
        //Create a test embedded SCA domain
        ClassLoader cl = getClass().getClassLoader();
        domain = new EmbeddedSCADomain(cl, "http://localhost");

        //Start the domain
        domain.start();

        // Contribute the SCA contribution
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain$DomainCompositeHelper

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.