Make your own free website on Tripod.com

Multi-Agent Systems

Assignment # 2

 

Answer: Firstly, only CIAgentEvent.JAVA and CIAgentState.JAVA were compiled successfully. Other classes failed to compile with JRE1.3. Then I uninstalled JRE1.3 and installed JRE1.4, the CIAgent.JAVA was compiled with 26 errors:

 

******************************************************************************************************

*  All errors point to one issue, that is the compiler cannot see other classes in the        *

*  ciagent package. So apparently I am doing something wrong here, well to be              *

*  continued …..                                                                                                        *

*******************************************************************************************************

 

Second attempt:

 

Problem B:

After installing “Sun Java™ Studio Enterprise 8” software all compilation problems with the CIAgent package were fixed. As I created a new project in the development environment, I imported all CIAgent *. java files into CIAgent package.  This package was then compiled successfully and the *.CLASS files were built.

 

 

Based on the lifecycle of CIAgent as described on page 237 of the textbook, to implement the CIAgent framework I performed the following steps:

  1. Add a new package called “pamanager” into the project.
  2. Added the following classes into the “paramanager” package.
    1. AlertDialog.java
    2. ExecuteDialog.java
    3. FileAgent.java
    4. FileAgentBeanInfo.java
    5. FileAgentCustomizer.java
    6. PAManagerApp.java
    7. PAManagerFrame.java
  3. Copy “PAManager.properties” into directory C:\Java Projects\MultiAgent
  4. Modify the PAManagerFrame.java at line 538  “FileInputStream in = new FileInputStream("pamanager.properties");” to become “FileInputStream in = new FileInputStream("PAManager.properties");” as this is case sensitive.  The source code provided was in lower case.
  5. Modify PAManager.properties removing the following classes off the “Create Menu”; AgentClassNames=pamanager.SchedulerAgent;pamanager.FileAgent;pamanager.AirfareAgent;pamanager.UserNotificationAgent;   The reason for removing this is to provide a shorter version for this implementation for testing purposes.
  6. Screen shot of the implementation results.

Initiated:

 

Active:

 

Suspended:

 

Resume:

 

Implement PAManager and FileAgent as follows:

 

1)      I initially had a problem as the program could not see the properties file.  Therfore, the menu items under “Create”  menu were grayed out or disabled.

2)      Copy “PAManager.properties” into directory C:\Java Projects\MultiAgent.  It was discovered that if one knew the correct directory of the project, then the program will run without any issues.  However, if one does not know the directory, then the full path has to be specified in order for the program to run.

E.g. FileInputStream in = new FileInputStream("c:\\MultiAgent\\pamanager.properties"); Double “\\” is needed in Java so that the compiler will not think that it is a tag.

3)      Modify the PAManagerFrame.java at line 538      FileInputStream in = new FileInputStream("pamanager.properties"); to become      FileInputStream in = new FileInputStream("PAManager.properties"); as this is case sensitive.  The source code provided was in lower case.

4)      Modify PAManager.properties removing the following classes off the “Create Menu”; AgentClassNames=pamanager.SchedulerAgent;pamanager.FileAgent;pamanager.AirfareAgent;pamanager.UserNotificationAgent;   The reason for removing this is to provide a shorter version for this implementation for testing purposes.

5)      There is an issue with the code since this was written in Windows95.  However, running in a W2K environment, errors came up.

Addendum (Updated 06/26/06): Follow the tips Corey provided (KUDOS Corey). The code in file “FileAgent.JAVA” (click here) was changed as:

a.       First attempt: This change did not fix the problem

    actionDialog.show();

    try {

      if (osType.equals("WINDOWS 2K"))

……………………….

b.      Second attempt: This time the problem is fixed

    actionDialog.show();

    try {

      if (osType.equals("WINDOWS 2000"))

…………………….

6)      Screen shot of the implementation results.

 

Implement FileAgent:

 

 

Call FileAgent Customizer:

 

Coding error for “Windows 2K”:

 

Fixed Windows 2K error