gr.uoa.di.madgik.commons.channel.nozzle
Class ChannelInlet

java.lang.Object
  extended by gr.uoa.di.madgik.commons.channel.nozzle.ChannelInlet
All Implemented Interfaces:
java.util.Observer

public class ChannelInlet
extends java.lang.Object
implements java.util.Observer

This class represents one of the channel's nozzles. Each channel can have two types of nozzles. One that initiates the channel, publishes an IChannelLocator for it and acts a the central synchronization point which is the ChannelInlet, and the other receives an IChannelLocator to a previously created channel and can receive events emitted through it and can in turn emit events itself.

Author:
gpapanikos

Constructor Summary
ChannelInlet(INozzleConfig Config)
          Instantiates a new channel inlet.
 
Method Summary
 void Dispose()
          Disposed the nozzle and all associated state.
 IChannelLocator GetLocator()
          Retrieves the locator that can be used by other nozzles to connect to the channel
 java.util.Collection<ChannelStateEvent> GetNozzleEvents()
          The nozzle exposes a set of events that are published through the rest of the connected nozzles.
 java.lang.String GetNozzleID()
          Gets the nozzle id.
 void Push(ChannelPayloadStateEvent Event)
          Emits the provided event to all connected nozzles.
 void update(java.util.Observable o, java.lang.Object arg)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChannelInlet

public ChannelInlet(INozzleConfig Config)
Instantiates a new channel inlet. Creates an identifier for the nozzle through which it can be distinguished among the rest of the nozzles, registers itself to receive notifications from the underlying ChannelState and registers the created ChannelState with the ChannelRegistry

Parameters:
Config - the configuration
Method Detail

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer

GetNozzleID

public java.lang.String GetNozzleID()
Gets the nozzle id.

Returns:
the nozzle identifier

GetNozzleEvents

public java.util.Collection<ChannelStateEvent> GetNozzleEvents()
The nozzle exposes a set of events that are published through the rest of the connected nozzles. The events exposed through the nozzle are only the ones that the rest of the connected nozzles emitted and not the ones this nozzle emitted

Returns:
The events the client can register for notifications

Dispose

public void Dispose()
Disposed the nozzle and all associated state. The nozzle is unregistered from all events, then the ChannelState publishing events that the client is registering for is disposed through ChannelState.Dispose() and finally the underlying ChannelState that is used to synchronize all connected nozzles id disposed through a call to ChannelState.Dispose()


Push

public void Push(ChannelPayloadStateEvent Event)
Emits the provided event to all connected nozzles. In case a nozzle is not yet connected, there is no guarantee that after the nozzle is connected the previously emitted events will be delivered.

Parameters:
Event - the event to emit

GetLocator

public IChannelLocator GetLocator()
Retrieves the locator that can be used by other nozzles to connect to the channel

Returns:
the channel locator