edu.sc.seis.fissuresUtil.database
Class ConnMgr

java.lang.Object
  extended by edu.sc.seis.fissuresUtil.database.ConnMgr

public class ConnMgr
extends java.lang.Object


Field Summary
static java.lang.String DB_SERVER_PORT
           
static java.lang.String DBPASSWORD_KEY
           
static java.lang.String DBURL_KEY
           
static java.lang.String DBUSER_KEY
           
static java.lang.String DEFAULT
           
static java.lang.String HSQL
           
static java.lang.String MCKOI
           
static java.lang.String MYSQL
           
static java.lang.String MYSQL_PROPS
           
static java.lang.String ORACLE
           
static java.lang.String ORACLE_PROPS
           
static java.lang.String POSTGRES
           
static java.lang.String POSTGRES_PROPS
           
 
Constructor Summary
ConnMgr()
           
 
Method Summary
static void addPropsLocation(java.lang.String loc)
          Use this method to add loacations for sql property files to be stored When setDB is loaded, if there is a default.props file at that location, it will be added to the existing properties, and if one of the .props exists, it will also be loaded.
static java.sql.Connection createConnection()
           
static java.lang.String getDB_TYPE()
           
static java.util.Properties getDBProps()
           
static java.lang.String getDriver()
           
static java.lang.String getPass()
           
static java.lang.String getSQL(java.lang.String key)
           
static java.lang.String getURL()
           
static java.lang.String getUser()
           
static boolean hasSQL(java.lang.String key)
           
static void installDbProperties(java.util.Properties sysProperties, java.util.Properties dbProperties)
           
static void installDbProperties(java.util.Properties sysProperties, java.lang.String[] args)
           
static java.util.Properties readDbProperties(java.lang.String[] args)
           
static void setDB()
          Sets the ConnMgr to use the default db, which as of now is an in-memory HSQLDb
static void setDB(java.util.Properties newprops)
           
static void setDB(java.lang.String dbName)
          Sets the DB to be used based on the default values for the name.
static void setURL(java.lang.String url)
           
static void setURL(java.lang.String url, java.lang.String databaseUser, java.lang.String databasePassword)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final java.lang.String DEFAULT
See Also:
Constant Field Values

HSQL

public static final java.lang.String HSQL
See Also:
Constant Field Values

MCKOI

public static final java.lang.String MCKOI
See Also:
Constant Field Values

MYSQL

public static final java.lang.String MYSQL
See Also:
Constant Field Values

MYSQL_PROPS

public static final java.lang.String MYSQL_PROPS
See Also:
Constant Field Values

ORACLE

public static final java.lang.String ORACLE
See Also:
Constant Field Values

ORACLE_PROPS

public static final java.lang.String ORACLE_PROPS
See Also:
Constant Field Values

POSTGRES

public static final java.lang.String POSTGRES
See Also:
Constant Field Values

POSTGRES_PROPS

public static final java.lang.String POSTGRES_PROPS
See Also:
Constant Field Values

DB_SERVER_PORT

public static final java.lang.String DB_SERVER_PORT
See Also:
Constant Field Values

DBURL_KEY

public static final java.lang.String DBURL_KEY
See Also:
Constant Field Values

DBUSER_KEY

public static final java.lang.String DBUSER_KEY
See Also:
Constant Field Values

DBPASSWORD_KEY

public static final java.lang.String DBPASSWORD_KEY
See Also:
Constant Field Values
Constructor Detail

ConnMgr

public ConnMgr()
Method Detail

addPropsLocation

public static void addPropsLocation(java.lang.String loc)
Use this method to add loacations for sql property files to be stored When setDB is loaded, if there is a default.props file at that location, it will be added to the existing properties, and if one of the .props exists, it will also be loaded.


setDB

public static void setDB()
                  throws java.io.IOException
Sets the ConnMgr to use the default db, which as of now is an in-memory HSQLDb

Throws:
java.io.IOException

setDB

public static void setDB(java.lang.String dbName)
                  throws java.io.IOException
Sets the DB to be used based on the default values for the name. Names fissuresUtil knows are ConnMgr.MCKOI, ConnMgr.HSQL, and ConnMgr.POSTGRES

Throws:
java.io.IOException - if some of the props don't load

setDB

public static void setDB(java.util.Properties newprops)

hasSQL

public static boolean hasSQL(java.lang.String key)

getSQL

public static java.lang.String getSQL(java.lang.String key)

getDriver

public static java.lang.String getDriver()

getDB_TYPE

public static java.lang.String getDB_TYPE()

setURL

public static void setURL(java.lang.String url)

setURL

public static void setURL(java.lang.String url,
                          java.lang.String databaseUser,
                          java.lang.String databasePassword)

getURL

public static java.lang.String getURL()

getPass

public static java.lang.String getPass()

getUser

public static java.lang.String getUser()

getDBProps

public static java.util.Properties getDBProps()

createConnection

public static java.sql.Connection createConnection()
                                            throws java.sql.SQLException
Throws:
java.sql.SQLException

installDbProperties

public static void installDbProperties(java.util.Properties sysProperties,
                                       java.util.Properties dbProperties)

readDbProperties

public static java.util.Properties readDbProperties(java.lang.String[] args)

installDbProperties

public static void installDbProperties(java.util.Properties sysProperties,
                                       java.lang.String[] args)