|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--arlut.csd.ganymede.DBLog
This class manages recording events in the system log and generating reports from the system log based on specific criteria.
Most of the methods in this class must be synchronized, both to keep the
logfile itself orderly, and to allow the various log-processing methods
in DBLogEvent to re-use the
'multibuffer' StringBuffer.
| Field Summary | |
(package private) boolean |
closed
This variable tracks whether the log file has been closed, or whether it is open for append. |
(package private) java.util.Date |
currentTime
We use this Date object to track the time of the last log event recorded. |
(package private) static boolean |
debug
|
(package private) GanymedeSession |
gSession
GanymedeSession reference to allow the log code to do searching of the database, etc. |
(package private) java.io.File |
logFile
|
(package private) java.lang.String |
logFileName
|
(package private) java.io.FileOutputStream |
logStream
|
(package private) java.io.PrintWriter |
logWriter
|
(package private) Qsmtp |
mailer
Our mail relay. |
(package private) SharedStringBuffer |
multibuffer
Reusable StringBuffer for transaction processing. |
(package private) java.util.Hashtable |
objEventCodes
We keep a table of the system event codes to speed the logging process. |
(package private) java.util.Date |
objEventCodesTimeStamp
This field keeps track of when we last updated the objEventCodes hash, so that we can check against the timestamp held in the Object Event DBObjectBase to see whether we need to refresh the objEventCodes hash. |
(package private) java.lang.String |
signature
The signature to be appended to any outgoing mail |
(package private) java.util.Hashtable |
sysEventCodes
We keep a table of the system event codes to speed the logging process. |
(package private) java.util.Date |
sysEventCodesTimeStamp
This field keeps track of when we last updated the sysEventCodes hash, so that we can check against the timestamp held in the System Event DBObjectBase to see whether we need to refresh the sysEventCodes hash. |
| Constructor Summary | |
DBLog(java.lang.String filename,
GanymedeSession gSession)
|
|
| Method Summary | |
private java.util.Vector |
appendMailOut(DBLogEvent event,
java.util.Hashtable map,
DBSession session,
systemEventType transactionType)
This method takes a DBLogEvent object, scans it to determine what mailing lists should be notified of the event in the context of a transaction, and adds a description of the passed in event to each MailOut
object held in map. |
private java.util.Vector |
appendObjectMail(DBLogEvent event,
java.util.Hashtable objectOuts,
java.lang.String transdescrip,
DBSession transSession)
This sends out the 'auxiliary' type specific log information mail to designated users, using the object event objects in the Ganymede database. |
private void |
calculateMailTargets(DBLogEvent event,
DBSession session,
systemEventType eventType)
|
private void |
calculateMailTargets(DBLogEvent event,
DBSession session,
systemEventType eventType,
boolean mailToObjects,
boolean mailToOwners)
This method generates a list of additional email addresses that notification for this event should be sent to, based on the event's type and the ownership of objects referenced by this event. |
java.util.Vector |
calculateOwnerAddresses(java.util.Vector objects,
boolean mailToObjects,
boolean mailToOwners)
This method takes a vector of Invid's
representing objects touched
during a transaction, and returns a Vector of email addresses that
should be notified of operations affecting the objects in the
<objects> list. |
static java.util.Vector |
calculateOwnerAddresses(java.util.Vector objects,
boolean mailToObjects,
boolean mailToOwners,
DBSession session)
This method takes a vector of Invid's
representing objects touched
during a transaction, and returns a Vector of email addresses that
should be notified of operations affecting the objects in the
<objects> list. |
static java.util.Vector |
calculateOwnerAddresses(java.util.Vector objects,
DBSession session)
This method takes a vector of Invid's
representing objects touched
during a transaction, and returns a Vector of email addresses that
should be notified of operations affecting the objects in the
<objects> list. |
(package private) void |
close()
This method closes out the log file. |
private void |
loadSignature()
This method gets the signature file loaded. |
void |
logSystemEvent(DBLogEvent event)
This method is used to log an event such as server shutdown/restart, user log-in, persona change, etc. |
void |
logTransaction(java.util.Vector logEvents,
java.lang.String adminName,
Invid admin,
DBEditSet transaction)
This method is used to log all events associated with a transaction. |
void |
mailNotify(java.lang.String title,
java.lang.String description,
DBLogEvent event,
boolean mailToObjects,
boolean mailToOwners,
DBSession session)
This method is used to handle an email notification event, where the mail title should reflect detailed information about the event, and extra descriptive information is to be sent out. |
void |
mailNotify(java.lang.String title,
java.lang.String description,
DBLogEvent event,
boolean mailToOwners,
DBSession session)
This method is used to handle an email notification event, where the mail title should reflect detailed information about the event, and extra descriptive information is to be sent out. |
java.lang.StringBuffer |
retrieveHistory(Invid invid,
java.util.Date sinceTime,
boolean keyOnAdmin,
boolean fullTransactions)
This method is used to scan the log file for log events that match invid and that have occurred since sinceTime. |
void |
sendMail(java.util.Vector recipients,
java.lang.String title,
java.lang.String description,
boolean mailToObjects,
boolean mailToOwners,
java.util.Vector invids)
This method sends out a generic mail message that will not be logged. |
private void |
sendObjectMail(java.lang.String returnAddr,
java.lang.String adminName,
java.util.Hashtable objectOuts)
|
private java.util.Vector |
sendSysEventMail(DBLogEvent event,
java.lang.String transdescrip)
This sends out system event mail to the appropriate users, based on the system event record's flags. |
private void |
updateObjEventCodeHash()
Private helper method to (re)initialize our local hash of object event codes. |
private void |
updateSysEventCodeHash()
Private helper method to (re)initialize our local hash of system event codes. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
static final boolean debug
java.lang.String logFileName
java.io.File logFile
java.io.FileOutputStream logStream
java.io.PrintWriter logWriter
java.lang.String signature
java.util.Date currentTime
boolean closed
java.util.Hashtable sysEventCodes
systemEventTypejava.util.Date sysEventCodesTimeStamp
java.util.Hashtable objEventCodes
objectEventTypejava.util.Date objEventCodesTimeStamp
Qsmtp mailer
SharedStringBuffer multibuffer
GanymedeSession gSession
| Constructor Detail |
public DBLog(java.lang.String filename,
GanymedeSession gSession)
throws java.io.IOException
| Method Detail |
void close()
throws java.io.IOException
public void sendMail(java.util.Vector recipients,
java.lang.String title,
java.lang.String description,
boolean mailToObjects,
boolean mailToOwners,
java.util.Vector invids)
This method sends out a generic mail message that will not be logged. If mailToObjects and/or mailToObjects are true, mail may be sent to email addresses associated with the objects in the invids Vector, in addition to the recipients list.
recipients - a Vector of email addresses to send this message
to. May legally be null or empty, in which case mail will be sent
to anyone needed according to the mailToObjects and mailToOwners
parameterstitle - The email subject for this message, will have 'Ganymede: ' prepended
to it.description - The message itselfmailToObjects - If true, this event's mail will go to any
email addresses associated with objects referenced by event.mailToOwners - If true, this event's mail will go to the owners
of any objects referenced by event.invids - A vector of Invids to consult for possible mail targetting
public void mailNotify(java.lang.String title,
java.lang.String description,
DBLogEvent event,
boolean mailToOwners,
DBSession session)
This method is used to handle an email notification event, where the mail title should reflect detailed information about the event, and extra descriptive information is to be sent out.
mailNotify() will send the message to the owners of any objects referenced by event if mailToOwners is true.
description and/or title may be null, in which case the proper strings will be extracted from the event's database record
event - A single event to be logged, with its own timestamp.mailToOwners - If true, this event's mail will go to the owners
of any objects referenced by event.
public void mailNotify(java.lang.String title,
java.lang.String description,
DBLogEvent event,
boolean mailToObjects,
boolean mailToOwners,
DBSession session)
This method is used to handle an email notification event, where the mail title should reflect detailed information about the event, and extra descriptive information is to be sent out.
mailNotify() will send the message to the owners of any objects referenced by event if mailToOwners is true.
description and/or title may be null, in which case the proper strings will be extracted from the event's database record
event - A single event to be logged, with its own timestamp.mailToObjects - If true, this event's mail will go to any
email addresses associated with objects referenced by event.mailToOwners - If true, this event's mail will go to the owners
of any objects referenced by event.public void logSystemEvent(DBLogEvent event)
This method is used to log an event such as server shutdown/restart, user log-in, persona change, etc. Basically any thing not associated with a transaction.
event - A single event to be logged, with its own timestamp.
public void logTransaction(java.util.Vector logEvents,
java.lang.String adminName,
Invid admin,
DBEditSet transaction)
This method is used to log all events associated with a transaction.
logEvents - a Vector of DBLogEvent objects.
public java.lang.StringBuffer retrieveHistory(Invid invid,
java.util.Date sinceTime,
boolean keyOnAdmin,
boolean fullTransactions)
This method is used to scan the log file for log events that match invid and that have occurred since sinceTime.
invid - If not null, retrieveHistory() will only return events involving
this object invid.sinceTime - if not null, retrieveHistory() will only return events
occuring on or after the time specified in this Date object.keyOnAdmin - if true, rather than returning a string containing events
that involved <invid>, retrieveHistory() will return a string containing events
performed on behalf of the administrator with invid <invid>.fullTransactions - if true, the buffer returned will include all events in any
transactions that involve the given invid. if false, only those events in a transaction
directly affecting the given invid will be returned.
private java.util.Vector sendSysEventMail(DBLogEvent event,
java.lang.String transdescrip)
This sends out system event mail to the appropriate users, based on the system event record's flags.
private java.util.Vector appendObjectMail(DBLogEvent event,
java.util.Hashtable objectOuts,
java.lang.String transdescrip,
DBSession transSession)
This sends out the 'auxiliary' type specific log information mail to designated users, using the object event objects in the Ganymede database. This mail is sent for a distinct eventcode/object type pair, outside of the context of a transaction.
private void sendObjectMail(java.lang.String returnAddr,
java.lang.String adminName,
java.util.Hashtable objectOuts)
private void updateSysEventCodeHash()
Private helper method to (re)initialize our local hash of system event codes.
private void updateObjEventCodeHash()
Private helper method to (re)initialize our local hash of object event codes.
private void calculateMailTargets(DBLogEvent event,
DBSession session,
systemEventType eventType)
private void calculateMailTargets(DBLogEvent event,
DBSession session,
systemEventType eventType,
boolean mailToObjects,
boolean mailToOwners)
This method generates a list of additional email addresses that notification for this event should be sent to, based on the event's type and the ownership of objects referenced by this event.
Note that the email addresses added to this event's mail list will be in addition to any that were previously specified by the code that originally generated the log event.
private java.util.Vector appendMailOut(DBLogEvent event,
java.util.Hashtable map,
DBSession session,
systemEventType transactionType)
This method takes a DBLogEvent object, scans it to determine
what mailing lists should be notified of the event in the
context of a transaction, and adds a description of the
passed in event to each MailOut
object held in map.
That is, the map passed in maps each discrete recipient list to a running MailOut object which has the complete text that will be mailed to that recipient when the transaction's records are mailed out.
private void loadSignature()
throws java.io.IOException
public java.util.Vector calculateOwnerAddresses(java.util.Vector objects,
boolean mailToObjects,
boolean mailToOwners)
This method takes a vector of Invid's
representing objects touched
during a transaction, and returns a Vector of email addresses that
should be notified of operations affecting the objects in the
<objects> list.
public static java.util.Vector calculateOwnerAddresses(java.util.Vector objects,
DBSession session)
This method takes a vector of Invid's
representing objects touched
during a transaction, and returns a Vector of email addresses that
should be notified of operations affecting the objects in the
<objects> list.
public static java.util.Vector calculateOwnerAddresses(java.util.Vector objects,
boolean mailToObjects,
boolean mailToOwners,
DBSession session)
This method takes a vector of Invid's
representing objects touched
during a transaction, and returns a Vector of email addresses that
should be notified of operations affecting the objects in the
<objects> list.
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||