MADS Simulation Framework

Compiling and Deploying Service Agents

To show how agents are compiled and deployed for use together with SAGS Personal Agent Server, we will create an agent based on one of the samples shown in the tutorial sections. Start JBuilder and create a new project, called SampleAgent. Click the Finish button.

Service Agents - new project

The service agent will be included in a package, which will be now created. Right-click the item from the Project Browser, select New followed by Package.

Service Agents - new package

For this sample, write your name as the package name, then click OK.

Service Agents - package name

We will now create the class that will hold our service agent, class contained in this package. For this, right-click on the previously created package, select New and then Class.

Service Agents - new class

To be in agreement with the source code of the tutorial we are going to use, write "Sample10_ServiceAgents" in the Class Name text box, then click OK.

Service Agents - new class

Replace the code that was automatically generated by JBuilder with the one given in the Creating Service Agents: the basics tutorial, then declare the package containing the class at the beginning on the file using the "package" keyword, followed by the package name.

Service Agents - the code

Now compile the project by selecting the "Make Project ... " option from the Project menu.

Service Agents - make

If all went OK, confirmation that the project was compiled should appear in the lower-left corner, as in the image below.

Service Agents - make confirmation

Now that the agent has been compiled, we need to copy it in the Service Agent folder of the SAGS Personal Agent Server, so that it can be found on the next server restart. Go in the folder where the project was saved and enter the "classes" sub-folder. There you should see another folder with the name of the package (your name).

Service Agents - project folder

To see that the compiled agent is indeed here, enter the package folder. You should see a file having the name of the the agent class and the .class extension.

Service Agents - class file

Now it's time to deploy the agent by moving it to the server's agent folder. Open the SAGS Personal Server agent folder by selecting the "Agent Folder" from SAGS Personal Agent Server's program group (Start -> Program Files -> SAGS Personal Agent Server -> Agent Folder). Then copy the package folder here.

Service Agents - agent folder

Now start the server. If the server was already running, close it and restart it. The agent should be now register with the server. To check that, start the MADS Agent Browser utility and search the word "sample". The result should look like in the image below.

Service Agents - success