Accessing Application Scheduler using Application Scheduler MBean interface

Use the command line to invoke the Application Scheduler MBean

Why and when to perform this task

Perform the following to invoke Application Scheduler MBean.

Steps for this task

  1. Set the properties SOAP_HOSTNAME and SOAP_PORT in the class com.ibm.wbiserver.migration.ics.Parameters. This class is in the migration-wbi-ics.jar file in the WAS_HOME\lib directory. SOAP_HOSTNAME is the name of the host where Application Scheduler is running. SOAP_PORT is the port where the Application Scheduler is running.
    		Parameters.instance.setProperty(Parameters.SOAP_HOSTNAME, "localhost");
    		Parameters.instance.setProperty(Parameters.SOAP_PORT, "8880");
    Note: If security is turned on, you must specify a userid and password in the soap properties file found at the location inWAS_HOME\profiles\profiles\properties\soap.client.props.

    This properties file name must be set in the Parameters instance shown here.

    Parameters.instance.setProperty(Parameters.SOAP_PROPERTIES, 
    "WAS_HOME\profiles\profiles\properties\soap.client.props";
  2. Create an instance of the class com.ibm.wbiserver.migration.ics.utils.MBeanUtil that implements calls to the AppScheduler Mbean.
    To instantiate an MBeanUtil, you must pass this query string to its constructor that invokes the correct Mbean based on its name, type, server name and node name.
     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. Call Mbean methods using the invoke() method of the MbeanUtil instance and pass it the name of the method.
Here is an example of invoking the createSchedulerEntry method of the Scheduler Mbean. The first step is to create a SchedulerEntry and to set various parameters like name, type, version, transition, entry status, recurrence type, recurrence week, recurrence period, initial date, repeat interval and component 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());

Then invoke the Mbean’s createSchedulerEntry method. We pass it the scheduler entry entry1 as a parameter along with the name of the ScheduleEntry class.

Then invoke the MBean’s createScheduleEntry method:
mbs.invoke(schedulerExtMBName, "createScheduleEntry", new Object[]{entry1}, 
		new String[]{"com.ibm.wbiserver.scheduler.common.ScheduleEntry"});
Finally, read all the Schedule entries including the one that was just added by calling the readAllScheduleEntries method.
result = mbs.invoke("readAllScheduleEntries", null, null);
	}
	catch (MigrationException e)
	{ e.printStackTrace();
	}

Terms of use |

Last updated: Tue Feb 21 17:19:15 2006

(c) Copyright IBM Corporation 2005.
This information center is powered by Eclipse technology (http://www.eclipse.org)