Sun Cluster Data Services Developer's Guide for Solaris OS

Reusing Completed Work

Agent Builder enables you reuse completed work in the following ways:

How to Clone an Existing Resource Type

Follow this procedure to clone an existing resource type generated by Agent Builder.

  1. Load an existing resource type into Agent Builder by using one of these methods:

    • Launch Agent Builder from the working directory (which contains the rtconfig file) for an existing resource type (created with Agent Builder). Agent Builder loads the values for that resource type in the Create and Configure screens.

    • Use the Load Resource Type option from the File pull-down menu.

  2. Change the working directory on the Create screen.

    You must use Browse to select a directory. Typing a new directory name is not sufficient. After you select a directory, Agent Builder re-enables the Create button.

  3. Make changes.

    You might use this procedure to change the type of code generated for the resource type. For example, if you initially create a Korn shell version of a resource type but find over time that you require a C version, you can load the existing Korn shell resource type, change the language for the output to C, and then have Agent Builder build a C version of the resource type.

  4. Create the cloned resource type.

    Click Create to create the resource type. Click Next to display the Configure screen. Click Configure to configure the resource type, and then click Cancel to finish.

Editing the Generated Source Code

To keep the process of creating a resource type simple, Agent Builder limits the number of inputs, which necessarily limits the scope of the generated resource type. Therefore, to add more sophisticated features, such as validation checks for additional properties or to tune parameters Agent Builder does not expose, you need to modify the generated source code or the RTR file.

The source files are in the install_directory/rt_name/src directory. Agent Builder embeds comments in the source code at places you can add code. These comments are of the form (for C code):


/* User added code -- BEGIN vvvvvvvvvvvvvvv */
/* User added code -- END   ^^^^^^^^^^^^^^^ */


Note –

These comments are identical in Korn shell source code, except the pound sign (#) indicates the beginning of a comment.


For example, rt_name.h declares all the utility routines that the different programs use. At the end of the list of declarations are comments that enable you to declare additional routines that you might have added to any of your code.

Agent Builder also generates the makefile in the install_directory/rt_name/src directory with appropriate targets. Use the make command to recompile the source code, and use the make pkg command to regenerate the resource type package.

The RTR file is in the install_directory/rt_name/etc directory. You can edit the RTR file with a standard text editor. See Setting Resource and Resource Type Properties for more information about the RTR file and Appendix A, Standard Properties for information about properties.