Agent Controller 是一個常駐程式程序,它使得用戶端應用程式能夠啟動主機程序以及與主機程序內並存的代理程式交談。 系統係使用一個單一配置檔來管理其行為的範圍。
您可用各種方式來延伸 Agent Controller,例如,新增或延伸功能,或者新增代理程式。如果要讓 Agent Controller 使用您的外掛程式功能,便需要修改 Agent Controller 配置檔。 方法是延伸配置產生器,以在執行 SetConfig 時,產生自訂配置檔。 延伸配置產生器後,您便可以在設定時查詢使用者指定的資訊,並使用此資訊來產生自訂配置檔。 此外,您也可以在延伸規格中提供您自己的邏輯,以產生特定平台的配置檔。
如果要延伸配置產生器以為您的外掛程式產生配置檔,請遵循下列步驟:
public static String TAG = "<您的外掛程式套件名稱>"; // 例如,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"); }
//您應該用此區段來啟動這個方法: doc = configFile.getDoc(); if(doc == null) { return; } pConfig = doc.createElement(PluginConfig.TAG); holder = configFile.getHolder(); holder.appendChild(pConfig); //外掛程式結束。請用此區段來結束這個方法: 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 來源資料夾中: