Communication mechanisms used by Siena.

Basic Communication in Siena

The basis for communication between Siena components is a generic, uni-directional, point-to-point, packet-based communication service. In essence, this mechanism is an abstraction of a datagram link between two components. A link is defined by the {@link siena.comm.PacketSender PacketSender} and {@link siena.comm.PacketReceiver PacketReceiver} interfaces, representing the sender's and receiver's ends respectively.

As a first step in establishing a communication link, a receiver creates a {@link siena.comm.PacketReceiver PacketReceiver} object. Once a PacketReceiver is active, a sender can create a corresponding {@link siena.comm.PacketSender PacketSender} object to send packets to the receiver. PacketSender objects are created idirectly through {@link siena.comm.PacketSenderFactory PacketSenderFactory}, using the receiver's {@link siena.comm.PacketReceiver#address() external address}.

An external address of a PacketReceiver is a byte string that serves as a universal locator for that receiver. The space of external addresses is obviously shared by all link types and implementations. Therefore, in order to partition the address space, an external address must comply with the following syntax:

address ::= schema:schema-dependent-part

Where schema is a short string, not containing the ":" (colon) charachter, that uniquely identifies the type of receiver, and schema-dependent-part is another string whose format is specific to that type of receiver.

The current implementation of Siena provides three sender/receiver implementation pairs:

Extending the Communication Capabilities of Siena

Siena can be easily extended with new packet sender/receiver implementation pairs. For example, a developer may want to implement a communication mechanism that uses, say, an infra-red port. In order to do that, the developer must:
  1. choose a globally unique schema identifier, for example "ir".
  2. provide a pair of specific implementations of {@link siena.comm.PacketReceiver} and {@link siena.comm.PacketSender} that make use of the infra-red port. For example, these could be called org.xyz.IRPacketReceiver and org.xyz.IRPacketSender.
  3. provide a specific sender factory, say org.xyz.IRSenderFactory, to be used directly by applications, or indirectly through the {@link siena.comm.GenericSenderFactory#registerFactory(String,PacketSenderFactory) factory registration} feature of {@link siena.comm.GenericSenderFactory}.