|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectavignon.handlers.database.DatabaseConnection
Encapsulates a connection to a database. The database driver used is defined by the DatabaseDriver property in the Avignon properties file. The JDBC url to use is defined by the DatabaseURL property.
| Constructor Summary | |
protected |
DatabaseConnection()
Constructs a database connection with no commandQueue. |
|
DatabaseConnection(java.lang.String driver,
java.lang.String url,
java.lang.String user,
java.lang.String password)
|
| Method Summary | |
void |
addCommand(DatabaseCommand command)
Queues a command to be executed. |
void |
copyTable(java.lang.String originalName,
java.lang.String destinationName)
Executes a SQL statement that will make a copy of a table. |
boolean |
equals(java.lang.Object value)
|
void |
executeCommand(DatabaseCommand command)
Adds the given command to the queue and executes all commandQueue in the queue. |
void |
executeCommands()
Calls the execute method of each command currently in the queue. |
protected java.util.List |
getCommandQueue()
|
java.sql.Connection |
getConnection()
Returns a new java.sql.Connection to the database defined by the Avignon properties. |
static DatabaseConnection |
newConnection()
|
protected void |
setCommandQueue(java.util.List commandQueue)
|
static void |
shunt(java.util.List queue,
java.sql.SQLException error)
|
boolean |
tableExists(java.lang.String name)
Determines if the table with the given name exists or not. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected DatabaseConnection()
public DatabaseConnection(java.lang.String driver,
java.lang.String url,
java.lang.String user,
java.lang.String password)
| Method Detail |
public static DatabaseConnection newConnection()
public static void shunt(java.util.List queue,
java.sql.SQLException error)
public java.sql.Connection getConnection()
throws java.sql.SQLException
java.sql.SQLExceptionpublic boolean tableExists(java.lang.String name)
name -
public void copyTable(java.lang.String originalName,
java.lang.String destinationName)
originalName - destinationName - public void addCommand(DatabaseCommand command)
command -
public void executeCommand(DatabaseCommand command)
throws java.sql.SQLException
command -
java.sql.SQLException
public void executeCommands()
throws java.sql.SQLException
java.sql.SQLExceptionprotected java.util.List getCommandQueue()
protected void setCommandQueue(java.util.List commandQueue)
public boolean equals(java.lang.Object value)
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||