com.alien.enterpriseRFID.notify
Class Message

java.lang.Object
  extended bycom.alien.enterpriseRFID.notify.Message
Direct Known Subclasses:
ErrorMessage

public class Message
extends java.lang.Object

Message encapsulates the information contained in a reader's notification messages. When a MessageListenerService receives a notification message, it parses the contents of the message, and uses the pieces of data to construct a Message. A typical notification message takes the form:

    <Alien-RFID-Reader-Auto-Notification>
      <ReaderName>Alien RFID Reader</ReaderName>
      <ReaderType>Alien RFID Tag Reader, Model: ALR-9780 (Four Antenna / EPC Class 1
 / 915Mhz)</ReaderType>
      <IPAddress>10.1.70.42</IPAddress>
      <CommandPort>23</CommandPort>
      <MACAddress>00:80:66:10:2D:17</MACAddress>
      <Time>2003/12/09 16:16:59</Time>
      <Reason>TEST MESSAGE</Reason>
      <StartTriggerLines>1</StartTriggerLines>
      <StopTriggerLines>2</StopTriggerLines>
      <Alien-RFID-Tag-List>
        <Alien-RFID-Tag>
          <TagID>0203 0405 0607 0809</TagID>
          <DiscoveryTime>2003/12/09 16:16:16</DiscoveryTime>
          <LastSeenTime>2003/12/09 16:16:57</LastSeenTime>
          <Antenna>0</Antenna>
          <ReadCount>48</ReadCount>
        </Alien-RFID-Tag>
        <Alien-RFID-Tag>
          <TagID>8000 8004 0000 003B</TagID>
          <DiscoveryTime>2003/12/09 16:16:16</DiscoveryTime>
          <LastSeenTime>2003/12/09 16:16:58</LastSeenTime>
          <Antenna>0</Antenna>
          <ReadCount>222</ReadCount>
        </Alien-RFID-Tag>
      </Alien-RFID-Tag-List>
    </Alien-RFID-Reader-Auto-Notification>
 
Each element of the XML message corresponds to a field in the Message object. Each field has accompanying get/set methods for accessing it. This includes the list of tags, which are represented in the Message object as an array of Tags. Furthermore, the entire contents of the notification message are stored in the Message.

Some newer readers can also track events on the external I/O pins, and include this even data in notification messages. The MessageListenerService will extract this data and populate the IOList field of this Message class with an array of ExternalIO objects (similar to the TagList field storing an array of Tag objects).

The MessageListenerService also supports the IOStream and TagStream functions of newer readers. When the reader streams tag read or digital I/O events, the MessageListenerService decodes each event and generates an appropriate Message object with the tag external I/O data read from the stream.

Version:
2.0 Feb 2007
Author:
David Krull

Field Summary
static java.lang.String REASON_IOSTREAM
           
static java.lang.String REASON_TAGSTREAM
           
 
Constructor Summary
Message()
          Constructs a new empty Message object.
 
Method Summary
 java.util.Date getDate()
          Returns the Date of this Message.
 ExternalIO getIO(int index)
          Returns the ExternalIO that holds position index in this Message's IOList.
 int getIOCount()
          Returns the number of ExternalIOs in this Message's IOList.
 ExternalIO[] getIOList()
          Returns the IOList of this notification message, as an array of ExternalIOs.
 java.lang.String getRawData()
          Returns the raw data content of the notification message sent by the reader.
 int getReaderCommandPort()
          Returns the Command port number of the reader as indicated in the reader's notification message.
 java.lang.String getReaderHostname()
          Returns the network hostname of the reader as indicated in the reader's notification message.
 java.lang.String getReaderIPAddress()
          Returns the IP Address of the reader as indicated in the reader's notification message.
 java.lang.String getReaderMACAddress()
          Returns the MAC Address of the reader as indicated in the reader's notification message.
 java.lang.String getReaderName()
          Returns the name of the reader as indicated in the reader's notification message.
 java.lang.String getReaderType()
          Returns the type of the reader as indicated in the reader's notification message.
 java.lang.String getReason()
          Gets the Reason value for this Message.
 int getStartTriggerLines()
          Returns the external input lines that triggered this autonomous cycle to start.
 int getStopTriggerLines()
          Returns the external input lines that triggered this autonomous cycle to stop.
 Tag getTag(int index)
          Returns the Tag that holds position index in this Message's TagList.
 int getTagCount()
          Returns the number of tags in this Message's TagList.
 Tag[] getTagList()
          Returns the TagList of this notification message, as an array of Tags.
 java.lang.String getXML()
          Deprecated. Use getRawData() instead.
 void setDate(java.util.Date date)
          Sets the Date for this Message.
 void setIOList(ExternalIO[] ioList)
          Sets the IOList of this Message as an array of ExternalIOs.
 void setRawData(java.lang.String rawData)
          Sets the raw content of this Message.
 void setReaderCommandPort(int readerCommandPort)
          Sets the ReaderCommandPort value for this Message.
 void setReaderHostname(java.lang.String readerHostname)
          Sets the network hostname value for this Message.
 void setReaderIPAddress(java.lang.String readerIPAddress)
          Sets the IPAddress value for this Message.
 void setReaderMACAddress(java.lang.String readerMACAddress)
          Sets the MACAddress value for this Message.
 void setReaderName(java.lang.String readerName)
          Sets the ReaderName value for this Message.
 void setReaderType(java.lang.String readerType)
          Sets the ReaderType value for this Message.
 void setReason(java.lang.String reason)
          Sets the Reason value for this Message.
 void setStartTriggerLines(int startTriggerLines)
          Sets the external input lines that triggered this autonomous cycle to start.
 void setStopTriggerLines(int stopTriggerLines)
          Sets the external input lines that triggered this autonomous cycle to stop.
 void setTagList(Tag[] tagList)
          Sets the TagList of this Message as an array of Tags.
 void setXML(java.lang.String rawXML)
          Deprecated. Use setRawData(String) instead.
 java.lang.String toString()
          Returns a string representation of this Message object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REASON_TAGSTREAM

