📄 basicupes.java
字号:
/*BEGIN CMVC */
//*************************************************************************
//
// Workfile: mqwfupes/src/com/acme/sample/BasicUpes.java, v3-upes, fmv3
// Last update: 04/01/08 11:42:14
// SCCS path, id: /home/flowmark/vc/0/5/5/8/s.00 1.2
//
//************************************************************************/
/*END CMVC */
/*BEGIN COPYRIGHT */
//*************************************************************************
//
// Licensed Materials - Property of IBM
// WA05 Support Pac - @sname@
// (c) Copyright IBM Corp. 2003
// US Government Users Restricted Rights - Use, duplication or
// disclosure restricted by GSA ADP Schedule Contract
// with IBM Corp.
//
//************************************************************************/
/*END COPYRIGHT */
/*BEGIN DISCLAIMER */
//*************************************************************************
// DISCLAIMER
// ----------
// This material contains programming source code for your consideration.
// These examples have not been thoroughly tested under all conditions.
// IBM, therefore, cannot guarantee or imply reliability, serviceability,
// or function of these programs.
// ALL PROGRAMS CONTAINED HEREIN ARE PROVIDED TO YOU "AS IS", WITHOUT ANY
// WARRANTIES (EXPRESS OR IMPLIED) OR SUPPORT WHATSOEVER, INCLUDING BUT
// NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
// FOR A PARTICULAR PURPOSE.
//************************************************************************/
/*END DISCLAIMER */
package com.acme.sample;
import com.ibm.workflow.upes.BasicContainer;
import com.ibm.workflow.util.msg.BasicResponder;
import com.ibm.workflow.util.msg.Message;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import org.w3c.dom.Element;
/**
* BasicUpes is the implementation of a simple standalone UPES. It can be launced via the main() method.
* The BasicTask class used by BasicUpes operates directly at the XML message level.
*
* @authorRJ@
* @authorAW@
* @version@
*
*/
public class BasicUpes extends BasicResponder
{
/**
* The BasicTask class used by BasicUpes. It will be instantiated as many times as the BasicResponder thread pool has threads.
* It deals with UPES messages directly. The onMessage() method skeleton needs to be completed to provide the intended semantics of the UPES.
*/
public class BasicTask extends Task
{
/**
* A BasicTask does not convert messages to/from Java Beans but operates on the messages itself. The makeBean() method returns
* the <ActivityImplInvoke> element of the message instead of converting the <programInputData> it to a Java Bean. Also, since a
* BasicUpes does not provide an FdlGenerator, the 'endpointParameter' map (which otherwise would contain the PARAMETER and
* ENVIRONMENT settings from the generated PROGRAM) will always be empty.
*/
protected Object makeBean(Element programInputData, Map endpointParameter) throws InvocationTargetException
{
return programInputData.getParentNode();
}
/**
* The onMessage skeleton.
*/
public Object onMessage(Object inputData, Map endpointParameter, Message.IntHolder rc) throws Exception
{
Element invoke = (Element)inputData; // The <ProgramInputData> element
String output = null; // The data for <ProgramOutputData>, already in WMQWF XML format
rc.value = 42; // The value for <ProgramRC>. To return a fatal <Exception>, throw an Exception instead
System.out.println(invoke.toString()); // Your code to calculate 'output' goes here
return output;
}
}
/**
* This method returns the TaskFactory singleton which will create the BasicTask instances.
*/
public TaskFactory getTaskFactory() { return taskFactory; }
/**
* One way to run this UPES. Here, a BasicContainer (which reads its configuration from the file given in args[0]). Once the UPES has been created.
* the name of the configuration file has to be passed to (newly created) the BasicContainer; the container is then passed to the init() method of
* the UPES. This call will never return but launch the UPES instead.
*/
public static void main(String[] args) throws Exception { new BasicUpes().init(new BasicContainer(args[0])); }
// The TaskFactory singleton
private final TaskFactory taskFactory = new TaskFactory()
{
public final Task createTask() throws InvocationTargetException { return new BasicTask(); }
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -