asgaard.utils.log
Class LogMsg

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

public class LogMsg
extends java.lang.Object
implements java.io.Serializable

This is a Bean that carries a statement in the LOG - File. Collection and Distribution of statements within the LogBroker.

See Also:
LogBroker, Serialized Form

Field Summary
static byte BEAN_NONE
          No Bean included to the Statement
static byte BEAN_NOT_INCLUDED
          Bean available at the LogBroker but not included
static byte BEAN_OBJECT
          Some complex bean which is some Object
static byte BEAN_STRING
          Bean is a simple type and stored as String
static java.lang.String LOCAL_HOST
          If the Hostname cannot be resolved
static byte LOG_BACKUP
          Log-level "Backup" Statements to ensave information
static byte LOG_DEBUG
          Log-level "Debuginformation" to trace processes about different server-tasks
static byte LOG_ERROR
          Log-level "Security violation", occour if an anourmalous behavior is detected.
static byte LOG_NONE
          Log-level "No Message"
static byte LOG_PROFILE
          Log-level "Profile", storing profiling- and evaluation information
static byte LOG_REMARK
          Log-level "Remark" by the Server as documentation of the Server-State
static byte LOG_SECURITY
          Log-level "Fatal Error", an error occoured and can not be recovered automaticaly
static byte LOG_WARNING
          Log-level "Warning", an error occoured and has been repaired automatically but may not work in the intended way (e.g. locally but remote)
 
Constructor Summary
LogMsg()
          Default-constructor, do not use manually - internal use only!
LogMsg(long nr, java.lang.String host, java.lang.String server, java.lang.String point, java.util.Date c, java.util.Date d, byte typ, boolean ok, java.lang.String msg, java.lang.Object bean, boolean beanExist)
          Complete constructor for a historical Statement, do not use manually - internal use only!
LogMsg(java.lang.String server, java.lang.String point, byte typ, boolean ok, java.lang.String msg)
          Manual constructor for a short statement without included streamable object (Bean)
LogMsg(java.lang.String server, java.lang.String point, byte typ, boolean ok, java.lang.String msg, java.lang.Object bean)
          Manual constructor for a short statement including a streamable object (Bean)
LogMsg(java.lang.String host, java.lang.String server, java.lang.String point, byte typ, boolean ok, java.lang.String msg, java.lang.Object bean)
          Manual and automated constructor for a logclients (used in LogClient).
 
Method Summary
 byte getBeanType()
          Get the type of the Bean included to the Statement
 java.util.Date getCreated()
          Get Local Time when the Statement was created, precision "seconds/1000"
 java.lang.String getHostName()
          Get name of the Host the requesting Server is located
 java.lang.Object getLogBean()
          Get some streamable Object
 java.lang.String getLogMessage()
          Get human redable Message of the Statement
 long getLogNr()
          Get number of the Message within the logfile
 byte getLogType()
          Get the Type of the LOG-Statement
static java.lang.String getLogType(byte type)
          Converts the Type of the LOG-Statement
static byte getLogType(java.lang.String type)
          Converts the Type of the LOG-Statement
 java.lang.String getOk()
          Get was the Action successful
static java.lang.String getOk(boolean ok)
          Converts boolean to String
static boolean getOk(java.lang.String ok)
          Converts String to boolean
 java.util.Date getReceived()
          Get Local Time when the Statement was processed by the LOG-server, precision "seconds"
 java.lang.String getServerClass()
          Get the calling Java-Serverclass
 java.lang.String getServicePoint()
          Get the Method / place where the statement was created
 boolean isSuccess()
          Get was the Action successful
 void setHostName(java.lang.String name)
          Set the name of the Host the requesting Server is located, default is the localhost.
 void setLogBean(java.lang.Object bean)
          Set some streamable object
 void setLogMessage(java.lang.String msg)
          Set the message to the statement
 void setLogNr(long nr)
          Set the number of the Message within the logfile, do not use manually - internal use only!
 void setLogType(byte val)
          Set the Type of the LOG-statement ("Log-level")
 void setReceived(java.util.Date ts)
          Set the Local Time when the Statement was processed by the LOG-server
 void setServerClass(java.lang.String name)
          Set the calling Java-Serverclass
 void setServicePoint(java.lang.String name)
          Set the Method / place where the statement was created
 void setSuccess(boolean ok)
          Set if the Servicepoint was passed successfuly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_NONE

