org.objectweb.dream.channel
Class AbstractTCPChannelInImpl

java.lang.Object
  extended byorg.objectweb.dream.AbstractComponent
      extended byorg.objectweb.dream.channel.AbstractTCPChannelInImpl
All Implemented Interfaces:
AttributeController, BindingController, IPChannelInAttributeController, LifeCycleController, Loggable
Direct Known Subclasses:
BasicTCPChannelInImpl, MultiConnTCPChannelInImpl

public class AbstractTCPChannelInImpl
extends AbstractComponent
implements IPChannelInAttributeController

Abstract implementation of a TCP ChannelIn Component.


Field Summary
protected  MessageCodec messageCodecItf
          The message encoder/decoder interface to which this component is bound.
protected  int openRetry
           
protected  Push outPushItf
          The server interface to which this component is bound.
protected  int portNum
          The listening port number;
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, componentDesc, fcState, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
AbstractTCPChannelInImpl()
           
 
Method Summary
 void bindFc(String clientItfName, Object serverItf)
           
protected  ServerSocket createServerSocket(int port)
          This method creates and returns a server socket which uses all network interfaces on the host, and is bound to the specified port.
 int getListeningPort()
          Returns the listening port.
 int getOpenRetry()
          Returns the number of attempts to open a ServerSocket before aborting.
 String[] listFc()
           
protected  void sendAck(Socket socket)
          Does not do anything.
 void setListeningPort(int port)
          Sets the listening port.
 void setOpenRetry(int retry)
          Sets the number of attempts to open a ServerSocketbefore aborting.
protected  void setSocketOption(Socket sock)
          Configures this socket using the socket options established for this factory.
 
Methods inherited from class org.objectweb.dream.AbstractComponent
getFcState, initComponent, lookupFc, setLogger, startFc, stopFc, unbindFc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outPushItf

protected Push outPushItf
The server interface to which this component is bound.


messageCodecItf

protected MessageCodec messageCodecItf
The message encoder/decoder interface to which this component is bound.


portNum

protected int portNum
The listening port number;


openRetry

protected int openRetry
Constructor Detail

AbstractTCPChannelInImpl

public AbstractTCPChannelInImpl()
Method Detail

getListeningPort

public int getListeningPort()
Description copied from interface: IPChannelInAttributeController
Returns the listening port.

Specified by:
getListeningPort in interface IPChannelInAttributeController
Returns:
the listening port.
See Also:
IPChannelInAttributeController.getListeningPort()

setListeningPort

public void setListeningPort(int port)
                      throws IllegalLifeCycleException
Description copied from interface: IPChannelInAttributeController
Sets the listening port.

Specified by:
setListeningPort in interface IPChannelInAttributeController
Parameters:
port - the listening port.
Throws:
IllegalLifeCycleException - cannot change port number if the component is started.
See Also:
IPChannelInAttributeController.setListeningPort(int)

getOpenRetry

public int getOpenRetry()
Description copied from interface: IPChannelInAttributeController
Returns the number of attempts to open a ServerSocket before aborting.

Specified by:
getOpenRetry in interface IPChannelInAttributeController
Returns:
the number of attempts to open a ServerSocket before aborting.
See Also:
IPChannelInAttributeController.getOpenRetry()

setOpenRetry

public void setOpenRetry(int retry)
Description copied from interface: IPChannelInAttributeController
Sets the number of attempts to open a ServerSocketbefore aborting.

Specified by:
setOpenRetry in interface IPChannelInAttributeController
Parameters:
retry - the number of attempts to open a ServerSocketbefore aborting.
See Also:
IPChannelInAttributeController.setOpenRetry(int)

listFc

public String[] listFc()
Specified by:
listFc in interface BindingController
See Also:
BindingController.listFc()

bindFc

public void bindFc(String clientItfName,
                   Object serverItf)
            throws NoSuchInterfaceException,
                   IllegalBindingException,
                   IllegalLifeCycleException
Specified by:
bindFc in interface BindingController
Throws:
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
See Also:
BindingController.bindFc(String, Object)

sendAck

protected void sendAck(Socket socket)
                throws IOException
Does not do anything.

Parameters:
socket -
Throws:
IOException

createServerSocket

protected ServerSocket createServerSocket(int port)
                                   throws IOException
This method creates and returns a server socket which uses all network interfaces on the host, and is bound to the specified port. It may be overloaded in subclass, in order to create particular subclasses of server sockets.

Parameters:
port - the port to listen to.
Returns:
a server socket bound to the specified port.
Throws:
IOException - for networking errors

setSocketOption

protected void setSocketOption(Socket sock)
                        throws SocketException
Configures this socket using the socket options established for this factory. It may be overloaded in subclass, in order to handle particular subclasses of sockets

Parameters:
sock - the socket.
Throws:
SocketException - for networking errors


Copyright © 2003, 2004 - INRIA Rhone-Alpes - All Rights Reserved.