asgaard.utils.log
Class LogBroker

java.lang.Object
  |
  +--asgaard.utils.log.LogBroker

public class LogBroker
extends java.lang.Object
implements RemoteLog

This is the Collector (and distributor) for all Log-statements based on LogMsg-Beans.

See Also:
LogMsg

Field Summary
static java.lang.String CONNECT_STRING
          Used flatfile-driver
static java.lang.String local_path
          Path to the Logfile (may be modified before instantiation).
static java.lang.String LOG_FILE_EXTENSION
          Used flatfile-file-extension
static java.lang.String LOG_FILE_NAME
          Used flatfile-filename
static java.lang.String MAIL_SUBJECT
          Used prefix of the mail-subject (used if mailclient active)
static java.lang.String VERSION
           
 
Constructor Summary
LogBroker()
          Creating a LogBroker Object with the default settings, LOGFILE is chreated automatically if nessecary.
LogBroker(java.lang.String path)
          Creating a LogBroker, LOGFILE is chreated automatically if nessecary.
 
Method Summary
 LogMsg[] get(java.util.Date date, byte type, boolean withBean)
          Gets a Statement from the LOGFILE returning the Statement-bean. (
 LogMsg[] get(long nr, boolean withBean)
          Gets a Statement from the LOGFILE returning the Statement-bean.
 byte getMailLevel()
          Get the current MailLevel
 void put(LogMsg stmt)
          Puts a Statement into the LOGFILE returning the (modified) Statement-bean.
 void setMailServer(byte level, java.lang.String to, java.lang.String from, java.lang.String cc, java.lang.String mailhost, long size)
          Defines a Mailserver for automatically forward LOGMSG also via eMail.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION

CONNECT_STRING

public static final java.lang.String CONNECT_STRING
Used flatfile-driver

LOG_FILE_NAME

public static final java.lang.String LOG_FILE_NAME
Used flatfile-filename

LOG_FILE_EXTENSION

public static final java.lang.String LOG_FILE_EXTENSION
Used flatfile-file-extension

MAIL_SUBJECT

public static final java.lang.String MAIL_SUBJECT
Used prefix of the mail-subject (used if mailclient active)

local_path

public static java.lang.String local_path
Path to the Logfile (may be modified before instantiation).
Constructor Detail

LogBroker

public LogBroker()
          throws java.sql.SQLException,
                 java.io.IOException
Creating a LogBroker Object with the default settings, LOGFILE is chreated automatically if nessecary.
Throws:
java.sql.SQLException - if the JDBC connection to the flatfile (logfile) failes
java.io.IOException - if the access to the flatfile (logfile) failes

LogBroker

public LogBroker(java.lang.String path)
          throws java.sql.SQLException,
                 java.io.IOException
Creating a LogBroker, LOGFILE is chreated automatically if nessecary.
Throws:
java.sql.SQLException - if the JDBC connection to the flatfile (logfile) failes
java.io.IOException - if the access to the flatfile (logfile) failes
Method Detail

setMailServer

public void setMailServer(byte level,
                          java.lang.String to,
                          java.lang.String from,
                          java.lang.String cc,
                          java.lang.String mailhost,
                          long size)
Defines a Mailserver for automatically forward LOGMSG also via eMail.
Specified by:
setMailServer in interface RemoteLog
Parameters:
level - Which Error-Level should be forwarded
to - mailto - eMailadress
from - eMailadress
cc - carbon copy (optional)
mailhost - assumption: mail.smtp.host
logsize - send warning if logfile exceeds size (0 for no warning)

getMailLevel

public byte getMailLevel()
Get the current MailLevel
See Also:
LogMsg

put

public void put(LogMsg stmt)
         throws java.sql.SQLException,
                java.io.IOException
Puts a Statement into the LOGFILE returning the (modified) Statement-bean. If the Statement-bean exists already, it is replaced.
Specified by:
put in interface RemoteLog
Parameters:
stmt - Statement as a LogMsg-Bean
Throws:
java.sql.SQLException - if the JDBC connection to the flatfile (logfile) failes
java.io.IOException - if the access to the flatfile (logfile) failes
See Also:
LogMsg

get

public LogMsg[] get(long nr,
                    boolean withBean)
Gets a Statement from the LOGFILE returning the Statement-bean.
Specified by:
get in interface RemoteLog
Parameters:
nr - Number of the statement in the current Logfile
withBean - if the Bean carried by the Statement is required
Returns:
a List with the found Statement-Beans
See Also:
LogMsg

get

public LogMsg[] get(java.util.Date date,
                    byte type,
                    boolean withBean)
Gets a Statement from the LOGFILE returning the Statement-bean. (NOT TESTED YET!)
Parameters:
date - minimum date of the statement in the current Logfile
type - minimum type of the statement in the current Logfile
withBean - if the Bean carried by the Statement is required
Returns:
a List with the found Statement-Beans
See Also:
LogMsg