org.javaWebGen.data
Class WebLogicDataManager

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

public class WebLogicDataManager
extends java.lang.Object
implements DataManager

Handles talking to Weblogic to get a database conneciton. only can be used inside the Weblogic container(IE inside a EJB, or JSP) sure will be more efficient than doing a JNDI lookup! This has not been tested much because I do not have WebLogic installed. And ony has been tried with an Oracle Database. Will use the built in weblogic connection pool WARNING this is Experimental(


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
protected WebLogicDataManager()
           
 
Method Summary
 void close(java.sql.Connection con)
          close db connection actally just return it it ppol
 void endTransaction(java.sql.Connection con)
          end Db tranacton commiting any uncommited data
 java.lang.String formatDate(java.util.Date date)
          get a String that the Oracle data will accept
 java.sql.Connection getConnection()
          get db connection
 java.util.Date getDate(java.lang.String dateStr)
          get a date object by parsing a string the databases native format usefull for doing updates etc..
 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 escapted( handles ') WARNING is not tested
 java.lang.String[] getTableList()
           
 void init()
           
 void rollbackTransaction(java.sql.Connection con)
          rollback uncommited data ignoring any errors
 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

WebLogicDataManager

protected WebLogicDataManager()
Method Detail

setReader

public void setReader(PropertiesReader propReader)
set db properties reader

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

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 java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Description copied from interface: DataManager
get db connection

Specified by:
getConnection in interface DataManager
Throws:
java.sql.SQLException

close

public void close(java.sql.Connection con)
close db connection actally just return it it ppol

Specified by:
close in interface DataManager
Parameters:
con - db connection

getNextValue

public 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
Throws:
DBException

getNextValue

public 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 - db connection
Throws:
java.sql.SQLException

endTransaction

public void endTransaction(java.sql.Connection con)
                    throws java.sql.SQLException
Description copied from interface: DataManager
end Db tranacton commiting any uncommited data

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

rollbackTransaction

public void rollbackTransaction(java.sql.Connection con)
Description copied from interface: DataManager
rollback uncommited data ignoring any errors

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

formatDate

public java.lang.String formatDate(java.util.Date date)
get a String that the Oracle data will accept

Specified by:
formatDate in interface DataManager
Parameters:
date - to convert
Returns:
date string the database understands

getDate

public java.util.Date getDate(java.lang.String dateStr)
                       throws java.text.ParseException
get a date object by parsing a string the databases native format usefull for doing updates etc.. when not using databean objects mysql uses YYYY-MM-DD by default

Specified by:
getDate in interface DataManager
Parameters:
dateStr - ate string
Returns:
formatted string of the date
Throws:
java.text.ParseException - error converting date

getSqlText

public java.lang.String getSqlText(java.lang.String text)
get a String that is escapted( handles ') WARNING is not tested

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

getTableList

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


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