org.objectweb.dream.channel
Class SocketManagerIPStaticImpl

java.lang.Object
  extended byorg.objectweb.dream.AbstractComponent
      extended byorg.objectweb.dream.channel.SocketManagerIPStaticImpl
All Implemented Interfaces:
AttributeController, BindingController, LifeCycleController, Loggable, SocketManager, SocketManagerIPStaticAttributeController

public class SocketManagerIPStaticImpl
extends AbstractComponent
implements SocketManager, SocketManagerIPStaticAttributeController

Socket manager managing only one open socket at a time. Socket is retrieved using a IPSocketManager, the IP and port value are set with the SocketManagerIPStaticAttributeControllerattribute controller interface.


Field Summary
protected  SocketState currentSocket
           
protected  IPSocketManager delegateSocketManagerItf
           
protected  InetAddress destinationAddress
           
protected  boolean destinationChanged
           
protected  int destinationPort
           
protected  boolean inUse
           
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, componentDesc, fcState, firstStart, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.channel.SocketManager
ITF_NAME
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
SocketManagerIPStaticImpl()
           
 
Method Summary
 void bindFc(String clientItfName, Object serverItf)
           
 String getDestinationHostname()
          Returns the destination hostname.
 int getDestinationPort()
          Returns the destination port.
 SocketState getSocket(Message message)
          Returns a socket that can be used to send message to a ChannelIn
 String[] listFc()
           
 void releaseSocket(SocketState socketState, boolean error)
          Releases the given SocketState.
 void setDestinationHostname(String hostname)
          Sets the destinationHostname attribute value.
 void setDestinationPort(int port)
          Sets the destinationPort attribute value.
 void stopFc()
           
 
Methods inherited from class org.objectweb.dream.AbstractComponent
beforeFirstStart, getFcState, initComponent, lookupFc, setLogger, startFc, unbindFc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

destinationChanged

protected boolean destinationChanged

inUse

protected boolean inUse

currentSocket

protected SocketState currentSocket

destinationAddress

protected InetAddress destinationAddress

destinationPort

protected int destinationPort

delegateSocketManagerItf

protected IPSocketManager delegateSocketManagerItf
Constructor Detail

SocketManagerIPStaticImpl

public SocketManagerIPStaticImpl()
Method Detail

getSocket

public SocketState getSocket(Message message)
                      throws IOException,
                             InterruptedException
Description copied from interface: SocketManager
Returns a socket that can be used to send message to a ChannelIn

Specified by:
getSocket in interface SocketManager
Parameters:
message - a message that is going to be sent to a ChannelIn
Returns:
a connection to the ChannelIn.
Throws:
InterruptedException - if the component is interrupted while waiting.
IOException - if the socket can't be opened.
See Also:
SocketManager.getSocket(Message)

releaseSocket

public void releaseSocket(SocketState socketState,
                          boolean error)
Description copied from interface: SocketManager
Releases the given SocketState.

Specified by:
releaseSocket in interface SocketManager
Parameters:
socketState - the socket state to release.
error - true if an exception has been catched while sending the message, false otherwise.
See Also:
SocketManager.releaseSocket(SocketState, boolean)

getDestinationHostname

public String getDestinationHostname()
Description copied from interface: SocketManagerIPStaticAttributeController
Returns the destination hostname. Each message will be send to this hostname.

Specified by:
getDestinationHostname in interface SocketManagerIPStaticAttributeController
Returns:
the destinationHostname attribute value.
See Also:
SocketManagerIPStaticAttributeController.getDestinationHostname()

setDestinationHostname

public void setDestinationHostname(String hostname)
                            throws UnknownHostException
Description copied from interface: SocketManagerIPStaticAttributeController
Sets the destinationHostname attribute value.

Specified by:
setDestinationHostname in interface SocketManagerIPStaticAttributeController
Parameters:
hostname - the new destinationHostname attribute value.
Throws:
UnknownHostException - if the given hostname can't be resolved.
See Also:
SocketManagerIPStaticAttributeController.setDestinationHostname(String)

getDestinationPort

public int getDestinationPort()
Description copied from interface: SocketManagerIPStaticAttributeController
Returns the destination port.

Specified by:
getDestinationPort in interface SocketManagerIPStaticAttributeController
Returns:
the destinationPort attribute value.
See Also:
SocketManagerIPStaticAttributeController.getDestinationPort()

setDestinationPort

public void setDestinationPort(int port)
Description copied from interface: SocketManagerIPStaticAttributeController
Sets the destinationPort attribute value.

Specified by:
setDestinationPort in interface SocketManagerIPStaticAttributeController
Parameters:
port - the new destinationPort attribute value.
See Also:
SocketManagerIPStaticAttributeController.setDestinationPort(int)

stopFc

public void stopFc()
            throws IllegalLifeCycleException
Specified by:
stopFc in interface LifeCycleController
Throws:
IllegalLifeCycleException
See Also:
LifeCycleController.stopFc()

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)


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