public static final byte LOG_NONE
Log-level "No Message"

LOG_SECURITY

public static final byte LOG_SECURITY
Log-level "Fatal Error", an error occoured and can not be recovered automaticaly

LOG_ERROR

public static final byte LOG_ERROR
Log-level "Security violation", occour if an anourmalous behavior is detected.

LOG_PROFILE

public static final byte LOG_PROFILE
Log-level "Profile", storing profiling- and evaluation information

LOG_WARNING

public static final byte LOG_WARNING
Log-level "Warning", an error occoured and has been repaired automatically but may not work in the intended way (e.g. locally but remote)

LOG_REMARK

public static final byte LOG_REMARK
Log-level "Remark" by the Server as documentation of the Server-State

LOG_BACKUP

public static final byte LOG_BACKUP
Log-level "Backup" Statements to ensave information

LOG_DEBUG

public static final byte LOG_DEBUG
Log-level "Debuginformation" to trace processes about different server-tasks

BEAN_NONE

public static final byte BEAN_NONE
No Bean included to the Statement

BEAN_NOT_INCLUDED

public static final byte BEAN_NOT_INCLUDED
Bean available at the LogBroker but not included

BEAN_OBJECT

public static final byte BEAN_OBJECT
Some complex bean which is some Object

BEAN_STRING

public static final byte BEAN_STRING
Bean is a simple type and stored as String

LOCAL_HOST

public static final java.lang.String LOCAL_HOST
If the Hostname cannot be resolved
Constructor Detail

LogMsg

public LogMsg()
Default-constructor, do not use manually - internal use only! Only used for Streaming.

LogMsg

public LogMsg(java.lang.String server,
              java.lang.String point,
              byte typ,
              boolean ok,
              java.lang.String msg)
       throws java.lang.IllegalArgumentException,
              java.io.NotSerializableException
Manual constructor for a short statement without included streamable object (Bean)
Parameters:
server - The calling Java-Serverclass
point - The Method / place where the statement was created
typ - The Type of the LOG-Statement
ok - Was the ServicePoint passed successfuly
msg - Human redable Message of the Statement
Throws:
java.lang.IllegalArgumentException - if the parameter typ does not fit to the log-types defined

LogMsg

public LogMsg(java.lang.String server,
              java.lang.String point,
              byte typ,
              boolean ok,
              java.lang.String msg,
              java.lang.Object bean)
       throws java.lang.IllegalArgumentException,
              java.io.NotSerializableException
Manual constructor for a short statement including a streamable object (Bean)
Parameters:
server - The calling Java-Serverclass
point - The Method / place where the statement was created
typ - The Type of the LOG-Statement
ok - Was the ServicePoint passed successfuly
msg - Human redable Message of the Statement
bean - Some streamable Object
Throws:
java.lang.IllegalArgumentException - if the parameter typ does not fit to the log-types defined
java.io.NotSerializableException - if the parameter bean can not be serialized

LogMsg

public LogMsg(java.lang.String host,
              java.lang.String server,
              java.lang.String point,
              byte typ,
              boolean ok,
              java.lang.String msg,
              java.lang.Object bean)
       throws java.lang.IllegalArgumentException,
              java.io.NotSerializableException
Manual and automated constructor for a logclients (used in LogClient).
Parameters:
host - The host where the statement was created
server - The calling Java-Serverclass
point - The Method / place where the statement was created
typ - The Type of the LOG-Statement
ok - Was the ServicePoint passed successfuly
msg - Human redable Message of the Statement
bean - Some streamable Object
Throws:
java.lang.IllegalArgumentException - if the parameter typ does not fit to the log-types defined
java.io.NotSerializableException - if the parameter bean can not be serialized

