애플리케이션 편집

관리 콘솔, wsadmin 도구 프로그래밍을 통해 전개된 애플리케이션을 편집할 수 있습니다. 이 예제를 사용하여 프로그래밍을 통해 전개된 애플리케이션을 편집하십시오.

시작하기 전에

이 태스크에서는 사용자가 MBean 프로그래밍의 기본 사항은 알고 있다고 가정합니다. MBean 프로그래밍에 대한 정보는 MBean Java™ API(Application Programming Interface) 문서를 참조하십시오.이 Information Center에서 참조 > Mbean 인터페이스를 클릭하십시오.

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();
        }

    }

}

주제 유형을 표시하는 아이콘 태스크 주제



시간소인 아이콘 마지막 업데이트 날짜: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tjmx_edit_apps
파일 이름:tjmx_edit_apps.html