The PAC Editor allows you to view, edit and create PACs, PAC Instances, and Java Instances. The data created by this editor is used extensively by the Rule Editor to construct various patterns. You cannot directly use classes defined in the Object Modeler in your rules. The PAC Editor is necessary for creating PACs from the classes so they can be made a part of your rules.
The File menu can be used to perform various operations on the PACs and instances. From the File menu, you can create new PACs, PAC Instances and Java instances. You can also save the list of defined PACs, PAC Instances, and Java Instances. You can also import and update the list of defined PACs. As with all of the other AgentBuilder tools, the File menu provides the Close and Exit menu items for closing the editor and exiting AgentBuilder. The PAC Editor is shown in Figure 49.
Figure 49. PAC Editor
The Edit menu allows you to delete any of the items in the defined PACs, PAC Instances, or Java Instances list. The Windows menu lets you switch between other open AgentBuilder tools. The Help menu provides you with access to the AgentBuilder help system.
The main panel of the PAC Editor contains a Panel Options panel. The Panel Options panel contains tabs that allow you to switch between the PACs, PAC Instances, or Java Instances panel. The contents of each of the panels is explained in the following sections.
The current version of AgentBuilder does not allow you to directly create PACs. Instead, you must import the PACs from classes defined in object models. To import PACs, select the Import menu item from the File menu. Figure 50 shows the Import Dialog .
Figure 50. Import Dialog
The Import Dialog consists of two sections: the Available Classes panel and the Selected Classes panel. To import PACs, you must first select an object model in the Available Classes panel. Once an object model is selected, the dialog will display the names of the classes that have been defined in the selected object model.
The contents of the Object Model pull-down menu is a complete listing of all defined ontologies in the user's repository. You have several ways to select classes to be added to the list in the Selected Classes panel. The first method is to select a class in the list and then click on the Add button. If you need to select multiple classes, you must hold down the Control key on your keyboard while selecting the classes. Once all of the classes have been selected, click on the Add button. If you want to add all of the classes listed, you can click on the Add All button. You can now select a different object model and continue to add classes as described above.
You can delete classes listed in the Selected Classes panel at any time. To do this, first select the classes to be deleted. Then, click on the Delete button. The selected class will then be deleted from the list.
When you are finished adding classes to the list, you must click on the OK button. Clicking on the Cancel button will cancel the import operation. If the OK button has been pressed and there were classes listed in the Selected Classes panel, then the selected classes will be converted into PACs. The new PACs will be displayed in the Defined PACs panel. If you cannot see the Defined PACs panel, make sure that the PACs radio button in the Panel Options panel of the PAC editor is selected.
The Pac Editor supports java package naming conventions, if you are unfamiliar with Java package naming, see Sun Microsystem's documentation. Each class that is imported as a PAC is given a unique short name by the PAC Editor. This means when importing a class with a base class name of another class, it is assigned a name other than its class name, typically the PAC Editor adds a %2 after the class name.
For example, if you import the class com.company.Container and issue a Save it will be given the short name of Container . This means that everywhere in the agency manager where Container appears, it is actually referring to com.company.Container . If a class tool.util.Container is imported and saved, the PAC Editor gives the class a new short name of Container%2 (with some input from the user as described below). Consequently the user is able to determine the difference between the two using the percent sign. If you delete the com.company.Container PAC, the short name will NOT be released. All short name assignments are permanent, with the exception described below. Therefore, unless a remapping is done, the old references to the Container short name are still referencing the com.company.Container class.
When the user has imported a new PAC with a potential short name collision and then issues a Save , a dialog is displayed to inform and query the user. This dialog, shown in Figure 51, allows the user to choose whether to map the class to an existing short name or allow the tool to create a new short name. By selected an existing short name the user is remapping all usages in the rules, commitments, instances and actions to this new class. This remapping is normally only appropriate when a class has been renamed or the package has changed.
Figure 51. Dialog for Handling Short Names
To view the properties of a defined PAC, select the PAC in the Defined PACs list. Selecting a defined PAC from this list will cause the PAC Properties panel to display information about the selected PAC. The selected PAC's name, description, package, and ontology will be displayed. To view attributes or methods simply click the appropriate button and an attribute or methods list will appear in a dialog box.
You can use the Defined PACs panel to delete any of the defined PACs. To do this, you must first select the PAC to be deleted. Then, click on the Delete button. Clicking on the Delete button will remove the selected PAC from the list.
On occasion you will need to update a PAC from an ontology. The PAC Editor provides a way to update the list of defined PACs. Figure 52 shows the Update Dialog used to update defined PACs.
Figure 52. PAC Update Dialog
The Update Dialog is accessed from the File menu's Update menu item. The dialog contains a PACs panel, which lists all the PACs associated with the agent. To update the defined PACs in the Update Dialog , select the PACs you wish to update. Holding the Ctrl key while clicking on the PACs, will allow you to make multiple PAC selections. If you want to update all of the PACs listed, click the Select All button. Once the PACs that need to be updated are selected, you need to click on the OK button.
Any of the defined PAC's whose object models were updated will now display the updated information.Once you have defined a PAC, you can define PAC Instances. To define a PAC Instance, select the PAC you want to instantiate. All other items in the Instance Properties panel are optional for defining a PAC Instance. To specify a name for the PAC Instance, type the name into the Name text field. To add the name to the PAC Instance, you must either press the Enter key on your keyboard while the cursor is in the Name text field, or click on the Enter button next to the Name text field. You can also type the description of the PAC Instance in the Description text area.
Once a PAC is selected, you are given the option of defining the PAC Instance as an Initial PAC Instance. This is done using the Initial PAC Instance checkbox. If the Initial PAC Instance checkbox is selected, the Specify Constructor button will be enabled. A necessary condition for defining an initial PAC Instance is that its constructor be selected and that all of its constructor parameters be specified.
To specify constructors for a PAC Instance click on the Specify Constructor button. Figure 53 shows the dialog that will appear.
Figure 53. Instance Constructor Dialog
The Constructor Dialog allows you to specify the constructor and its corresponding parameter values for various kinds of objects. The dialog consists of two sections: a Constructor Tree panel and a panel that switches between a Parameter panel and a Complex Parameter panel.
The Constructor Tree panel contains a hierarchical tree of the parameters. The tree nodes use the name(type) convention for labeling. The root node is labeled with the PAC Instance name and the PAC Instance's PAC type. The children of the root node are the parameters for the PAC type's constructors. Any nodes with a folder icon indicate that the parameter is a complex object whose constructor needs to be specified.
The color of the nodes is also significant. Nodes whose values have not been specified have a red label; nodes whose value have been specified have a black label. An unspecified node recursively sets its parent to be unspecified, so you can easily see which nodes have not been specified even when the tree is fully collapsed.
To specify a parameter value, you must first select the parameter to be specified. The panel below the Constructor Tree will change to either a Parameter panel or a Complex Parameter panel based on the type of node selected. Both the Parameter panel and the Complex Parameter panel contain a read-only Name and Type text field. The name and type of the selected node are shown in the read-only text fields. The difference between the two panels is that the Parameter panel allows you to specify a value for the selected parameter. To enter a value for the selected parameter, enter a value into the Value text field in the Parameter panel. To enter a null value for the parameter, type null into the value field. An empty string is considered to be a valid value and can also be entered into the value field. Once a value has been entered, you can press the Enter key on your keyboard while the cursor is in the Value text field, or the Enter button can be clicked. This will cause the value to be registered with the selected parameter. The entered value is shown in the tree once it has been registered.
The Complex Parameter panel contains a pull-down menu for specifying a constructor for the selected parameter. This is because the selected node type is a complex object. You must select a constructor from the Constructor pull-down menu.
If no constructors are listed, you can create a constructor for the complex object. To do this, go back to the Object Modeler and open the ontology that contains the complex object. You can then modify the object's properties and include one or more constructors. The object model must then be saved and the defined PACs updated.
Once a constructor is selected for the complex object, the tree node for the complex object will change. Any parameters that are in the selected constructor become children of the tree node. If the children's types are all Java types, then you can assign values to the parameters as described above. Otherwise, if the children's parameter types contain complex objects, the process of selecting a constructor and specifying values must be repeated. This process must be repeated until all leaves either contain Java types, or the selected constructors for complex objects have no parameters.
Once you have fully specified the constructor tree, you can click on the OK button to register the new parameter values. Clicking on the Cancel button will cancel any changes that were made to the constructor tree.Once a PAC Instance has been defined, the PAC Instance can be added to the list of Defined Instances. If the Add button in the Defined Instances panel is disabled, then the PAC Instance has not been completely defined. Check to make sure that a PAC has been selected. If the PAC Instance is checked to indicate that it is an Initial PAC Instance, make sure the constructor and its parameters have been fully specified.
Once the Add button is enabled, you can add the PAC Instance to the list of defined PACs. Clicking on the Add button will add the PAC Instance to the list. Notice that the Instance Properties panel is cleared and the text field in the Defined Instance panel updated to reflect that a new PAC Instance has been defined.
To view the properties of a defined PAC Instance, select the PAC Instance in the Defined Instances list. Selecting a defined PAC Instance will cause the Instance Properties panel to display information about the selected PAC Instance. The selected PAC Instance's name, description, PAC and Initial PAC Instance status will all be displayed. If the PAC Instance is an Initial PAC Instance, you can view the specified constructor by clicking on the Specify Constructor button (see Figure 54).
Figure 54. Viewing PAC Instances
To edit a PAC Instance, follow the above instructions for viewing a defined PAC Instance. Once the PAC Instance is loaded into the Instance Properties panel, you can modify the PAC Instance. When finished modifying the PAC Instance, the PAC Instance can be added to the list of Defined Instances as described above. Note that if the modified PAC Instance has the same name as the original PAC Instance, the modified PAC Instance will overwrite the original PAC Instance. If the modified PAC Instance has a different name, the PAC Instance will be added to the list in the same manner as a new instance.
From the Defined Instances panel, you can delete any of the defined PAC Instances. To do this, first select the PAC Instance to be deleted. Then, click on the Delete button. Clicking on the delete button will delete the selected PAC Instance from the list.
The PAC Editor also supports the construction of Java Instances. Java Instances are used in the Rule Editor in the construction of patterns. To specify a Java Instance, you must select a Java type for the instance. Like PAC Instances, everything else in the Java Instance Properties panel is optional. Java types include some non-primitive types, which are Arrays, Enumeration, Hashtable, Object, and Vector. To specify a name for the Java Instance, type the name into the Name text field. To add the name to the Java Instance, you must either press the Enter key on your keyboard while the cursor is in the Name text field, or click on the Enter button next to the Name text field. You can also type in a description of the Java Instance in the Description text area.
Once a Java type has been selected, you are given the option to make the Java Instance an Initial Java Instance. This is done using the Initial Java Instance checkbox. The Initial Java Instance checkbox will be disabled for non-primitive java types. If the Initial Java Instance checkbox is selected, the text field and the Add button adjacent to the checkbox are enabled. The text field is used to enter a value for the Java Instance. Once a value has been entered in the text field, you can either press the Enter button while the cursor is in the text field or click on the Add button.
Once a Java Instance has been defined, the Java Instance can be added to the list of Defined Java Instances. If the Add button in the Defined Java Instances panel is disabled, then the Java Instance has not been completely defined. Check to make sure that a Java type has been selected. If the Java Instance is checked as an Initial Java Instance, ensure that a value has been specified.
Once the Add button is enabled, you can add the Java Instance to the list of Defined Java Instances. Clicking on the Add button will add the Java Instance to the list. Note that the Java Instance Properties panel is cleared and the text field in the Defined Java Instance panel updated to show that a new Java Instance has been defined.
To view the properties of a defined Java Instance, you must select the Java Instance in the Defined Java Instances list. Selecting a defined Java Instance will cause the Java Instance Properties panel to display information about the selected Java Instance. The selected Java Instance's name, description, Java type and Initial Java Instance status will be displayed. If the Java Instance is an initial Java instance, the text field will display the value assigned to the Java Instance (see Figure 55).
Figure 55. Viewing Java Instances
To edit a Java Instance, follow the instructions for viewing a defined Java Instance. When the Java Instance is loaded into the Java Instance Properties panel, you can modify the Java Instance. When finished modifying the Java Instance, the Java Instance can be added to the list of Defined Java Instances as described above. Note that if the modified Java Instance has the same name as the original Java Instance, the modified Java Instance will overwrite the original Java Instance. If the modified Java Instance has a different name, the Java Instance will be added to the list.
Using the Defined Java Instances panel, you can delete any of the defined Java Instances. To do this, you must first select the Java Instance to be deleted, then click on the Delete button. Clicking on the Delete button will delete the selected Java Instance from the list.
If you have modified the contents of the Defined PACs, PAC Instances or Java Instances, you must save the new or modified data to the currently loaded agent. To do this, select the Save menu item in the File menu. The Save menu item selection will save all PACs, PAC Instances, and Java Instances to the currently loaded agent.
The Windows menu is a dynamic menu that contains a list of all AgentBuilder tools that are open. This menu facilitates switching between the tools. To switch a different tool, select the tool you wish to switch to from the Windows menu list. The selected tool will then be brought to the front on your display.
The help system can be accessed using the Help menu item. The About menu item allows you to read the help information for the current tool. The Index menu item will display an index to the help system's contents. The Tutorial menu item will display the Quick Tour of the AgentBuilder toolkit. The About AgentBuilder menu item will display the AgentBuilder logo along with the version number and copyright information. The AgentBuilder Home Page menu item will display the home page for the AgentBuilder product.