cz.cuni.amis.pogamut.base.communication.connection.impl.socket
Class SocketConnection

Package class diagram package SocketConnection
java.lang.Object
  extended by cz.cuni.amis.pogamut.base.communication.connection.impl.AbstractConnection<ISocketConnectionAddress>
      extended by cz.cuni.amis.pogamut.base.communication.connection.impl.socket.SocketConnection
All Implemented Interfaces:
IWorldConnection<ISocketConnectionAddress>, IWorldReaderProvider, IWorldWriterProvider, IComponent

public class SocketConnection
extends AbstractConnection<ISocketConnectionAddress>


Field Summary
static String CONNECTION_ADDRESS_DEPENDENCY
           
static String CONNECTION_DEPENDENCY
           
 
Fields inherited from class cz.cuni.amis.pogamut.base.communication.connection.impl.AbstractConnection
address, COMPONENT_ID, controller, DEFAULT_LINE_END, eventBus, log
 
Constructor Summary
SocketConnection(ComponentDependencies dependencies, IComponentBus bus, IAgentLogger logger)
           
SocketConnection(ISocketConnectionAddress address, ComponentDependencies dependencies, IComponentBus bus, IAgentLogger logger)
           
 
Method Summary
protected  Reader getConnectionReader()
          This should return plain reader for the current connection.
protected  Writer getConnectionWriter()
          This should return plain writer for the current connection.
 String toString()
           
protected  void unsyncClose()
          Inner unsynchronized implementation of the close(), should close the connection to the remote side without throwing any exception.
protected  void unsyncConnect(ISocketConnectionAddress address)
          Inner implementation of connect, unsynchronized, this is called from connect(IConnectionDescriptor).
 
Methods inherited from class cz.cuni.amis.pogamut.base.communication.connection.impl.AbstractConnection
getAddress, getComponentId, getLog, getMessageEnd, getReader, getWriter, setAddress, setLogMessages
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONNECTION_DEPENDENCY

public static final String CONNECTION_DEPENDENCY
See Also:
Constant Field Values

CONNECTION_ADDRESS_DEPENDENCY

public static final String CONNECTION_ADDRESS_DEPENDENCY
See Also:
Constant Field Values
Constructor Detail

SocketConnection

@Inject
public SocketConnection(ISocketConnectionAddress address,
                               ComponentDependencies dependencies,
                               IComponentBus bus,
                               IAgentLogger logger)

SocketConnection

public SocketConnection(ComponentDependencies dependencies,
                        IComponentBus bus,
                        IAgentLogger logger)
Method Detail

getConnectionReader

protected Reader getConnectionReader()
                              throws ConnectionException
Description copied from class: AbstractConnection
This should return plain reader for the current connection. If connection is down, this should throw WorldConnectionException. We will wrap this reader with our own implementation that is capable of sniffing messages as they come (if required).

Specified by:
getConnectionReader in class AbstractConnection<ISocketConnectionAddress>
Returns:
Throws:
ConnectionException

getConnectionWriter

protected Writer getConnectionWriter()
                              throws ConnectionException
Description copied from class: AbstractConnection
This should return plain writer for the current connection. If connection is down, this should throw WorldConnectionException. We will wrap this writer with our own implementation that is capable of sniffing messages as they go (if required).

Specified by:
getConnectionWriter in class AbstractConnection<ISocketConnectionAddress>
Returns:
Throws:
ConnectionException

unsyncClose

protected void unsyncClose()
Description copied from class: AbstractConnection
Inner unsynchronized implementation of the close(), should close the connection to the remote side without throwing any exception. You may be sure that the connection is up (according to the flag) when this method is called.

Specified by:
unsyncClose in class AbstractConnection<ISocketConnectionAddress>

unsyncConnect

protected void unsyncConnect(ISocketConnectionAddress address)
                      throws ConnectionException
Description copied from class: AbstractConnection
Inner implementation of connect, unsynchronized, this is called from connect(IConnectionDescriptor). This is called only iff the connection is down and the address is a new address.

Specified by:
unsyncConnect in class AbstractConnection<ISocketConnectionAddress>
Throws:
ConnectionException

toString

public String toString()
Overrides:
toString in class AbstractConnection<ISocketConnectionAddress>


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.