openlsd.database.session
Class LSDDbAdmin

java.lang.Object
  extended by openlsd.database.session.LSDDbAdmin

public class LSDDbAdmin
extends java.lang.Object

Class for Admin through Database

Author:
Frederic Bregier LGPL

Field Summary
static boolean classLoaded
          Info on JDBC Class is already loaded or not
 boolean isConnected
          Is this DB Admin connected
 boolean isMultipleDBAccess
          Is this DB Admin accessed by only one thread at a time (no concurrency and no lock/unlock problem)
 boolean isReadOnly
          Is this DB Admin Read Only
 LSDDbSession session
          session is the Session object for all type of requests
 
Constructor Summary
LSDDbAdmin(java.sql.Connection conn, boolean isread)
          Use a given connexion to create the context.
LSDDbAdmin(java.lang.String driver, java.lang.String server, java.lang.String user, java.lang.String passwd)
          This version creates a default write enabled connection.
LSDDbAdmin(java.lang.String driver, java.lang.String server, java.lang.String user, java.lang.String passwd, boolean write)
          This version creates can create a read only connection if write is false.
 
Method Summary
 void close()
          Close the underlying session.
 void commit()
          Commit on connection
static void initialize(java.lang.String driver)
          Load the correct jdbc driver (default com.mysql.jdbc.Driver)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isConnected

public boolean isConnected
Is this DB Admin connected


isReadOnly

public boolean isReadOnly
Is this DB Admin Read Only


isMultipleDBAccess

public boolean isMultipleDBAccess
Is this DB Admin accessed by only one thread at a time (no concurrency and no lock/unlock problem)


session

public LSDDbSession session
session is the Session object for all type of requests


classLoaded

public static boolean classLoaded
Info on JDBC Class is already loaded or not

Constructor Detail

LSDDbAdmin

public LSDDbAdmin(java.lang.String driver,
                  java.lang.String server,
                  java.lang.String user,
                  java.lang.String passwd)
This version creates a default write enabled connection.
A this time, only one driver is possible! If a new driver is needed, then we need to create a new LSDDbSession object. Be aware that LSDDbSession.initialize should be call only once for each driver, whatever the number of LSDDbSession objects that could be created (=> need a hashtable for specific driver when created). Also, don't know if two drivers at the same time (two different LSDDbSession) is allowed by JDBC.

Parameters:
driver -
server -
user -
passwd -

LSDDbAdmin

public LSDDbAdmin(java.lang.String driver,
                  java.lang.String server,
                  java.lang.String user,
                  java.lang.String passwd,
                  boolean write)
This version creates can create a read only connection if write is false.
A this time, only one driver is possible! If a new driver is needed, then we need to create a new LSDDbSession object. Be aware that LSDDbSession.initialize should be call only once for each driver, whatever the number of LSDDbSession objects that could be created (=> need a hashtable for specific driver when created). Also, don't know if two drivers at the same time (two different LSDDbSession) is allowed by JDBC.

Parameters:
driver -
server -
user -
passwd -
write -

LSDDbAdmin

public LSDDbAdmin(java.sql.Connection conn,
                  boolean isread)
Use a given connexion to create the context.
A this time, only one driver is possible! If a new driver is needed, then we need to create a new LSDDbSession object. Be aware that LSDDbSession.initialize should be call only once for each driver, whatever the number of LSDDbSession objects that could be created (=> need a hashtable for specific driver when created). Also, don't know if two drivers at the same time (two different LSDDbSession) is allowed by JDBC. This version use given connection. typeDriver must be set before !

Parameters:
conn -
isread -
Method Detail

initialize

public static void initialize(java.lang.String driver)
Load the correct jdbc driver (default com.mysql.jdbc.Driver)

Parameters:
driver -

close

public void close()
Close the underlying session. Can be call even for connection given from the constructor LSDDbAdmin(Connection, boolean).


commit

public void commit()
Commit on connection