LogMsg

public LogMsg(long nr,
              java.lang.String host,
              java.lang.String server,
              java.lang.String point,
              java.util.Date c,
              java.util.Date d,
              byte typ,
              boolean ok,
              java.lang.String msg,
              java.lang.Object bean,
              boolean beanExist)
       throws java.lang.IllegalArgumentException,
              java.io.NotSerializableException
Complete constructor for a historical Statement, do not use manually - internal use only! (LogBroker)
Parameters:
nr - Number of the statement
host - name of the Host the requesting Server is located
server - The calling Java-Serverclass
point - The Method / place where the statement was created
c - Timestamp when the statement was created
d - Timestamp when the statement was received
typ - The Type of the LOG-Statement
ok - Was the ServicePoint passed successfuly
msg - Human redable Message of the Statement
bean - Some streamable Object
beanExist - only used, if bean=null and beantype=BEAN_NOT_INCLUDED)
Throws:
java.lang.IllegalArgumentException - if the parameter typ does not fit to the log-types defined
java.io.NotSerializableException - if the parameter bean can not be serialized
See Also:
LogBroker
Method Detail

setLogNr

public void setLogNr(long nr)
Set the number of the Message within the logfile, do not use manually - internal use only! (LogBroker)

setHostName

public void setHostName(java.lang.String name)
Set the name of the Host the requesting Server is located, default is the localhost.

setServerClass

public void setServerClass(java.lang.String name)
Set the calling Java-Serverclass

setServicePoint

public void setServicePoint(java.lang.String name)
Set the Method / place where the statement was created

setLogType

public void setLogType(byte val)
                throws java.lang.IllegalArgumentException
Set the Type of the LOG-statement ("Log-level")
Throws:
java.lang.IllegalArgumentException - if the parameter does not fit to the log-types defined

setReceived

public void setReceived(java.util.Date ts)
Set the Local Time when the Statement was processed by the LOG-server

setSuccess

public void setSuccess(boolean ok)
Set if the Servicepoint was passed successfuly.

setLogMessage

public void setLogMessage(java.lang.String msg)
Set the message to the statement

setLogBean

public void setLogBean(java.lang.Object bean)
                throws java.io.NotSerializableException
Set some streamable object
Parameters:
bean - the Bean which shall be included to the message, null setzt the BeanType to BEAN_NONE.
Throws:
java.io.NotSerializableException - if the parameter can not be serialized (null is ignored)

getLogNr

public long getLogNr()
Get number of the Message within the logfile

getHostName

public java.lang.String getHostName()
Get name of the Host the requesting Server is located

getServerClass

public java.lang.String getServerClass()
Get the calling Java-Serverclass

getServicePoint

public java.lang.String getServicePoint()
Get the Method / place where the statement was created

getLogType

public byte getLogType()
Get the Type of the LOG-Statement

getLogType

public static java.lang.String getLogType(byte type)
Converts the Type of the LOG-Statement
Parameters:
the - asked type
Returns:
a String

getLogType

public static byte getLogType(java.lang.String type)
Converts the Type of the LOG-Statement
Parameters:
the - asked type
Returns:
a String

getCreated

public java.util.Date getCreated()
Get Local Time when the Statement was created, precision "seconds/1000"

getReceived

public java.util.Date getReceived()
Get Local Time when the Statement was processed by the LOG-server, precision "seconds"

isSuccess

public boolean isSuccess()
Get was the Action successful

getOk

public java.lang.String getOk()
Get was the Action successful

getOk

public static java.lang.String getOk(boolean ok)
Converts boolean to String

getOk

public static boolean getOk(java.lang.String ok)
Converts String to boolean

getLogMessage

public java.lang.String getLogMessage()
Get human redable Message of the Statement

getLogBean

public java.lang.Object getLogBean()
Get some streamable Object

getBeanType

public byte getBeanType()
Get the type of the Bean included to the Statement