BEA Systems, Inc.

com.connecterra.ale.reader
Class SocketAcceptorDeviceChannel

java.lang.Object
  extended by com.connecterra.ale.reader.DeviceChannel
      extended by com.connecterra.ale.reader.SocketAcceptorDeviceChannel

public class SocketAcceptorDeviceChannel
extends DeviceChannel

A DeviceChannel implemented by a TCP listener which waits for connections from a remote host or hosts.


Nested Class Summary
static interface SocketAcceptorDeviceChannel.SocketAcceptorListener
          This interface must be implemented by any class which is set as an asynchronous listener on this channel.
 
Nested classes/interfaces inherited from class com.connecterra.ale.reader.DeviceChannel
DeviceChannel.AbstractOpenChannel, DeviceChannel.MarkingInputStream
 
Constructor Summary
SocketAcceptorDeviceChannel(PluginConfig config, String defaultPort)
          Like SocketAcceptorDeviceChannel.SocketAcceptorDeviceChannel(PluginConfig, String, String), with portKeyName set to "port".
SocketAcceptorDeviceChannel(PluginConfig config, String defaultPort, String portKeyName)
          Creates a new SocketAcceptorDeviceChannel instance.
 
Method Summary
static void addToPluginMeta(DynamicConfigFactory factory, PluginMeta pm, String portKeyName, String portDisplayName, String defaultPort)
          Adds PluginParameterMeta to the specified PluginMeta for each parameter read by the channel.
 int getConfiguredPort()
           
 int getOpenPort()
           
 void setListener(SocketAcceptorDeviceChannel.SocketAcceptorListener l)
          Sets a listener whose methods are invoked via the associated ChannelManager proxy's ChannelManager.Proxy.listenerExecute(java.lang.Runnable) method when a new connection is accepted or when input is available on one of the accepted sockets.
 
Methods inherited from class com.connecterra.ale.reader.DeviceChannel
close, getLogger, getReactor, markUsed, open, reactivateChannels
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketAcceptorDeviceChannel

public SocketAcceptorDeviceChannel(PluginConfig config,
                                   String defaultPort,
                                   String portKeyName)
                            throws com.connecterra.ale.resources.PluginLoadException
Creates a new SocketAcceptorDeviceChannel instance. The portKeyName argument specifies the config parameter from which the listener port is read. If the listener port is 0, then the system will choose an available port. The concatenation of the portKeyName argument and "Timeout" specifies the config parameter from which the timeout in milliseconds is read.

Parameters:
config - a PluginConfig value
defaultPort - a String value which is used as the default port number.
portKeyName - a String value
Throws:
com.connecterra.ale.resources.PluginLoadException - if a configuration error occurs

SocketAcceptorDeviceChannel

public SocketAcceptorDeviceChannel(PluginConfig config,
                                   String defaultPort)
                            throws com.connecterra.ale.resources.PluginLoadException
Like SocketAcceptorDeviceChannel.SocketAcceptorDeviceChannel(PluginConfig, String, String), with portKeyName set to "port".

Parameters:
config - a PluginConfig value
defaultPort - a String value which is used as the default port number.
Throws:
com.connecterra.ale.resources.PluginLoadException - if a configuration error occurs
Method Detail

addToPluginMeta

public static void addToPluginMeta(DynamicConfigFactory factory,
                                   PluginMeta pm,
                                   String portKeyName,
                                   String portDisplayName,
                                   String defaultPort)
Adds PluginParameterMeta to the specified PluginMeta for each parameter read by the channel.

Currently this adds parameters for the port to listen on, given by the portDisplayName argument, and for the socket timeout, which is the port display name followed by " Timeout".

Parameters:
factory - a DynamicConfigFactory value
pm - a PluginMeta value to which parameters are added
portKeyName - the String key name for the parameter which contains the port
portDisplayName - the String display name for the parameter which contains the port
defaultPort - the String default port value if none is specified.

getConfiguredPort

public int getConfiguredPort()
Returns:
the remote port number configured for the channel.

getOpenPort

public int getOpenPort()
                throws IOException
Returns:
the remote port number for an open channel.
Throws:
IOException - if the channel is not open.

setListener

public void setListener(SocketAcceptorDeviceChannel.SocketAcceptorListener l)
                 throws IOException
Sets a listener whose methods are invoked via the associated ChannelManager proxy's ChannelManager.Proxy.listenerExecute(java.lang.Runnable) method when a new connection is accepted or when input is available on one of the accepted sockets.

Parameters:
l - a SocketAcceptorListener value
Throws:
IOException - if an I/O error occurs
IllegalStateException - if the channel is not open

Documentation is available at
${DOCSWEBROOT}
Copyright 2007 BEA Systems Inc.