
org.apache.openejb.server.hsql.HsqlService Maven / Gradle / Ivy
The newest version!
/**
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.openejb.server.hsql;
import org.apache.openejb.loader.SystemInstance;
import org.apache.openejb.resource.jdbc.plugin.HsqldbDataSourcePlugin;
import org.apache.openejb.server.SelfManaging;
import org.apache.openejb.server.ServerService;
import org.apache.openejb.server.ServiceException;
import org.apache.openejb.spi.ContainerSystem;
import org.hsqldb.Database;
import org.hsqldb.DatabaseManager;
import org.hsqldb.Server;
import org.hsqldb.persist.HsqlDatabaseProperties;
import org.hsqldb.persist.HsqlProperties;
import org.hsqldb.server.ServerConfiguration;
import org.hsqldb.server.ServerConstants;
import javax.naming.Binding;
import javax.naming.NameNotFoundException;
import javax.naming.NamingEnumeration;
import javax.sql.DataSource;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import java.util.Collections;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
/**
* @version $Rev$ $Date$
*/
public class HsqlService implements ServerService, SelfManaging {
// copied from org.hsqldb.server.ServerProperties since it uses package visibility
private static final java.lang.String sc_key_port = "server.port";
private static final java.lang.String sc_key_silent = "server.silent";
private static final java.lang.String sc_key_dbname = "server.dbname";
private static final java.lang.String sc_key_address = "server.address";
private static final java.lang.String sc_key_database = "server.database";
private static final java.lang.String sc_key_no_system_exit = "server.no_system_exit";
private static final String DRIVER_NAME = HsqlDatabaseProperties.PRODUCT_NAME + " Driver";
private int port = ServerConfiguration.getDefaultPort(ServerConstants.SC_PROTOCOL_HSQL, false);
private String ip = ServerConstants.SC_DEFAULT_ADDRESS;
private Server server;
@Override
public String getName() {
return "hsql";
}
@Override
public int getPort() {
return port;
}
@Override
public String getIP() {
return ip;
}
@Override
public void init(final Properties p) throws Exception {
final Properties properties = new Properties();
for (final Map.Entry
© 2015 - 2025 Weber Informatics LLC | Privacy Policy