public static final java.lang.String REASON_TAGSTREAM
See Also:
Constant Field Values

REASON_IOSTREAM

public static final java.lang.String REASON_IOSTREAM
See Also:
Constant Field Values
Constructor Detail

Message

public Message()
Constructs a new empty Message object.

Method Detail

getRawData

public java.lang.String getRawData()
Returns the raw data content of the notification message sent by the reader.

Returns:
notification message's content
See Also:
setRawData(String)

setRawData

public void setRawData(java.lang.String rawData)
Sets the raw content of this Message.

Parameters:
rawData - the raw content of this Message
See Also:
getRawData()

getXML

public java.lang.String getXML()
Deprecated. Use getRawData() instead.

Returns the raw XML content of the notification message sent by the reader.

Returns:
notification message's XML content

setXML

public void setXML(java.lang.String rawXML)
Deprecated. Use setRawData(String) instead.

Sets the raw XML content of this Message.

Parameters:
rawXML - the original XML content of this Message

getReaderName

public java.lang.String getReaderName()
Returns the name of the reader as indicated in the reader's notification message.

Returns:
notification message's ReaderName attribute
See Also:
setReaderName(String)

setReaderName

public void setReaderName(java.lang.String readerName)
Sets the ReaderName value for this Message.

Parameters:
readerName - the ReaderName attribute for this Message
See Also:
getReaderName()

getReaderType

public java.lang.String getReaderType()
Returns the type of the reader as indicated in the reader's notification message.

Returns:
notification message's ReaderType attribute
See Also:
setReaderType(String)

setReaderType

public void setReaderType(java.lang.String readerType)
Sets the ReaderType value for this Message.

Parameters:
readerType - the ReaderType attribute for this Message
See Also:
getReaderType()

getReaderIPAddress

public java.lang.String getReaderIPAddress()
Returns the IP Address of the reader as indicated in the reader's notification message.

Returns:
notification message's IPAddress attribute
See Also:
setReaderIPAddress(String)

setReaderIPAddress

public void setReaderIPAddress(java.lang.String readerIPAddress)
Sets the IPAddress value for this Message.

Parameters:
readerIPAddress - the IPAddress attribute for this Message
See Also:
getReaderIPAddress()

getReaderCommandPort

public int getReaderCommandPort()
Returns the Command port number of the reader as indicated in the reader's notification message.

Returns:
notification message's CommandPort attribute
See Also:
setReaderCommandPort(int)

setReaderCommandPort

public void setReaderCommandPort(int readerCommandPort)
Sets the ReaderCommandPort value for this Message.

Parameters:
readerCommandPort - the CommandPort attribute for this Message
See Also:
getReaderCommandPort()

getReaderMACAddress

public java.lang.String getReaderMACAddress()
Returns the MAC Address of the reader as indicated in the reader's notification message.

Returns:
notification message's readerMACAddress attribute
See Also:
setReaderMACAddress(String)

setReaderMACAddress

public void setReaderMACAddress(java.lang.String readerMACAddress)
Sets the MACAddress value for this Message.

Parameters:
readerMACAddress - the readerMACAddress attribute for this Message
See Also:
getReaderMACAddress()

getReaderHostname

public java.lang.String getReaderHostname()
Returns the network hostname of the reader as indicated in the reader's notification message. Not all readers include the hostname information in a notification message, but it may be present in systems that stream tag or I/O events.

