T - The "real" connection of the Combox, be it a Socket or a Pipe.public abstract class Combox<T>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected POPAccessPoint |
accessPoint |
protected boolean |
available |
protected BufferFactory |
bufferFactory |
protected static int |
CLOSE_SUBCONNECTION |
protected Configuration |
conf |
protected static int |
OPEN_BIDIRECTIONAL |
protected T |
peerConnection |
protected static int |
PING |
protected POPRemoteCaller |
remoteCaller |
protected static int |
SEND_REMOTE_AP |
protected int |
timeOut |
| Constructor and Description |
|---|
Combox()
This is used by ServerCombox (server).
|
Combox(java.lang.String networkUUID)
This is used by Combox (client).
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
bindToBroker(int connectionID) |
void |
close(int connectionID)
Close the connection
|
protected void |
close(int connectionID,
boolean informPartner)
Close the connection
|
protected abstract void |
closeInternal() |
protected abstract boolean |
connectToServer()
Connect to the other side
|
boolean |
connectToServer(Broker broker,
POPAccessPoint accesspoint,
int timeout)
Connect to a ServerCombox on the other side, this will result in a Combox
(client mode) communicating with a Combox (server mode).
|
protected abstract boolean |
exportConnectionInfo()
Setup POPRemoteCaller (remoteCaller) variable which is going to be made
available to the user.
|
POPAccessPoint |
getAccessPoint()
Return the access point we are connected to
|
BufferFactory |
getBufferFactory()
Get the associated buffer factory
|
java.lang.String |
getNetworkUUID()
The network we are connecting or are connected to.
|
POPRemoteCaller |
getRemoteCaller()
Information about who we are talking too
|
protected void |
handleComboxMessages(POPBuffer tempBuffer) |
int |
makeBidirectional(Broker broker)
This function can be called to transform a client combox into a server
combox.
|
abstract int |
receive(POPBuffer buffer,
int requestId,
int connectionID)
Receive buffer from the other side
|
protected abstract boolean |
receiveNetworkName()
Called by the server client, it will receive the network name This must use
the basic peerConnection capabilities.
|
protected void |
registerCommuncation() |
protected int |
registerNewConnection() |
abstract int |
send(POPBuffer buffer)
Send the buffer to the other side
|
protected abstract boolean |
sendNetworkName()
Called by the client, it send the name of the network its in.
|
protected abstract boolean |
serverAccept()
Server accept connection.
|
boolean |
serverAccept(Broker broker,
T peerConnection)
Accept a connection from
connectToServer(). |
void |
setBufferFactory(BufferFactory bufferFactory)
Associate a buffer factory to the combox
|
void |
setNetworkUUID(java.lang.String networkUUID)
Set the new ID of this network
|
protected static final int SEND_REMOTE_AP
protected static final int OPEN_BIDIRECTIONAL
protected static final int CLOSE_SUBCONNECTION
protected static final int PING
protected int timeOut
protected POPAccessPoint accessPoint
protected boolean available
protected BufferFactory bufferFactory
protected T peerConnection
protected POPRemoteCaller remoteCaller
protected final Configuration conf
public Combox()
#serverAccept(java.lang.Object) to let the client connect.public Combox(java.lang.String networkUUID)
#connectToServer(ch.icosys.popjava.core.baseobject.POPAccessPoint, int)
to actually connect the client.networkUUID - The network UUID that will be send to the other endprotected int registerNewConnection()
public final boolean connectToServer(Broker broker, POPAccessPoint accesspoint, int timeout)
broker - Broker that is behind this connectionaccesspoint - Access point of the other side comboxtimeout - Connection time outpublic final boolean serverAccept(Broker broker, T peerConnection)
connectToServer(). Communicate with Client
mode Combox.peerConnection - the incoming connectionprotected abstract boolean exportConnectionInfo()
protected abstract boolean sendNetworkName()
protected abstract boolean receiveNetworkName()
protected abstract boolean connectToServer()
protected abstract boolean serverAccept()
#serverAccept(java.lang.Object) public abstract int send(POPBuffer buffer)
buffer - The buffer to sendpublic abstract int receive(POPBuffer buffer, int requestId, int connectionID)
buffer - Buffer to receiverequestId - The ID of the requestpublic void close(int connectionID)
protected void close(int connectionID,
boolean informPartner)
protected abstract void closeInternal()
public void setBufferFactory(BufferFactory bufferFactory)
bufferFactory - The buffer factory to associatepublic BufferFactory getBufferFactory()
public POPAccessPoint getAccessPoint()
public POPRemoteCaller getRemoteCaller()
public java.lang.String getNetworkUUID()
public void setNetworkUUID(java.lang.String networkUUID)
networkUUID - set the network UUIDpublic int makeBidirectional(Broker broker)
protected boolean bindToBroker(int connectionID)
protected void handleComboxMessages(POPBuffer tempBuffer)
protected void registerCommuncation()