com.ibm.di.store
Class StoreFactory

java.lang.Object
  extended by com.ibm.di.store.StoreFactory

public class StoreFactory
extends Object


Field Summary
static String DEFAULT_PROPERTYSTORE
           
static String REGEX
           
static String VARCHAR_LENGTH
           
 
Constructor Summary
StoreFactory()
           
 
Method Summary
static void debugmsg(String msg)
           
static Object deserializeObject(Object o)
          Deserializes a byte array into a Java object.
static boolean dropTable(Connection connection, String table)
          Drops a table in the database associated with connection.
static Exception dropTable(String tableName)
          Drops a table in the default database.
static Connection getConnection()
          Returns a connection object to the default database.
static Connection getConnection(boolean autoCommit)
          Returns a connection object to the default database using the default username/password.
static Connection getConnection(String database)
          Returns a connection object to the named database with AutoCommit set to TRUE using the default username/password.
static Connection getConnection(String database, boolean autoCommit)
          Returns a connection object to the named database with the default username/password.
static Connection getConnection(String database, boolean autoCommit, String user, String password, Properties info)
          Returns a connection to the named database.
static PropertyStore getDefaultPropertyStore()
          Returns the default property store.
static DeltaStore getDeltaStore(String identifier, boolean isRestarting)
          Returns the DeltaStore with identifier
static PropertyStore getPropertyStore(String name)
          Returns the PropertyStore identified by name.
static String getSystemDatabase()
          Returns the default system database name
static String getSystemDatabaseURL()
          Returns the SystemStore JDBC URL.
static Vector getTables(Connection connection, String table)
           
static boolean isCloudscapeNetworkDriver(String driver)
          Determines if the passed driver is a Cloudscape Network Driver.
static boolean isDerbyDriver(String driver)
           
static boolean isMSSQLDriver(String driver)
           
static void logmsg(String msg)
           
static void releaseDB(String id)
           
static void retainDB(String id, String db)
           
static byte[] serializeObject(Object obj)
          Serializes an object to a byte array.
static void shutdown()
          Shuts down all open databases.
static void startCloudscapeServer(String hostname, String portNo, boolean sysIBM)
           
static boolean tableExists(Connection connection, String table)
          Checks if a table is accessible in the database.
static boolean verifyTable(Connection connection, String table, Vector sql)
          Verifies that a table is accessible in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PROPERTYSTORE

public static final String DEFAULT_PROPERTYSTORE
See Also:
Constant Field Values

VARCHAR_LENGTH

public static final String VARCHAR_LENGTH

REGEX

public static final String REGEX
See Also:
Constant Field Values
Constructor Detail

StoreFactory

public StoreFactory()
Method Detail

getDefaultPropertyStore

public static PropertyStore getDefaultPropertyStore()
                                             throws Exception
Returns the default property store.

Throws:
Exception

getPropertyStore

public static PropertyStore getPropertyStore(String name)
                                      throws Exception
Returns the PropertyStore identified by name. Only one instance of a given name is present at one time.

Parameters:
name - The property store name
Returns:
The property store object associated with name
Throws:
Exception

getDeltaStore

public static DeltaStore getDeltaStore(String identifier,
                                       boolean isRestarting)
                                throws Exception
Returns the DeltaStore with identifier

Parameters:
identifier - The delta table identity/tablename
isRestarting - True if the delta is opened in restart mode
Returns:
The DeltaStore object associated with identifier
Throws:
Exception

getSystemDatabaseURL

public static String getSystemDatabaseURL()
Returns the SystemStore JDBC URL.


getSystemDatabase

public static String getSystemDatabase()
Returns the default system database name


getConnection

public static Connection getConnection()
                                throws Exception
Returns a connection object to the default database. The connection object is in auto-commit mode and uses the default username/password.

Returns:
A connection object to the named database.
Throws:
Exception

getConnection

public static Connection getConnection(boolean autoCommit)
                                throws Exception
Returns a connection object to the default database using the default username/password.

Parameters:
autoCommit - The auto-commit flag
Returns:
A connection object to the named database.
Throws:
Exception

getConnection

public static Connection getConnection(String database)
                                throws Exception
Returns a connection object to the named database with AutoCommit set to TRUE using the default username/password.

Parameters:
database - The database name
Returns:
A connection object to the named database.
Throws:
Exception

getConnection

public static Connection getConnection(String database,
                                       boolean autoCommit)
                                throws Exception
Returns a connection object to the named database with the default username/password.

Parameters:
database - The database name
autoCommit - The auto-commit flag
Returns:
A connection object to the named database.
Throws:
Exception

getConnection

public static Connection getConnection(String database,
                                       boolean autoCommit,
                                       String user,
                                       String password,
                                       Properties info)
                                throws Exception
Returns a connection to the named database.

Parameters:
database - If the value starts with "jdbc:" then it is used asis to obtain a connection object. Otherwise, this method prepends the JDBC_URL setting from the global.properties file and appends ";create=true". When prepending JDBC_URL it is assumed that CloudScape is used.
autoCommit - The auto commit flag set on the connection object
user - The username
password - The password
info - If specified, this method will use the database asis (e.g. no prepend/append) combined with this parameter to obtain a connection object. The info object should contain fields for user and pass and other related parameters to the driver.
Throws:
Exception

dropTable

public static boolean dropTable(Connection connection,
                                String table)
Drops a table in the database associated with connection.

Parameters:
connection - The connection object obtained by getConnection()
table - The table to drop

verifyTable

public static boolean verifyTable(Connection connection,
                                  String table,
                                  Vector sql)
                           throws Exception
Verifies that a table is accessible in the database.

Parameters:
connection - The connection object obtained by getConnection(). If NULL, a connection to the default table is obtained.
table - The table name to verify
sql - A vector of SQL statements to create the table if it does not exist
Throws:
Exception

tableExists

public static boolean tableExists(Connection connection,
                                  String table)
                           throws Exception
Checks if a table is accessible in the database.

Parameters:
connection - The connection object obtained by getConnection(). If NULL, a connection to the default table is obtained.
table - The table name to verify
Throws:
Exception

getTables

public static Vector getTables(Connection connection,
                               String table)
                        throws Exception
Throws:
Exception

shutdown

public static void shutdown()
Shuts down all open databases.


dropTable

public static Exception dropTable(String tableName)
Drops a table in the default database.

Parameters:
tableName - The name of the table to drop.

serializeObject

public static byte[] serializeObject(Object obj)
                              throws Exception
Serializes an object to a byte array.

Parameters:
obj - The object to serialize
Returns:
The byte array containing the serialized object
Throws:
Exception

deserializeObject

public static Object deserializeObject(Object o)
                                throws Exception
Deserializes a byte array into a Java object.

Parameters:
o - The byte array with the serialized Java object
Returns:
The resurrected java object
Throws:
Exception

retainDB

public static void retainDB(String id,
                            String db)

releaseDB

public static void releaseDB(String id)

logmsg

public static void logmsg(String msg)

debugmsg

public static void debugmsg(String msg)

startCloudscapeServer

public static void startCloudscapeServer(String hostname,
                                         String portNo,
                                         boolean sysIBM)
                                  throws Exception
Throws:
Exception

isCloudscapeNetworkDriver

public static boolean isCloudscapeNetworkDriver(String driver)
Determines if the passed driver is a Cloudscape Network Driver.

Returns:
true if the passed driver is a Cloudscape network driver otherwise false.

isDerbyDriver

public static boolean isDerbyDriver(String driver)

isMSSQLDriver

public static boolean isMSSQLDriver(String driver)