All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.agletx.util.MeetingsItinerary

java.lang.Object
   |
   +----com.ibm.aglet.event.MobilityAdapter
           |
           +----com.ibm.agletx.util.SeqItinerary
                   |
                   +----com.ibm.agletx.util.MeetingsItinerary

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:434")));
	itinerary.addMeetingTask(new MeetingTaskB(new Meeting("atp://tai.trl.ibm.com:434")));
	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.

See Also:
Meeting

Constructor Index

 o MeetingsItinerary(Aglet)
Constructs a MeetingsItinerary object with the specified owner aglet.

Method Index

 o addMeetingTask(MeetingTask)
Add the new plan item (meetingTask object)
 o getCurrentMeeting()
Return the current Meeting object
 o getMeetingAt(int)
Return the meeting object at the specified index.

Constructors

 o MeetingsItinerary
 public MeetingsItinerary(Aglet aglet)
Constructs a MeetingsItinerary object with the specified owner aglet.

Parameters:
aglet - the owner aglet

Methods

 o getCurrentMeeting
 public Meeting getCurrentMeeting()
Return the current Meeting object

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

 o addMeetingTask
 public void addMeetingTask(MeetingTask task)
Add the new plan item (meetingTask object)

Parameters:
meeting - the meeting to participate

All Packages  Class Hierarchy  This Package  Previous  Next  Index