Below, you can find a collection of example programs.
HelloAglet is a mobile aglet that goes to a remote host to say "Hello World" then returns home and dies.
CirculateAglet is an aglet which moves around the servers defined by the SeqPlanItinerary class. This illustrates how to use SeqPlanItinerary class.
OldStyleAglet is an example to show how to migrate an alpha4 aglet to alpha5.
TalkMaster is an aglet based implemenation of the "talk" application in unix. The TalkSlave class is an example of aglet which runs with ManualSerialization.
This package is an example of meeting pattern.
ProxyWatcher is an aglet which dispatches a WatcherSlave aglet and monitors proxies of the remote context. This example makes use of these features in Aglets.
HelloAglet is a revised version of examples.hello.HelloAglet,
which uses MethodDispatcherclass to handle incoming messages.
MethodDispatcher class binds a message and a corresponding method. All
methods which have a signature method(Message msg); are bound and
invoked when it receives the corresponding message.
MethodDispatcher mdispatcher = null; public void onCreation(Object obj) { mdispatcher = new MethodDispatcher(this); } pubic boolean handleMessage(Message m) { return mdispatcher(m); } // This method is called when the message("doJob") is sent to the aglet. public void doJob(Message m) { // do your job. }This may be incorporated into MessageManager in the future.
The WatcherClient example illustrates how to use an aglet from a client application. With this API, you can create an aglet in the remote server, dispatch it, send a message, and receive a result from it. To run this example, you need a server and WatcherSlave aglet.
ServerApp example illustrates how to embed the AgletsServer facility into an application program.
WebServerAglet is an aglet which behaves like WebServer. Please enable the HTTP messaging feature in the configuration panel Options -> Network Configuration -> Others. If the aglet is successfully created, please try
http://aglet.server:434/aglets/default/test/index.htmlin your web browser. The port number have to be same with the port number on which the aglet server is running. (434 by default)