Aglets is a Java based mobile agent platform and library for building mobile agents based applications. An aglet is a Java agent which can autonomously and spontaneously move from one host to another carrying a piece of code with it. It can be programmed to execute at a remote host and show different behaviours at different hosts. Java based security implementations take care of authorised access to local resources at the remote hosts.
Aglets is completely written in Java, thus allowing a high portability of both the agents and the platform. Aglets includes both a complete Java mobile agent platform, with a stand-alone server called Tahiti, and a library that allows developers to build mobile agents and to embed the Aglets technology in their applications.
No new releases of Aglets have been made since 2001, although an updated users manual was released in 2004. The future of the project is unclear.
This guide provides the necessary information for deploying and running IBM Aglets Workbench on Ubuntu.
System Requirements
- JDK 1.5 or older(JDK 1.6 is not supported by Aglets)
- Apache Ant (Group Compilation tool) - {To run ‘ant ‘command, we need a ‘build.xml’ file in the source program directory.}
- Aglets SDK
JDK 1.5 Installation Steps
Step 1 : Open a shell prompt (terminal) and type the following to install JDK and JRE:
$ sudo apt-get install sun-java5-bin sun-java5-jre sun-java5-jdk
Step 2 : Setup the environment variable : You also need to setup JAVA_HOME and PATH variable. Open your “/etc/environment” file:
$ vi /etc/environment
Step 3: Append following lines
export JAVA_HOME=/usr/lib/jvm/java-5-sun
export PATH=$PATH:$JAVA_HOME/bin
Step 4: Choosing the default Java to use : Just installing new Java flavours does not change the default Java pointed to by /usr/bin/java. You must explicitly set this:
Run sudo update-java-alternatives -l to see the current configuration and possibilities.
Run sudo update-java-alternatives -s java-5-sun to set the java version as default.
Run java -version to ensure that the correct version is being called.
Apache Ant Installation
Open a Terminal window and enter following command
$ sudo apt-get install ant ant-optional
Aglets SDK Installation Steps
Download Aglet SDK from sourceforge.net. Currently available version is aglets-2.0.2.
- Extract the compressed file in to ‘/usr/local/aglets’.
- Change to the bin directory in ‘/usr/local/aglets’.
- Run the command: ant
The directory, aglets, contains files you need to put on your own account. These files are
- tahiti (called agletsd in the original distribution) A script for running the Aglet server
- aglets.props A configuration file for the Aglet server.
- .java.policy Configures Java 2 security
- .keystore Contains encryption keys
- Copy “.keystore” file into user’s home directory (eg: /home/cusat, if the user login is ‘cusat’)
- To run the Aglet server, enter following command from ‘/usr/local/aglets/bin’ folder ./agletsd -port 9000. Use ‘anonymous’ as Login ID and ‘aglets’ as password. Following window will be obtained.
Environments for Aglets Application Development
- To run the Aglets Software Development Kit, you need to set four environment variables (AGLET_HOME, AGLET_EXPORT_PATH, PATH and CLASSPATH).
- To Setup the environment variables, open your “/etc/environment” file:
$ vi /etc/environment
- Append following line:
export CLASSPATH= $CLASSPATH : /usr/lib/jvm/java-5-sun/lib/mysql-connector-java-5.1.6-bin.jar : /usr/local/aglets/lib/aglets-2.0.2.jar :/usr/local/aglets/public/
export AGLET_HOME =/usr/local/aglets
export AGLET_EXPORT_PATH =/usr/local/aglets
export PATH=$PATH: $JAVA_HOME/bin : $ AGLET_HOME/bin
Configuration of Security Settings of Aglets
- Open “aglets.policy” file in ‘/home/cusat/.aglets/security’ (If the linux user is cusat, otherwise use appropriate user home folder. ‘.algets’ folder can be found in user home folder)
- Append following statements in the aglets.policy file
grant {
permission java.net.SocketPermission “localhost:*”, “accept,connect,listen,resolve”;
permission java.net.SocketPermission “codebase:*”, “accept,connect,listen,resolve”;
permission java.net.SocketPermission “*:*”, “accept,connect,listen,resolve”;
permission java.security.AllPermission;
permission java.awt.AWTPermission “accessClipboard”;
permission java.awt.AWTPermission “accessEventQueue”;
permission java.awt.AWTPermission “showWindowWithoutWarningBanner”;
permission java.io.FilePermission “<<ALL FILES>>”, “read, write, delete, execute”;
};
Writing Your First Aglet
Here is an example how to create a new aglet “MyAglet” which is the same example as provided in the aglets documentation. Create a work directory, say myfirst, in ‘public’ directory in aglets directory tree. In that directory, create the file MyAglet.java with following content
Then compile the code using javac. This should result, without any warnings, in file MyAglet.class. Now, you can run your aglet from Tahiti. In Tahiti, click on Create and type in the package name followed by the class name “myfirst.MyAglet” into the “Aglet name” field. Then click on Add to List so that your aglet appears at the bottom of the list of aglet classes.
For more details follow this link
JDK 1.5 Installation Steps
Step 1 : Open a shell prompt (terminal) and type the following to install JDK and JRE:
$ sudo apt-get install sun-java5-bin sun-java5-jre sun-java5-jdk
Step 2 : Setup the environment variable : You also need to setup JAVA_HOME and PATH variable. Open your “/etc/environment” file:
$ vi /etc/environment
Step 3: Append following lines
export JAVA_HOME=/usr/lib/jvm/java-5-sun
export PATH=$PATH:$JAVA_HOME/bin
Step 4: Choosing the default Java to use : Just installing new Java flavours does not change the default Java pointed to by /usr/bin/java. You must explicitly set this:
Run sudo update-java-alternatives -l to see the current configuration and possibilities.
Run sudo update-java-alternatives -s java-5-sun to set the java version as default.
Run java -version to ensure that the correct version is being called.
Aglets SDK Installation Steps
Download Aglet SDK from sourceforge.net. Currently available version is aglets-2.0.2.
- Extract the compressed file in to ‘/usr/local/aglets’.
- Change to the bin directory in ‘/usr/local/aglets’.
- Run the command: ant
The directory, aglets, contains files you need to put on your own account. These files are
- tahiti (called agletsd in the original distribution) A script for running the Aglet server
- aglets.props A configuration file for the Aglet server.
- .java.policy Configures Java 2 security
- .keystore Contains encryption keys
- Copy “.keystore” file into user’s home directory (eg: /home/cusat, if the user login is ‘cusat’)
- To run the Aglet server, enter following command from ‘/usr/local/aglets/bin’ folder ./agletsd -port 9000. Use ‘anonymous’ as Login ID and ‘aglets’ as password. Following window will be obtained.
Environments for Aglets Application Development
- To run the Aglets Software Development Kit, you need to set four environment variables (AGLET_HOME, AGLET_EXPORT_PATH, PATH and CLASSPATH).
- To Setup the environment variables, open your “/etc/environment” file:
$ vi /etc/environment
- Append following line:
export CLASSPATH= $CLASSPATH : /usr/lib/jvm/java-5-sun/lib/mysql-connector-java-5.1.6-bin.jar : /usr/local/aglets/lib/aglets-2.0.2.jar :/usr/local/aglets/public/
export AGLET_HOME =/usr/local/aglets
export AGLET_EXPORT_PATH =/usr/local/aglets
export PATH=$PATH: $JAVA_HOME/bin : $ AGLET_HOME/bin
Configuration of Security Settings of Aglets
- Open “aglets.policy” file in ‘/home/cusat/.aglets/security’ (If the linux user is cusat, otherwise use appropriate user home folder. ‘.algets’ folder can be found in user home folder)
- Append following statements in the aglets.policy file
grant {
permission java.net.SocketPermission “localhost:*”, “accept,connect,listen,resolve”;
permission java.net.SocketPermission “codebase:*”, “accept,connect,listen,resolve”;
permission java.net.SocketPermission “*:*”, “accept,connect,listen,resolve”;
permission java.security.AllPermission;
permission java.awt.AWTPermission “accessClipboard”;
permission java.awt.AWTPermission “accessEventQueue”;
permission java.awt.AWTPermission “showWindowWithoutWarningBanner”;
permission java.io.FilePermission “<<ALL FILES>>”, “read, write, delete, execute”;
};
Writing Your First Aglet
Here is an example how to create a new aglet “MyAglet” which is the same example as provided in the aglets documentation. Create a work directory, say myfirst, in ‘public’ directory in aglets directory tree. In that directory, create the file MyAglet.java with following content
Then compile the code using javac. This should result, without any warnings, in file MyAglet.class. Now, you can run your aglet from Tahiti. In Tahiti, click on Create and type in the package name followed by the class name “myfirst.MyAglet” into the “Aglet name” field. Then click on Add to List so that your aglet appears at the bottom of the list of aglet classes.
For more details follow this link