BEA Systems, Inc.

com.connecterra.ale.reader
Class DeviceChannel

java.lang.Object
  extended by com.connecterra.ale.reader.DeviceChannel
Direct Known Subclasses:
SocketAcceptorDeviceChannel, com.connecterra.ale.reader.SocketDeviceChannel

public abstract class DeviceChannel
extends Object

This class is the base class for all channels used by the ChannelManager. A DeviceChannel may only be associated with a single ChannelManager. Note that creating a channel must not actually begin communications with the device until the DeviceChannel.open() method is called.

See ChannelManager for notes on this class and reentrancy.


Nested Class Summary
protected  class DeviceChannel.AbstractOpenChannel
          An instance of this class should be instantiated and returned by the channel when the channel is opened.
protected  class DeviceChannel.MarkingInputStream
          This class wraps another input stream.
 
Constructor Summary
DeviceChannel()
           
 
Method Summary
protected abstract  void close()
          Close the channel.
protected  Logger getLogger()
           
protected  com.connecterra.ale.reader.Reactor getReactor()
           
protected  void markUsed()
          This method must be invoked by the channel whenever data is received on the channel.
protected abstract  DeviceChannel.AbstractOpenChannel open()
          Open the channel.
protected  void reactivateChannels()
          Delegates to ChannelManager.reactivateChannels() on the associated ChannelManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeviceChannel

public DeviceChannel()
Method Detail

getReactor

protected com.connecterra.ale.reader.Reactor getReactor()
                                                 throws IOException
Returns:
a Reactor which can be used to implement asynchronous listeners.
Throws:
IOException - if an I/O error occurs

getLogger

protected Logger getLogger()
Returns:
the Logger returned by the associated ChannelManager's proxy.

markUsed

protected void markUsed()
This method must be invoked by the channel whenever data is received on the channel. This updates the time returned by the associated ChannelManager's ChannelManager.getLastUsedTime() method.


reactivateChannels

protected void reactivateChannels()
Delegates to ChannelManager.reactivateChannels() on the associated ChannelManager.


open

protected abstract DeviceChannel.AbstractOpenChannel open()
                                                   throws IOException
Open the channel. This should initiate communications with the channel (open a socket, listen for inbound connections, initialize a library, etc.).

Returns:
an AbstractOpenChannel value which represents the open channel.
Throws:
IOException - if an I/O error occurs

close

protected abstract void close()
Close the channel. Give up all resources, because after this call, another DeviceChannel object with the same configuration might be opened, and it should not fail just because this object still holds some resource.


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