gr.uoa.di.madgik.commons.channel.events
Class ChannelState

java.lang.Object
  extended by gr.uoa.di.madgik.commons.channel.events.ChannelState

public class ChannelState
extends java.lang.Object

The ChannelState acts as a container for Events regarding a specific channel with which it is associated. Different parts of the synchronization and notification mechanisms that make the channel concept work use the events this class exposes to perform their work. If a thread is accessing the instance events while the dispose method is being called the result may be undefined.

Author:
gpapanikos

Nested Class Summary
static class ChannelState.EventName
          The Events that can be registered for, exposed and send.
 
Constructor Summary
ChannelState()
          Creates a new instance of the ChannelState and initializes the StateItems that will be used for Observers to come and register for notifications on their status
 
Method Summary
 void Dispose()
          Unregisters everyone that have registered for events and disposes the state of the object
 java.util.Collection<ChannelStateEvent> GetChannelEvents()
          Retrieves all the available Events one can register for
 ChannelStateEvent GetEvent(ChannelState.EventName EventToRetrieve)
          Retrieves a specific Event requesting it by name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChannelState

public ChannelState()
Creates a new instance of the ChannelState and initializes the StateItems that will be used for Observers to come and register for notifications on their status

Method Detail

GetChannelEvents

public java.util.Collection<ChannelStateEvent> GetChannelEvents()
Retrieves all the available Events one can register for

Returns:
The available updates one can be asked to be notified on their status change

GetEvent

public ChannelStateEvent GetEvent(ChannelState.EventName EventToRetrieve)
Retrieves a specific Event requesting it by name. If the channel is being disposed, then no events might be available. Before using a returned event it must be checked if the event is null

Parameters:
EventToRetrieve - The Event to retrieve
Returns:
The Event object that can be used to be registered with or send a new Event to the ones that have already registered with. If the event is not found, null is returned

Dispose

public void Dispose()
Unregisters everyone that have registered for events and disposes the state of the object