In the Broadcast Server example, the Object Model starts as follows:
a Site: contains a set of Channels a Channel: contains a set of ScheduledEvents a ScheduledEvent: is made of a Lecture, a Scheduled Time and a Duration. a Lecture: is composed of Assets and a composition file. an Asset: is made of a MaterialFile and meta-data : belongs to one or more AssetCategories an AssetCategory: contains Assets : belongs to a parent AssetCategory
A distributed object cannot publish data directly, because all access to the distributed object must be mediated by the middleware -- that is, data is not directly accessible through pointers because it resides in separate processes and machines.
For example, the Channel object can be characterized by the following interface (using Java-like syntax):
public Interface Channel { // return eagerly the whole list of scheduled events on the channel // whose ScheduledTime is more or equal than "from" and strictly less // than "to". // Exception thrown if: To < From // Returns an empty list if the channel is not formatted during the // requested period. SchedEventList getSchedEvents(DateTime from, DateTime to) throws EInvalidParam; // return a lazy enumerator of the sched. events on the channel // Same signature as above. SchedEventEnum getSchedEventsEnum(DateTime from, DateTime to) throws EInvalidParam; // add a scheduled event to the channel. // The parameter specifies the requested time and duration. // throws an exception if the requested slot overlaps with an existing // scheduled event. void addSchedEvent(SchedEvent se) throws ECannotAdd; }
The ChannelProtocol maintains a state according to the following state-machine:
Ready ReceiveParameter1-1 (One set for each method) ReceiveParameter1-2 ...According to the protocol, the client sends requests identified with "tags" and the server sends back return values or exception notification using tags. The tags used for the Channel Protocol are:
Incoming Tags GS1 Requests the getSchedEvents method GS1-1 Send parameter 1 (From) of getSchedEvents GS1-2 Send parameter 2 (To) of getSchedEvents GS2 Requests the getSchedEventsEnum method GS2-1 Send parameter 1 (From) of getSchedEventsEnum GS2-2 Send parameter 2 (To) of getSchedEventsEnum GS3 Requests the addSchedEvent method GS3-1 Send parameter 1 (Se) of addschedevent Outgoing Tags GS1-V Return value of getSchedEvents method GS1-E Exception from getSchedEvents method p GS2-V Return value of getSchedEventsEnum method GS2-E Exception from getSchedEvents method GS3-V Return value of getSchedEventsEnum method GS3-E Exception from getSchedEvents methodThe state-machine implements the following transitions:
Current State Event Reaction Next State =================================================================== Ready GS1 ok ReceiveParameter1-1 Ready GS2 ok ReceiveParameter2-1 Ready GS3 ok ReceiveParameter3-1 ReadyERROR Ready ReceiveParameter1-1 GS1-1 ok ReceiveParameter1-2 ReceiveParameter1-1 ERROR Ready ReceiveParameter1-2 GS1-2 invoke-return Ready ReceiveParameter1-2 ERROR Ready ReceiveParameter2-1 GS2-1 ok ReceiveParameter2-2 ReceiveParameter2-1 ERROR Read ReceiveParameter2-2 GS2-2 invoke-return Ready ReceiveParameter2-2 ERROR Ready ReceiveParameter3-1 GS3-1 invoke-return Ready ReceiveParameter3-1 ERROR Ready
To make an object serializable, just add:
public class Channel implements Serializable ...The methods used to read and write objects are:
writeObject(ObjectOutputStream out) throws IOException; readObject(ObjectInputStream out) throws IOException;