org.apache.activemq.apollo.transport
Class TransportFilter

java.lang.Object
  extended by org.apache.activemq.apollo.transport.TransportFilter
All Implemented Interfaces:
Transport, TransportListener, Service

public class TransportFilter
extends java.lang.Object
implements TransportListener, Transport

Version:
$Revision: 1.5 $

Field Summary
protected  Transport next
           
protected  TransportListener transportListener
           
 
Constructor Summary
TransportFilter(Transport next)
           
 
Method Summary
 boolean full()
           
 org.fusesource.hawtdispatch.DispatchQueue getDispatchQueue()
          Returns the dispatch queue used by the transport
 Transport getNext()
           
 ProtocolCodec getProtocolCodec()
           
 java.lang.String getRemoteAddress()
           
 TransportListener getTransportListener()
          Returns the current transport listener
 java.lang.String getTypeId()
           
 boolean isConnected()
           
 boolean isDisposed()
           
 boolean isFaultTolerant()
          Indicates if the transport can handle faults
<T> T
narrow(java.lang.Class<T> target)
           
 boolean offer(java.lang.Object command)
          A one way asynchronous send of a command.
 void onRefill()
          transport can now accept more commands for transmission.
 void onTransportCommand(java.lang.Object command)
          called to process a command
 void onTransportConnected()
          The transport has been connected.
 void onTransportDisconnected()
          The transport has suffered a disconnection from which it hopes to recover
 void onTransportFailure(java.io.IOException error)
          An unrecoverable exception has occured on the transport
 void reconnect(java.net.URI uri)
          reconnect to another location
 void resumeRead()
          resume delivery of commands.
 void setDispatchQueue(org.fusesource.hawtdispatch.DispatchQueue queue)
          Sets the dispatch queue used by the transport
 void setNext(Transport next)
           
 void setProtocolCodec(ProtocolCodec protocolCodec)
          Sets the protocol codec for the transport
 void setTransportListener(TransportListener listener)
          Registers an inbound command listener
 void start()
           
 void start(java.lang.Runnable onComplete)
           
 void stop()
           
 void stop(java.lang.Runnable onComplete)
           
 void suspendRead()
          suspend delivery of commands.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

next

protected Transport next

transportListener

protected TransportListener transportListener
Constructor Detail

TransportFilter

public TransportFilter(Transport next)
Method Detail

getNext

public Transport getNext()
Returns:
Returns the next transport.

setNext

public void setNext(Transport next)

getTransportListener

public TransportListener getTransportListener()
Description copied from interface: Transport
Returns the current transport listener

Specified by:
getTransportListener in interface Transport
Returns:

setTransportListener

public void setTransportListener(TransportListener listener)
Description copied from interface: Transport
Registers an inbound command listener

Specified by:
setTransportListener in interface Transport

getDispatchQueue

public org.fusesource.hawtdispatch.DispatchQueue getDispatchQueue()
Description copied from interface: Transport
Returns the dispatch queue used by the transport

Specified by:
getDispatchQueue in interface Transport
Returns:

setDispatchQueue

public void setDispatchQueue(org.fusesource.hawtdispatch.DispatchQueue queue)
Description copied from interface: Transport
Sets the dispatch queue used by the transport

Specified by:
setDispatchQueue in interface Transport

suspendRead

public void suspendRead()
Description copied from interface: Transport
suspend delivery of commands.

Specified by:
suspendRead in interface Transport

resumeRead

public void resumeRead()
Description copied from interface: Transport
resume delivery of commands.

Specified by:
resumeRead in interface Transport

start

public void start()
           throws java.lang.Exception
Specified by:
start in interface Service
Throws:
java.io.IOException - if the next channel has not been set.
java.lang.Exception
See Also:
Service.start()

start

public void start(java.lang.Runnable onComplete)
           throws java.lang.Exception
Specified by:
start in interface Service
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Specified by:
stop in interface Service
Throws:
java.lang.Exception
See Also:
Service.stop()

stop

public void stop(java.lang.Runnable onComplete)
          throws java.lang.Exception
Specified by:
stop in interface Service
Throws:
java.lang.Exception

onTransportCommand

public void onTransportCommand(java.lang.Object command)
Description copied from interface: TransportListener
called to process a command

Specified by:
onTransportCommand in interface TransportListener

onRefill

public void onRefill()
Description copied from interface: TransportListener
transport can now accept more commands for transmission.

Specified by:
onRefill in interface TransportListener

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

offer

public boolean offer(java.lang.Object command)
Description copied from interface: Transport
A one way asynchronous send of a command. Only sent if the the transport is not full.

Specified by:
offer in interface Transport
Returns:
true if the command was accepted.

full

public boolean full()
Specified by:
full in interface Transport

onTransportFailure

public void onTransportFailure(java.io.IOException error)
Description copied from interface: TransportListener
An unrecoverable exception has occured on the transport

Specified by:
onTransportFailure in interface TransportListener

onTransportDisconnected

public void onTransportDisconnected()
Description copied from interface: TransportListener
The transport has suffered a disconnection from which it hopes to recover

Specified by:
onTransportDisconnected in interface TransportListener

onTransportConnected

public void onTransportConnected()
Description copied from interface: TransportListener
The transport has been connected.

Specified by:
onTransportConnected in interface TransportListener

narrow

public <T> T narrow(java.lang.Class<T> target)
Specified by:
narrow in interface Transport
Returns:
the target

getRemoteAddress

public java.lang.String getRemoteAddress()
Specified by:
getRemoteAddress in interface Transport
Returns:
the remote address for this connection

isFaultTolerant

public boolean isFaultTolerant()
Description copied from interface: Transport
Indicates if the transport can handle faults

Specified by:
isFaultTolerant in interface Transport
Returns:
See Also:
Transport.isFaultTolerant()

isDisposed

public boolean isDisposed()
Specified by:
isDisposed in interface Transport
Returns:
true if the transport is disposed

isConnected

public boolean isConnected()
Specified by:
isConnected in interface Transport
Returns:
true if the transport is connected

getTypeId

public java.lang.String getTypeId()
Specified by:
getTypeId in interface Transport
Returns:
the identifier for the transport type. Example "tcp" for the tcp transport.

reconnect

public void reconnect(java.net.URI uri)
Description copied from interface: Transport
reconnect to another location

Specified by:
reconnect in interface Transport

getProtocolCodec

public ProtocolCodec getProtocolCodec()
Specified by:
getProtocolCodec in interface Transport
Returns:
The protocol codec for the transport.

setProtocolCodec

public void setProtocolCodec(ProtocolCodec protocolCodec)
Description copied from interface: Transport
Sets the protocol codec for the transport

Specified by:
setProtocolCodec in interface Transport


Copyright © 2005-2011 The Apache Software Foundation. All Rights Reserved.