com.ibm.agletx.util
Class SeqItinerary

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

public abstract class SeqItinerary
extends MobilityAdapter
implements java.io.Serializable

Define an abstract interface for an aglet's itinerary. An Itinerary is a set of pairs of the form [host, task] where the task should be performed upon arrival of the aglet to the host.

Version:
1.10 $Date: 2001/07/28 06:33:36 $
Author:
Yariv Aridor
See Also:
Task, Serialized Form

Field Summary
protected  Aglet aglet
           
protected  AgletProxy currentTarget
           
 
Constructor Summary
SeqItinerary(Aglet aglet)
          Constructor.
 
Method Summary
 void addAddress(java.lang.String address)
          Add a new destination
 java.util.Enumeration addresses()
          Return an enumeration of all the addresses
 void addTask(java.lang.String address, Task task)
          Add a new task
 boolean atLastDestination()
          Check if at the last destination
 void clear()
          Empty the itineray
 java.lang.String getAddressAt(int index)
          Return the address at the specified index.
 java.lang.String getCurrentAddress()
          Return the address of the current destination
protected  Task getCurrentTask()
          Return the task to be preformed at the current destination
 java.lang.String getOrigin()
          Return the address of the origin
 AgletProxy getOwnerAglet()
          Return the Proxy of the owner aglet
 Task getTaskAt(int index)
          Return the task at a specific index
 void goToNext()
          Go to the next address and perform the next task
 void handleException(java.lang.Throwable ex)
          Handle exception during task execution
 void handleTripException(java.lang.Throwable ex)
          Handle exception during the travelling of the owner aglet (try to dispatch to the next destination).
 int indexOf(java.lang.String address)
          Return the index of a specific address
 int indexOf(Task task)
          Return the index of a specific task
 boolean isRepeat()
          Check if the itinerary is a cyclic one.
 void onArrival(MobilityEvent ev)
          This is not normally used by aglets programmers.
protected  void onTermination()
           
 void removeTaskAt(int index)
          Remove a task at a specific index
 void setRepeat(boolean b)
          Define whether the itinerary is to be repeated (cyclic)
 int size()
          Return the size of the aglet's itinerary.
 void startTrip()
          Start the trip defined in this itinerary
 
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
 

Field Detail

aglet

protected Aglet aglet

currentTarget

protected transient AgletProxy currentTarget
Constructor Detail

SeqItinerary

public SeqItinerary(Aglet aglet)
Constructor.
Parameters:
aglet - the owner aglet
Method Detail

addAddress

public void addAddress(java.lang.String address)
Add a new destination
Parameters:
the - address of the host where the task is to be executed.

addresses

public java.util.Enumeration addresses()
Return an enumeration of all the addresses

addTask

public void addTask(java.lang.String address,
                    Task task)
Add a new task
Parameters:
task - the task to be added
the - address of the host where the task is to be executed.

atLastDestination

public boolean atLastDestination()
Check if at the last destination

clear

public void clear()
Empty the itineray

getAddressAt

public java.lang.String getAddressAt(int index)
Return the address at the specified index.

getCurrentAddress

public java.lang.String getCurrentAddress()
Return the address of the current destination

getCurrentTask

protected Task getCurrentTask()
Return the task to be preformed at the current destination

getOrigin

public java.lang.String getOrigin()
Return the address of the origin

getOwnerAglet

public AgletProxy getOwnerAglet()
Return the Proxy of the owner aglet

getTaskAt

public Task getTaskAt(int index)
Return the task at a specific index

goToNext

public void goToNext()
Go to the next address and perform the next task

handleException

public void handleException(java.lang.Throwable ex)
Handle exception during task execution
Parameters:
ex - the exception

handleTripException

public void handleTripException(java.lang.Throwable ex)
Handle exception during the travelling of the owner aglet (try to dispatch to the next destination).
Parameters:
ex - the exception

indexOf

public int indexOf(Task task)
Return the index of a specific task

indexOf

public int indexOf(java.lang.String address)
Return the index of a specific address

isRepeat

public boolean isRepeat()
Check if the itinerary is a cyclic one.

onArrival

public void onArrival(MobilityEvent ev)
This is not normally used by aglets programmers.
Overrides:
onArrival in class MobilityAdapter

onTermination

protected void onTermination()

removeTaskAt

public void removeTaskAt(int index)
Remove a task at a specific index

setRepeat

public void setRepeat(boolean b)
Define whether the itinerary is to be repeated (cyclic)

size

public int size()
Return the size of the aglet's itinerary.

startTrip

public void startTrip()
Start the trip defined in this itinerary