B629: Languages for Programming the Web
Project 5: A Calendar Agent using the Aglets Workbench

Outline

Your job in this project is to design and implement a mobile "calendar secretary" using the Aglets Workbench, a mobile agent programming system based on Java.

Using the Aglets Workbench

The Aglets Workbench is installed in the course directories, at:
      /u/pierce/pub/629/systems/Aglets
Several papers and book chapters on the Aglets framework can be found through the course papers page. The API documentation is also available locally.

On CS machines, the directory

  /u/pierce/pub/629/handouts/project5
contains a single directory tiny, which in turn contains java sources implementing a very simple mobile agent that moves between hosts, performing a simple interaction with the user at each one. (The same files can be found in the project handouts directory via the web.)

Let's say PROJECTPATH is the name of the directory where your project is going to live. Make sure that a directory named PROJECTPATH exists, and then do:

  cp -r /u/pierce/pub/629/handouts/project5 PROJECTPATH/project5

Next, we need to set some environment variables. If you are a bash user, the appropriate incantation is

  export AGLET_HOME=/u/pierce/pub/629/systems/Aglets
  export PATH=$PATH:$AGLET_HOME/bin
  export CLASSPATH=$AGLET_HOME/lib:$AGLET_HOME/public:$CLASSPATH
  export AGLET_PATH=PROJECTPATH/project5:$AGLET_HOME/public
  export AGLET_EXPORT_PATH=$AGLET_PATH
where PROJECTPATH on the fourth line is replaced by your actual project path. You'll want to add this to your .bashrc file. (Users of other shells will need to make appropriate adjustments to this bit.)

Choose two port numbers, PORT1 and PORT2. (Try to choose them randomly - any numbers over 8000 - to avoid conflicts with other teams working on the same machine.)

Edit the file Tiny.java and change the lines

  private String host = "shovelnose.cs.indiana.edu";
  private int lPort = 4434;
  private int rPort = 4435;
to reflect the name of your machine and the two ports you've chosen.

You should now be able to recompile the sample aglet program. Go to the directory PROJECTPATH/project5/tiny and do

  javac Tiny.java
to generate class files for the demo aglet.

Next, build an aglet server ("context") listening at the first port number that you chose:

  agletsd -port PORT1 &
You'll be prompted for some registration information; after filling in the form, create another context at the second port:
  agletsd -port PORT2 &

Now create an aglet. Click on the Create button in either context dialog box. Type tiny.Tiny in the top line of the "create Aglet" dialog box that appears, and click the Create button at the bottom.

You should see the aglet appear in the viewer's status window, and, shortly afterwards, a dialog box should pop up. Clicking in the Go button will send the Tiny aglet to the other context, where it will again pop up a dialog. (If the two contexts were running on different machines, each pop-up dialog would appear on the local screen.)

To get started writing your own code, make a copy of the directory tiny (as a sibling of tiny within the PROJECTPATH/project5 directory). Change the package name in Tiny.java to the name of this directory.

Have fun.

Assignment

The specifications below are intentionally left fairly vague, to give you scope for choosing your own design. In fact, feel free to ignore them entirely and design your own project using aglets to implement a mobile service.
  1. Implement a simple calendar secretary agent. It is started by a user that wants to schedule a meeting with a given set of other users. She creates the agent, gives it a list of addresses where the other users can be found, and writes a short text explaining what the meeting is for. The aglet visits the given machines, popping up a dialog on each one and requesting that the user there mark the times at which he could be free for the meeting. When he's finished, he presses a button that sends the agent off to find the next user - or, if he was the last one, back to the original user to report its results.
  2. Refine the calendar agent so that, if a given user is not at his terminal when the agent arrives, it goes off looking for someone else instead of getting stuck there waiting.
  3. The design so far has assumed that each user is located at a known machine. Extend it so that users may move around between machines, signalling their arrival by informing a local agent. [How robust is your design in the face of machine or communication failures?]
  4. Additional extensions, making interesting use of the facilities of the Aglets system and/or illustrating the power of the mobile agent programming style.

    For this part, you can choose between two approaches:

    1. Small project 5 / large project 6. Design and implement one or two modest improvements to the design sketched above. Save the rest of your energy for working hard on project 6.
    2. Large project 5 / small project 6. Expend some serious effort and creativity on designing a useful application using mobile agents. Do something more modest for project 6.
Feel free to make simplifying assumptions to make your user-interface design more straightforward. For example, you might want to assume that there are only four possible time slots for the event being scheduled and label them 1-4, instead of dealing with days, dates, 24-hour clocks, etc. The purpose of the project is to explore mobility, not user interfaces.

Deliverables

  1. As usual, please prepare a single directory containing:
  2. Please make sure that your project is self-contained and easy to navigate. (It would be good to provide an HTML cover page with instructions for the demo.)

Submission Procedure

Same as usual.

Due date

The project is due at the beginning of class on Monday, November 17th.
(If you decide to make this your "major project" and do a smaller project 6, we can negotiate a later due date.)


B629: Languages for Programming the Web
Benjamin Pierce (pierce@cs.indiana.edu)