Package org.apache.openejb.loader

Examples of org.apache.openejb.loader.SystemInstance


public class TomeeJaxWsService implements Service {

    @Override
    public void init(final Properties props) throws Exception {
        // Install the Tomcat webservice registry
        final SystemInstance system = SystemInstance.get();

        TomcatWsRegistry tomcatSoapHandler = (TomcatWsRegistry) system.getComponent(WsRegistry.class);
        if (tomcatSoapHandler == null) {
            tomcatSoapHandler = new TomcatWsRegistry();
            system.setComponent(WsRegistry.class, tomcatSoapHandler);
        }

        system.addObserver(this);
    }
View Full Code Here


    // TODO: Remove it once init() suits our (initialisation) needs
    @Override
    public void init(final Properties props) throws Exception {
        this.props = props;

        final SystemInstance system = SystemInstance.get();
        final File home = system.getHome().getDirectory();
        system.setProperty(DeploymentFilterable.CLASSPATH_INCLUDE, system.getProperty(DeploymentFilterable.CLASSPATH_INCLUDE, ".*/" + home.getName() + "/lib/.*"));
        system.setProperty(DeploymentFilterable.CLASSPATH_REQUIRE_DESCRIPTOR, system.getProperty(DeploymentFilterable.CLASSPATH_REQUIRE_DESCRIPTOR, "true"));
        system.setProperty(DeploymentFilterable.CLASSPATH_FILTER_SYSTEMAPPS, system.getProperty(DeploymentFilterable.CLASSPATH_FILTER_SYSTEMAPPS, "false"));

        OpenEJB.init(props, new ServerFederation());

        if (SystemInstance.get().getOptions().get("openejb.nobanner", (String) null) == null) {
            System.out.println("[init] OpenEJB Remote Server");
View Full Code Here

    private static final String VALIDATION_OUTPUT_LEVEL = "openejb.validation.output.level";

    @BeforeClass
    public static void setupTestCase() {
        SystemInstance.reset();
        final SystemInstance system = SystemInstance.get();
        system.setProperty(VALIDATION_OUTPUT_LEVEL, "VERBOSE");
    }
View Full Code Here

    }

    public void printEjb(String name, PrintWriter out, HttpSession session)
        throws Exception {

        SystemInstance system = SystemInstance.get();
        ContainerSystem containerSystem = system.getComponent(ContainerSystem.class);

        String id = (name.startsWith("/")) ? name.substring(1, name.length()) : name;

        org.apache.openejb.DeploymentInfo ejb = containerSystem.getDeploymentInfo(id);
View Full Code Here

        body.println("<tr bgcolor=\"#5A5CB8\">");
        body.println("<td><font face=\"arial\" color=\"white\">ID</font></td>");
        body.println("<td><font color=\"white\">" + id + "</font></td>");
        body.println("</tr>");

        SystemInstance system = SystemInstance.get();
        ContainerSystem containerSystem = system.getComponent(ContainerSystem.class);

        CoreDeploymentInfo di = (CoreDeploymentInfo) containerSystem.getDeploymentInfo(id);

        printRow("Name", bean.ejbName, body);
        printRow(
View Full Code Here

    private EnterpriseBeanInfo getBeanInfo(String id) {
        return (EnterpriseBeanInfo) deploymentIdIndex.get(id);
    }

    private void printDeployments(PrintWriter out) throws IOException {
        SystemInstance system = SystemInstance.get();
        ContainerSystem containerSystem = system.getComponent(ContainerSystem.class);

        DeploymentInfo[] deployments = containerSystem.deployments();
        String[] deploymentString = new String[deployments.length];
        out.println("<table width=\"100%\" border=\"1\">");
        out.println("<tr bgcolor=\"#5A5CB8\">");
View Full Code Here

    public void init(Properties props) throws Exception {
        name = props.getProperty("name");
        EjbServer ejbServer = new EjbServer();
        ServerServiceAdapter adapter = new ServerServiceAdapter(ejbServer);

        SystemInstance systemInstance = SystemInstance.get();
        HttpListenerRegistry registry = systemInstance.getComponent(HttpListenerRegistry.class);
        if (registry == null){
            registry = new HttpListenerRegistry();
            systemInstance.setComponent(HttpListenerRegistry.class, registry);
        }

        registry.addHttpListener(adapter, "/ejb/?.*");

        // todo this breaks the http ejb server impl
        // the service manage makes a static decision based on the interface of this class to create
        // a service daemon socket or not.  Since jetty is "self managed" and throws an exception from
        // service socket, this breaks this code
//        // props can name an implementation
//        // if implementation is not named, use jetty if jetty classes are present; otherwise use openejb
//        String impl = props.getProperty("impl");
//        if ("Jetty".equalsIgnoreCase(impl)) {
//            httpServer = (HttpServer) getClass().getClassLoader().loadClass("org.apache.openejb.server.httpd.JettyHttpServer").newInstance();
//        } else if ("OpenEJB".equalsIgnoreCase(impl)) {
            httpServer = new OpenEJBHttpServer(registry);
//        } else if (impl == null) {
//            try {
//                getClass().getClassLoader().loadClass("org.mortbay.jetty.Server");
//                httpServer = (HttpServer) getClass().getClassLoader().loadClass("org.apache.openejb.server.httpd.JettyHttpServer").newInstance();
//            } catch (Exception ignored) {
//                // Jetty classes not available
//                httpServer = new OpenEJBHttpServer(registry);
//            }
//        } else {
//            throw new IllegalArgumentException("Unknown HTTP server impl '" + impl + "'. Valid implementation are OpenEJB and Jetty.");
//        }

        // register the http server
        systemInstance.setComponent(HttpServer.class, httpServer);

        httpServer.init(props);
        ejbServer.init(props);
    }
View Full Code Here

            }
        }

        // get SystemInstance (the only static class in the system)
        // so we'll set up all the props in it
        SystemInstance systemInstance = null;
        try {
            SystemInstance.init(System.getProperties());
            systemInstance = SystemInstance.get();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(2);
        }

        // Read in and apply the conf/system.properties
        try {
            File conf = systemInstance.getBase().getDirectory("conf");
            File file = new File(conf, "system.properties");
            if (file.exists()){
                Properties systemProperties = new Properties();
                FileInputStream fin = new FileInputStream(file);
                InputStream in = new BufferedInputStream(fin);
View Full Code Here

    }

    private static void configureInternal() throws IOException {

        System.setProperty("openjpa.Log", "log4j");
        SystemInstance system = SystemInstance.get();
        FileUtils base = system.getBase();
        File confDir = base.getDirectory("conf");
        File loggingPropertiesFile = new File(confDir, LOGGING_PROPERTIES_FILE);
        if (confDir.exists()) {
            if (loggingPropertiesFile.exists()) {
                BufferedInputStream bis = new BufferedInputStream(new FileInputStream(loggingPropertiesFile));
View Full Code Here

                }
            }
        }

        try {
            SystemInstance system = SystemInstance.get();
            File libs = system.getHome().getDirectory("lib");
            system.getClassPath().addJarsToPath(libs);
            initServer();
        } catch (DontStartServerException ignored) {
        } catch (Exception e) {
            e.printStackTrace();
        }
View Full Code Here

TOP

Related Classes of org.apache.openejb.loader.SystemInstance

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.