Package adams.db
Class LogEntry
- java.lang.Object
-
- adams.db.LogEntry
-
- All Implemented Interfaces:
CloneHandler<LogEntry>,LargeDatabaseIDHandler,MutableLargeDatabaseIDHandler,Serializable,Comparable<LogEntry>
public class LogEntry extends Object implements Serializable, MutableLargeDatabaseIDHandler, CloneHandler<LogEntry>, Comparable<LogEntry>
A simple log entry container that can be stored and retrieve in a database.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringFILENAMEthe name of the properties file.static StringKEY_DBIDthe key for the database ID.static StringKEY_ERRORSthe key for errors.static StringKEY_HOSTthe key for the computer name.static StringKEY_IDthe key for the ID.static StringKEY_IPthe key for the IP address.protected longm_DatabaseIDthe database ID of the entry.protected static DateFormatm_DateFormatthe formatter for the generation timestamp.protected Datem_Generationthe generation timestamp.protected Stringm_Hostthe computer name.protected Stringm_IPthe IP address.protected Stringm_Messagethe content of the message (props format).protected Stringm_Sourcethe source of the entry.protected Stringm_Statusthe status of the entry.protected Stringm_Typethe type of the message.static StringSTATUS_NEWthe status "New".static StringSTATUS_OPENthe status "Open".static StringSTATUS_RESOLVEDthe status "Resolved".static StringTIMESTAMP_FORMATthe format of the timestamps.
-
Constructor Summary
Constructors Constructor Description LogEntry()Initializes the entry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(LogEntry o)Compares this object with the specified object for order.booleanequals(Object obj)Indicates whether some other object is "equal to" this one.LogEntrygetClone()Returns a clone of the object.protected DateFormatgetDateFormat()Returns the formatter for the timestamps.DategetGeneration()Returns the generation timestamp.StringgetGenerationAsString()Returns the generation timestamp as string.StringgetHost()Returns the host name.StringgetIP()Returns the IP address.longgetLargeDatabaseID()Returns the database ID.StringgetMessage()Returns the message.PropertiesgetMessageAsProperties()Returns the message as properties object.StringgetSource()Returns the source.StringgetStatus()Returns the status.StringgetType()Returns the type.inthashCode()Hashcode so can be used as hashtable key.voidsetGeneration(Date value)Sets the generation timestamp.voidsetHost(String value)Sets the host name.voidsetIP(String value)Sets the IP address.voidsetLargeDatabaseID(long value)Sets the database ID.voidsetMessage(Properties value)Sets the message as properties object.voidsetMessage(String value)Sets the message.voidsetSource(String value)Sets the source.voidsetStatus(String value)Sets the status.voidsetType(String value)Sets the type.StringtoString()Returns a short string representation of the container.
-
-
-
Field Detail
-
TIMESTAMP_FORMAT
public static final String TIMESTAMP_FORMAT
the format of the timestamps.- See Also:
- Constant Field Values
-
FILENAME
public static final String FILENAME
the name of the properties file.- See Also:
- Constant Field Values
-
KEY_DBID
public static final String KEY_DBID
the key for the database ID.- See Also:
- Constant Field Values
-
KEY_ID
public static final String KEY_ID
the key for the ID.- See Also:
- Constant Field Values
-
KEY_HOST
public static final String KEY_HOST
the key for the computer name.- See Also:
- Constant Field Values
-
KEY_IP
public static final String KEY_IP
the key for the IP address.- See Also:
- Constant Field Values
-
KEY_ERRORS
public static final String KEY_ERRORS
the key for errors.- See Also:
- Constant Field Values
-
STATUS_NEW
public static final String STATUS_NEW
the status "New".- See Also:
- Constant Field Values
-
STATUS_OPEN
public static final String STATUS_OPEN
the status "Open".- See Also:
- Constant Field Values
-
STATUS_RESOLVED
public static final String STATUS_RESOLVED
the status "Resolved".- See Also:
- Constant Field Values
-
m_DatabaseID
protected long m_DatabaseID
the database ID of the entry.
-
m_Host
protected String m_Host
the computer name.
-
m_IP
protected String m_IP
the IP address.
-
m_Type
protected String m_Type
the type of the message.
-
m_Message
protected String m_Message
the content of the message (props format).
-
m_Generation
protected Date m_Generation
the generation timestamp.
-
m_Source
protected String m_Source
the source of the entry.
-
m_Status
protected String m_Status
the status of the entry.
-
m_DateFormat
protected static DateFormat m_DateFormat
the formatter for the generation timestamp.
-
-
Method Detail
-
getDateFormat
protected DateFormat getDateFormat()
Returns the formatter for the timestamps.- Returns:
- the formatter
-
setLargeDatabaseID
public void setLargeDatabaseID(long value)
Sets the database ID.- Specified by:
setLargeDatabaseIDin interfaceMutableLargeDatabaseIDHandler- Parameters:
value- the database ID
-
getLargeDatabaseID
public long getLargeDatabaseID()
Returns the database ID.- Specified by:
getLargeDatabaseIDin interfaceLargeDatabaseIDHandler- Returns:
- the database ID
-
setHost
public void setHost(String value)
Sets the host name.- Parameters:
value- the host name
-
getHost
public String getHost()
Returns the host name.- Returns:
- the host name, can be null
-
setIP
public void setIP(String value)
Sets the IP address.- Parameters:
value- the IP address
-
getIP
public String getIP()
Returns the IP address.- Returns:
- the IP address, can be null
-
setType
public void setType(String value)
Sets the type.- Parameters:
value- the type
-
getType
public String getType()
Returns the type.- Returns:
- the type
-
setMessage
public void setMessage(String value)
Sets the message.- Parameters:
value- the message
-
setMessage
public void setMessage(Properties value)
Sets the message as properties object.- Parameters:
value- the message
-
getMessage
public String getMessage()
Returns the message.- Returns:
- the message
-
getMessageAsProperties
public Properties getMessageAsProperties()
Returns the message as properties object.- Returns:
- the message
-
setGeneration
public void setGeneration(Date value)
Sets the generation timestamp.- Parameters:
value- the generation timestamp
-
getGeneration
public Date getGeneration()
Returns the generation timestamp.- Returns:
- the generation timestamp
-
getGenerationAsString
public String getGenerationAsString()
Returns the generation timestamp as string.- Returns:
- the generation timestamp
- See Also:
TIMESTAMP_FORMAT
-
setSource
public void setSource(String value)
Sets the source.- Parameters:
value- the source
-
getSource
public String getSource()
Returns the source.- Returns:
- the source
-
setStatus
public void setStatus(String value)
Sets the status.- Parameters:
value- the status
-
getStatus
public String getStatus()
Returns the status.- Returns:
- the status
-
getClone
public LogEntry getClone()
Returns a clone of the object.- Specified by:
getClonein interfaceCloneHandler<LogEntry>- Returns:
- the clone
-
compareTo
public int compareTo(LogEntry o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.- Specified by:
compareToin interfaceComparable<LogEntry>- Parameters:
o- the object to be compared.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
equals
public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.
-
hashCode
public int hashCode()
Hashcode so can be used as hashtable key. Returns the hashcode of the "DBID + Generation" string.
-
-