|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.alien.enterpriseRFID.notify.MessageListenerService
MessageListenerService is a class for receiving notification messages from a
Reader. This class will listen for incoming messages, and if found will hand
off the socket to a MessageListenerEngine. The MessageListenerEngine parses
the notification, packs the data into a Message
object, and hands it off
to a registered MessageListener
.
This listener runs in the background on its own thread.
Constructor Summary | |
MessageListenerService()
Constructs a MessageListenerService which listens for reader notifications on the default port, 3600. |
|
MessageListenerService(int listenerPort)
Constructs a MessageListenerService which listens for reader notifications on the port specified by listenerPort , using the default (chosen
by ServerSocket) Ethernet interface. |
|
MessageListenerService(int listenerPort,
java.net.InetAddress listenerInterface)
Constructs a MessageListenerService which listens for reader notifications on the port specified by listenerPort , using the specified Ethernet
interface. |
Method Summary | |
java.net.InetAddress |
getListenerInterface()
Returns the interface IP address that this MessageListenerService
is listening on for reader notification messages. |
int |
getListenerPort()
Returns the port number that this MessageListenerService is
listening on for reader notification messages. |
MessageListener |
getMessageListener()
Returns the MessageListener object that has been registered by this
MessageListenerService to be notified when reader notifications
arrive. |
boolean |
isCustomTagList()
Returns the flag indicating whether this MessageListenerService
should use the custom taglist decoder, or the standard "Text" format decoder. |
boolean |
isRunning()
Indicates if this MessageListenerService is currently running. |
void |
messageReceived(Message message)
Daughter MessageListenerEngines pass their message events up to the server, and the server hands them up to the user's MessageListener. |
void |
run()
Runs the MessageListenerService. |
void |
setDebug(boolean isDebug)
Sets the internal debug flag for this MessageListenerService . |
void |
setIsCustomTagList(boolean isCustom)
Sets the flag indicating whether this MessageListenerService
should use the custom taglist decoder, or the standard "Text" format decoder. |
void |
setListenerInterface(java.net.InetAddress listenerInterface)
Specifies the interface IP address for this MessageListenerService
to listen on for reader notification messages. |
void |
setListenerPort(int listenerPort)
Specifies the port number for this MessageListenerService to listen
on for reader notification messages. |
void |
setMessageListener(MessageListener messageListener)
Registers a MessageListener with this MessageListenerService
to be notified when a new notification message is received from a reader. |
void |
startService()
Starts this MessageListenerService . |
void |
stopService()
Stops this MessageListenerService . |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MessageListenerService()
MessageListenerService(int)
, or setListenerPort(int)
.
startService()
public MessageListenerService(int listenerPort)
listenerPort
, using the default (chosen
by ServerSocket) Ethernet interface. Once a MessageListenerService
is constructed, it still requires starting.
listenerPort
- the port to listen on for reader notificationsstartService()
public MessageListenerService(int listenerPort, java.net.InetAddress listenerInterface)
listenerPort
, using the specified Ethernet
interface. Once a MessageListenerService is constructed, it still requires starting.
listenerPort
- the port to listen on for reader notificationslistenerInterface
- the InetAddress of the interface to listen onstartService()
Method Detail |
public void setDebug(boolean isDebug)
MessageListenerService
.
Setting the debug flag true
causes diagnostic messages to be sent
to System.out.
isDebug
- the new setting for the internal debug flagpublic int getListenerPort()
MessageListenerService
is
listening on for reader notification messages.
setListenerPort(int)
public void setListenerPort(int listenerPort)
MessageListenerService
to listen
on for reader notification messages.
listenerPort
- the port number to listen ongetListenerPort()
public java.net.InetAddress getListenerInterface()
MessageListenerService
is listening on for reader notification messages.
setListenerInterface(InetAddress)
public void setListenerInterface(java.net.InetAddress listenerInterface)
MessageListenerService
to listen on for reader notification messages.
listenerInterface
- the IP address to listen ongetListenerInterface()
public MessageListener getMessageListener()
MessageListener
object that has been registered by this
MessageListenerService
to be notified when reader notifications
arrive.
setMessageListener(MessageListener)
public void setMessageListener(MessageListener messageListener)
MessageListener
with this MessageListenerService
to be notified when a new notification message is received from a reader.
messageListener
- the MessageListener object to be registeredgetMessageListener()
public boolean isCustomTagList()
MessageListenerService
should use the custom taglist decoder, or the standard "Text" format decoder.
setIsCustomTagList(boolean)
public void setIsCustomTagList(boolean isCustom)
MessageListenerService
should use the custom taglist decoder, or the standard "Text" format decoder.
isCustom
- the boolean flagisCustomTagList()
public void startService() throws java.io.IOException
MessageListenerService
. Once started, it waits for
messages to arrive on its listener port, decodes them, and passes the resulting
Message
object to any registered MessageListener
.
java.io.IOException
- if the service could not bind to the given portstopService()
public void stopService()
MessageListenerService
. It will no longer react to
notification messages sent to its listener port by readers, and these messages
will be lost. The MessageListenerService
can be restarted by calling
its startService()
method.
startService()
public void run()
run
in interface java.lang.Runnable
isRunning()
public boolean isRunning()
MessageListenerService
is currently running.
true
if the service is running, false
otherwisepublic void messageReceived(Message message)
messageReceived
in interface MessageListener
message
- the Message received from a reader
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |