Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

evt.gui
Class JspmEvtDbMySql  view JspmEvtDbMySql download JspmEvtDbMySql.java

java.lang.Object
  extended byevt.gui.JspmEvtDbMySql
All Implemented Interfaces:
JspmEvtDb

public class JspmEvtDbMySql
extends java.lang.Object
implements JspmEvtDb

This class defines the connection to the event management database. It includes all the methods to create/delete/update events in the JSPM event management database.

Version:
0.0.8

Field Summary
(package private)  java.sql.Connection con
          The database connection used to connect to the SQL database
private static int debugLevel
          The debug level.
private static java.lang.String JSPM_HOME
          The JSPM home directory.
private  com.jdk.JspmLogWriter logWriter
          The log writer class
 
Constructor Summary
JspmEvtDbMySql()
          Constructor.
JspmEvtDbMySql(com.jdk.JspmLogWriter lw)
          Constructor.
 
Method Summary
 void addAction(int msgid, java.lang.String group, int sequence, int fcolor, int bcolor, int attr, int sev, int act, java.lang.String text)
          Adds a action to the action table
 void addEvent(java.lang.String source, java.lang.String node, int type, java.lang.String data)
          This method adds an event to the event management database.
 void addMessage(int id, java.lang.String token, java.lang.String text, java.lang.String dsc, java.lang.String group, java.lang.String owner, java.lang.String node, java.lang.String source)
          Adds a message to the message table
 void close()
          Closes the connection to the JSPMEVT database.
 boolean connect()
          Connects to the local database.
 boolean connect(java.lang.String host, java.lang.String user, java.lang.String passwd)
          Connects to the local database using the specified user/passwd
 int deleteActionByGroup(java.lang.String group)
          Delete action by group
 int deleteActionByMsgid(int msgid)
          Delete action by msgid
 void deleteEvent(int id)
          This method adds an event to the event management database.
 int deleteMessageByGroup(java.lang.String group)
          Delete message by token
 int deleteMessageById(int id)
          Delete message by id
 int deleteMessageByToken(java.lang.String token)
          Delete message by token
 void delKeep(java.lang.String token)
          This deletes a sendkeep message
 java.util.Vector findAction(int msgid)
          This find the action belonging to a specified message.
 java.util.Vector findMessage(java.lang.String data)
          This method gets a list messages which meat the spcified pattern.
 java.sql.Connection getConnection()
          This method returns the connection to the JSPMEVT database.
 int getDbType()
          This method returns the database type.
 int getLastEventId()
          Returns the id of the last row
 int getLastMessageId()
          Returns the id of the last row in the message table
private  java.lang.String getLocalHost()
          This method return the name of the local host.
 java.util.Vector getServer()
          This method gets a list of all event management server.
 void sendKeep(int id, boolean keep)
          This sets the hold flag for the specified event.
 void setAck(int id, boolean ack)
          This sets the hold flag for the specified event.
 void setAttributes(int id, int bcolor, int fcolor, int attr, int sev)
          This set the attributes back_color, fore_color, attr and severity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JSPM_HOME

private static java.lang.String JSPM_HOME
The JSPM home directory. It is taken from the environment variable JSPM_HOME, supplied with the executing batch file.


debugLevel

private static int debugLevel
The debug level. Only events with a severity higher than the debug level are written to the log stream.


logWriter

private com.jdk.JspmLogWriter logWriter
The log writer class


con

java.sql.Connection con
The database connection used to connect to the SQL database

Constructor Detail

JspmEvtDbMySql

public JspmEvtDbMySql()
Constructor.


JspmEvtDbMySql

public JspmEvtDbMySql(com.jdk.JspmLogWriter lw)
Constructor.

Method Detail

connect

public boolean connect()
Connects to the local database. The user and password will be provided by the DB login dialog.

Specified by:
connect in interface JspmEvtDb

connect

public boolean connect(java.lang.String host,
                       java.lang.String user,
                       java.lang.String passwd)
Connects to the local database using the specified user/passwd

Specified by:
connect in interface JspmEvtDb

getLocalHost

private java.lang.String getLocalHost()
This method return the name of the local host.


getConnection

public java.sql.Connection getConnection()
This method returns the connection to the JSPMEVT database.

Specified by:
getConnection in interface JspmEvtDb

getDbType

public int getDbType()
This method returns the database type.

Specified by:
getDbType in interface JspmEvtDb

close

public void close()
Closes the connection to the JSPMEVT database.

Specified by:
close in interface JspmEvtDb

getServer

public java.util.Vector getServer()
This method gets a list of all event management server.

Specified by:
getServer in interface JspmEvtDb

addEvent

public void addEvent(java.lang.String source,
                     java.lang.String node,
                     int type,
                     java.lang.String data)
This method adds an event to the event management database.

Specified by:
addEvent in interface JspmEvtDb

deleteEvent

public void deleteEvent(int id)
This method adds an event to the event management database.

Specified by:
deleteEvent in interface JspmEvtDb

findMessage

public java.util.Vector findMessage(java.lang.String data)
This method gets a list messages which meat the spcified pattern.

Specified by:
findMessage in interface JspmEvtDb

findAction

public java.util.Vector findAction(int msgid)
This find the action belonging to a specified message.

Specified by:
findAction in interface JspmEvtDb

setAttributes

public void setAttributes(int id,
                          int bcolor,
                          int fcolor,
                          int attr,
                          int sev)
This set the attributes back_color, fore_color, attr and severity.

Specified by:
setAttributes in interface JspmEvtDb

sendKeep

public void sendKeep(int id,
                     boolean keep)
This sets the hold flag for the specified event.

Specified by:
sendKeep in interface JspmEvtDb

delKeep

public void delKeep(java.lang.String token)
This deletes a sendkeep message

Specified by:
delKeep in interface JspmEvtDb

setAck

public void setAck(int id,
                   boolean ack)
This sets the hold flag for the specified event.


getLastEventId

public int getLastEventId()
Returns the id of the last row

Specified by:
getLastEventId in interface JspmEvtDb

getLastMessageId

public int getLastMessageId()
Returns the id of the last row in the message table

Specified by:
getLastMessageId in interface JspmEvtDb

addMessage

public void addMessage(int id,
                       java.lang.String token,
                       java.lang.String text,
                       java.lang.String dsc,
                       java.lang.String group,
                       java.lang.String owner,
                       java.lang.String node,
                       java.lang.String source)
Adds a message to the message table

Specified by:
addMessage in interface JspmEvtDb

deleteMessageById

public int deleteMessageById(int id)
Delete message by id

Specified by:
deleteMessageById in interface JspmEvtDb

deleteMessageByToken

public int deleteMessageByToken(java.lang.String token)
Delete message by token

Specified by:
deleteMessageByToken in interface JspmEvtDb

deleteMessageByGroup

public int deleteMessageByGroup(java.lang.String group)
Delete message by token

Specified by:
deleteMessageByGroup in interface JspmEvtDb

addAction

public void addAction(int msgid,
                      java.lang.String group,
                      int sequence,
                      int fcolor,
                      int bcolor,
                      int attr,
                      int sev,
                      int act,
                      java.lang.String text)
Adds a action to the action table

Specified by:
addAction in interface JspmEvtDb

deleteActionByMsgid

public int deleteActionByMsgid(int msgid)
Delete action by msgid

Specified by:
deleteActionByMsgid in interface JspmEvtDb

deleteActionByGroup

public int deleteActionByGroup(java.lang.String group)
Delete action by group

Specified by:
deleteActionByGroup in interface JspmEvtDb