응용프로그램 스케줄러 MBean 인터페이스를 사용하여 응용프로그램 스케줄러 액세스

다음 명령행을 사용하여 응용프로그램 스케줄러 MBean을 호출하십시오.

이 타스크의 수행 목적 및 시기

다음을 수행하여 응용프로그램 스케줄러 MBean을 호출하십시오.

이 타스크의 단계

  1. 클래스 com.ibm.wbiserver.migration.ics.Parameters에 SOAP_HOSTNAME 및 SOAP_PORT 등록 정보를 설정하십시오. 이 클래스는 WAS_HOME\lib 디렉토리의 migration-wbi-ics.jar 파일에 있습니다. SOAP_HOSTNAME은 응용프로그램 스케줄러가 실행 중인 호스트의 이름입니다. SOAP_PORT는 응용프로그램 스케줄러가 실행 중인 포트입니다.
    Parameters.instance.setProperty(Parameters.SOAP_HOSTNAME, "localhost");
    Parameters.instance.setProperty(Parameters.SOAP_PORT, "8880");
    주: 보안이 사용되는 경우 WAS_HOME\profiles\profiles\properties\soap.client.props 위치에 있는 SOAP 등록 정보 파일에 사용자 ID와 암호를 지정해야 합니다.

    이 등록 정보 파일 이름이 여기에 표시되는 매개변수 인스턴스에 설정되어야 합니다.

    Parameters.instance.setProperty(Parameters.SOAP_PROPERTIES, 
    "WAS_HOME\profiles\profiles\properties\soap.client.props";
  2. AppScheduler Mbean에 대한 호출을 구현하는 클래스 com.ibm.wbiserver.migration.ics.utils.MBeanUtil의 인스턴스를 작성하십시오.
    MBeanUtil을 인스턴스화하려면 이름, 유형, 서버 이름노드 이름을 기초로 올바른 MBean을 호출하는 생성자로 이 조회 문자열을 전달해야 합니다.
     protected static final String WEBSPHERE_MB_QUERY_CONSTANT = "WebSphere:*";
    	protected static final String NAME_QUERY_CONSTANT = ",name=";
    	protected static final String WBI_SCHED_MB_NAME = "WBISchedulerMB1";
    	protected static final String TYPE_QUERY_CONSTANT = ",type=";
    	protected static final String WBI_SCHED_MB_TYPE = "WBIScheduler";
    	protected static final String SERVER_QUERY_CONSTANT = ",process=";
    	protected static final String NODE_QUERY_CONSTANT = ",node=";      	
    
    	serverName = “server1”;
    	nodeName = "myNode";	
    
    	String queryString = new StringBuffer(WEBSPHERE_MB_QUERY_CONSTANT)
    				.append(NAME_QUERY_CONSTANT).append(WBI_SCHED_MB_NAME).append(
    				TYPE_QUERY_CONSTANT).append(WBI_SCHED_MB_TYPE).append(
    				SERVER_QUERY_CONSTANT).append(serverName).append(
    				NODE_QUERY_CONSTANT).append(nodeName).toString();
    			
    	MBeanUtil mbs = new MBeanUtil(queryString.toString());
  3. MbeanUtil 인스턴스의 invoke() 메소드를 사용하고 메소드의 이름을 전달하여 MBean 메소드를 호출하십시오.
다음은 스케줄러 MBean의 createSchedulerEntry 메소드 호출 예입니다. 첫 번째 단계는 SchedulerEntry를 작성하고 이름, 유형, 버전, 상태 전이, 항목 상태, 재발 유형, 재발 주, 재발 기간, 초기 날짜, 반복 간격구성요소 ID 같은 다양한 매개변수를 설정하는 것입니다.
try 
	{
	//First we set up the Schedule entry 

	ScheduleEntry entry1 = new ScheduleEntry();
	entry1.setCName("BPEWebClient_localhost_server1");
	entry1.setCType("Application");
	entry1.setCVersion("ver1");
	entry1.setCTransition("startApplication");
	entry1.setSchedulerNumberOfRepeats(3); // Fire Three times
	entry1.setScheduleEntryStatus(TaskStatus.SCHEDULED);
	entry1.setRType(Recurrence.MINUTES);
	entry1.setRWeekNumber(-1);
	entry1.setRPeriod(2);
	entry1.setInitialDate(new Date(System.currentTimeMillis()+SIXTY_SECOND_OFFSET));
	entry1.setRepeatInterval(entry1.getInitialDate(), entry1.getRType(), 
  entry1.getRWeekNumber(),
					entry1.getRPeriod());
	entry1.setComponentID(entry1.getCName(), entry1.getCType(), entry1.getCVersion(),
					entry1.getCTransition());

그런 후 Mbean의 createSchedulerEntry 메소드를 호출하십시오. ScheduleEntry 클래스의 이름과 함께 스케줄러 항목 entry1에 매개변수로서 전달합니다.

그런 후 MBean의 createScheduleEntry 메소드를 호출하십시오.
mbs.invoke(schedulerExtMBName, "createScheduleEntry", new Object[]{entry1}, 
		new String[]{"com.ibm.wbiserver.scheduler.common.ScheduleEntry"});
마지막으로 방금 readAllScheduleEntries 메소드를 호출하여 추가된 것을 포함하여 모든 스케줄 항목을 읽으십시오.
result = mbs.invoke("readAllScheduleEntries", null, null);
	}
	catch (MigrationException e)
	{ e.printStackTrace();
	}

이용약관 |

최종 갱신: 2006년 4월 13일

(c) Copyright IBM Corporation 2005, 2006.
이 Information Center는 Eclipse 기술을 기반으로 합니다. (http://www.eclipse.org 웹 사이트 참조)