org.fuin.jmsmvc4swing.jms
Class ControllerReceiver

java.lang.Object
  extended by org.fuin.jmsmvc4swing.jms.ControllerReceiver
All Implemented Interfaces:
javax.jms.MessageListener, IControllerReceiver

public class ControllerReceiver
extends Object
implements javax.jms.MessageListener, IControllerReceiver

Receives a JMS message for the controller and selects the appropriate handler.


Constructor Summary
ControllerReceiver(JmsJndiEnvironment env, String topicName, Controller ctrl)
          Constructor with all necessary data.
 
Method Summary
 void addRequestHandler(MethodHandler handler)
          Adds a new handler for a controller method.
 String getTopicName()
          Returns the topic for this controller.
 boolean isStopped()
          Checks if the JMS subscription is already cancelled.
 void onMessage(javax.jms.Message message)
          
 void start()
          Opens the JMS connection and listens for an appropriate start message.
 void stop()
          Terminate the JMS subscription.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ControllerReceiver

public ControllerReceiver(JmsJndiEnvironment env,
                          String topicName,
                          Controller ctrl)
Constructor with all necessary data.

Parameters:
env - Context.
topicName - Topic the listener subscribes to.
ctrl - Controller to use.
Method Detail

getTopicName

public final String getTopicName()
Returns the topic for this controller.

Returns:
Topic.

start

public final void start()
Opens the JMS connection and listens for an appropriate start message.

Specified by:
start in interface IControllerReceiver

onMessage

public final void onMessage(javax.jms.Message message)

Specified by:
onMessage in interface javax.jms.MessageListener

isStopped

public final boolean isStopped()
Checks if the JMS subscription is already cancelled.

Specified by:
isStopped in interface IControllerReceiver
Returns:
If there is no longer a connection TRUE else FALSE.

stop

public final void stop()
Terminate the JMS subscription.

Specified by:
stop in interface IControllerReceiver

addRequestHandler

public final void addRequestHandler(MethodHandler handler)
Adds a new handler for a controller method.

Parameters:
handler - Handles a single JMS controller message.


Copyright © 2011 Future Invent Informationsmanagement GmbH. All Rights Reserved.