Package org.apache.tuscany.sca.host.embedded

Examples of org.apache.tuscany.sca.host.embedded.SCADomain


*/
public class TrafficAdvisoryServer {

    public static void main(String[] args) {
        try {
            SCADomain domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite");

            try {
                System.out.println("TrafficAdvisoryServer, hit return to end");
                System.in.read();
            } catch (IOException e) {
                e.printStackTrace();
            }

            domain.close();
        } catch(Throwable e) {
            e.printStackTrace();
        }
    }
View Full Code Here


*/
public class CRUDClient {

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

        SCADomain scaDomain = SCADomain.newInstance("crud.composite");
        CRUD crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent");
       
        String id = crudService.create("ABC");
        Object result = crudService.retrieve(id);
        System.out.println("Result from create: " + result);
        crudService.update(id, "EFG");
        result = crudService.retrieve(id);
        System.out.println("Result from update: " + result);
        crudService.delete(id);
        result = crudService.retrieve(id);
        if (result == null) {
            System.out.println("Result from delete: null");
        } else {
            System.out.println("Result from delete: should be null but was " + result);
        }
       
        scaDomain.close();

    }
View Full Code Here

    public static void main(String[] args) {
        try {
            notificationType = new URI("trafficAdvisory");
            String compositeName = "TrafficAdvisoryNotification.composite";
            SCADomain domain = SCADomain.newInstance(compositeName);
            TestCaseProducer testCaseProducer = domain.getService(TestCaseProducer.class, "TrafficAdvisoryProducer");

            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String value = "";
            if (args.length == 1) {
                value = args[0];
            }
            do {
                if(value == null || value.equals("end")) {
                    break;
                }
                try {
                    System.out.println("Send a report value, ^C or 'end' to end");
                    value = reader.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (value.equals("rb")) {
                    NotificationBindingProviderFactory.removeBroker(notificationType);
                }
                else {
                    testCaseProducer.produceTrafficNotification("Report value [" + value + "]");
                }
            }
            while(true);

            domain.close();
        } catch(Throwable e) {
            e.printStackTrace();
        }
    }
View Full Code Here

    /**
     * Initializes the SCADomian associated with a webapp context. If a SCADomain
     * doesn't exist already then one is create based on the webapp config.
     */
    public static SCADomain initSCADomain(ServletContext servletContext) {
        SCADomain scaDomain = (SCADomain)servletContext.getAttribute(SCA_DOMAIN_ATTRIBUTE);
       
        String domainURI = "http://localhost/" + servletContext.getServletContextName().replace(' ', '.');
        String contributionRoot = null;
       
        try {
View Full Code Here

        }
    }

    public void contextDestroyed(ServletContextEvent event) {
        ServletContext servletContext = event.getServletContext();
        SCADomain scaDomain = (SCADomain) servletContext.getAttribute(SCADomainHelper.SCA_DOMAIN_ATTRIBUTE);
        if (scaDomain != null) {
            scaDomain.close();
        }
    }
View Full Code Here

        OSGiRuntime.getRuntime().shutdown();
    }
   
    public void testOSGiComponent() throws Exception {
       
        SCADomain scaDomain = SCADomain.newInstance("osgitest.composite");
        OSGiTestInterface testService = scaDomain.getService(OSGiTestInterface.class, "OSGiTestServiceComponent");
        assert(testService != null);
       
        assert(testService instanceof Proxy);
       
        String str = testService.testService();
       
        System.out.println("className " + className + " str " + str);
        assertEquals(className, str);

        scaDomain.close();
             
    }
View Full Code Here

    public  final static void main(String[] args) throws Exception {
    //SCANode node = SCANodeFactory.createNodeWithComposite("helloworldjmsreference.composite");
    //HelloWorldService helloWorldService = node.getDomain().getService(HelloWorldService.class, "HelloWorldServiceComponent");
     
        SCADomain scaDomain = SCADomain.newInstance("helloworldjmsreference.composite");
        HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");

        String value = helloWorldService.getGreetings("World");
        System.out.println(value);

        scaDomain.close();
    }
View Full Code Here

import org.apache.tuscany.sca.host.embedded.SCADomain;

public class LaunchGallery {
    public static void main(String[] args) throws Exception {
        System.out.println("Starting ...");
        SCADomain scaDomain = SCADomain.newInstance("photo-gallery.composite");
        System.out.println("photo.gallery.composite ready for big business !!!");
        System.in.read();
        System.out.println("Stopping ...");
        scaDomain.close();
        System.out.println();
    }
View Full Code Here

import org.apache.tuscany.sca.host.embedded.SCADomain;

public class LaunchProtected {
    public static void main(String[] args) throws Exception {
        System.out.println("Starting ...");
        SCADomain scaDomain = SCADomain.newInstance("store-protected.composite");
        System.out.println("store.composite ready for big business !!!");
        System.in.read();
        System.out.println("Stopping ...");
        scaDomain.close();
        System.out.println();
    }
View Full Code Here

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

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

        SCADomain domain = SCADomain.newInstance("Calculator.composite");

        System.out.println("Press Enter to Exit...");
        System.in.read();

        domain.close();

        System.out.println("Bye");
        System.exit(0);
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.host.embedded.SCADomain

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.