org.caleigo.toolkit.tunnel
Interface ITunnelServer

All Known Implementing Classes:
AbstractTunnelServer

public interface ITunnelServer

An ITunnelServer is responsible for accepting connections from ITunnels and for setting up those connections. Setting up a connection involves creating an ITunnel that can receive messages from the connecting ITunnel, and configuring the created ITunnel so that it uses the correct ITunnelCodec and ITunnelPackers.

Version:
1.00
Author:
Mattias Hagstrand

Method Summary
 void addMessageConsumer(IMessageConsumer consumer)
          Adds the IMessageConsumer that receives messages from all connections that this ITunnelServer has set up.
 void addTunnelServerListener(ITunnelServerListener listener)
           
 void finalize()
          Performs cleanup for this ITunnelServer.
 ITunnel getTunnel(int index)
          Returns the ITunnel with the provided index.
 int getTunnelCount()
          Returns the number of ITunnels that this ITunnelServer has created.
 java.util.Iterator getTunnels()
          Returns an Iterator for all ITunnels that this ITunnelServer has created.
 void initialize()
          Initializes the ITunnelServer.
 void registerCodec(java.lang.Class codec)
          Registers an ITunnelCodec that can be used when setting up a connection.
 void registerPacker(java.lang.Class packer)
          Registers an ITunnelPacker that can be used when setting up a connection.
 void removeMessageConsumer(IMessageConsumer consumer)
          Removes the IMessageConsumer all connections that this ITunnelServer has set up.
 void removeTunnelServerListener(ITunnelServerListener listener)
           
 

Method Detail

initialize

public void initialize()
                throws java.lang.IllegalStateException,
                       TunnelException
Initializes the ITunnelServer. This method must be called before connections can be accepted.

Throws:
java.lang.IllegalStateException
TunnelException

finalize

public void finalize()
              throws java.lang.IllegalStateException,
                     TunnelException
Performs cleanup for this ITunnelServer. This involves closing all connections. No connections can be accepted after this method has been called.

Throws:
java.lang.IllegalStateException
TunnelException

registerPacker

public void registerPacker(java.lang.Class packer)
Registers an ITunnelPacker that can be used when setting up a connection.


registerCodec

public void registerCodec(java.lang.Class codec)
Registers an ITunnelCodec that can be used when setting up a connection.


addMessageConsumer

public void addMessageConsumer(IMessageConsumer consumer)
Adds the IMessageConsumer that receives messages from all connections that this ITunnelServer has set up. This is a convenience method. Calling this method has the same effect as calling addMessageConsumer on all of the individual ITunnels returned by getTunnels. All IMessageConsumers that have been added with this method will automatically be added to all new ITunnels that are create.


removeMessageConsumer

public void removeMessageConsumer(IMessageConsumer consumer)
Removes the IMessageConsumer all connections that this ITunnelServer has set up. This is a convenience method. Calling this method has the same effect as calling removeMessageConsumer on all of the individual ITunnels returned by getTunnels.


getTunnel

public ITunnel getTunnel(int index)
Returns the ITunnel with the provided index.


getTunnels

public java.util.Iterator getTunnels()
Returns an Iterator for all ITunnels that this ITunnelServer has created.


getTunnelCount

public int getTunnelCount()
Returns the number of ITunnels that this ITunnelServer has created.


addTunnelServerListener

public void addTunnelServerListener(ITunnelServerListener listener)

removeTunnelServerListener

public void removeTunnelServerListener(ITunnelServerListener listener)


Copyright © 2005 Caleigo. All Rights Reserved.