Inheritance diagram for fr.dyade.aaa.util.MySqlDBRepository:


Public Member Functions | |
| int | getNbSavedObjects () |
| int | getNbDeletedObjects () |
| int | getNbBadDeletedObjects () |
| int | getNbLoadedObjects () |
| void | init (File dir) throws IOException |
| String[] | list (String prefix) throws IOException |
| void | save (String dirName, String name, byte[] content) throws IOException |
| Object | loadobj (String dirName, String name) throws IOException, ClassNotFoundException |
| byte[] | load (String dirName, String name) throws IOException |
| void | delete (String dirName, String name) throws IOException |
| void | commit () throws IOException |
| void | close () throws IOException |
Static Public Attributes | |
| static Logger | logger |
Package Functions | |
| MySqlDBRepository () | |
Package Attributes | |
| String | driver = System.getProperty("DBDriver", "org.gjt.mm.mysql.Driver") |
| String | connurl = System.getProperty("ConnURL", "jdbc:mysql://localhost:3306/mysql") |
| String | user = System.getProperty("DBUser", "root") |
| String | pass = System.getProperty("DBPass", "") |
| BasicDataSource | ds = null |
| boolean | reconnectLoop = false |
| File | dir = null |
| Connection | conn = null |
| PreparedStatement | insertStmt = null |
| PreparedStatement | updateStmt = null |
| PreparedStatement | deleteStmt = null |
The basic setup at the code to get Database code to run is the same.
The additional thing when using MySQL database is:
<property name="Transaction" value="fr.dyade.aaa.util.NTransaction"/> <property name="NTRepositoryImpl" value="fr.dyade.aaa.util.MySqlDBRepository"/> <property name="DBDriver" value="org.gjt.mm.mysql.Driver"/> <property name="ConnURL" value="jdbc:mysql://hostname:3306/instance"/> <property name="DBUser" value="dbUserName"/> <property name="DBPass" value="dbPassword"/>
CLASSPATH=$CLASSPATH:$VIATOR_LIB/mysql-connector-java-5.0.5-bin.jar CLASSPATH=$CLASSPATH:$VIATOR_LIB/commons-dbcp-1.2.1.jar CLASSPATH=$CLASSPATH:$VIATOR_LIB/commons-pool-1.3.jar
JAVA_ARGS=$JAVA_ARGS" -DNTRepositoryImpl=fr.dyade.aaa.util.MySqlDBRepository -DDBDriver=org.gjt.mm.mysql.Driver -DConnURL=jdbc:mysql://hostname:3306/instance -DDBUser=dbUserName -DDBPass=dbPassword"
CREATE TABLE JoramDB (name VARCHAR(256), content longblob, primary key(name));
Definition at line 100 of file MySqlDBRepository.java.
| int fr.dyade.aaa.util.MySqlDBRepository.getNbSavedObjects | ( | ) |
Returns the number of save operation to repository.
Implements fr.dyade.aaa.util.Repository.
Definition at line 127 of file MySqlDBRepository.java.
| int fr.dyade.aaa.util.MySqlDBRepository.getNbDeletedObjects | ( | ) |
Returns the number of delete operation on repository.
Implements fr.dyade.aaa.util.Repository.
Definition at line 138 of file MySqlDBRepository.java.
| int fr.dyade.aaa.util.MySqlDBRepository.getNbBadDeletedObjects | ( | ) |
Returns the number of useless delete operation on repository.
Implements fr.dyade.aaa.util.Repository.
Definition at line 149 of file MySqlDBRepository.java.
| int fr.dyade.aaa.util.MySqlDBRepository.getNbLoadedObjects | ( | ) |
Returns the number of load operation from repository.
Implements fr.dyade.aaa.util.Repository.
Definition at line 160 of file MySqlDBRepository.java.
| void fr.dyade.aaa.util.MySqlDBRepository.init | ( | File | dir | ) | throws IOException |
Initializes the repository. Opens the connection, evntually creates the database and tables.
Implements fr.dyade.aaa.util.Repository.
Definition at line 176 of file MySqlDBRepository.java.
References fr.dyade.aaa.util.MySqlDBRepository.conn, fr.dyade.aaa.util.MySqlDBRepository.deleteStmt, fr.dyade.aaa.util.MySqlDBRepository.dir, fr.dyade.aaa.util.MySqlDBRepository.driver, fr.dyade.aaa.util.MySqlDBRepository.insertStmt, fr.dyade.aaa.util.MySqlDBRepository.pass, fr.dyade.aaa.util.MySqlDBRepository.updateStmt, and fr.dyade.aaa.util.MySqlDBRepository.user.
| String [] fr.dyade.aaa.util.MySqlDBRepository.list | ( | String | prefix | ) | throws IOException |
Gets a list of persistent objects that name corresponds to prefix.
Implements fr.dyade.aaa.util.Repository.
Definition at line 245 of file MySqlDBRepository.java.
References fr.dyade.aaa.util.MySqlDBRepository.conn, fr.dyade.aaa.util.MySqlDBRepository.logger, and fr.dyade.aaa.util.MySqlDBRepository.reconnectLoop.
| void fr.dyade.aaa.util.MySqlDBRepository.save | ( | String | dirName, | |
| String | name, | |||
| byte[] | content | |||
| ) | throws IOException |
Save the corresponding bytes array.
Implements fr.dyade.aaa.util.Repository.
Definition at line 289 of file MySqlDBRepository.java.
References fr.dyade.aaa.util.MySqlDBRepository.insertStmt, fr.dyade.aaa.util.MySqlDBRepository.logger, fr.dyade.aaa.util.MySqlDBRepository.reconnectLoop, and fr.dyade.aaa.util.MySqlDBRepository.updateStmt.
| Object fr.dyade.aaa.util.MySqlDBRepository.loadobj | ( | String | dirName, | |
| String | name | |||
| ) | throws IOException, ClassNotFoundException |
Loads the object.
Definition at line 362 of file MySqlDBRepository.java.
References fr.dyade.aaa.util.MySqlDBRepository.load(), and fr.dyade.aaa.util.MySqlDBRepository.logger.
Here is the call graph for this function:

