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

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


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

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

        SCADomain scaDomain = SCADomain.newInstance("FeedAggregator.composite");

        try {
            System.out.println("Sample Feed server started (press enter to shutdown)");
            System.out.println();
            System.out.println("To read the aggregated feeds, point your Web browser to the following addresses:");
            System.out.println("http://localhost:8083/atomAggregator");
            System.out.println("http://localhost:8083/rssAggregator");
            System.out.println("http://localhost:8083/atomAggregator?feedType=rss_2.0");
            System.out.println("http://localhost:8083/rssAggregator?feedType=atom_1.0");
            System.out.println();
            System.in.read();
        } catch (IOException e) {
            e.printStackTrace();
        }

        // RssFeed feedService = scaDomain.getService(RssFeed.class,
        // "RssAggregatorComponent");
        // SyndFeed syndFeed = feedService.get();
        // SyndFeedOutput output = new SyndFeedOutput();
        // output.output(syndFeed,new PrintWriter(System.out));

        scaDomain.close();
        System.out.println("Sample Feed server stopped");
    }
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 static void main(String[] args) throws Exception {

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

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

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

        domain.close();

        System.out.println("Bye");
    }
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.stop();
    }
   
    public void testOSGiComponent() throws Exception {
       
        SCADomain scaDomain = SCADomain.newInstance(compositeName);
        OSGiTestInterface testService = scaDomain.getService(OSGiTestInterface.class, "OSGiTestServiceComponent");
        assert(testService != null);
       
        assert(testService instanceof Proxy);
       
        String str = testService.testService();
       
        assertEquals(className, str);

        scaDomain.close();
             
    }
View Full Code Here

public class Consumer {

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

        SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Consumer.composite");

        CustomerClient testService = scaDomain.getService(CustomerClient.class, "CustomerClient");
        testService.testCustomerCollection();

        scaDomain.close();
    }
View Full Code Here

public class Provider {

    public static void main(String[] args) {

        SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Provider.composite");
        System.out.println("Provider.composite ready...");

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

        scaDomain.close();
    }
View Full Code Here

        ebi.build(endpoint);
    }

    protected Component findTarget() {
        for (StandardContext sc : TuscanyHost.scaApps) {
            SCADomain scaDomain = (SCADomain)sc.getServletContext().getAttribute(WebAppServletHost.SCA_DOMAIN_ATTRIBUTE);
            if (scaDomain != null) {
                Component component = ((DefaultSCADomain)scaDomain).getComponent(endpoint.getTargetName());
                if ( component != null) {
                    return component;
                }
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.
     */
    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

        } catch (ServletException e) {
            throw new JspException("Exception initializing Tuscany webapp: " + e, e);
        }
        ServletContext servletContext = pageContext.getServletContext();
        SCADomain scaDomain = (SCADomain)servletContext.getAttribute(WebAppServletHost.SCA_DOMAIN_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 {
            o = scaDomain.getService(typeClass, name);
        } catch (Exception e) {
            throw new JspException("Exception getting service for reference'" + name + "': " + e, e);
        }
        if (o == null) {
            throw new JspException("Reference '" + name + "' not found");
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.