org.activeio.command
Class AsyncChannelToAsyncCommandChannel

java.lang.Object
  extended byorg.activeio.command.AsyncChannelToAsyncCommandChannel
All Implemented Interfaces:
AsyncCommandChannel, Channel, Disposable, Service

public class AsyncChannelToAsyncCommandChannel
extends Object
implements AsyncCommandChannel

Version:
$Revision: 1.1 $

Field Summary
 
Fields inherited from interface org.activeio.Service
NO_WAIT_TIMEOUT, WAIT_FOREVER_TIMEOUT
 
Constructor Summary
AsyncChannelToAsyncCommandChannel(AsyncChannel channel, WireFormat wireFormat)
           
 
Method Summary
 void dispose()
          This method should not throw any exceptions.
 Object narrow(Class target)
          Since a Channel may be composed from a chain of other Channel obejcts, this method allows you to query the chain for the specified interface.
 void setCommandListener(CommandListener listener)
          Allows a listener to be added for commands
 void start()
          Starts the channel.
 void stop(long timeout)
          Stops the channel.
 void writeCommand(Object command)
          Sends a command down the channel towards the media, using a WireFormat to decide how to marshall the command onto the media.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncChannelToAsyncCommandChannel

public AsyncChannelToAsyncCommandChannel(AsyncChannel channel,
                                         WireFormat wireFormat)
Method Detail

writeCommand

public void writeCommand(Object command)
                  throws IOException
Description copied from interface: AsyncCommandChannel
Sends a command down the channel towards the media, using a WireFormat to decide how to marshall the command onto the media.

Specified by:
writeCommand in interface AsyncCommandChannel
Parameters:
command -
Throws:
IOException

narrow

public Object narrow(Class target)
Description copied from interface: Channel
Since a Channel may be composed from a chain of other Channel obejcts, this method allows you to query the chain for the specified interface. The first Channel in the chain the implments the requested interface will be return an implementing object. If no Channel in the chain implements the requested class, then null is returned.

Specified by:
narrow in interface Channel

dispose

public void dispose()
Description copied from interface: Disposable
This method should not throw any exceptions. Cleaning up a Disposable object should be easy of an end user therefore do not make him have to handle an Exception.

Specified by:
dispose in interface Disposable

start

public void start()
           throws IOException
Description copied from interface: Service
Starts the channel. Once started, the channel is in the running state.

Specified by:
start in interface Service
Throws:
IOException

stop

public void stop(long timeout)
          throws IOException
Description copied from interface: Service
Stops the channel. Once stopped, the channel is in the stopped state.

Specified by:
stop in interface Service
Parameters:
timeout - The amount of time the channel is allowed to take to gracefully stop. If the timeout is exceeded, the channel should do a forcefull stop.
Throws:
IOException

setCommandListener

public void setCommandListener(CommandListener listener)
Description copied from interface: AsyncCommandChannel
Allows a listener to be added for commands

Specified by:
setCommandListener in interface AsyncCommandChannel
Parameters:
listener -


Copyright © -2007 The ActiveIO Project. All Rights Reserved.