com.isti.quakewatch.message
Class QWMsgRecord

java.lang.Object
  extended by com.isti.quakewatch.message.QWRecord
      extended by com.isti.quakewatch.message.QWMsgRecord
All Implemented Interfaces:
QWMsgNumTimeRec, Archivable
Direct Known Subclasses:
QWDataMsgRecord

public class QWMsgRecord
extends QWRecord
implements Archivable, QWMsgNumTimeRec

QWMsgRecord defines a record of data from an XML QWmessage.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.isti.util.Archivable
Archivable.Marker
 
Field Summary
protected  java.lang.String archiveFormStr
          Archive-string form of record data.
 long msgNumber
          Message number from the 'QWmessage' element for this message.
 java.util.Date origTimeGenerated
          Original time generated if changed (or null if not given).
 org.jdom.Element qwMsgElement
          Handle to the QWmessage 'Element' object used to construct this object.
 java.util.Date timeGenerated
          Time that message was created by server (or null if not given).
 
Fields inherited from class com.isti.quakewatch.message.QWRecord
currentElement
 
Constructor Summary
QWMsgRecord(org.jdom.Element qwMsgElement)
          Creates a record of data from an XML QWmessage.
QWMsgRecord(org.jdom.Element qwMsgElement, long msgNumber, java.util.Date timeGenerated)
          Creates a record of data from existing data items.
QWMsgRecord(java.lang.String dataStr, Archivable.Marker mkrObj)
          Creates a record of data from the archived-string data for an XML QWmessage.
 
Method Summary
protected  void checkQWMsgRecordName(org.jdom.Element qwMsgElement)
          Checks if the root element of the given message element object is named "QWmessage".
static java.lang.String elemToStr(org.jdom.Element elementObj)
          Converts an Element object to a string.
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 boolean equals(QWMsgRecord obj)
          Indicates whether some other object is "equal to" this one.
 java.util.Date getArchiveDate()
          Returns the date that this object should be archived under.
 long getMsgNum()
          Returns the message number from the 'QWmessage' element for this message.
 java.lang.String getServerAddress()
          Returns the contents of the Server Address attribute for this message record.
 java.lang.String getServerIDName()
          Returns the contents of the Server-ID Name attribute for this message record.
 java.lang.String getServerRevStr()
          Returns the contents of the Server Revision String attribute for this message record.
 long getTimeGenerated()
          Returns the time-generated value for this record.
 java.lang.String toArchivedForm()
          Returns the archive-data representation of this object.
 
Methods inherited from class com.isti.quakewatch.message.QWRecord
getAttribDouble, getAttribInteger, getAttribLong, getAttribStr, getAttribTime, getChildElementDouble, getChildElementDouble, getChildElementInteger, getChildElementInteger, getChildElementStr, getChildElementStr, getCurrentElement, getDefAttribBoolean, getDefElementBoolean, getElementDouble, getElementInteger, getElementLong, getElementStr, getElementTime, getElementValueDouble, getElementValueStr, getElementValueTime, getNonNullOptAttribStr, getNonNullOptElementStr, getOptAttribBoolean, getOptAttribDouble, getOptAttribInteger, getOptAttribStr, getOptAttribTime, getOptElementBoolean, getOptElementDouble, getOptElementInteger, getOptElementStr, getOptElementTime, getOptElementValueDouble, getOptTextDouble, parseDataBoolean, parseDataDouble, parseDataInteger, parseDataLong, parseDataTime
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

qwMsgElement

public final org.jdom.Element qwMsgElement
Handle to the QWmessage 'Element' object used to construct this object.


msgNumber

public final long msgNumber
Message number from the 'QWmessage' element for this message.


timeGenerated

public final java.util.Date timeGenerated
Time that message was created by server (or null if not given).


origTimeGenerated

public final java.util.Date origTimeGenerated
Original time generated if changed (or null if not given).


archiveFormStr

