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

Examples of org.apache.tuscany.sca.host.embedded.SCADomain


public class Consumer {

    public static void main(String[] args) throws Exception {

        SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/feed/Consumer.composite");

        CustomerClient testService = scaDomain.getService(CustomerClient.class, "CustomerClient");
        testService.testCustomerCollection();

        scaDomain.close();
    }
View Full Code Here


public class Provider {

    public static void main(String[] args) {

        SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/feed/Provider.composite");
        System.out.println("Provider.composite ready...");

        try {
            System.in.read();
        } catch (IOException e) {
            e.printStackTrace();
        }

        scaDomain.close();
    }
View Full Code Here

* @version $Rev: 538806 $ $Date: 2007-05-17 06:21:15 +0100 (Thu, 17 May 2007) $
*/
public class CompositeClient {

    public static void main(String[] args) throws Exception {
      SCADomain domain = SCADomain.newInstance("OuterComposite.composite");
     
        Source source = domain.getService(Source.class, "SourceComponent");
       
        System.out.println("Main thread " + Thread.currentThread());
        source.clientMethod("Client.main");
        Thread.sleep(500);
       
        domain.close();
    }
View Full Code Here

import org.apache.tuscany.sca.host.embedded.SCADomain;

public class O2TestCase extends TestCase {

    public void testGet() throws Exception {
        SCADomain sca = SCADomain.newInstance("foo/o2.composite");
        I i = sca.getService(I.class, "O1Component");
        assertEquals("foo.A", i.get(0));
    }
View Full Code Here

import org.apache.tuscany.sca.host.embedded.SCADomain;

public class O4TestCase extends TestCase {

  public void testO3Component() throws Exception {
    SCADomain sca = SCADomain.newInstance("foo/o4.composite");
    I i = sca.getService(I.class, "O3Component");
    assertEquals("foo.A", i.get(0));
  }
View Full Code Here

            } else {
                throw e;
            }
        }

        SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
       
        CalculatorService calculatorService =
            scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");

        // Calculate
        System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
                "policy for subtract and divide operations...");
        System.out.println("3 + 2=" + calculatorService.add(3, 2));
        System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
        System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
        System.out.println("3 / 2=" + calculatorService.divide(3, 2));
       
        calculatorService =
            scaDomain.getService(CalculatorService.class, "AnotherCalculatorServiceComponent");

        // Calculate
        System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
                "for all operations in the implementation...");
        System.out.println("3 + 2=" + calculatorService.add(3, 2));
        System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
        System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
        System.out.println("3 / 2=" + calculatorService.divide(3, 2));

        scaDomain.close();
    }
View Full Code Here

* activates the helloworld Web service endpoint.
*/
public class HelloWorldServer {

    public static void main(String[] args) {
      SCADomain scaDomain = null;
      try {
      BrokerService broker = new BrokerService();
      broker.setPersistent(false);
      broker.setUseJmx(false);
      broker.addConnector("tcp://localhost:61619");
      broker.start();

      // ActiveMQModuleActivator.startBroker();
      scaDomain = SCADomain.newInstance("helloworldjmsservice.composite");

      try {
        System.out
            .println("HelloWorld server started (press enter to shutdown)");
        System.in.read();
      } catch (IOException e) {
        e.printStackTrace();
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

        scaDomain.close();
        System.out.println("HelloWorld server stopped");
       
    }
View Full Code Here

    I i = sca.getService(I.class, "O3Component");
    assertEquals("foo.A", i.get(0));
  }

  public void testO2Component() throws Exception {
    SCADomain sca = SCADomain.newInstance("foo/o4.composite");
    I i = sca.getService(I.class, "O2Component");
    assertEquals("foo.A", i.get(0));
  }
View Full Code Here

*/
public class DomainNode {

    public static void main(String[] args) {

        SCADomain scaDomain = SCADomain.newInstance("domain/domain.composite");

        try {
            System.out.println("Domain node started (press enter to shutdown)");
            System.in.read();
        } catch (IOException e) {
            e.printStackTrace();
        }

        scaDomain.close();
        System.out.println("Domain node stopped");
    }
View Full Code Here

            // network.
            DistributedSCADomain distributedDomain = new DistributedSCADomainNetworkImpl(domainName);
      
            // create the node that runs the calculator component
            EmbeddedNode node = new EmbeddedNode(nodeName);
            SCADomain domain = node.attachDomain(distributedDomain);
               
            // the application components are added. The null here just gets the node
            // implementation to read a directory from the classpath with the node name
            // TODO - should be done as a management action.      
            node.addContribution(domainName, null)
           
            // start the node
            // TODO - should be done as a management action.
            node.start();
                   
            // nodeA is the head node and runs some tests while all other nodes
            // simply listen for incoming messages
            if ( nodeName.equals("nodeA") ) {           
                // do some application stuff
                CalculatorService calculatorService =
                    domain.getService(CalculatorService.class, "CalculatorServiceComponent");
       
                // Calculate
                System.out.println("3 + 2=" + calculatorService.add(3, 2));
                System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
                System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
                System.out.println("3 / 2=" + calculatorService.divide(3, 2));
            } else {
                // start up and wait for messages
                try {
                    System.out.println("Node started (press enter to shutdown)");
                    System.in.read();
                } catch (IOException e) {
                    e.printStackTrace();
               
            }
           
            // stop the node and all the domains in it
            domain.close();
       
        } catch(Exception ex) {
            System.err.println("Exception in node - " + ex.getMessage());
            ex.printStackTrace(System.err);
        }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.host.embedded.SCADomain

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.