配置 Agent Controller 上部署的自訂外掛程式

自訂的外掛程式可部署在 Agent Controller 上,也可在遠端主機上執行。 外掛程式會安裝在 Agent Controller 安裝目錄的 plugin 目錄中。 每一個外掛程式有自己的 pluginconfig.xml,指定可供執行外掛程式的執行環境和應用程式環境設定。

配置執行環境

自訂外掛程式的執行環境必須包含自訂的類別路徑定義。 以確保僅執行自訂外掛程式所需的 jar 檔。若要自訂執行環境,請:

  1. 尋找自訂外掛程式的 pluginconfig.xml 配置檔。通常位於 Agent Controller 安裝目錄的 /plugin/<custom_plugin>/ 之下, 其中,custom_plugin 是外掛程式目錄的名稱。
  2. 利用編輯器來開啟它,再搜尋 <AgentControllerEnvironment> 元素。如果這個元素不存在,請建立元素。
  3. 新增子元素 <Variable>。以 CLASSPATH_<org>_<myapp> 格式來指定 name 屬性的值, 其中,org_myapp 是外掛程式目錄名稱,且句點 '.' 取代為底線 '_'。指定 position 屬性的值為 'append'。 將 value 屬性指定為自訂外掛程式目錄中的 jar 檔。以下是自訂的 <AgentControllerEnvironment> 元素範例:
    <AgentControllerEnvironment configuration="default">
      <Variable name="CLASSPATH_ORG_MYAPP" position="append" value="%PLUGINS_HOME%/org.myapp/one.jar"/>
      <Variable name="CLASSPATH_ORG_MYAPP" position="append" value="%PLUGINS_HOME%/org.myapp/two.jar"/>
      <Variable name="CLASSPATH_ORG_MYAPP" position="append" value="%PLUGINS_HOME%/org.myapp/three.jar"/>
    	</AgentControllerEnvironment>
    
  4. 儲存變更。
  5. 重新啟動 Agent Controller。

    附註:環境中可以新增任何數目的 <Variable> 元素。 規則依先到先服務的順序來處理。 

配置應用程式環境

外掛程式的應用程式環境是在 pluginconfig.xml 檔案的 <Application> 元素內定義。 只有應用程式可看見這個元素內的這些設定。利用 <Application> 元素, 您也可以配置應用程式來使用 Agent Controller 上部署的其他應用程式的 jar 檔。 若要配置應用程式環境:

  1. 尋找自訂外掛程式的 pluginconfig.xml 配置檔。通常位於 Agent Controller 安裝目錄的 /plugin/<custom_plugin>/ 之下, 其中,custom_plugin 是外掛程式目錄的名稱。
  2. 在編輯器中開啟,搜尋 <Application> 元素。該元素應定義如下:
    <Application configuration="default" executable="myapp2" location="%SYS_TEMP_DIR%" path="%JAVA_PATH%">
       </Application>
    其中
  3. 若要配置應用程式來使用其他應用程式的 jar 檔,請新增子元素 Variable。 指定 name 屬性的值為 CLASSPATH。 將 position 屬性的值指定為執行環境。 將 value 屬性的值指定為您要使用的其他應用程式的外掛程式目錄。 下列是 myapp2 的 pluginconfig.xml 範例,使用另一個執行環境 org.myapp 的 jar 檔。
      <?xml version="1.0" encoding="UTF-8"?>
    <PluginConfiguration>
      <Application configuration="default" executable="myapp2" location="%SYS_TEMP_DIR%" path="%JAVA_PATH%">
        <Variable name="CLASSPATH" position="append" value="%CLASSPATH_ORG_MYAPP%"/>
       </Application>  <Option name="my.proj2" type="version" value="1.0.0"/>
    </PluginConfiguration>
    
  4. 儲存變更。
  5. 重新啟動 Agent Controller。

相關作業
尋找配置檔
管理 Agent Controller
 


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