protected java.lang.String archiveFormStr
Archive-string form of record data.

Constructor Detail

QWMsgRecord

public QWMsgRecord(org.jdom.Element qwMsgElement)
            throws QWRecordException
Creates a record of data from an XML QWmessage.

Parameters:
qwMsgElement - the XML "QWmessage" element object.
Throws:
QWRecordException - if an error occurs while creating the data record.

QWMsgRecord

public QWMsgRecord(java.lang.String dataStr,
                   Archivable.Marker mkrObj)
            throws QWRecordException
Creates a record of data from the archived-string data for an XML QWmessage. This constructor is needed to have this class implement the 'Archivable' interface.

Parameters:
dataStr - the archived-string data to use.
mkrObj - Archivable.Marker parameter to indicate that this constructor is used to dearchive a record.
Throws:
QWRecordException - if an error occurs while creating the data record.

QWMsgRecord

public QWMsgRecord(org.jdom.Element qwMsgElement,
                   long msgNumber,
                   java.util.Date timeGenerated)
            throws QWRecordException
Creates a record of data from existing data items.

Parameters:
qwMsgElement - the XML "QWmessage" element object.
msgNumber - message number from the 'QWmessage' element for this message.
timeGenerated - time that message was created by server (or null if not given).
Throws:
QWRecordException - if an error occurs while creating the data record.
Method Detail

checkQWMsgRecordName

protected final void checkQWMsgRecordName(org.jdom.Element qwMsgElement)
                                   throws QWRecordException
Checks if the root element of the given message element object is named "QWmessage".

Parameters:
qwMsgElement - message element object to check.
Throws:
QWRecordException - if the root element of the given message element is not named "QWmessage".

equals

public boolean equals(QWMsgRecord obj)
Indicates whether some other object is "equal to" this one.

Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class QWRecord
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

getArchiveDate

public java.util.Date getArchiveDate()
Returns the date that this object should be archived under. This method is needed to have this class implement the 'Archivable' interface.

Specified by:
getArchiveDate in interface Archivable
Returns:
the date we should be archived under

toArchivedForm

public java.lang.String toArchivedForm()
Returns the archive-data representation of this object. This method is needed to have this class implement the 'Archivable' interface.

Specified by:
toArchivedForm in interface Archivable
Returns:
A string containing the archive-data representation of this object.
Throws:
QWRecordException - if an error occurs while converting the XML data to string form.

getMsgNum

public long getMsgNum()
Returns the message number from the 'QWmessage' element for this message. This method is needed to have this class implement the 'QWMsgNumTimeRec' interface.

Specified by:
getMsgNum in interface QWMsgNumTimeRec
Returns:
The message number from the 'QWmessage' element for this message.

getTimeGenerated

public long getTimeGenerated()
Returns the time-generated value for this record. This method is needed to have this class implement the 'QWMsgNumTimeRec' interface.

Specified by:
getTimeGenerated in interface QWMsgNumTimeRec
Returns:
The long-integer epoch time-generated values, in milliseconds since 1/1/1970.

getServerIDName

public java.lang.String getServerIDName()
Returns the contents of the Server-ID Name attribute for this message record.

Returns:
The contents of the 'ServerIDName' attribute for this message record, or null if not available.

getServerRevStr

public java.lang.String getServerRevStr()
Returns the contents of the Server Revision String attribute for this message record.

Returns:
The contents of the 'ServerRevStr' attribute for this message record, or null if not available.

getServerAddress

public java.lang.String getServerAddress()
Returns the contents of the Server Address attribute for this message record.

Returns:
The contents of the 'ServerAddress' attribute for this message record, or null if not available.

elemToStr

public static java.lang.String elemToStr(org.jdom.Element elementObj)
Converts an Element object to a string.

Parameters:
elementObj - the Element object to use.
Returns:
A new converted string.
Throws:
QWRecordException - if an error occurred.