Package org.apache.tuscany.sca.node

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


    @Test
    public void testNodeWithRelativeCompositeURI() {
        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, contribution);
        testNode(node);
    }
View Full Code Here


    private void bundleStarted(Bundle bundle) {
        if (!isSCABundle(bundle)) {
            return;
        }
        try {
            Node node = factory.createNode(bundle);
            node.start();
        } catch (Throwable e) {
            logger.log(Level.SEVERE, e.getMessage(), e);
        }
    }
View Full Code Here

            logger.log(Level.SEVERE, e.getMessage(), e);
        }
    }

    private void bundleStopping(Bundle bundle) {
        Node node = factory.getNodes().get(bundle);
        if (node == null) {
            return;
        }
        node.stop();
    }
View Full Code Here

        // Stop and destroy the work manager
        workScheduler.destroy();
    }

    public Node createNode(Bundle bundle) {
        Node node = new NodeImpl(bundle);
        nodes.put(bundle, node);
        return node;
    }
View Full Code Here

        nodes.put(bundle, node);
        return node;
    }

    public Node createNode(Bundle bundle, String compositeContent) {
        Node node = new NodeImpl(bundle, compositeContent);
        nodes.put(bundle, node);
        return node;
    }
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);
        testNode2(node);
    }
View Full Code Here

    public static void init(ServletConfig servletConfig) {
        init(servletConfig.getServletContext());
    }
   
    public static ServletHost init(final ServletContext servletContext) {
        Node node = (Node)servletContext.getAttribute(SCA_NODE_ATTRIBUTE);
        if (node == null) {
            try {
                node = createNode(servletContext);
                servletContext.setAttribute(SCA_NODE_ATTRIBUTE, node);
                getServletHost(node).init(new ServletConfig() {
View Full Code Here

    private static Node createNode(final ServletContext servletContext) throws ServletException {
        String contextPath = initContextPath(servletContext);
        String contributionRoot = getContributionRoot(servletContext);
        NodeFactory factory = NodeFactory.newInstance();
        String webComposite = getWebComposite(servletContext);
        Node node = factory.createNode(contextPath, webComposite, new Contribution(contributionRoot, contributionRoot));
        node.start();
        return node;
    }
View Full Code Here

        logger.info("ContextPath: " + contextPath);
        return contextPath;
    }

    public static void stop(ServletContext servletContext) {
        Node node = (Node) servletContext.getAttribute(ServletHostHelper.SCA_NODE_ATTRIBUTE);
        if (node != null) {
            node.stop();
            servletContext.setAttribute(ServletHostHelper.SCA_NODE_ATTRIBUTE, null);
        }
    }
View Full Code Here

    /*
     * Using the Tuscany Node API to load a contribution.
     * Using the Tuscany Node API to get a local service proxy
     */
    public void launchBindingSCACalculator(){
        Node node = NodeFactory.newInstance().createNode(new Contribution("c1", "../binding-jsonrpc/calculator-contribution/target/sample-binding-jsonrpc-calculator-contribution.jar"));
        node.start();
       
        CalculatorService calculator = node.getService(CalculatorService.class, "CalculatorServiceComponent");
       
        // TODO - could use JUnit assertions but don't want to have to handle JUnit dependency from Ant script
        double result = calculator.add(3, 2);
        System.out.println("3 + 2 = " + result);
        if (result != 5.0){
            throw new SampleLauncherException();
        }
       
        node.stop();
    }
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.