gr.uoa.di.madgik.commons.channel.proxy
Interface IChannelProxy

All Known Implementing Classes:
LocalChannelProxy, TCPServerChannelProxy

public interface IChannelProxy

Interface of the proxy class that will handle the mediation between ChannelInlet and ChannelOutlet. Depending on the side where the proxy is initialized, inlet or outlet there is a different initialization procedure.

In the inlet side the proxy is created with any configuration it may support. It is then passed to the ChannelInlet method as part of the configuration argument INozzleConfig. this method will use the ChannelRegistry.Register(ChannelState, INozzleConfig, String) method to register its channel and will associate the IChannelProxy with this channel. It will also call SetChannelRegistryKey(ChannelRegistryKey). At this point, after the call setting the managed registry entry, the implementation of the IChannelProxy must be fully initialized and ready to serve requests from a ChannelOutlet. It must be able to create a IChannelLocator that can fully identify the channel that was set by the registry using the set channel registry method. Full initialization for a proxy that mediates between remote nozzles and needs to synchronize the channel means also that a protocol implementing thread is instantiated.

In the outlet side the proxy is initialized with any configuration it may support but also with the an IChannelLocator identifying the channel that the outlet will access. Upon initialization the IChannelProxy must be ready to be used by a ChannelOutlet to access the identified channel. Full initialization for a proxy that mediates between remote nozzles and needs to synchronize the channel means also that a protocol implementing thread is instantiated.

Author:
gpapanikos

Nested Class Summary
static class IChannelProxy.ProxyConnector
          The types of proxy connectors known and usable by the framework
 
Method Summary
 java.lang.Boolean CanHandleProxyLocator(IChannelLocator.LocatorType Locator)
          Checks if this proxy can handle the specific type of locator
 void Dispose()
          Disposes the proxy
 ChannelState GetChannelState()
          Retrieves the ChannelState that the proxy mediates for and is used to synchronize between the various instances of the ChannelState all connected nozzles use
 IChannelLocator GetLocator()
          Retrieves a locator to this proxy
 IChannelProxy.ProxyConnector GetProxyType()
          Retrieves the type of proxy
 java.lang.Boolean HasConnected()
          Depending on the side the IChannelProxy mediates for, this method has a slightly different meaning.
 void SetChannelRegistryKey(ChannelRegistryKey RegistryKey)
          Sets the ChannelRegistryKey this proxy will manage.
 java.lang.Boolean StillConnected()
          Depending on the side the IChannelProxy mediates for, this method has a slightly different meaning.
 

Method Detail

GetLocator

IChannelLocator GetLocator()
Retrieves a locator to this proxy

Returns:
The locator

GetProxyType

IChannelProxy.ProxyConnector GetProxyType()
Retrieves the type of proxy

Returns:
The proxy type

CanHandleProxyLocator

java.lang.Boolean CanHandleProxyLocator(IChannelLocator.LocatorType Locator)
Checks if this proxy can handle the specific type of locator

Parameters:
Locator - The type of Locator
Returns:
Whether or not it can handle the provided locator type

SetChannelRegistryKey

void SetChannelRegistryKey(ChannelRegistryKey RegistryKey)
Sets the ChannelRegistryKey this proxy will manage. This method is called by the ChannelRegistry.Register(ChannelState, INozzleConfig, String) when called by the ChannelInlet initialization constructor. This proxy instance is passed to the nozzle's constructor through the INozzleConfig and is updated by calling the SetChannelRegistryKey(ChannelRegistryKey) from the registry's method.

Parameters:
RegistryKey - the registry key

GetChannelState

ChannelState GetChannelState()
Retrieves the ChannelState that the proxy mediates for and is used to synchronize between the various instances of the ChannelState all connected nozzles use

Returns:
the channel state

HasConnected

java.lang.Boolean HasConnected()
Depending on the side the IChannelProxy mediates for, this method has a slightly different meaning. On the inlet side, it checks if any outlets has been connected to the exposed channel. On the outlet side, it checks if the outlet has been connected to the inlet.

Returns:
Whether or not someone has been connected

StillConnected

java.lang.Boolean StillConnected()
Depending on the side the IChannelProxy mediates for, this method has a slightly different meaning. On the inlet side, it checks if any outlets is still connected to the exposed channel. On the outlet side, it checks if the outlet is still connected to the inlet. This method should only be used after the HasConnected() has already been set to true

Returns:
Whether or not someone is still connected

Dispose

void Dispose()
Disposes the proxy