Package calculator

Examples of calculator.CalculatorService


      String location = ContributionLocationHelper.getContributionLocation("spring/annotations/Calculator.composite");
        Node node = NodeFactory.newInstance().createNode("spring/annotations/Calculator.composite", new Contribution("c1", location));
        node.start();       
             
        CalculatorService calculatorService =
            ((Client)node).getService(CalculatorService.class, "CalculatorServiceComponent");
       
        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 =
            ((SCAClient)node).getService(CalculatorService.class, "AnotherCalculatorServiceComponent");

        System.out.println("3 + 2=" + calculatorService.add(3, 2));
View Full Code Here


       
      String location = ContributionLocationHelper.getContributionLocation("context/imports/ContextImports.composite");
        Node node = NodeFactory.newInstance().createNode("context/imports/ContextImports.composite", new Contribution("c1", location));
        node.start();      
             
        CalculatorService calculatorService =
            ((Client)node).getService(CalculatorService.class, "CalculatorServiceComponent");
       
        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

        String location = ContributionLocationHelper.getContributionLocation("implementation/policies/ImplementationPolicies.composite");
        Node node = NodeFactory.newInstance().createNode("implementation/policies/ImplementationPolicies.composite", new Contribution("c1", location));
        node.start();  
             
        CalculatorService calculatorService =
            ((Client)node).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 =
            ((Client)node).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));

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

            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();
           
View Full Code Here

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

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

        SCANodeFactory factory = SCANodeFactory.newInstance();
        SCANode node = factory.createSCANode(new File("src/main/resources/context/imports/Calculator.composite").toURL().toString(),
                new SCAContribution("TestContribution", new File("src/main/resources/context/imports/").toURL().toString()));
        node.start();       
             
        CalculatorService calculatorService =
            ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
       
        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

        // Code: To access the Spring Application Context instance
        ApplicationContext ctx = SCAApplicationContextProvider.getApplicationContext();
        if (ctx.containsBean("CalculatorServiceBean"))
            System.out.println("CalculatorServiceBean is now available for use...");
             
        CalculatorService calculatorService =
            ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
               
        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

        SCANodeFactory factory = SCANodeFactory.newInstance();
        SCANode node = factory.createSCANode(new File("src/main/resources/spring/annotations/Calculator.composite").toURL().toString(),
                new SCAContribution("TestContribution", new File("src/main/resources/spring/annotations/").toURL().toString()));
        node.start();       
             
        CalculatorService calculatorService =
            ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
       
        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 =
            ((SCAClient)node).getService(CalculatorService.class, "AnotherCalculatorServiceComponent");

        System.out.println("3 + 2=" + calculatorService.add(3, 2));
View Full Code Here

               
                // start the domain
                node.getDomain().start();
               
                // do some application stuff
                CalculatorService calculatorService =
                    node.getDomain().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));
               
                // a little hidden loop test to put some load on the nodes
                if (args.length > 2){
                    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));
                    }
                }
               
                // stop all the nodes
                node.getDomain().stop();
View Full Code Here

        SCANodeFactory factory = SCANodeFactory.newInstance();
        SCANode node = factory.createSCANode(new File("src/main/resources/implementation/policies/Calculator.composite").toURL().toString(),
                new SCAContribution("TestContribution", new File("src/main/resources/implementation/policies/").toURL().toString()));
        node.start();      
             
        CalculatorService calculatorService =
            ((SCAClient)node).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 =
            ((SCAClient)node).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));

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

TOP

Related Classes of calculator.CalculatorService

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.