net.sf.doolin.bus.support
Class SubscriberAdapter<M>

java.lang.Object
  extended by net.sf.doolin.bus.support.SubscriberAdapter<M>
Type Parameters:
M - Type of message that is handled by this subscriber.
All Implemented Interfaces:
Subscriber<M>, SubscriberExecution<M>, SubscriberTrigger<M>, SubscriberValidator

public class SubscriberAdapter<M>
extends Object
implements Subscriber<M>

This Subscriber delegates its methods to a SubscriberValidator, a SubscriberTrigger and a SubscriberExecution.

Author:
Damien Coraboeuf

Constructor Summary
SubscriberAdapter(SubscriberValidator validator, SubscriberTrigger<M> trigger, SubscriberExecution<M> execution)
          Constructor.
 
Method Summary
 boolean accept(M message)
          Checks the message
 String getExecutionDescription()
          Describes the execution.
 Class<M> getMessageClass()
          Gets the class that this subscriber accepts to handle
 String getTriggerDescription()
          Description for the trigger
 String getValidatorDescription()
          Gets a description for this validator
 boolean isValid()
          Checks if the subscription is still valid.
 void receive(M message)
          This method called whenever a message is received.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubscriberAdapter

public SubscriberAdapter(SubscriberValidator validator,
                         SubscriberTrigger<M> trigger,
                         SubscriberExecution<M> execution)
Constructor.

Parameters:
validator - The validator to use
trigger - The trigger to use
execution - The execution to use
Method Detail

getMessageClass

public Class<M> getMessageClass()
Description copied from interface: SubscriberTrigger
Gets the class that this subscriber accepts to handle

Specified by:
getMessageClass in interface SubscriberTrigger<M>

getExecutionDescription

public String getExecutionDescription()
Description copied from interface: SubscriberExecution
Describes the execution. This information is used for debugging purpose only.

Specified by:
getExecutionDescription in interface SubscriberExecution<M>
Returns:
A description of the execution.

getTriggerDescription

public String getTriggerDescription()
Description copied from interface: SubscriberTrigger
Description for the trigger

Specified by:
getTriggerDescription in interface SubscriberTrigger<M>

getValidatorDescription

public String getValidatorDescription()
Description copied from interface: SubscriberValidator
Gets a description for this validator

Specified by:
getValidatorDescription in interface SubscriberValidator

isValid

public boolean isValid()
Description copied from interface: SubscriberValidator
Checks if the subscription is still valid.

Specified by:
isValid in interface SubscriberValidator
Returns:
true if the subscription is still valid, false otherwise.

receive

public void receive(M message)
Description copied from interface: SubscriberExecution
This method called whenever a message is received.

Specified by:
receive in interface SubscriberExecution<M>
Parameters:
message - Message to handle

accept

public boolean accept(M message)
Description copied from interface: SubscriberTrigger
Checks the message

Specified by:
accept in interface SubscriberTrigger<M>


Copyright © 2011. All Rights Reserved.