| byte [] fr.dyade.aaa.util.MySqlDBRepository.load | ( | String | dirName, | |
| String | name | |||
| ) | throws IOException |
Loads the byte array.
Implements fr.dyade.aaa.util.Repository.
Definition at line 394 of file MySqlDBRepository.java.
References fr.dyade.aaa.util.MySqlDBRepository.conn, fr.dyade.aaa.util.MySqlDBRepository.logger, and fr.dyade.aaa.util.MySqlDBRepository.reconnectLoop.
Referenced by fr.dyade.aaa.util.MySqlDBRepository.loadobj().
| void fr.dyade.aaa.util.MySqlDBRepository.delete | ( | String | dirName, | |
| String | name | |||
| ) | throws IOException |
Deletes the corresponding objects in repository.
Implements fr.dyade.aaa.util.Repository.
Definition at line 456 of file MySqlDBRepository.java.
References fr.dyade.aaa.util.MySqlDBRepository.conn, fr.dyade.aaa.util.MySqlDBRepository.logger, and fr.dyade.aaa.util.MySqlDBRepository.reconnectLoop.
| void fr.dyade.aaa.util.MySqlDBRepository.commit | ( | ) | throws IOException |
Commits all changes to the repository.
Implements fr.dyade.aaa.util.Repository.
Definition at line 499 of file MySqlDBRepository.java.
References fr.dyade.aaa.util.MySqlDBRepository.conn.
| void fr.dyade.aaa.util.MySqlDBRepository.close | ( | ) | throws IOException |
Closes the repository.
Implements fr.dyade.aaa.util.Repository.
Definition at line 514 of file MySqlDBRepository.java.
References fr.dyade.aaa.util.MySqlDBRepository.conn, and fr.dyade.aaa.util.MySqlDBRepository.ds.
1.5.0