Extending the Agent Controller

The Agent Controller is a daemon process that enables client applications to launch host processes and interact with agents that coexist within host processes.  A single configuration file is used to manage the extent of its behavior.

The Agent Controller can be extended in various ways such as adding or extending a function, or adding a new agent. To enable the Agent Controller to utilize your plug-in function, the Agent Controller configuration file needs to be modified. This can be done by extending the configuration generator which will enable a custom configuration file to be generated when SetConfig is run. By extending the configuration generator, you will have the ability to query user-specific information at setup time and use this information to generate a customized configuration file. As well, you can provide your own logic in the extension to generate platform-specific configuration files.

Follow the steps below to extend the configuration generator to generate a configuration file for your own plug-in:

  1. Create a jar file config.jar under your plug-ins's lib directory. The configuration generator will look for this jar.
  2. Create a config directory under your plug-ins's root directory to store the configuration file. The configuration generator will automatically search for your jar file plug-in create a configuration file pluginconfig.xml under your plug-in's config directory.
  3. Write a configuration generator extension:
    1. Name the class <your plug-in package name>.SetConfig. It should extend the class org.eclipse.hyades.internal.config.generator.SetConfigSkeleton.
    2. Define a tag for your plug-in:
      public static String TAG = "<your plug-in package name>"; // e.g. org.eclipse.hyades.datacollection
    3. Implement the following six methods that are required by the configuration generator in order to correctly generate the custom configuration file:
      • SetConfig(): You should at least call super(TAG) inside the null argument constructor.
        Example:
        public SetConfig() {
          super(TAG);
          }
      • init(): This method can perform the initialization using the hash table passed by the main configuration generator. The hash table contain commplug-in line arguments passed to SetConfig. You will need to specify the path plug-in name of the configuration file inside this method.
        Example:
        public void init(Hashtable hash) {
          String home = HashUtility.getValue(hash, "RASERVER_HOME");
          setFileName(home + sr + "plug-ins" + sr + TAG + sr + "config" + sr + "pluginconfig.xml");
          }
        
      • askUser(): This method is used to ask user information specific to your plug-in.
      • printHelp(): This method is used to display plugin-specific help messages. This can be an empty method.
      • printExamples(): This method is used to display usage example such as command line arguments. This can be an empty method.
      • generateConfiguration(): This method is used to generate the XML DOM for your plug-in.
        Example:
        //You should start this method with this section:
          
          doc = configFile.getDoc();
          if(doc == null) {
        	  return;
          }
        
          pConfig = doc.createElement(PluginConfig.TAG);
          holder = configFile.getHolder();
          holder.appendChild(pConfig);
        
          //End plug-in end the method with this section:
          
          option = doc.createElement(Option.TAG);
          Option.setName(option, TAG);
          Option.setType(option, "version");
          Option.setValue(option, getString("Config.Plugin.Version"));
          pConfig.appendChild(option);
        
          configFile.saveToFile();
        

Examples on writing a configuration file generator extension

Refer to the Hyades project org.eclipse.hyades.collection.framework. The examples are located under the src.config source folder:



Related reference
The Agent Controller configuration files

 


(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.