asgaard.utils.log
Class Log

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--asgaard.utils.log.Log

public class Log
extends java.rmi.server.UnicastRemoteObject
implements RemoteLog

This class implements a simple and robust standalone remote running LOG-server. A wrapper-class for LogBroker with minimum use of code (e.g. no profiles and resources).

Before starting asgaard.utils.log.Log the rmiregistry need to be started!

See Also:
LogBroker, Serialized Form

Field Summary
static java.lang.String COPYRIGHT
          The Copyright message
static java.lang.String SERVER
          Internal name of the Server (used for Prefixes and generated messages)
static java.lang.String ServerName
          Binding-Name of the LOG-Server within the rmiregistry
static java.lang.String VERSION
          Version of the Implementation
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
Log(java.lang.String path)
          Instanciates a new server-object and sets the local path.
 
Method Summary
 LogMsg[] get(long nr, boolean withBean)
          Gets a Statement from the LOGFILE returning the Statement-bean (wrapper method to LogBroker).
static void main(java.lang.String[] args)
          Starting the remote Server.
 void put(LogMsg stmt)
          Puts a Statement into the LOGFILE (wrapper method to LogBroker).
 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.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SERVER

public static final java.lang.String SERVER
Internal name of the Server (used for Prefixes and generated messages)

VERSION

public static final java.lang.String VERSION
Version of the Implementation

COPYRIGHT

public static final java.lang.String COPYRIGHT
The Copyright message

ServerName

public static java.lang.String ServerName
Binding-Name of the LOG-Server within the rmiregistry
Constructor Detail

Log

public Log(java.lang.String path)
    throws java.rmi.RemoteException
Instanciates a new server-object and sets the local path. If available also the mailserver is instanciated.
Method Detail

put

public void put(LogMsg stmt)
         throws java.rmi.RemoteException,
                java.io.IOException,
                java.sql.SQLException
Puts a Statement into the LOGFILE (wrapper method to LogBroker). If the Statement exists already, it is replaced. If any Exception rises it will be ignored
Specified by:
put in interface RemoteLog
Parameters:
stmt - Statement as a LogMsg-Bean
Throws:
java.sql.SQLException - from LogBroker.put forwarded exception
java.io.IOException - from LogBroker.put forwarded exception
java.rmi.RemoteException - if the remote (only if remote!) Object cannot be accessed
See Also:
LogMsg, LogBroker.put(asgaard.utils.log.LogMsg)

get

public LogMsg[] get(long nr,
                    boolean withBean)
             throws java.rmi.RemoteException
Gets a Statement from the LOGFILE returning the Statement-bean (wrapper method to LogBroker).
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
Throws:
java.rmi.RemoteException - if the remote (only if remote!) Object cannot be accessed
See Also:
LogMsg, LogBroker.get(long, boolean)

setMailServer

public void setMailServer(byte level,
                          java.lang.String to,
                          java.lang.String from,
                          java.lang.String cc,
                          java.lang.String mailhost,
                          long size)
                   throws java.rmi.RemoteException
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)
Throws:
java.rmi.RemoteException - if the remote (only if remote!) Object cannot be accessed

main

public static void main(java.lang.String[] args)
Starting the remote Server.
Parameters:
args - commandline parameter