org.alliance.core.comm
Class Connection

java.lang.Object
  extended by org.alliance.core.comm.Connection
Direct Known Subclasses:
PacketConnection

public abstract class Connection
extends java.lang.Object

Created by IntelliJ IDEA. User: maciek Date: 2005-dec-26 Time: 11:56:52 To change this template use File | Settings | File Templates.


Nested Class Summary
static class Connection.Direction
           
 
Field Summary
protected  BandwidthAnalyzer bandwidthIn
           
protected  BandwidthAnalyzer bandwidthOut
           
protected  long bytesReceived
           
protected  long bytesSent
           
protected  boolean connected
           
protected  CoreSubsystem core
           
protected  Connection.Direction direction
           
protected  boolean hasWriteInterest
           
protected  java.lang.Object key
           
protected  NetworkManager netMan
           
protected  java.lang.String statusString
           
 
Constructor Summary
protected Connection(NetworkManager netMan, Connection.Direction direction)
           
protected Connection(NetworkManager netMan, Connection.Direction direction, java.lang.Object key)
           
 
Method Summary
 void bytesReceived(int n)
           
 void bytesSent(int sent)
           
 void close()
          Close this connection
 BandwidthAnalyzer getBandwidthIn()
           
 BandwidthAnalyzer getBandwidthOut()
           
 long getBytesReceived()
           
 long getBytesSent()
           
protected abstract  int getConnectionId()
           
 int getConnectionIdForRemote()
           
 Connection.Direction getDirection()
           
 java.lang.Object getKey()
           
 NetworkManager getNetMan()
           
 java.lang.String getStatusString()
           
 boolean hasWriteInterest()
           
 void init()
           
 boolean isConnected()
           
abstract  void readyToSend()
           
abstract  void received(java.nio.ByteBuffer buf)
           
 void setHasWriteInterest(boolean hasWriteInterest)
           
 void setKey(java.lang.Object key)
           
 void setStatusString(java.lang.String statusString)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

netMan

protected NetworkManager netMan

core

protected CoreSubsystem core

key

protected java.lang.Object key

direction

protected Connection.Direction direction

hasWriteInterest

protected boolean hasWriteInterest

bytesSent

protected long bytesSent

bytesReceived

protected long bytesReceived

bandwidthIn

protected BandwidthAnalyzer bandwidthIn

bandwidthOut

protected BandwidthAnalyzer bandwidthOut

statusString

protected java.lang.String statusString

connected

protected boolean connected
Constructor Detail

Connection

protected Connection(NetworkManager netMan,
                     Connection.Direction direction)

Connection

protected Connection(NetworkManager netMan,
                     Connection.Direction direction,
                     java.lang.Object key)
Method Detail

received

public abstract void received(java.nio.ByteBuffer buf)
                       throws java.io.IOException
Throws:
java.io.IOException

readyToSend

public abstract void readyToSend()
                          throws java.io.IOException
Throws:
java.io.IOException

getConnectionId

protected abstract int getConnectionId()

getConnectionIdForRemote

public int getConnectionIdForRemote()

bytesReceived

public void bytesReceived(int n)

bytesSent

public void bytesSent(int sent)

setKey

public void setKey(java.lang.Object key)

getDirection

public Connection.Direction getDirection()

init

public void init()
          throws java.io.IOException
Throws:
java.io.IOException

getNetMan

public NetworkManager getNetMan()

getKey

public java.lang.Object getKey()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

close

public void close()
           throws java.io.IOException
Close this connection

Throws:
java.io.IOException

getBytesSent

public long getBytesSent()

getBytesReceived

public long getBytesReceived()

hasWriteInterest

public boolean hasWriteInterest()

setHasWriteInterest

public void setHasWriteInterest(boolean hasWriteInterest)

getStatusString

public java.lang.String getStatusString()

setStatusString

public void setStatusString(java.lang.String statusString)

getBandwidthIn

public BandwidthAnalyzer getBandwidthIn()

getBandwidthOut

public BandwidthAnalyzer getBandwidthOut()

isConnected

public boolean isConnected()