WebSphere Application Server - Express for i5/OS, Version 6.1   
             オペレーティング・システム: i5/OS

             目次と検索結果のパーソナライズ化

アプリケーションの編集

デプロイ済みアプリケーションの編集は、管理コンソール、 wsadmin ツール、またはプログラミングによって行うことができます。この例を使用し、プログラミングによってデプロイ済みアプリケーションを編集します。

始める前に

このタスクでは、MBean プログラミングに関する基本的な知識があることが前提になっています。MBean プログラミングについては、MBean Java アプリケーション・プログラミング・インターフェース (API) 資料を参照してください。

WebSphere Application Server 上でアプリケーションを編集する前に、まずアプリケーションをインストールする必要があります。

このタスクについて

以下のタスクを実行して、デプロイ済みアプリケーションを編集します。

プロシージャー

  1. WebSphere Application Server に接続します。
  2. アプリケーション管理プロキシーを作成します。
  3. インストール済みのアプリケーションに関する情報を取得します。
  4. 必要に応じてタスク・データを操作します。
  5. インストール済みのアプリケーションに対する変更を保管します。

結果

コードが正常に実行されると、アプリケーションが編集されます。

以下の例には、前のステップに基づいた、アプリケーションの編集方法が示されています。

import java.lang.*;
import java.io.*;
import java.util.*;
import java.lang.reflect.*;
import com.ibm.websphere.management.application.*;
import com.ibm.websphere.management.application.client.*;
import com.ibm.websphere.management.*;

import javax.management.*;

public class aa {

    public static void main(String[] args) {

        try {
             
  // Connect to WebSphere Application Server.
  String host = "localhost";
  String port = "8880";
  String target = "WebSphere:cell=cellName,node=nodeName,server=server1";

  Properties config = new Properties();
  config.put (AdminClient.CONNECTOR_HOST,  host);
  config.put (AdminClient.CONNECTOR_PORT,  port);
  config.put (AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP);
  System.out.println ("Config: " + config);
     AdminClient _soapClient = AdminClientFactory.createAdminClient(config);
  
  // Create the application management proxy, AppManagement.
  AppManagement proxy = AppManagementProxy. getJMXProxyForClient (_soapClient);

  String appName = "MyApp";
// Get information for an application with name appName:
// Pass Locale information as the preference.
Hashtable prefs = new Hashtable();
 prefs.put(AppConstants.APPDEPL_LOCALE, Locale.getDefault());
Vector allTasks =  appMgmt.getApplicationInfo (appName, prefs, null);

// Manipulate task data as necessary.
if (task.getName().equals ("MapRolesToUsers") && !task. isTaskDisabled())
{ 
       // find out column index for role and user column
       // refer to the previous table to find the column names
       int roleColumn = -1;
       int userColumn = -1;
       String[] colNames = task.getColumnNames();
       for (int i=0; i < colNames.length; i++)
       { 
            if (colNames[i].equals ("role"))
            	roleColumn = i;
            else if (colNames[i].equals ("role.user"))
               userColumn = i;
       } 
            
       // iterate over task data starting at row 1 as row0 is
       // column names
       String[][] data = task.getTaskData();
       for (int i=1; i < data.length; i++)
       {
            if (data[i][roleColumn].equals ("Role1"))
            {
            	data[i][userColumn]="User1|User2";
               break;
            }
       } 
       
       // now that the task data is changed, save it back
       task.setTaskData (data);
} 

// Save changes back into the installed application:
// Set information for an application with name appName.
// Pass Locale information as the preference.
prefs = new Hashtable();
prefs.put(AppConstants.APPDEPL_LOCALE, Locale.getDefault());
appMgmt.setApplicationInfo (appName, prefs, null, allTasks);

        }
        catch (Exception e) {
            e.printStackTrace();
        }

    }

}



関連タスク
プログラミングによるアプリケーションのインストール
プログラミングによるアプリケーションのアンインストール
プログラミングによるアプリケーションの部分的な追加、更新、または削除
モジュールの準備とプログラミングによる既存アプリケーションへの追加
プログラミングによるモジュールの準備および更新
プログラミングによるモジュールの削除
プログラミングによるファイルの追加
プログラミングによるファイルの更新
プログラミングによるファイルの削除
タスク・トピック    

ご利用条件 | フィードバック

最終更新: Jan 21, 2008 7:05:28 PM EST
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.express.iseries.doc/info/iseriesexp/ae/tjmx_edit_apps.html