Returns:
notification message's readerHostname attribute
See Also:
setReaderHostname(String)

setReaderHostname

public void setReaderHostname(java.lang.String readerHostname)
Sets the network hostname value for this Message.

Parameters:
readerHostname - the ReaderName attribute for this Message
See Also:
getReaderHostname()

getReason

public java.lang.String getReason()
Gets the Reason value for this Message. The Reason attribute describes the trigger which caused the reader to sent the notification message. Notifications can be triggered by tags being added to the taglist, removed from the taglist, any change to the taglist, the Evaluation state of Autonomous Mode evaluating to true or false, or a timed event.

Returns:
notification message's Reason attribute
See Also:
setReason(String)

setReason

public void setReason(java.lang.String reason)
Sets the Reason value for this Message. The Reason attribute describes the trigger which caused the reader to sent the notification message. Notifications can be triggered by tags being added to the taglist, removed from the taglist, any change to the taglist, the Evaluation state of Autonomous Mode evaluating to true or false, or a timed event.

Parameters:
reason - the Reason attribute for this Message
See Also:
getReason()

getDate

public java.util.Date getDate()
Returns the Date of this Message. This is actually both the date and time, and is the date/time reported by the reader when it sends out the notification message.

Returns:
notification message's Date/Time attribute
See Also:
setDate(Date)

setDate

public void setDate(java.util.Date date)
Sets the Date for this Message. This is actually both the date and time, and is the date/time reported by the reader when it sends out the notification message.

Parameters:
date - the Date attribute for this Message
See Also:
getDate()

getStartTriggerLines

public int getStartTriggerLines()
Returns the external input lines that triggered this autonomous cycle to start.

Returns:
this notification message's StartTriggerLines attribute
See Also:
setStartTriggerLines(int)

setStartTriggerLines

public void setStartTriggerLines(int startTriggerLines)
Sets the external input lines that triggered this autonomous cycle to start.

Parameters:
startTriggerLines - the StartTriggerLines attribute for this Message
See Also:
getStartTriggerLines()

getStopTriggerLines

public int getStopTriggerLines()
Returns the external input lines that triggered this autonomous cycle to stop.

Returns:
this notification message's StopTriggerLines attribute
See Also:
setStopTriggerLines(int)

setStopTriggerLines

public void setStopTriggerLines(int stopTriggerLines)
Sets the external input lines that triggered this autonomous cycle to stop.

Parameters:
stopTriggerLines - the StopTriggerLines attribute for this Message
See Also:
getStopTriggerLines()

setTagList

public void setTagList(Tag[] tagList)
Sets the TagList of this Message as an array of Tags.

Parameters:
tagList - the TagList as an array of Tags
See Also:
getTagList()

getTagList

public Tag[] getTagList()
Returns the TagList of this notification message, as an array of Tags.

Returns:
tagList as an array of Tags
See Also:
setTagList(Tag[]), getTagCount(), getTag(int)

getTagCount

public int getTagCount()
Returns the number of tags in this Message's TagList.

Returns:
the number of tags in the tag TagList
See Also:
getTagList(), getTag(int)

getTag

public Tag getTag(int index)
Returns the Tag that holds position index in this Message's TagList. Use getTagCount() to retrieve the number of tags in the list, or simple use getTagList() to retrieve the entire TagList.

Parameters:
index - the index into the TagList of the tag to get
Returns:
the Tag at the position in the TagList given by index
See Also:
getTagList(), getTagCount()

setIOList

public void setIOList(ExternalIO[] ioList)
Sets the IOList of this Message as an array of ExternalIOs.

Parameters:
ioList - the IOList as an array of ExternalIOs
See Also:
getIOList()

getIOList

public ExternalIO[] getIOList()
Returns the IOList of this notification message, as an array of ExternalIOs.

Returns:
ioList as an array of ExternalIOs
See Also:
setIOList(ExternalIO[]), getIOCount(), getIO(int)

getIOCount

public int getIOCount()
Returns the number of ExternalIOs in this Message's IOList.

Returns:
the number of ExternalIOs in the tag IOList
See Also:
getIOList(), getIO(int)

getIO

public ExternalIO getIO(int index)
Returns the ExternalIO that holds position index in this Message's IOList. Use getIOCount() to retrieve the number of ExternalIOs in the list, or simple use getIOList() to retrieve the entire IOList.

Parameters:
index - the index into the IOList of the ExternalIO to get
Returns:
the ExternalIO at the position in the IOList given by index
See Also:
getIOList(), getIOCount()

toString

public java.lang.String toString()
Returns a string representation of this Message object.

Returns:
a text string representation of this Message