Package org.apache.openejb.server

Examples of org.apache.openejb.server.ServerService


        ejbJar.addEnterpriseBean(new StatelessBean(Target.class));
        assembler.createApplication(config.configureApplication(ejbJar));

        SystemInstance.get().setComponent(DiscoveryAgent.class, agent);

        final ServerService red = server(Host.RED);
        final ServerService blue = server(Host.BLUE);
        final ServerService green = server(Host.GREEN);

        red.start();
        blue.start();
        green.start();

        final TargetRemote target = getBean(red);

        assertEquals(Host.GREEN, target.kill(Host.RED, Host.BLUE).host);
        assertEquals(Host.GREEN, target.getHost());

        red.stop();
        blue.stop();
        green.stop();

        try {
            target.getHost();
            fail("EJBException should have been thrown");
        } catch (EJBException e) {
View Full Code Here


        final Context context = new InitialContext(props);
        return (TargetRemote) context.lookup("TargetRemote");
    }

    private ServerService server(final Host host) throws Exception {
        ServerService server = new EjbServer();

        server = new HostFilter(server, host);

        server = new ServiceDaemon(server, 0, "localhost");

        server = new AgentFilter(server, agent, host);

        server.init(new Properties());

        return server;
    }
View Full Code Here

            manager.init();
            manager.start(false);
        } else {
            // WS
            try {
                ServerService cxfService = (ServerService) cl.loadClass("org.apache.openejb.server.cxf.CxfService").newInstance();
                cxfService.init(properties);
                cxfService.start();
                services.add(cxfService);
            } catch (ClassNotFoundException ignored) {
            } catch (Exception e) {
                Logger logger = Logger.getInstance(LogCategory.OPENEJB_STARTUP, getClass());
                logger.error("Webservices failed to start", e);
            }

            // REST
            try {
                ServerService restService = (ServerService) cl.loadClass("org.apache.openejb.server.cxf.rs.CxfRSService").newInstance();
                restService.init(properties);
                restService.start();
                services.add(restService);
            } catch (ClassNotFoundException ignored) {
            } catch (Exception e) {
                logger.error("REST failed to start", e);
            }
View Full Code Here

            manager.init();
            manager.start(false);
        } else {
            // WS
            try {
                ServerService cxfService = (ServerService) cl.loadClass("org.apache.openejb.server.cxf.CxfService").newInstance();
                cxfService.start();
                services.add(cxfService);
            } catch (ClassNotFoundException ignored) {
            } catch (Exception e) {
                Logger logger = Logger.getInstance(LogCategory.OPENEJB_STARTUP, getClass());
                logger.error("Webservices failed to start", e);
            }

            // REST
            try {
                ServerService restService = (ServerService) cl.loadClass("org.apache.openejb.server.cxf.rs.CxfRSService").newInstance();
                restService.start();
                services.add(restService);
            } catch (ClassNotFoundException ignored) {
            } catch (Exception e) {
                logger.error("REST failed to start", e);
            }
View Full Code Here

        }
      */
    }

    private ServerService server(final Host host) throws Exception {
        ServerService server = new EjbServer();

        server = new HostFilter(server, host);

        server = new ServiceDaemon(server, 0, "localhost");

        server = new AgentFilter(server, agent, host);

        server.init(new Properties());

        return server;
    }
View Full Code Here

        ejbJar.addEnterpriseBean(new StatelessBean(Target.class));
        assembler.createApplication(config.configureApplication(ejbJar));

        SystemInstance.get().setComponent(DiscoveryAgent.class, agent);

        final ServerService red = server(Host.RED);
        final ServerService blue = server(Host.BLUE);
        final ServerService green = server(Host.GREEN);

        red.start();
        blue.start();
        green.start();

        final TargetRemote target = getBean(red);

        assertEquals(Host.RED, target.getHost());

        red.stop();

        assertEquals(Host.BLUE, target.getHost());

        blue.stop();

        assertEquals(Host.GREEN, target.getHost());

        green.stop();

        try {
            target.getHost();
            fail("EJBException should have been thrown");
        } catch (EJBException e) {
View Full Code Here

        ejbJar.addEnterpriseBean(new StatelessBean(Target.class));
        assembler.createApplication(config.configureApplication(ejbJar));

        SystemInstance.get().setComponent(DiscoveryAgent.class, agent);

        final ServerService red = server(Host.RED);
        final ServerService blue = server(Host.BLUE);
        final ServerService green = server(Host.GREEN);

        red.start();
        blue.start();
        green.start();

        final TargetRemote target = getBean(red);

        assertEquals(Host.GREEN, target.kill(Host.RED, Host.BLUE).host);
        assertEquals(Host.GREEN, target.getHost());

        red.stop();
        blue.stop();
        green.stop();

        try {
            target.getHost();
            fail("EJBException should have been thrown");
        } catch (EJBException e) {
View Full Code Here

        final Context context = new InitialContext(props);
        return (TargetRemote) context.lookup("TargetRemote");
    }

    private ServerService server(final Host host) throws Exception {
        ServerService server = new EjbServer();

        server = new HostFilter(server, host);

        server = new ServiceDaemon(server, 0, "localhost");

        server = new AgentFilter(server, agent, host);

        server.init(new Properties());

        return server;
    }
View Full Code Here

    // a better solution is to add a kind of spi for our webapps
    // to be able to add for each overlay new graphic part
    public static Services restWebServices() {
        final Services restServices = new Services();

        final ServerService ss = serverService("org.apache.openejb.server.cxf.rs.CxfRSService");
        if (ss == null) {
            return restServices;
        }

        try {
            final List<Object> services = (List<Object>) ss.getClass().getMethod("getServices").invoke(ss);
            for (Object rsService : services) {
                final Accessor accessor = new Accessor(rsService);
                final String app = (String) accessor.value("webapp");
                final String address = (String) accessor.value("address");
                final String origin = (String) accessor.value("origin");
View Full Code Here

    }

    public static Services soapWebServices() {
        final Services soapServices = new Services();

        final ServerService ss = serverService("org.apache.openejb.server.cxf.CxfService");
        if (ss == null) {
            return soapServices;
        }

        try {
            final Map<String, List<Object>> addressesByApp = (Map) ss.getClass().getMethod("getAddressesByApplication").invoke(ss);
            for (Map.Entry<String, List<Object>> entry : addressesByApp.entrySet()) {
                final Application app = soapServices.returnOrCreateApplication(entry.getKey());
                for (Object soapService : entry.getValue()) {
                    final Accessor accessor = new Accessor(soapService);
                    final String wsdl = (String) accessor.value("address");
View Full Code Here

TOP

Related Classes of org.apache.openejb.server.ServerService

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.