PowerBuilder Authors: Chris Pollach, Yeshim Deniz, Jayaram Krishnaswamy, Kevin Benedict, Avi Rosenthal

Related Topics: PowerBuilder

PowerBuilder: Article

Mobile Agent-Based File Search Utility

Creating a utility that can search for any desired document on multiple remote machines simultaneously

In today's world of network computers our important documents are usually widely dispersed on several computers in our networks. Over a period of time, we forget their location and searching for these files on a huge network turns out to be a frustrating experience. Such searches are typically not only time-consuming, but also consume valuable and scarce network resources. This article provides an elegant solution to this problem.

Here we'll present an application that simplifies the remote search operation on the entire network using mobile agent technology. We'll take advantage of code migration in mobile agents to reduce network traffic. A mobile agent locally searches each of the specified remote machines and sends the search results to the requestor. The application provides the requestor with the flexibility of dynamically defining the search criteria and creating a list of remote machines to search.

After initiating the search, the requestor is immediately freed for processing other tasks on the local machine. This is one of the important advantages offered by the current application compared to a traditional file find operation on a local drive that usually brings down machine performance drastically. The application also provides a facility for canceling the search operation anytime. Thus, the requestor after locating the first occurrence of the desired document may send a message to all the participating remote machines to stop searching further. After the document is located, the requestor can fetch it to her local machine for editing or review.

Using mobile agent technology results in more efficient searches in terms of network resource utilization and facilitates unattended search.

Why Mobile Agents?
A traditional file search on a set of network computers requires mapping each drive to be searched on the local file system. This is a tedious task. During the search operation, the results are frequently returned to the requestor on a continuous basis consuming valuable network resources.

One possible solution to this problem is to develop a search utility that will only do local searches. This utility is then deployed on each of the desired machines. The file requestor then communicates with each such deployed application to do the desired network search. This, however, requires a carefully designed communication protocol between the requestor and the remote machine where the search is done.

We used mobile agent technology to solve this problem. In this technology, a requestor creates a mobile agent and dispatches it to a desired remote machine on the network. The search criteria are defined in the agent that carries the search code to the remote machine. After reaching the remote machine, the code is executed locally freeing the sender for its own task. After the search is done, the results are dispatched to the sender.

In general, mobile agent technology solves many problems faced in traditional distributed software. It reduces the load on network, reduces the code design risk, and provides a robust application over unreliable networks. There are several other benefits offered by mobile agent technology. However, the most important have already been explained.

Mobile agent technology also carries a few disadvantages. One is the requirement for an agent server on each participating machine. The server listens to the incoming requests from the senders and provides a runtime environment for the agents to run their code. Other disadvantages would be protection against the malicious code and general code and data security.

Application Structure
The structure of our file search utility is depicted in Figure 1.

The search application consists of three agents. Out of these three agents one is stationary (the Master) and two are mobile (the Slave) agents. Each agent has its own specific task assigned in the system. The following are the three agents and the respective code files of our file search application:

  1. Main File Agent (Master): MainFileAglet.java and MainAgletGui.java
  2. File Search Agent (Slave): FileSearchAglet.java and SearchData.java
  3. File Transfer Agent (Slave): FileTransferAglet.java and FileTransferData.java
Now we'll describe the purpose of each agent.

Main File Agent (Master)
The main agent in our file search application is called the Master Agent and it is responsible for creating the other two agents, namely the File Search Agent and the File Transfer Agent. This Master Agent provides the user interface shown in Figure 2 through which it manages the other agents in the system.

The interface shown in Figure 2 lets the user input the search criteria consisting of the search file name, the search directory, and the addresses of the remote machines to be searched. When the search operation is initiated, the agent creates an instance of the File Search Agent for each search location (remote machine) and dispatches it to the respective location (remote machine) to search for the required file. Thus the search is done simultaneously on a number of remote machines.

The Main File Agent is the first agent that the application creates. This agent is also called the stationary agent because it doesn't move on the network and remains on the sender machine.

File Search Agent (Slave)
The File Search Agent (Slave) is the second agent in our application and unlike the previous agent it has no user interface. It is the real mobile agent in our system. This is the agent that's responsible for searching the remote machines and sending the results back to the client, i.e., all of the file search logic goes into this agent.

After launching the Main File Agent and providing the search criteria in its user interface, we launch this agent by clicking the START button. The Main File Agent supplies the search criteria to the mobile agent and dispatches it to the remote machine where it searches the entire system or a specified directory (as specified by the user) to find the user-specified file. After this agent moves across the network to the remote machine, the search is carried out locally on the remote machine. The network is only used to transfer this agent to the remote machine. The search is fast because it's done locally. While this agent is searching a particular file on the remote system it sends results to the Main File Agent, which is stationery on the sender machine. This agent sends all the file paths on which it finds the requested file on the remote machine to the Main File Agent. The Main File Agent then displays the result to the user on its GUI in a list box control (named Search Result) as shown in Figure 3.

The user has full control over this agent and can destroy it even while the search is in progress on the remote machine by selecting a location from the list box control (named Remote URL) and clicking the STOP button. The user can also initiate a search for the specified criteria on more than one machine. Clicking the STOP ALL button destroys all the File Search Agents.

More Stories By P.G. Sarang

Dr. Sarang in his long tenure of 20+ years has worked in various capacities in the IT industry. Dr. Sarang currently holds the position of Director (Architecture) with Kynetia, Spain and has been a Consultant to Sun Microsystems for last several years. He has previously worked as a Visiting Professor of Computer Engineering at University of Notre Dame, USA and is currently an adjunct faculty in the Univ. Dept. of Computer Science at University of Mumbai. Dr. Sarang has spoken in number of prestigious international conferences on Java/CORBA/XML/.NET and has authored several articles, research papers, courseware and books.

More Stories By Ninad Kamerkar

Ninad Kamerkar is currently pursuing a master's degree in computer science at the University of Mumbai in India. His research interests involve mobile agents, networking, and distributed systems. Besides his studies, he is interested in painting and listening to music.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.