All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ajanta.apps.calendar.sequence.CalendarAgent

java.lang.Object
   |
   +----ajanta.agent.Agent
           |
           +----ajanta.agent.ItinAgent
                   |
                   +----ajanta.apps.calendar.sequence.CalendarAgent

public class CalendarAgent
extends ItinAgent
The CalendarAgent which uses the Sequence pattern extends the ItinAgent class. A calendar agent is created with a list of possible options for meeting times. This is encapsulated in the agent as an object called Briefcase}, which is a list of choices. The agent first visits all servers to check for conflicts for each of the choices. If at the end of the first round it finds at least one choice when none of the participants have a conflict, it revisits them again to insert an event in each participant's calendar database.


Variable Index

 o br

Constructor Index

 o CalendarAgent(Credentials)
 o CalendarAgent(Credentials, Itinerary)

Method Index

 o arrive()
The arrive method obtains a reference to the calendar database object of the the current server using the getResource primitive.
 o checkDepartStatus(int)
This method uses a local flag firstRound to check if the first round for checking conflicts is over.
 o Conflict()
The Conflict method is executed at a CalendarServer of a participant to check if there are any conflicts with the participant's schedule and any of the requested timings.
 o createItinerary(String)
It cretes Itinerary for the agent for methods "schedule" or "conflict" by reading the briefcase
 o Schedule()
The schedule method is executed at the participant's CalendarServer to insert an event in the server's database.
 o schedulingPhase()
It checks the results of the first round and creates another briefcase for second round by inserting all the free slots.
 o setBriefcase(Briefcase)
Sets the briefcase of the Agent to the "b" passed as argument

Variables

 o br
 protected Briefcase br

Constructors

 o CalendarAgent
 public CalendarAgent(Credentials cred)
 o CalendarAgent
 public CalendarAgent(Credentials cred,
                      Itinerary itin)
Parameters:
cred - Credentials of the agent
itin - Itinerary object of the agent

Methods

 o arrive
 public void arrive()
The arrive method obtains a reference to the calendar database object of the the current server using the getResource primitive.

Overrides:
arrive in class ItinAgent
 o checkDepartStatus
 public void checkDepartStatus(int status)
This method uses a local flag firstRound to check if the first round for checking conflicts is over. If so, it resets the itinerary to execute the second round of visit by the agent.This method is executed after depart method.

Overrides:
checkDepartStatus in class ItinAgent
 o setBriefcase
 public void setBriefcase(Briefcase b)
Sets the briefcase of the Agent to the "b" passed as argument

 o createItinerary
 protected void createItinerary(String method)
It cretes Itinerary for the agent for methods "schedule" or "conflict" by reading the briefcase

Parameters:
method - name of the method
 o Conflict
 public void Conflict()
The Conflict method is executed at a CalendarServer of a participant to check if there are any conflicts with the participant's schedule and any of the requested timings. This is done by calling the checkConflict method of the CalendarDatabase of that participant.

 o schedulingPhase
 protected void schedulingPhase()
It checks the results of the first round and creates another briefcase for second round by inserting all the free slots.

 o Schedule
 public void Schedule()
The schedule method is executed at the participant's CalendarServer to insert an event in the server's database. This is done by calling the scheduleEvent method of the CalendarDatabase object through a proxy.


All Packages  Class Hierarchy  This Package  Previous  Next  Index