Package org.apache.openejb.server

Examples of org.apache.openejb.server.ServiceException


            return;
        }
        try {
            serverControl.shutdown();
        } catch (Exception e) {
            throw new ServiceException(e);
        } finally {
            serverControl = null;
        }
    }
View Full Code Here


                this.address = new InetSocketAddress(inetAddress, port);
                multicast = new Multicast(tracker);
            }
        } catch (Exception e) {
            throw new ServiceException(e);
        }
    }
View Full Code Here

            String value = (String) entry.getValue();

            if (property.startsWith(ServerConstants.SC_KEY_DBNAME + ".") ||
                    property.startsWith(ServerConstants.SC_KEY_DATABASE + ".")) {

                throw new ServiceException("Databases cannot be declared in the hsql.properties.  " +
                        "Instead declare a database connection in the openejb.conf file");
            }

            if ("port".equals(property)) {
                properties.setProperty(ServerConstants.SC_KEY_PORT, value);
            } else if ("bind".equals(property)) {
                properties.setProperty(ServerConstants.SC_KEY_ADDRESS, value);
            } else {
                properties.setProperty(property, value);
            }
        }
        properties.setProperty(ServerConstants.SC_KEY_NO_SYSTEM_EXIT, "true");

        boolean disabled = Boolean.parseBoolean(properties.getProperty("disabled"));
        ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
        if (!disabled && containerSystem != null) {
            NamingEnumeration<Binding> bindings = null;
            try {
                bindings = containerSystem.getJNDIContext().listBindings("openejb/Resource/");
                Set<String> dbnames = new TreeSet<String>();
                for (Binding binding : Collections.list(bindings)) {
                    Object value = binding.getObject();
                    if (value instanceof BasicDataSource) {
                        BasicDataSource jdbc = (BasicDataSource) value;
                        String path = getPath(jdbc);
                        if (path != null) {
                            if (dbnames.size() > 9) {
                                throw new ServiceException("Hsql Server can only host 10 database instances");
                            }
                            String dbname = path.substring(path.lastIndexOf(':') + 1);
                            dbname = dbname.substring(dbname.lastIndexOf('/') + 1);
                            if (!dbnames.contains(dbname)) {
                                properties.put(ServerConstants.SC_KEY_DBNAME + "." + dbnames.size(), dbname);
View Full Code Here

    public void start() throws ServiceException {
        try {
            server.start();
        } catch (Exception e) {
            throw new ServiceException(e);
        }
    }
View Full Code Here

    public void stop() throws ServiceException {
        try {
            server.stop();
        } catch (Exception e) {
            throw new ServiceException(e);
        }
    }
View Full Code Here

                    multipointServer.connect(URI.create("conn://"+st.nextToken().trim()));
                }

            }
        } catch (Exception e) {
            throw new ServiceException(port+"", e);
        }
    }
View Full Code Here

                    multipointServer.connect(URI.create("conn://"+st.nextToken().trim()));
                }

            }
        } catch (Exception e) {
            throw new ServiceException(e);
        }
    }
View Full Code Here

            String value = (String) entry.getValue();

            if (property.startsWith(sc_key_dbname + ".") ||
                    property.startsWith(sc_key_database + ".")) {

                throw new ServiceException("Databases cannot be declared in the hsql.properties.  " +
                        "Instead declare a database connection in the openejb.conf file");
            }

            if ("port".equals(property)) {
                properties.setProperty(sc_key_port, value);
            } else if ("bind".equals(property)) {
                properties.setProperty(sc_key_address, value);
            } else {
                properties.setProperty(property, value);
            }
        }
        properties.setProperty(sc_key_no_system_exit, "true");

        boolean disabled = Boolean.parseBoolean(properties.getProperty("disabled"));
        ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
        if (!disabled && containerSystem != null) {
            NamingEnumeration<Binding> bindings;
            try {
                bindings = containerSystem.getJNDIContext().listBindings("openejb/Resource/");
                Set<String> dbnames = new TreeSet<String>();
                for (Binding binding : Collections.list(bindings)) {
                    Object value = binding.getObject();
                    if (value instanceof BasicDataSource) {
                        BasicDataSource jdbc = (BasicDataSource) value;
                        String path = getPath(jdbc);
                        if (path != null) {
                            if (dbnames.size() > 9) {
                                throw new ServiceException("Hsql Server can only host 10 database instances");
                            }
                            String dbname = path.substring(path.lastIndexOf(':') + 1);
                            dbname = dbname.substring(dbname.lastIndexOf('/') + 1);
                            if (!dbnames.contains(dbname)) {
                                properties.put(sc_key_dbname + "." + dbnames.size(), dbname);
View Full Code Here

                this.address = new InetSocketAddress(inetAddress, port);
                multicast = new Multicast(tracker);
            }
        } catch (Exception e) {
            throw new ServiceException(e);
        }
    }
View Full Code Here

                    multipointServer.connect(URI.create("conn://"+st.nextToken().trim()));
                }

            }
        } catch (Exception e) {
            throw new ServiceException(port+"", e);
        }
    }
View Full Code Here

TOP

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

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.