org.oddjob.beanbus
Class AbstractBusComponent<T>

java.lang.Object
  extended by org.oddjob.beanbus.AbstractBusComponent<T>
Type Parameters:
T - The type of beans on the bus.
All Implemented Interfaces:
ServiceProvider, BusServiceProvider, Outbound<T>
Direct Known Subclasses:
IterableBusDriver, ScriptParser

public abstract class AbstractBusComponent<T>
extends Object
implements BusServiceProvider, Outbound<T>

A base class for Jobs and Services that provide an BeanBus.

Implementations must ensure #startBus() and {@link stopBus()} are called and must provide a {@link #stopTheBus()} method.

Author:
rob

Constructor Summary
AbstractBusComponent()
           
 
Method Summary
protected  void accept(T bean)
           
 SimpleBusService getServices()
          Provider the services.
 Collection<? super T> getTo()
           
protected  void requestBusStop()
           
 void setTo(Collection<? super T> to)
          Set the destination.
protected  void startBus()
           
protected  void stopBus()
           
protected abstract  void stopTheBus()
          Implementation override this to perform the action of stopping the bus.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractBusComponent

public AbstractBusComponent()
Method Detail

startBus

protected void startBus()
                 throws BusCrashException
Throws:
BusCrashException

accept

protected void accept(T bean)
               throws BusCrashException
Throws:
BusCrashException

stopBus

protected void stopBus()
                throws BusCrashException
Throws:
BusCrashException

requestBusStop

protected void requestBusStop()

stopTheBus

protected abstract void stopTheBus()
Implementation override this to perform the action of stopping the bus.


getServices

public SimpleBusService getServices()
Description copied from interface: ServiceProvider
Provider the services.

Specified by:
getServices in interface ServiceProvider
Specified by:
getServices in interface BusServiceProvider
Returns:
The services. May be null.

setTo

public void setTo(Collection<? super T> to)
Set the destination.

Specified by:
setTo in interface Outbound<T>
Parameters:
to -

getTo

public Collection<? super T> getTo()