Use the JavaCompute node to work with messages using the Java™ language.
This topic contains the following sections:
Using this node, you can complete the following tasks:
The Java code that is used by the node is stored in an Eclipse Java project.
The JavaCompute node is contained in the Transformation drawer of the palette, and is represented in the workbench by the following icon:
The JavaCompute node uses the same execution model as Java user-defined nodes and therefore the restrictions and assumptions associated with Java user-defined nodes also apply to Java code developed for JavaCompute nodes; see Creating a message processing or output node in Java. Only one instance of the JavaCompute node is created regardless of the number of threads running against the flow (either as a result of additional instances or multiple input nodes). Therefore all of your user Java code must be threadsafe and reentrant. For more information see User-defined extensions execution model and Threading considerations for user-defined extensions.
Double-click the JavaCompute node to open the New JavaCompute Node Class wizard. The wizard guides you through the creation of a new Java project and a Java class that contains some skeleton code. This skeleton code is displayed in a Java editor. For more information about creating Java code for a JavaCompute node, and for examples of the skeleton code or template that are provided, see Creating Java code for a JavaCompute node. If it is not the first time that you have double-clicked the node, the Java code is displayed.
Code Java statements to customize the behavior of the JavaCompute node. For example, you can customize the node to create a new output message or messages, using input message or database content (unchanged or modified), or new data. For example, you might want to modify a value in the input message by adding a value from a database, and store the result in a field in the output message.
Code the Java statements that you want in a Java file that is associated with the JavaCompute node.
If a Java file does not already exist for this node, right-click the JavaCompute node and then click Open Java to create and open a new Java file in the Editor view. If the file exists already, click Browse beside the Java Class property to display the JavaCompute Node Type Selection window, which lists the Java classes that can be accessed by this message flow. Select the appropriate Java class and click OK. The list of matching types show suitable Java classes when at least one character is entered in the Select field. All Java classes are shown if you enter '*' in the Select field.
When you have put an instance of the JavaCompute node into a message flow, you can configure it; see Configuring a message flow node. To associate an instance of a JavaCompute node with a Java class, configure the node's properties. The properties of the node are displayed in the Properties view. To display the properties of the node in the Properties dialog, right-click the node and click Properties. All mandatory properties for which you must enter a value (those that do not have a default value defined) are marked with an asterisk.
The JavaCompute node terminals are described in the following table.
Terminal | Description |
---|---|
In | The input terminal that accepts a message for processing by the node. |
Failure | The output terminal to which the input message is routed if a failure is detected during the computation. (Even if the Validate property is set, messages that are propagated to the Failure terminal of the node are not validated.) |
Out | The output terminal to which the transformed message is routed. |
Alternate | An alternative output terminal to which the transformed message can be routed, instead of to the Out terminal. |
The following tables describe the node properties. The column headed M indicates whether the property is mandatory (marked with an asterisk if you must enter a value when no default is defined); the column headed C indicates whether the property is configurable (you can change the value when you add the message flow to the BAR file to deploy it).
The Description properties of the JavaCompute node are described in the following table.
Property | M | C | Default | Description |
---|---|---|---|---|
Node name | No | No | The node type: JavaCompute | The name of the node. |
Short description | No | No | A brief description of the node. | |
Long description | No | No | Text that describes the purpose of the node in the message flow. |
The JavaCompute node has the Basic property that is described in the following table.
Property | M | C | Default | Description |
---|---|---|---|---|
Java class | Yes | No | None | The name of the Java class that is used in this node. This name must be displayed in the list of Java classes that are available in the project references for the message flow project. |
The Parser Options properties for the JavaCompute node are described in the following table.
Property | M | C | Default | Description |
---|---|---|---|---|
Parse timing | Yes | No | On Demand | This property controls when an input message is parsed. Valid values are On Demand, Immediate, and Complete. By default, this property is set to On Demand, which causes validation to be delayed until it is parsed by partial parsing. If you change this value to Immediate, partial parsing is overridden and everything in the message is parsed and validated, except for those complex types with a composition of Choice or Message that cannot be resolved at the time causing a validation failure. If you change this value to Complete, partial parsing is overridden and everything in the message is parsed and validated. For a full description of this property, see Parsing on demand. |
Use MQRFH2C compact parser for MQRFH2 domain | No | No | Cleared | This property controls whether the MQRFH2C compact parser, instead of the MQRFH2 parser, is used for MQRFH2 headers. |
Use XMLNSC Compact Parser for XMLNS Domain | No | No | Cleared | Setting this property causes the outgoing MQRFH2 to specify the XMLNS instead of XMLNSC parser, allowing an external application to remain unchanged. If outgoing messages do not contain MQRFH2 headers, this property has no effect. |
Retain mixed content | No | No | Cleared | This property controls whether the XMLNSC parser creates elements in the message tree when it encounters mixed text in an input message. If you select the check box, elements are created for mixed text. If you clear the check box, mixed text is ignored and no elements are created. |
Retain comments | No | No | Cleared | This property controls whether the XMLNSC parser creates elements in the message tree when it encounters comments in an input message. If you select the check box, elements are created for comments. If you clear the check box, comments are ignored and no elements are created. |
Retain processing instructions | No | No | Cleared | This property controls whether the XMLNSC parser creates elements in the message tree when it encounters processing instructions in an input message. If you select the check box, elements are created for processing instructions. If you clear the check box, processing instructions are ignored and no elements are created. |
The Validation properties of the JavaCompute node are described in the following table.
Set the validation properties for the parser to validate the body of messages against the Message set. If a message is propagated to the Failure terminal of the node, it is not validated. For more details, see Validating messages and Validation properties.
Property | M | C | Default | Description |
---|---|---|---|---|
Validate | No | Yes | None | This property controls whether validation takes place, and what part of the message is validated. Valid values are None, Content and Value, Content, and Inherit. |
Failure action | No | No | Exception | This property controls what happens if a validation failure occurs. You can set this property only if Validate is set to Content or Content and Value. Valid values are User Trace, Local Error Log, Exception, and Exception List. |
Include All Value Constraints | No | No | Selected | You cannot edit this property. If the check box is selected (the default), all value constraints are included in the validation. |
Fix | No | No | None | You cannot edit this property. Minimal fixing is provided. Valid values are None, and Full. |