代理控制器一个守护进程,它使客户机应用程序能够启动主机进程并与共存于那些主机进程内的代理程序交互。它的全部行为是在一个配置文件中管理的。
可以通过多种方法扩展代理控制器,如添加或扩展功能或者添加新的代理程序。要使代理控制器能够使用插件功能,需要对代理控制器配置文件进行修改。这可以通过扩展配置生成器来完成,配置生成器使您能够在运行 SetConfig 时生成 定制配置文件。通过扩展配置生成器,您就可以在设置时查询特定于用户的信息,然后使用此信息来生成定制的配置文件。您也可以在扩展中提供自已的逻辑以生成特定于平台的配置文件。
执行下列步骤来扩展配置生成器,以便为您自已的插件生成配置文件:
public static String TAG = "<your plug-in package name>"; // e.g. org.eclipse.hyades.datacollection
public SetConfig() { super(TAG); }
public void init(Hashtable hash) { String home = HashUtility.getValue(hash, "RASERVER_HOME"); setFileName(home + sr + "plug-ins" + sr + TAG + sr + "config" + sr + "pluginconfig.xml"); }
//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();
请参阅 Hyades 项目 org.eclipse.hyades.collection.framework。在 src.config 源代码文件夹下提供了下列示例: