|
DODS 5.1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.dods.DODS
Main DODS class. There are two modes of usage: non-threading and threading. In non-threading mode, only one DatabaseManager is used for the whole application, no matter the application has one or more Threads. In threading mode, there is one DatabaseManager for every Thread. User needs, for every Thread, to define the DatabaseManager. If, for any Thread, the DatabaseManager is not defined, the default DatabaseManager is used.
Example for non-threading mode:
... try { String fileName = "discRack.conf"; DatabaseManager dbManager = StandardDatabaseManager.newInstance(fileName); DODS.register(dbManager); } catch (Exception e) { e.printStackTrace(); } ...
Field Summary | |
protected static java.lang.String |
LOG4J_CONF_FILE
|
Constructor Summary | |
DODS()
|
Method Summary | |
static DatabaseManager |
getDatabaseManager()
Returns the DatabaseManager object for the current thread. |
static DatabaseManager |
getDatabaseManager(java.lang.Thread thread)
Returns the DatabaseManager object for the given thread. |
static DatabaseManager |
getDefaultDatabaseManager()
Returns the default DatabaseManager. |
static org.apache.log4j.Logger |
getDefaultLogger()
Returns the default logger. |
static org.apache.log4j.Logger |
getLogger()
Returns the logger object for the current thread. |
static org.apache.log4j.Logger |
getLogger(java.lang.Thread thread)
Returns the logger object for the given thread. |
protected static void |
init()
Initializes DODS. |
static boolean |
isThreading()
Returns the mode of usage. |
static void |
main(java.lang.String[] args)
|
static void |
register(DatabaseManager databaseManager)
In threading mode, this method associates the DatabaseManager object with the current thread. |
static void |
register(java.lang.Thread thread,
DatabaseManager databaseManager)
Associates the given DatabaseManager object with given thread. |
static void |
registerDefault(DatabaseManager databaseManager)
Sets the default DatabaseManager. |
static void |
registerDefault(java.lang.String fileName)
Sets the default DatabaseManager. |
static void |
registerDefaultLogger(org.apache.log4j.Logger logger)
Sets the default logger. |
static void |
registerDefaultLogger(java.lang.String name)
Sets the default logger. |
static void |
registerLogger(org.apache.log4j.Logger logger)
In threading mode, this method associates the logger object with
the current thread. |
static void |
registerLogger(java.lang.String name)
In threading mode, this method associates the logger object with the current thread. |
static void |
registerLogger(java.lang.Thread thread,
org.apache.log4j.Logger logger)
Associates the given logger object with the given thread. |
static void |
registerLogger(java.lang.Thread thread,
java.lang.String name)
Associates the given logger object with given thread. |
static void |
setThreading(boolean mode)
Sets mode of usage. |
static void |
shutdown()
Shutdowns all DatabaseManager s and Loggers s. |
static void |
startup(java.lang.Thread thread,
java.lang.String fileName)
Associates DatabaseManager created by the given fileName with given thread. |
static void |
stratup(java.lang.String fileName)
In threading mode, this method associates the DatabaseManager object with the current thread. |
static DatabaseManager |
unregister()
In threading mode, this method unregisters DatabaseManager
associated with the current thread. |
static DatabaseManager |
unregister(java.lang.Thread thread)
Unregisters DatabaseManager associated with the given thread. |
static DatabaseManager |
unregisterDefault()
Unregisters default DatabaseManager . |
static org.apache.log4j.Logger |
unregisterDefaultLogger()
Unregisters default Logger . |
static org.apache.log4j.Logger |
unregisterLogger()
In threading mode, this method unregisters Logger
associated with the current thread. |
static org.apache.log4j.Logger |
unregisterLogger(java.lang.Thread thread)
Unregisters Logger associated with the given thread. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String LOG4J_CONF_FILE
Constructor Detail |
public DODS()
Method Detail |
public static void registerDefault(DatabaseManager databaseManager)
databaseManager
- the DatabaseManager to be set as default.public static void registerDefault(java.lang.String fileName) throws com.lutris.util.ConfigException, DatabaseManagerException, java.sql.SQLException
fileName
- full path name of the application configuration file.
com.lutris.util.ConfigException
DatabaseManagerException
java.sql.SQLException
public static void register(DatabaseManager databaseManager)
null
, it will also be set.
In non-threading mode, only default DatabaseManager will be set.
databaseManager
- the DatabaseManager to associate
with current thread.public static void stratup(java.lang.String fileName) throws com.lutris.util.ConfigException, DatabaseManagerException, java.sql.SQLException
null
, it will also be set.
In non-threading mode, only default DatabaseManager will be set.
fileName
- full path name of the application configuration file
which will create DatabaseManager
associate with current thread.
com.lutris.util.ConfigException
DatabaseManagerException
java.sql.SQLException
public static void register(java.lang.Thread thread, DatabaseManager databaseManager)
thread
- the thread to associate with DatabaseManager
.databaseManager
- the DatabaseManager to associate the Thread
.public static void startup(java.lang.Thread thread, java.lang.String fileName) throws com.lutris.util.ConfigException, DatabaseManagerException, java.sql.SQLException
thread
- the thread to associate with DatabaseManager
.fileName
- full path name of the application configuration file
which will create DatabaseManager
associate with given thread.
com.lutris.util.ConfigException
DatabaseManagerException
java.sql.SQLException
public static void registerDefaultLogger(java.lang.String name)
name
- logger name, set in log4j configuration file.public static void registerDefaultLogger(org.apache.log4j.Logger logger)
logger
- logger that will be set as default logger.public static void registerLogger(java.lang.String name)
name
- logger name, set in log4j configuration file.public static void registerLogger(org.apache.log4j.Logger logger)
logger
object with
the current thread.
In non-threading mode, only default logger
will be set.
logger
- logger that will be set.public static void registerLogger(java.lang.Thread thread, java.lang.String name)
thread
- the thread to associate with the logger.name
- the logger to associate the Thread
.public static void registerLogger(java.lang.Thread thread, org.apache.log4j.Logger logger)
logger
object with the given thread.
thread
- the thread to associate with logger
.logger
- the logger
to associate the Thread
.public static DatabaseManager unregisterDefault() throws DODSException
DatabaseManager
.
Call this method to release default DatabaseManager
.
DatabaseManager
.
DODSException
- If an error occurs in unregistering the DatabaseManager.public static DatabaseManager unregister() throws DODSException
DatabaseManager
associated with the current thread.
In non-threading mode, only default DatabaseManager
will be unregistered.
Call this method to release DatabaseManager
.
DatabaseManager
.
DODSException
- If an error occurs in unregistering the DatabaseManager.public static DatabaseManager unregister(java.lang.Thread thread) throws DODSException
DatabaseManager
associated with the given thread.
Call this method to release DatabaseManager
.
DatabaseManager
.
DODSException
- If an error occurs in unregistering the DatabaseManager.public static org.apache.log4j.Logger unregisterDefaultLogger() throws DODSException
Logger
.
Call this method to release default Logger
.
Logger
.
DODSException
- If an error occurs in unregistering the logger.public static org.apache.log4j.Logger unregisterLogger() throws DODSException
Logger
associated with the current thread.
In non-threading mode, only default Logger
will be unregistered.
Call this method to release Logger
.
Logger
.
DODSException
- If an error occurs in unregistering the logger.public static org.apache.log4j.Logger unregisterLogger(java.lang.Thread thread) throws DODSException
Logger
associated with the given thread.
Call this method to release Logger
.
Logger
.
DODSException
- If an error occurs in unregistering the logger.public static DatabaseManager getDefaultDatabaseManager()
public static DatabaseManager getDatabaseManager()
DatabaseManager
will be returned.
public static DatabaseManager getDatabaseManager(java.lang.Thread thread)
thread
- the thread to associate with the DatabaseManager
.
public static org.apache.log4j.Logger getDefaultLogger()
public static org.apache.log4j.Logger getLogger()
Logger
will be returned.
public static org.apache.log4j.Logger getLogger(java.lang.Thread thread)
thread
- the thread to associate with the logger.
public static void shutdown() throws DODSException
DatabaseManager
s and Loggers
s.
Call this method to release and shutdown all DatabaseManager
s
and Loggers
s.
DODSException
- If an error occurs in releasing DatabaseManagers and loggers.public static boolean isThreading()
true
, DODS uses multi
threading mode. This means that DODS handles multiple threads, like
Enhydra application server (each application in one Thread
).
If this flag is false
, there can be more then one Thread
,
but there is only one DatabaseManager
for all Thread
s
(for the whole application).
true
if threading mode is used, otherwise
false
.public static void setThreading(boolean mode)
true
, DODS uses multi
threading mode. This means that DODS handles multiple threads, like
Enhydra application server (each application in one Thread
).
If this flag is false
, there can be more then one Thread
,
but there is only one DatabaseManager
for all Thread
s
(for the whole application).
mode
- mode of usage.protected static void init()
public static void main(java.lang.String[] args)
|
DODS 5.1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |