// Path: src/main/java/com/waratek/spiracle/sql/util/Constants.java
// public class Constants {
// 
//     public static final String DEFAULT_CONNECTION = "default.connection";
//     public static final String C3P0_POOL_SIZE = "c3p0.maxPoolSize";
//     public static final String JDBC_FETCH_SIZE = "jdbc.fetchsize";
// 
//     public static final String C3P0_ORACLE = "c3p0.oracle";
//     public static final String C3P0_MYSQL = "c3p0.mysql";
//     public static final String C3P0_MSSQL = "c3p0.mssql";
//     public static final String C3P0_DB2 = "c3p0.db2";
//     public static final String C3P0_SYBASE = "c3p0.sybase";
//     public static final String C3P0_POSTGRES = "c3p0.postgres";
// 
//     public static final String C3P0_ORACLE_CLASSNAME = "c3p0.oracle.classname";
//     public static final String C3P0_MYSQL_CLASSNAME = "c3p0.mysql.classname";
//     public static final String C3P0_MSSQL_CLASSNAME = "c3p0.mssql.classname";
//     public static final String C3P0_DB2_CLASSNAME = "c3p0.db2.classname";
//     public static final String C3P0_SYBASE_CLASSNAME = "c3p0.sybase.classname";
//     public static final String C3P0_POSTGRES_CLASSNAME = "c3p0.postgres.classname";
// 
//     public static final String ORACLE = "oracle";
//     public static final String MYSQL = "mysql";
//     public static final String MSSQL = "mssql";
//     public static final String DB2 = "db2";
//     public static final String SYBASE = "sybase";
//     public static final String POSTGRES = "postgres";
// 
//     public static final String ORACLE_CONNECTION_POOL = "oracleConnectionPool";
//     public static final String MYSQL_CONNECTION_POOL = "mysqlConnectionPool";
//     public static final String MSSQL_CONNECTION_POOL = "mssqlConnectionPool";
//     public static final String DB2_CONNECTION_POOL = "db2ConnectionPool";
//     public static final String SYBASE_CONNECTION_POOL = "sybaseConnectionPool";
//     public static final String POSTGRES_CONNECTION_POOL = "postgresConnectionPool";
// 
//     public final static String ORACLE_CONNECTION_DATA = "oracleConnectionData";
//     public final static String MYSQL_CONNECTION_DATA = "mysqlConnectionData";
//     public final static String MSSQL_CONNECTION_DATA = "mssqlConnectionData";
//     public final static String DB2_CONNECTION_DATA = "db2ConnectionData";
//     public final static String SYBASE_CONNECTION_DATA = "sybaseConnectionData";
//     public final static String POSTGRES_CONNECTION_DATA = "postgresConnectionData";
// }


import com.mchange.v2.c3p0.ComboPooledDataSource;
import com.waratek.spiracle.sql.util.Constants;
import java.text.MessageFormat;
import java.beans.PropertyVetoException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
/*
 *  Copyright 2014 Waratek Ltd.
 *
 *  Licensed 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 com.waratek.spiracle.init;





@WebListener
public class SpiracleInit implements ServletContextListener {

    private static final Logger logger = Logger.getLogger(SpiracleInit.class);

    public void contextDestroyed(ServletContextEvent arg0) {
        ServletContext application = arg0.getServletContext();
// Path: src/main/java/com/waratek/spiracle/sql/util/Constants.java
// public class Constants {
// 
//     public static final String DEFAULT_CONNECTION = "default.connection";
//     public static final String C3P0_POOL_SIZE = "c3p0.maxPoolSize";
//     public static final String JDBC_FETCH_SIZE = "jdbc.fetchsize";
// 
//     public static final String C3P0_ORACLE = "c3p0.oracle";
//     public static final String C3P0_MYSQL = "c3p0.mysql";
//     public static final String C3P0_MSSQL = "c3p0.mssql";
//     public static final String C3P0_DB2 = "c3p0.db2";
//     public static final String C3P0_SYBASE = "c3p0.sybase";
//     public static final String C3P0_POSTGRES = "c3p0.postgres";
// 
//     public static final String C3P0_ORACLE_CLASSNAME = "c3p0.oracle.classname";
//     public static final String C3P0_MYSQL_CLASSNAME = "c3p0.mysql.classname";
//     public static final String C3P0_MSSQL_CLASSNAME = "c3p0.mssql.classname";
//     public static final String C3P0_DB2_CLASSNAME = "c3p0.db2.classname";
//     public static final String C3P0_SYBASE_CLASSNAME = "c3p0.sybase.classname";
//     public static final String C3P0_POSTGRES_CLASSNAME = "c3p0.postgres.classname";
// 
//     public static final String ORACLE = "oracle";
//     public static final String MYSQL = "mysql";
//     public static final String MSSQL = "mssql";
//     public static final String DB2 = "db2";
//     public static final String SYBASE = "sybase";
//     public static final String POSTGRES = "postgres";
// 
//     public static final String ORACLE_CONNECTION_POOL = "oracleConnectionPool";
//     public static final String MYSQL_CONNECTION_POOL = "mysqlConnectionPool";
//     public static final String MSSQL_CONNECTION_POOL = "mssqlConnectionPool";
//     public static final String DB2_CONNECTION_POOL = "db2ConnectionPool";
//     public static final String SYBASE_CONNECTION_POOL = "sybaseConnectionPool";
//     public static final String POSTGRES_CONNECTION_POOL = "postgresConnectionPool";
// 
//     public final static String ORACLE_CONNECTION_DATA = "oracleConnectionData";
//     public final static String MYSQL_CONNECTION_DATA = "mysqlConnectionData";
//     public final static String MSSQL_CONNECTION_DATA = "mssqlConnectionData";
//     public final static String DB2_CONNECTION_DATA = "db2ConnectionData";
//     public final static String SYBASE_CONNECTION_DATA = "sybaseConnectionData";
//     public final static String POSTGRES_CONNECTION_DATA = "postgresConnectionData";
// }


// Path: src/main/java/com/waratek/spiracle/init/SpiracleInit.java
import com.mchange.v2.c3p0.ComboPooledDataSource;
import com.waratek.spiracle.sql.util.Constants;
import java.text.MessageFormat;
import java.beans.PropertyVetoException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

/*
 *  Copyright 2014 Waratek Ltd.
 *
 *  Licensed 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 com.waratek.spiracle.init;





@WebListener
public class SpiracleInit implements ServletContextListener {

    private static final Logger logger = Logger.getLogger(SpiracleInit.class);

    public void contextDestroyed(ServletContextEvent arg0) {
        ServletContext application = arg0.getServletContext();
        ((ComboPooledDataSource) application.getAttribute(Constants.ORACLE_CONNECTION_POOL)).close();