org.apache.mina.common.support
Class DelegatedIoConnector

java.lang.Object
  extended by org.apache.mina.common.support.DelegatedIoConnector
All Implemented Interfaces:
IoConnector, IoService
Direct Known Subclasses:
DatagramConnector

public class DelegatedIoConnector
extends java.lang.Object
implements IoConnector

A delegated IoConnector that wraps the other IoConnector.


Field Summary
protected  IoConnector delegate
           
 
Constructor Summary
protected DelegatedIoConnector()
          Creates a new instance.
 
Method Summary
 void addListener(IoServiceListener listener)
          Adds an IoServiceListener that listens any events related with this service.
 ConnectFuture connect(java.net.SocketAddress address, IoHandler handler)
          Connects to the specified address.
 ConnectFuture connect(java.net.SocketAddress address, IoHandler handler, IoServiceConfig config)
          Connects to the specified address.
 ConnectFuture connect(java.net.SocketAddress address, java.net.SocketAddress localAddress, IoHandler handler)
          Connects to the specified address.
 ConnectFuture connect(java.net.SocketAddress address, java.net.SocketAddress localAddress, IoHandler handler, IoServiceConfig config)
          Connects to the specified address.
 IoServiceConfig getDefaultConfig()
          Returns the default configuration which is used when you didn't specify any configuration.
 DefaultIoFilterChainBuilder getFilterChain()
          A shortcut for ( ( DefaultIoFilterChainBuilder ) IoService.getFilterChainBuilder() ).
 IoFilterChainBuilder getFilterChainBuilder()
          Returns the global IoFilterChainBuilder which will modify the IoFilterChain of all IoSessions which is managed by this service.
 java.util.Set<java.net.SocketAddress> getManagedServiceAddresses()
          Returns all SocketAddresses this service is managing.
 java.util.Set<IoSession> getManagedSessions(java.net.SocketAddress serviceAddress)
          Returns all sessions with the specified remote or local address, which are currently managed by this service.
protected  void init(IoConnector delegate)
          Sets the delegate.
 boolean isManaged(java.net.SocketAddress serviceAddress)
          Returns true if this service is managing the specified serviceAddress.
 void removeListener(IoServiceListener listener)
          Removed an existing IoServiceListener that listens any events related with this service.
 void setFilterChainBuilder(IoFilterChainBuilder builder)
          Sets the global IoFilterChainBuilder which will modify the IoFilterChain of all IoSessions which is managed by this service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delegate

protected IoConnector delegate
Constructor Detail

DelegatedIoConnector

protected DelegatedIoConnector()
Creates a new instance.

Method Detail

init

protected void init(IoConnector delegate)
Sets the delegate. This method should be invoked before any operation is requested.


connect

public ConnectFuture connect(java.net.SocketAddress address,
                             IoHandler handler)
Description copied from interface: IoConnector
Connects to the specified address. If communication starts successfully, events are fired to the specified handler.

Specified by:
connect in interface IoConnector
Returns:
ConnectFuture that will tell the result of the connection attempt

connect

public ConnectFuture connect(java.net.SocketAddress address,
                             IoHandler handler,
                             IoServiceConfig config)
Description copied from interface: IoConnector
Connects to the specified address. If communication starts successfully, events are fired to the specified handler.

Specified by:
connect in interface IoConnector
config - the configuration
Returns:
ConnectFuture that will tell the result of the connection attempt

connect

public ConnectFuture connect(java.net.SocketAddress address,
                             java.net.SocketAddress localAddress,
                             IoHandler handler)
Description copied from interface: IoConnector
Connects to the specified address. If communication starts successfully, events are fired to the specified handler.

Specified by:
connect in interface IoConnector
localAddress - the local address the channel is bound to
Returns:
ConnectFuture that will tell the result of the connection attempt

connect

public ConnectFuture connect(java.net.SocketAddress address,
                             java.net.SocketAddress localAddress,
                             IoHandler handler,
                             IoServiceConfig config)
Description copied from interface: IoConnector
Connects to the specified address. If communication starts successfully, events are fired to the specified handler.

Specified by:
connect in interface IoConnector
config - the configuration
Returns:
ConnectFuture that will tell the result of the connection attempt

isManaged

public boolean isManaged(java.net.SocketAddress serviceAddress)
Description copied from interface: IoService
Returns true if this service is managing the specified serviceAddress. If this service is an IoAcceptor, serviceAddress is a bind address. If this service is an IoConnector, serviceAddress is a remote address.

Specified by:
isManaged in interface IoService

getManagedServiceAddresses

public java.util.Set<java.net.SocketAddress> getManagedServiceAddresses()
Description copied from interface: IoService
Returns all SocketAddresses this service is managing. If this service is an IoAcceptor, a set of bind addresses will be returned. If this service is an IoConnector, a set of remote addresses will be returned.

Specified by:
getManagedServiceAddresses in interface IoService

getManagedSessions

public java.util.Set<IoSession> getManagedSessions(java.net.SocketAddress serviceAddress)
Description copied from interface: IoService
Returns all sessions with the specified remote or local address, which are currently managed by this service. IoAcceptor will assume the specified address is a local address, and IoConnector will assume it's a remote address.

Specified by:
getManagedSessions in interface IoService
Parameters:
serviceAddress - the address to return all sessions for.
Returns:
the sessions. An empty collection if there's no session.

getDefaultConfig

public IoServiceConfig getDefaultConfig()
Description copied from interface: IoService
Returns the default configuration which is used when you didn't specify any configuration.

Specified by:
getDefaultConfig in interface IoService

getFilterChainBuilder

public IoFilterChainBuilder getFilterChainBuilder()
Description copied from interface: IoService
Returns the global IoFilterChainBuilder which will modify the IoFilterChain of all IoSessions which is managed by this service. The default value is an empty DefaultIoFilterChainBuilder.

Specified by:
getFilterChainBuilder in interface IoService

setFilterChainBuilder

public void setFilterChainBuilder(IoFilterChainBuilder builder)
Description copied from interface: IoService
Sets the global IoFilterChainBuilder which will modify the IoFilterChain of all IoSessions which is managed by this service. If you specify null this property will be set to an empty DefaultIoFilterChainBuilder.

Specified by:
setFilterChainBuilder in interface IoService

getFilterChain

public DefaultIoFilterChainBuilder getFilterChain()
Description copied from interface: IoService
A shortcut for ( ( DefaultIoFilterChainBuilder ) IoService.getFilterChainBuilder() ). Please note that the returned object is not a real IoFilterChain but a DefaultIoFilterChainBuilder. Modifying the returned builder won't affect the existing IoSessions at all, because IoFilterChainBuilders affect only newly created IoSessions.

Specified by:
getFilterChain in interface IoService

addListener

public void addListener(IoServiceListener listener)
Description copied from interface: IoService
Adds an IoServiceListener that listens any events related with this service.

Specified by:
addListener in interface IoService

removeListener

public void removeListener(IoServiceListener listener)
Description copied from interface: IoService
Removed an existing IoServiceListener that listens any events related with this service.

Specified by:
removeListener in interface IoService