You can use the Java™ MbElement class for mapping inputs and outputs that are not simple types with a Custom Java transform.
The plug-in is a JAR file that is provided with the IBM® Integration Toolkit. The jplugin2.jar is also available in the classes directory of the server installation.
import com.ibm.broker.plugin.MbElement;
You can use the Node class from the standard Java DOM API to process complex or repeating elements in a Custom Java transform.
For example, the following code shows a Java method that uses the Node class:
public static Node nodeMove(Node inEl)
If your Java code is likely to be used by multiple solutions, store it in a shared library. You can store the Java code in the same shared library as a message map. Alternatively, you can store the Java code separately in a referenced shared library.
When you map a single non-repeating element input to a single non-repeating element output, you can use a Java method with the following signature:
public static MbElement mbElMove(MbElement inEl)
For example, the following code shows a Java method that copies a sub tree:
public static MbElement mbElMove(MbElement inEl)
{
MbElement outEl = null;
try {
outEl = inEl.copy();
outEl.copyElementTree(inEl);
} catch (MbException e) {
throw (new RuntimeException(e));
}
return outEl;
}
When you map a single repeating element input to an output repeating element, you can use a Java method with the following signature:
public static List<MbElement>; customCompleTypeMove(List<MbElement>; inEls)
public static List<MbElement> customCompleTypeMove(List<MbElement> inEls)
{
List<MbElement> outEls = new ArrayList<MbElement>();
try {
Iterator<MbElement> i = inEls.iterator();
while (i.hasNext()) {
MbElement inEl = i.next();
MbElement outEl = inEl.copy();
// Do some processing of outEl
outEls.add(outEl);
}
} catch (MbException e) {
throw (new RuntimeException(e));
}
return outEls;
}