Package org.apache.tuscany.sca.node

Examples of org.apache.tuscany.sca.node.SCANode


        jmsBroker.setUseJmx(false);
        jmsBroker.addConnector("tcp://localhost:61619");
        jmsBroker.start();
       
        NodeLauncher launcher = NodeLauncher.newInstance();
        SCANode node = launcher.createNode(null,
                                           new Contribution("assets", "../assets/target/tutorial-assets.jar"),
                                           new Contribution("warehouse", "../warehouse-spring/target/tutorial-warehouse-spring.jar"));
        node.start();
       
        System.out.println("Press a key to stop");
        try {
            System.in.read();
        } catch (IOException e) {}
       
        node.stop();
       
        jmsBroker.stop();

    }
View Full Code Here


        }
       
        System.out.println("Starting the Sample SCA StockQuote Service...");

        SCANodeFactory factory = SCANodeFactory.newInstance();
        SCANode node = factory.createSCANodeFromClassLoader("StockQuote.composite", StockQuoteServer.class.getClassLoader());
        node.start();
       
        // Method 1: To access the Spring Application Context instance
        ApplicationContext ctx = SCAApplicationContextProvider.getApplicationContext();
        if (ctx.containsBean("StockQuoteServiceBean"))
            System.out.println("StockQuoteServiceBean is now available for use...");       
       
        if (timeout < 0) {
            System.out.println("Press Enter to Exit...");
            System.in.read();
        } else {
            Thread.sleep(timeout);
        }

        node.stop();
        System.out.println("Bye");
    }
View Full Code Here

import calculator.CalculatorService;

public class LaunchCalculatorNodeA {
    public static void main(String[] args) throws Exception {
       
        SCANode node = null;
        try {
           
            NodeLauncher nodeLauncher = NodeLauncher.newInstance();
            node = nodeLauncher.createNodeFromURL("http://localhost:9990/node-config/NodeA");

            node.start();
           
            // get a reference to the calculator component
            SCAClient client = (SCAClient)node;
            CalculatorService calculatorService =
                client.getService(CalculatorService.class, "CalculatorServiceComponentA");
           
            // 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));
           
            if (args.length > 1){
                for (int i=0; i < 1000; i++){
                    // 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));
                }
            }
           
            node.stop();
           
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
        }       
    }
View Full Code Here

        }

        System.out.println("Starting the Sample SCA Calculator...");

        SCANodeFactory factory = SCANodeFactory.newInstance();
        SCANode node = factory.createSCANodeFromClassLoader("Calculator.composite", CalculatorServer.class.getClassLoader());
        node.start();

        if (timeout < 0) {
            System.out.println("Press Enter to Exit...");
            System.in.read();
        } else {
            Thread.sleep(timeout);
        }

        node.stop();
        System.out.println("Bye");
    }
View Full Code Here

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

        SCANodeFactory factory = SCANodeFactory.newInstance();
        SCANode node = factory.createSCANodeFromClassLoader("callbacks.composite", CallbackJMSClient.class.getClassLoader());
        node.start();
       
        OrderServiceClient orderServiceClient = ((SCAClient)node).getService(OrderServiceClient.class, "ClientComponent");
       
        // do something
        orderServiceClient.doSomeOrdering();
       
        // wait to give the service time to respond
        Thread.sleep(500);
       
        node.stop();
    }
View Full Code Here

public class LaunchStoreClientNode {

    public static void main(String[] args) throws Exception {
        NodeLauncher nodeLauncher = NodeLauncher.newInstance();
        SCANode storeClientNode = nodeLauncher.createNodeFromURL("http://localhost:9990/node-config/StoreClientNode");
        storeClientNode.start();
        SCAClient client = (SCAClient)storeClientNode;
       
        Shopper shopper = client.getService(Shopper.class, "StoreClient");
       
        String total = shopper.shop("Orange", 5);
        System.out.println("Total: " + total);
       
        storeClientNode.stop();
    }
View Full Code Here

*/
public class CallbackServer {

    public static void main(String[] args) throws Exception {
       
        SCANode node = SCANodeFactory.newInstance().createSCANodeFromClassLoader("callbackws.composite", null);
        node.start();

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

        node.stop();
        System.out.println("Callback server stopped");
    }
View Full Code Here

            org.apache.tuscany.sca.node.launcher.Contribution[] contributions = new org.apache.tuscany.sca.node.launcher.Contribution[dependencies.size()];
            for (int c =0, n = dependencies.size(); c < n; c++) {
                Contribution dependency = dependencies.get(c);
                contributions[c] = new org.apache.tuscany.sca.node.launcher.Contribution(dependency.getURI(), dependency.getLocation());
            }
            SCANode runtimeNode = launcher.createNode("http://sample/" + node.getName(), print(runnable), contributions);
           
            // Start the node
            runtimeNode.start();
            runtimeNodes.add(runtimeNode);
        }
       
        System.out.println("Nodes are running, press enter to stop...");
        System.in.read();
       
        for (SCANode runtimeNode: runtimeNodes) {
            runtimeNode.stop();
        }
    }
View Full Code Here

*/
public class CalculatorClient {
    public static void main(String[] args) throws Exception {

        SCANodeFactory factory = SCANodeFactory.newInstance();
        SCANode node = factory.createSCANodeFromClassLoader("Calculator.composite", CalculatorClient.class.getClassLoader());
        node.start();
       
        CalculatorService calculatorService = ((SCAClient)node).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));

        node.stop();
    }
View Full Code Here

*/
public class BigBankClient {
    public static void main(String[] args) throws Exception {

        SCANodeFactory factory = SCANodeFactory.newInstance();
        SCANode node = factory.createSCANodeFromClassLoader("BigBank.composite", BigBankClient.class.getClassLoader());
        node.start();
       
        AccountService accountService = ((SCAClient)node).getService(AccountService.class, "AccountServiceComponent");

        System.out.println("Account summary: " + accountService.getAccountReport("Customer_01") );

        node.stop();
   
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.node.SCANode

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.