|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.dyade.aaa.util.MySqlDBRepository
public final class MySqlDBRepository
This class allows to use a MySQL database as repository with the NTransaction module.
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));
NTransaction
,
Repository
Field Summary | |
---|---|
static org.objectweb.util.monolog.api.Logger |
logger
|
Constructor Summary | |
---|---|
MySqlDBRepository()
|
Method Summary | |
---|---|
void |
close()
Closes the repository. |
void |
commit()
Commits all changes to the repository. |
void |
delete(java.lang.String dirName,
java.lang.String name)
Deletes the corresponding objects in repository. |
int |
getNbBadDeletedObjects()
Returns the number of useless delete operation on repository. |
int |
getNbDeletedObjects()
Returns the number of delete operation on repository. |
int |
getNbLoadedObjects()
Returns the number of load operation from repository. |
int |
getNbSavedObjects()
Returns the number of save operation to repository. |
void |
init(java.io.File dir)
Initializes the repository. |
java.lang.String[] |
list(java.lang.String prefix)
Gets a list of persistent objects that name corresponds to prefix. |
byte[] |
load(java.lang.String dirName,
java.lang.String name)
Loads the byte array. |
java.lang.Object |
loadobj(java.lang.String dirName,
java.lang.String name)
Loads the object. |
void |
save(java.lang.String dirName,
java.lang.String name,
byte[] content)
Save the corresponding bytes array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static org.objectweb.util.monolog.api.Logger logger
Constructor Detail |
---|
public MySqlDBRepository()
Method Detail |
---|
public int getNbSavedObjects()
getNbSavedObjects
in interface Repository
public int getNbDeletedObjects()
getNbDeletedObjects
in interface Repository
public int getNbBadDeletedObjects()
getNbBadDeletedObjects
in interface Repository
public int getNbLoadedObjects()
getNbLoadedObjects
in interface Repository
public void init(java.io.File dir) throws java.io.IOException
init
in interface Repository
java.io.IOException
public java.lang.String[] list(java.lang.String prefix) throws java.io.IOException
list
in interface Repository
java.io.IOException
public void save(java.lang.String dirName, java.lang.String name, byte[] content) throws java.io.IOException
save
in interface Repository
java.io.IOException
public java.lang.Object loadobj(java.lang.String dirName, java.lang.String name) throws java.io.IOException, java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
java.io.IOException
public byte[] load(java.lang.String dirName, java.lang.String name) throws java.io.IOException
load
in interface Repository
java.io.IOException
public void delete(java.lang.String dirName, java.lang.String name) throws java.io.IOException
delete
in interface Repository
java.io.IOException
public void commit() throws java.io.IOException
commit
in interface Repository
java.io.IOException
public void close() throws java.io.IOException
close
in interface Repository
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |