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.
-
br
-
-
CalendarAgent(Credentials)
-
-
CalendarAgent(Credentials, Itinerary)
-
-
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
-
actionOnArrive()
- This method obtains a reference to the calendar database object of the
the current server using the getResource primitive.
-
actionOnJoin()
- This method gets executed when all the child agents has joined
-
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.
-
getBriefcase()
- Return briefcase of the agent
-
run()
- It is a empty method which can be overridden in subclasses.
-
Schedule()
- The schedule method is executed at the participant's CalendarServer to
insert an event in the server's database.
-
schedulingPhase()
- Here parent chooses a non-conflicting choice, if there is one, and sets up its
briefcase for next phase for scheduling.
-
setBriefcase(Briefcase)
- Set the briefcase of the agent to "b"
-
setBriefcaseAndItin(Briefcase)
- It sets the briefcase and the itinerary of the agent
-
updateItinerary(String)
- It creates itinerary either for "conflict" or "schedule"
br
protected Briefcase br
CalendarAgent
public CalendarAgent(Credentials cred)
CalendarAgent
public CalendarAgent(Credentials cred,
Itinerary itin)
- Parameters:
- cred - Credentials of the agent
- itin - Itinerary object of the agent
getBriefcase
public Briefcase getBriefcase()
- Return briefcase of the agent
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
setBriefcase
public void setBriefcase(Briefcase b)
- Set the briefcase of the agent to "b"
setBriefcaseAndItin
public void setBriefcaseAndItin(Briefcase b)
- It sets the briefcase and the itinerary of the agent
updateItinerary
protected void updateItinerary(String method)
- It creates itinerary either for "conflict" or "schedule"
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.
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
actionOnJoin
public void actionOnJoin()
- This method gets executed when all the child agents has joined
- Overrides:
- actionOnJoin in class JoinableAgent
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.
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.
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