Package jadex.platform.service.transport
Interface ITransport<Con>
-
- All Known Implementing Classes:
IntravmTransport,TcpTransport,WebSocketTransport
public interface ITransport<Con>Internal transport representation for host:port-based transports.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcloseConnection(Con con)Perform close operations on a connection.IFuture<Con>createConnection(java.lang.String address, IComponentIdentifier target)Create a connection to a given address.java.lang.StringgetProtocolName()Get the protocol name.voidinit(ITransportHandler<Con> handler)Initialize the transport.IFuture<java.lang.Integer>openPort(int port)Open a port to accept connections.IFuture<java.lang.Integer>sendMessage(Con con, byte[] header, byte[] body)Send bytes using the given connection.voidshutdown()Shutdown and free all resources.
-
-
-
Method Detail
-
init
void init(ITransportHandler<Con> handler)
Initialize the transport. To be called once, before any other method.- Parameters:
handler- The transport handler with callback methods.
-
shutdown
void shutdown()
Shutdown and free all resources. To be called once, as last method.
-
getProtocolName
java.lang.String getProtocolName()
Get the protocol name.
-
openPort
IFuture<java.lang.Integer> openPort(int port)
Open a port to accept connections.- Parameters:
port- The (positive) port or 0 for any port.- Returns:
- A future holding the actual port, once the server is running.
-
createConnection
IFuture<Con> createConnection(java.lang.String address, IComponentIdentifier target)
Create a connection to a given address.- Parameters:
address- The target platform's address.target- The target identifier to maybe perform authentication of the connection.- Returns:
- A future containing the connection when succeeded.
-
closeConnection
void closeConnection(Con con)
Perform close operations on a connection. Potentially cleans up key attachments as well.
-
-