Package org.apache.tuscany.sca.node

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


    public static void main(String[] args) throws Exception {
        SampleOSGILauncherBindingWS launcher = new SampleOSGILauncherBindingWS();
       
        // launcher.launchBindingWSCalculator();
       
        Node node = launcher.startNode(new Contribution("c1", "../../learning-more/binding-ws/calculator-contribution/target/sample-binding-ws-calculator-contribution.jar"));
       
        CalculatorService calculator = node.getService(CalculatorService.class, "CalculatorServiceComponent");
              
        double result = calculator.add(3, 2);
        System.out.println("3 + 2 = " + result);
        if (result != 5.0){
            throw new SampleLauncherException();
View Full Code Here


    /**
     * The contribution-binding-sca-calculator contribution includes a client component
     * that calls the CalculatorServiceComponent from an operation marked by @Init.
     */
    public void launchBindingSCACalculator(){
        Node node = startNode(new Contribution("c1", "../../learning-more/binding-sca/contribution-calculator/target/sample-contribution-binding-sca-calculator.jar"));
       
        stopNode(node);
    }   
View Full Code Here

   
    /*
     * Using a Tuscany specific mechanism for getting at local service proxies
     */
    public void launchBindingWSCalculator() throws NoSuchDomainException, NoSuchServiceException{
        Node node = startNode(new Contribution("c1", "../../learning-more/binding-ws/contribution-calculator/target/sample-contribution-binding-ws-calculator.jar"));
       
        CalculatorService calculator = node.getService(CalculatorService.class, "CalculatorServiceComponent");
              
        double result = calculator.add(3, 2);
        System.out.println("3 + 2 = " + result);
        if (result != 5.0){
            throw new SampleLauncherException();
View Full Code Here

        JSELauncherImplementationJavaCalculatorAsync launcher = new JSELauncherImplementationJavaCalculatorAsync();
        launcher.launchImplementationJavaCalculator();        
    }
   
    public void launchImplementationJavaCalculator(){
        Node node = NodeFactory.newInstance().createNode(new Contribution("c1", "../../learning-more/async/calculator-contribution/target/sample-implementation-java-calculator-async-contribution.jar"));
        node.start();
       
        node.stop();
    }
View Full Code Here

    }
   

    public void launchBindingRMICalculator(){
     
        Node node1 = NodeFactory.newInstance().createNode(new Contribution("c1", "../../learning-more/binding-rmi/calculator-service-contribution/target/sample-binding-rmi-calculator-service-contribution.jar"));      
        Node node2 = NodeFactory.newInstance().createNode(new Contribution("c1", "../../learning-more/binding-rmi/calculator-reference-contribution/target/sample-binding-rmi-calculator-reference-contribution.jar"));
       
        node1.start();
        node2.start();
       
        CalculatorService calculator = node2.getService(CalculatorService.class, "CalculatorServiceComponent");

        double result = calculator.add(3, 2);
        System.out.println("3 + 2 = " + result);
        if (result != 5.0){
            throw new SampleLauncherException();
        }
       
        node1.stop();
        node2.stop();
    }
View Full Code Here

        }
        return new NodeImpl(this, configuration);
    }

    protected Node removeNode(NodeConfiguration configuration) {
        Node node = nodes.remove(getNodeKey(configuration));
        if (autoDestroy && nodes.isEmpty()) {
            destroy();
        }
        return node;
    }
View Full Code Here

public class Provider {

    public static void main(String[] args) {

        String contribution = ContributionLocationHelper.getContributionLocation(Provider.class);
        Node node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/atom/Provider.composite", new Contribution("c1", contribution));
        System.out.println("Provider.composite ready...");

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

        node.stop();
    }
View Full Code Here

     */
    public void testComet() {
        JettyServer.portDefault = 8085;
        try {
            final String location = ContributionLocationHelper.getContributionLocation("test.composite");
            final Node node = NodeFactory.newInstance().createNode("test.composite", new Contribution("c1", location));
            node.start();
            // System.out.println("Press any key to stop the node.");
            // System.in.read();
            node.stop();
        } catch (final Exception e) {
            e.printStackTrace();
            Assert.fail();
        }
    }
View Full Code Here

            throw new JspException("Exception initializing Tuscany webapp: " + e, e);
        }
        ServletContext servletContext = pageContext.getServletContext();
        ComponentContext componentContext = (ComponentContext)servletContext.getAttribute("org.oasisopen.sca.ComponentContext");
        Node scaDomain = null;
        if (componentContext == null) {
            scaDomain = (Node)servletContext.getAttribute(WebAppServletHost.SCA_NODE_ATTRIBUTE);
            if (scaDomain == null) {
                throw new JspException("SCADomain is null. Check Tuscany configuration in web.xml");
            }
        }

        Class<?> typeClass;
        try {
            typeClass = Class.forName(type, true, Thread.currentThread().getContextClassLoader());
        } catch (ClassNotFoundException e) {
            throw new JspException("Reference '" + name + "' type class not found: " + type);
        }

        Object o;
        try {
            if (componentContext != null) {
                o = componentContext.getService(typeClass, name);
            } else {
                o = scaDomain.getService(typeClass, name);
            }
        } catch (Exception e) {
            throw new JspException("Exception getting service for reference'" + name + "': " + e, e);
        }
        if (o == null) {
View Full Code Here

    @Test
    public void testNodeWithCompositeContent() {
        NodeFactory factory = new NodeFactoryImpl();
        Contribution contribution = new Contribution("c1", new File("target/test-classes").toURI().toString());
        String compositeURI = "HelloWorld.composite";
        Node node = factory.createNode(compositeURI, composite, contribution);
        testNode(node);
    }
View Full Code Here

TOP

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

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.