org.openbandy.event
Class EventSourceController

java.lang.Object
  extended by org.openbandy.event.EventSourceController

public class EventSourceController
extends java.lang.Object

An instance of the EventSourceController is used to control the life of every event source that provides a certain type of event, i.e. for every event type that is currently by the event service, there is an event source controller in charge of starting and stopping corresponding event sources. As the actual instances are controlled by the EventSourceBroker, the EventSourceController only holds indexes.

(c) Copyright Philipp Bolliger 2007, ALL RIGHTS RESERVED.

Version:
1.0
Author:
Philipp Bolliger (philipp@bolliger.name)

Constructor Summary
EventSourceController(java.lang.String eventShortClassName, EventSourceBroker eventSourceBroker)
           
 
Method Summary
 void addSource(java.lang.Integer eventSourceIndex)
          Put the event source with the given index under this EventSourceController's control.
 void ensureRunning()
          Check if every controlled event source is running.
 java.lang.String getEventShortClassName()
          Return the short class name of the event type that is controlled by this EventSourceController
 boolean isEmpty()
          Check whether this EventSourceController controls any sources.
 boolean removeSource(java.lang.Integer eventSourceIndex)
          Relieve an event source with the given index from this EventSourceController's control.
 void stopSources()
          Stop all event sources under control.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventSourceController

public EventSourceController(java.lang.String eventShortClassName,
                             EventSourceBroker eventSourceBroker)
Method Detail

getEventShortClassName

public java.lang.String getEventShortClassName()
Return the short class name of the event type that is controlled by this EventSourceController

Returns:
Short class name of the controlled event type

addSource

public void addSource(java.lang.Integer eventSourceIndex)
Put the event source with the given index under this EventSourceController's control.

Parameters:
eventSourceIndex - Index of the EventSource as given by the EventSourceBroker

removeSource

public boolean removeSource(java.lang.Integer eventSourceIndex)
Relieve an event source with the given index from this EventSourceController's control.

Parameters:
eventSourceIndex - Index of the EventSource as given by the EventSourceBroker
Returns:

isEmpty

public boolean isEmpty()
Check whether this EventSourceController controls any sources.

Returns:
True if no sources are added, false else

ensureRunning

public void ensureRunning()
Check if every controlled event source is running. If a source is not running yet, start it.


stopSources

public void stopSources()
Stop all event sources under control.