|
WIDAR Classes | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
ca.nrc.widar.mccc.crm.CrmDb
public class CrmDb
WIDAR/EVLA - CRM: CrmDb Class
A class which facilitates the connection to the MySQL CrmDb that exists (or will exists) on the MCCC.
Copyright: National Research Council of Canada and Associated Universities Inc., 2010, 2011, 2012
![]() |
![]() |
![]() |
![]() |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static java.lang.String |
CLASSNAME
|
static java.lang.String |
DEFAULT_DATABASE
|
static java.lang.String |
DEFAULT_DRIVER
|
static java.lang.String |
DEFAULT_HOST
|
static java.lang.String |
DEFAULT_PASSWORD
|
static java.lang.Integer |
DEFAULT_PORT
|
static java.lang.String |
DEFAULT_URL
|
static java.lang.String |
DEFAULT_USERNAME
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
CrmDb(ca.nrc.widar.jaxb.crm.CrmDbInfo cdiXml)
Common Constructor for the CrmDb Class. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent event)
Receives an ActionEvent, determines the source and performs instructions accordingly. |
void |
addActionListener(java.awt.event.ActionListener listener)
Adds a listener to the action listener list within this class. |
static void |
close()
Attempt to close a connection to the DB |
static boolean |
connect()
Attempt to establish a connection with the database defined in the class variables. |
protected void |
fireActionEvent(java.lang.String value)
Generates an action event for each class listed in the listener list, and calls the actionPerformed method in that class. |
static java.sql.Connection |
getConnection()
Returns the CrmDb Connection for any queries requiring to connect. |
static ca.nrc.widar.jaxb.crm.CrmDbInfo |
getCrmDbInfo()
Returns a CrmDbInfo object with the current CrmDb parameters, including a string version of the URL. |
static java.lang.String |
getHost()
Returns the Host name |
static java.sql.Statement |
getReadOnlyStatement()
Returns a read-only statement for any query requiring a Statement. |
static java.sql.Statement |
getStatement()
Returns a Statement for any query requiring a Statement. |
static void |
halt()
Closes the current CrmDb Connection and sets the running variable to false, allowing the execution loop of this Thread to stop upon being interrupted. |
static boolean |
isConnected()
Return the status of the DB connection |
static boolean |
isDriverLoaded()
Return the status of the DB Driver |
static boolean |
isRunning()
Return the status of the Db Server |
void |
removeActionListener(java.awt.event.ActionListener listener)
Removes a listener from the action listener list within this class. |
void |
run()
The execution loop of the CrmDb object. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CLASSNAME
public static final java.lang.String DEFAULT_HOST
public static final java.lang.String DEFAULT_DATABASE
public static final java.lang.String DEFAULT_DRIVER
public static final java.lang.String DEFAULT_URL
public static final java.lang.String DEFAULT_USERNAME
public static final java.lang.String DEFAULT_PASSWORD
public static final java.lang.Integer DEFAULT_PORT
Constructor Detail |
---|
public CrmDb(ca.nrc.widar.jaxb.crm.CrmDbInfo cdiXml)
cdiXml
- A CrmDbInfo JAXB element containing database connectivity information, or
null if default values are to be used. Note that only attributes
present within the CrmDbInfo object are processed. If attributes are
missing from the object, then default values are used in their place.Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public static boolean connect()
public static java.sql.Connection getConnection()
public static java.sql.Statement getStatement() throws java.sql.SQLException
java.sql.SQLException
public static java.sql.Statement getReadOnlyStatement() throws java.sql.SQLException
java.sql.SQLException
public static void close()
public static void halt()
public static ca.nrc.widar.jaxb.crm.CrmDbInfo getCrmDbInfo()
public static java.lang.String getHost()
public static boolean isDriverLoaded()
public static boolean isConnected()
public static boolean isRunning()
public void addActionListener(java.awt.event.ActionListener listener)
listener
- The class being added to the listener list.public void removeActionListener(java.awt.event.ActionListener listener)
listener
- The class being removed from the listener list.protected void fireActionEvent(java.lang.String value)
value
- A string value that is to be fired as the action in
a newly created ActionEventpublic void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed
in interface java.awt.event.ActionListener
event
- The incoming action event.
|
NRAO/DRAO | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |