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 String
FILENAME
the name of the properties file.static String
KEY_DBID
the key for the database ID.static String
KEY_ERRORS
the key for errors.static String
KEY_HOST
the key for the computer name.static String
KEY_ID
the key for the ID.static String
KEY_IP
the key for the IP address.protected long
m_DatabaseID
the database ID of the entry.protected static DateFormat
m_DateFormat
the formatter for the generation timestamp.protected Date
m_Generation
the generation timestamp.protected String
m_Host
the computer name.protected String
m_IP
the IP address.protected String
m_Message
the content of the message (props format).protected String
m_Source
the source of the entry.protected String
m_Status
the status of the entry.protected String
m_Type
the type of the message.static String
STATUS_NEW
the status "New".static String
STATUS_OPEN
the status "Open".static String
STATUS_RESOLVED
the status "Resolved".static String
TIMESTAMP_FORMAT
the 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 int
compareTo(LogEntry o)
Compares this object with the specified object for order.boolean
equals(Object obj)
Indicates whether some other object is "equal to" this one.LogEntry
getClone()
Returns a clone of the object.protected DateFormat
getDateFormat()
Returns the formatter for the timestamps.Date
getGeneration()
Returns the generation timestamp.String
getGenerationAsString()
Returns the generation timestamp as string.String
getHost()
Returns the host name.String
getIP()
Returns the IP address.long
getLargeDatabaseID()
Returns the database ID.String
getMessage()
Returns the message.Properties
getMessageAsProperties()
Returns the message as properties object.String
getSource()
Returns the source.String
getStatus()
Returns the status.String
getType()
Returns the type.int
hashCode()
Hashcode so can be used as hashtable key.void
setGeneration(Date value)
Sets the generation timestamp.void
setHost(String value)
Sets the host name.void
setIP(String value)
Sets the IP address.void
setLargeDatabaseID(long value)
Sets the database ID.void
setMessage(Properties value)
Sets the message as properties object.void
setMessage(String value)
Sets the message.void
setSource(String value)
Sets the source.void
setStatus(String value)
Sets the status.void
setType(String value)
Sets the type.String
toString()
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:
setLargeDatabaseID
in interfaceMutableLargeDatabaseIDHandler
- Parameters:
value
- the database ID
-
getLargeDatabaseID
public long getLargeDatabaseID()
Returns the database ID.- Specified by:
getLargeDatabaseID
in 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:
getClone
in 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:
compareTo
in 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.
-
-