Package org.apache.tuscany.sca.node

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


import com.tuscanyscatours.payment.Payment;

public class PaymentLauncher {

    public static void main(String[] args) throws Exception {
        SCANode node = SCANodeFactory.newInstance().createSCANode(null,
                                                              locate("payment-java"),
                                                              locate("creditcard-payment-jaxb"));
        node.start();
       
        SCAClient client = (SCAClient)node;
        Payment payment = client.getService(Payment.class, "Payment");

        System.out.println("Payment Java test");
        System.out.println("\nSuccessful Payment - Status = \n\n" + payment.makePaymentMember("c-0", 100.00f));
        System.out.println("\n\nFailed Payment - Status = \n\n" + payment.makePaymentMember("c-1", 100.00f));
       
        node.stop();
    }
View Full Code Here


                contributions[i] = new SCAContribution(contributionsToDeploy.get(i).getURI(), contributionsToDeploy.get(i).getLocation());
            }
                  
            SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
           
            SCANode node = nodeFactory.createSCANode(chosenDeployableLocation, contributions);
           
            node.start();
            SCAClient client = (SCAClient)node;
            CalculatorService calculatorService =
                client.getService(CalculatorService.class, "CalculatorServiceComponentA");
           
            System.out.println("Add 2.0 + 3.0 + 3.0 = " + calculatorService.add(2.0, 3.0));
View Full Code Here

                   
                }
            }
           
            SCANodeFactory factory = SCANodeFactory.newInstance();
            SCANode node = factory.createSCANode(null,
                                                 new SCAContribution("contrib2wsdl", contributionPath));
           
            // Print out all generated WSDL
            // today this means finding all services in the deployment composites
            // that have a binding.ws configured
View Full Code Here

    protected boolean isExplodedContribution(File folder) {
        return getJARsInFolder(folder).length < 1 && containsCompositeFile(folder);
    }

    protected void addContributionFolder(File folder) {
        SCANode repoNode;
        try {
            repoNode = createNode(cp);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
       
        try {
            repoNode.addContribution(folder.toURL().toString(), folder.toURL());
            logger.info("added contribution folder: " + folder.toURL());
        } catch (Exception e) {
            e.printStackTrace();
            logger.log(Level.WARNING, "exception adding contribution folder: " + folder, e);
        }
View Full Code Here

            logger.log(Level.WARNING, "exception adding contribution folder: " + folder, e);
        }
    }

    protected URL[] addTopLevelJARs(File repository) {
        SCANode repoNode;
        try {
            repoNode = createNode(cp);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
       
        URL[] jars = getJARsInFolder(repository);
        for (URL jarURL : jars) {
            try {
                repoNode.addContribution(jarURL.toString(), jarURL);
                logger.info("added contribution: " + jarURL);
            } catch (NodeException e) {
                e.printStackTrace();
                logger.log(Level.WARNING, "exception adding contribution: " + jarURL, e);
            }
View Full Code Here

    protected URL[] addSubFolders(File repository) {
        URL[] folders = getSubFolders(repository);
        for (URL folderURL : folders) {
            try {
                SCANode scaNode = createNode(cp + "/" + folderURL);
                scaNode.addContribution(folderURL.toString(), folderURL);
                logger.info("added contribution: " + folderURL);
            } catch (Exception e) {
                e.printStackTrace();
                logger.log(Level.WARNING, "exception adding contribution: " + folderURL, e);
            }
View Full Code Here

        }
        return folders;
    }

    public void addContribution(URL contributionURL) throws NodeException {
        SCANode scaNode = createNode(cp + "/" + contributionURL);

        if (started && domainName == null) {
            scaNode.stop();
        }
       
        scaNode.addContribution(contributionURL.toString(), contributionURL);
        logger.info("added contribution: " + contributionURL);
       
        if (started) {
            if (domainName == null) {
                scaNode.addToDomainLevelComposite((QName)null);
                scaNode.start();
            } else {
                scaNode.addToDomainLevelComposite((QName)null);
                scaNode.start();
            }
        }
    }
View Full Code Here

    /**
     * Creates a new SCA Node unless running as a standalone node in
     * which case just a single node is used to run for all contributions
     */
    protected SCANode createNode(String nodeName) throws NodeException {
        SCANode scaNode;

        if (domainName == null || domainName.length() < 1) {
            if (scaNodes.size() < 1) {
                scaNode = scaNodeFactory.createSCANode(nodeName, null);
                scaNodes.add(scaNode);
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

        }

        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");

        // The following line is a workaround for TUSCANY-3277 (the JVM hangs when exiting).
        System.exit(0);
    }
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.