org.javaWebGen.data
Class DerbySQLDataManager

java.lang.Object
  extended by org.javaWebGen.data.DerbySQLDataManager
All Implemented Interfaces:
DataManager

public class DerbySQLDataManager
extends java.lang.Object
implements DataManager

Author:
Kevin Scott

Field Summary
 java.lang.String BIG_DECIMAL
           
 java.lang.String DATE
           
 java.lang.String INT
           
 java.lang.String LONG
           
 java.lang.String OBJECT
           
 java.lang.String STRING
           
 java.lang.String TIMESTAMP
           
 
Constructor Summary
DerbySQLDataManager()
           
 
Method Summary
 void close(java.sql.Connection con)
          Return a connection back to the pool of available connections
 void endTransaction(java.sql.Connection con)
          commit transaction
 java.lang.String formatDate(java.util.Date date)
          get a String of a date object in the databases native format useful for doing updates etc..
 java.sql.Connection getConnection()
          get db connection
 java.util.Date getDate(java.lang.String dateStr)
          get a date from a date String based on default database format database understands
 int getNextValue(java.sql.Connection con, java.lang.String tablename)
          get next value for the primary key
 int getNextValue(java.lang.String tablename)
          get next value for the primary key
 Sequence getSequence()
           
 java.lang.String getSqlText(java.lang.String text)
          get a String that is escaped (handles ') derby likes \' not ''
 java.lang.String[] getTableList()
           
 void init()
           
 void rollbackTransaction(java.sql.Connection con)
          rollback transaction
 void setDriverClass(java.lang.String name)
          used to change the default database driver
 void setReader(PropertiesReader propReader)
          set db properties reader
 void setSequence(Sequence seq)
          Use this sequence generator NOTE this should not be used by a calling class
 void startTransaction(java.sql.Connection con)
          start Db tranacton
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BIG_DECIMAL

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

LONG

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

INT

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

STRING

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

OBJECT

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

DATE

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

TIMESTAMP

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

DerbySQLDataManager

public DerbySQLDataManager()
Method Detail

setReader

public void setReader(PropertiesReader propReader)
set db properties reader

Specified by:
setReader in interface DataManager
Parameters:
propReader - data base properties reader

setDriverClass

public void setDriverClass(java.lang.String name)
used to change the default database driver

Parameters:
name - of class of driver

getSequence

public Sequence getSequence()
Specified by:
getSequence in interface DataManager

setSequence

public void setSequence(Sequence seq)
Description copied from interface: DataManager
Use this sequence generator NOTE this should not be used by a calling class

Specified by:
setSequence in interface DataManager
Parameters:
seq - sequence object

init

public void init()
Specified by:
init in interface DataManager

getConnection

public final java.sql.Connection getConnection()
                                        throws java.sql.SQLException
Description copied from interface: DataManager
get db connection

Specified by:
getConnection in interface DataManager
Returns:
JDBC connection object
Throws:
java.sql.SQLException

close

public final void close(java.sql.Connection con)
Return a connection back to the pool of available connections

Specified by:
close in interface DataManager
Parameters:
con - close a JDBC connection object

getNextValue

public final int getNextValue(java.lang.String tablename)
                       throws DBException
Description copied from interface: DataManager
get next value for the primary key

Specified by:
getNextValue in interface DataManager
Parameters:
tablename - table name to get next key for
Returns:
the next unique value
Throws:
DBException

getNextValue

public final int getNextValue(java.sql.Connection con,
                              java.lang.String tablename)
                       throws java.sql.SQLException
Description copied from interface: DataManager
get next value for the primary key

Specified by:
getNextValue in interface DataManager
Parameters:
con - db connection
tablename - table name
Throws:
java.sql.SQLException

startTransaction

public void startTransaction(java.sql.Connection con)
                      throws java.sql.SQLException
Description copied from interface: DataManager
start Db tranacton

Specified by:
startTransaction in interface DataManager
Parameters:
con - connection
Throws:
java.sql.SQLException

endTransaction

public void endTransaction(java.sql.Connection con)
                    throws java.sql.SQLException
commit transaction

Specified by:
endTransaction in interface DataManager
Parameters:
con - connection
Throws:
java.sql.SQLException

rollbackTransaction

public void rollbackTransaction(java.sql.Connection con)
rollback transaction

Specified by:
rollbackTransaction in interface DataManager
Parameters:
con - connection

formatDate

public java.lang.String formatDate(java.util.Date date)
get a String of a date object in the databases native format useful for doing updates etc.. when not using databean objects derby uses YYYY-MM-DD by default

Specified by:
formatDate in interface DataManager
Parameters:
date -
Returns:
formatted string of the date

getDate

public java.util.Date getDate(java.lang.String dateStr)
                       throws java.text.ParseException
Description copied from interface: DataManager
get a date from a date String based on default database format database understands

Specified by:
getDate in interface DataManager
Parameters:
dateStr - date text
Returns:
date object
Throws:
java.text.ParseException

getSqlText

public java.lang.String getSqlText(java.lang.String text)
get a String that is escaped (handles ') derby likes \' not ''

Specified by:
getSqlText in interface DataManager
Parameters:
text - input text
Returns:
sql text

getTableList

public java.lang.String[] getTableList()
Specified by:
getTableList in interface DataManager
Returns:
list of current tables


Copyright(C) 2003-2006 Kevin Scott - All Rights Reserved.