com.ibm.agletx.util
Class MeetingsItinerary

java.lang.Object
  |
  +--com.ibm.aglet.event.MobilityAdapter
        |
        +--com.ibm.agletx.util.SeqItinerary
              |
              +--com.ibm.agletx.util.MeetingsItinerary
All Implemented Interfaces:
java.util.EventListener, MobilityListener, java.io.Serializable

public class MeetingsItinerary
extends SeqItinerary

An Itinerary class to control an itinerary to participate in multiple meetings.
The following is an typical usage of this class.

 MeetingsItinerary itinerary  = null;
 class MeetingTaskA extends MeetingTask {
 public MeetingTaskA(Meeting m) {
 super(m);
 }
 public void execute(SeqItinerary itin, Enumeration e) throws Exception {
 // do some work during the meeting.
 }
 }
 
 class MeetingTaskB extends MeetingTask {
 public MeetingTaskB(Meeting m) {
 super(m);
 
 }
 public void execute(SeqItinerary itin, Enumeration e) throws Exception {
 // do some work during the meeting
 }
 }
 
 public boolean handleMessage(Message msg) {
 if (msg.sameKind(itinerary.getCurrentMeeting().getID())) {
 // get notified of any new aglets arrived to the current meeting.
 return true;
 }
 return false;
 }
 
 public void onCreation(Object ini) {
 itinerary = new MeetingsItinerary(this);
 itinerary.addMeetingTask(new MeetingTaskA(new Meeting("atp://yariv.trl.ibm.com:4434")));
 itinerary.addMeetingTask(new MeetingTaskB(new Meeting("atp://tai.trl.ibm.com:4434")));
 itinerary.startTrip();
 }
 
In the above code, The MeetingTaskA and MeetingTaskB defines the specific tasks to be performed in every meeting. The itinerary.startTrip() causes the owner aglet to be dispatched sequentially among the meeting places. Upon arrival to a meeting place, the corresponding task (defined by the MeetingTask objects) is automatically executed.

Version:
1.20 $Date: 2001/07/28 06:33:39 $
Author:
Yariv Aridor
See Also:
Meeting, Serialized Form

Fields inherited from class com.ibm.agletx.util.SeqItinerary
aglet, currentTarget
 
Constructor Summary
MeetingsItinerary(Aglet aglet)
          Constructs a MeetingsItinerary object with the specified owner aglet.
 
Method Summary
 void addMeetingTask(MeetingTask task)
          Add the new plan item (meetingTask object)
 Meeting getCurrentMeeting()
          Return the current Meeting object
 Meeting getMeetingAt(int index)
          Return the meeting object at the specified index.
 
Methods inherited from class com.ibm.agletx.util.SeqItinerary
addAddress, addresses, addTask, atLastDestination, clear, getAddressAt, getCurrentAddress, getCurrentTask, getOrigin, getOwnerAglet, getTaskAt, goToNext, handleException, handleTripException, indexOf, indexOf, isRepeat, onArrival, onTermination, removeTaskAt, setRepeat, size, startTrip
 
Methods inherited from class com.ibm.aglet.event.MobilityAdapter
onDispatching, onReverting
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MeetingsItinerary

public MeetingsItinerary(Aglet aglet)
Constructs a MeetingsItinerary object with the specified owner aglet.
Parameters:
aglet - the owner aglet
Method Detail

addMeetingTask

public void addMeetingTask(MeetingTask task)
Add the new plan item (meetingTask object)
Parameters:
meeting - the meeting to participate

getCurrentMeeting

public Meeting getCurrentMeeting()
Return the current Meeting object

getMeetingAt

public Meeting getMeetingAt(int index)
Return the meeting object at the specified index.