All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ajanta.apps.calendar.splitjoin.CalendarAgent

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

public class CalendarAgent
extends JoinableAgent
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. In this implementation using the SplitJoin pattern, the calendar agent creates child agents to visit each participant's server and check for conflicts in parallel. Each child is given the parent's Briefcase of choices for meeting times. After visiting the designated server, a child agent returns to the parent agent's host and reports back data on conflicts. The calendar is extended from JoinableAgent class.


Variable Index

 o br

Constructor Index

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

Method Index

 o actionBeforeJoin(Agent)
It gets executed before join and in this method child agents updates briefcase of parent based on the results of the conflict phase using their own briefcases
 o actionOnArrive()
This method obtains a reference to the calendar database object of the the current server using the getResource primitive.
 o actionOnJoin()
This method gets executed when all the child agents has joined
 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 getBriefcase()
Return briefcase of the agent
 o run()
It is a empty method which can be overridden in subclasses.
 o Schedule()
The schedule method is executed at the participant's CalendarServer to insert an event in the server's database.
 o schedulingPhase()
Here parent chooses a non-conflicting choice, if there is one, and sets up its briefcase for next phase for scheduling.
 o setBriefcase(Briefcase)
Set the briefcase of the agent to "b"
 o setBriefcaseAndItin(Briefcase)
It sets the briefcase and the itinerary of the agent
 o updateItinerary(String)
It creates itinerary either for "conflict" or "schedule"

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 getBriefcase
 public Briefcase getBriefcase()
Return briefcase of the agent

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

Overrides:
actionOnArrive in class JoinableAgent
 o setBriefcase
 public void setBriefcase(Briefcase b)
Set the briefcase of the agent to "b"

 o setBriefcaseAndItin
 public void setBriefcaseAndItin(Briefcase b)
It sets the briefcase and the itinerary of the agent

 o updateItinerary
 protected void updateItinerary(String method)
It creates itinerary either for "conflict" or "schedule"

 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 actionBeforeJoin
 public synchronized void actionBeforeJoin(Agent ag)
It gets executed before join and in this method child agents updates briefcase of parent based on the results of the conflict phase using their own briefcases

Overrides:
actionBeforeJoin in class JoinableAgent
 o actionOnJoin
 public void actionOnJoin()
This method gets executed when all the child agents has joined

Overrides:
actionOnJoin in class JoinableAgent
 o schedulingPhase
 protected void schedulingPhase()
Here parent chooses a non-conflicting choice, if there is one, and sets up its briefcase for next phase for scheduling. If no empty slot found, the parent raises an exception and aborts the next phase. In the next split-join pattern, child agents are created and dispatched to insert an event in each participants' calendar database.

 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.

 o run
 public void run()
It is a empty method which can be overridden in subclasses.

Overrides:
run in class ItinAgent

All Packages  Class Hierarchy  This Package  Previous  Next  Index