com.sap.aii.mapping.api

Class AbstractTransformation

java.lang.Object
  extended by com.sap.aii.mapping.api.AbstractTransformation

public abstract class AbstractTransformation
extends Object

Each XI Java mapping program must extends this abstract class. It replace the deprecated interface AbstractTransformation. The implementing class needs a default constructor. For each message a new instance is created with the default constructor. Afterwards setHelper(AbstractHelper) is called before transform(TransformationInput, TransformationOutput) is called.

Example The following example shows how the MAPPING_TRACE and RECEIVER_NAME parameters are set and evaluated in a Java mapping program:

 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.Map;
 import java.util.HashMap;
 import com.sap.aii.mapping.api.AbstractTrace;
 import com.sap.aii.mapping.api.StreamTransformation;
 import com.sap.aii.mapping.api.StreamTransformationConstants;
 
 public class JavaMapping extends AbstractTransformation {
 
        public void transform(TransformationInput in, TransformationOutput out) throws StreamTransformationException {
 
                getTrace().addInfo("...");
 
                // ...
 
                String receiverName = (String) in.getInputHeader().getReceiverInterface();
 
                // ...
 
        }
 }
 

It is possible that different instances of the implementing class are executed in parallel in different Threads. Take care about this when using static fields or static methods. Java mapping programs are not permitted to be stateful. It is not permitted to perform actions such as writing data to a database table during a Java mapping. The Integration Server cannot track such side effects. Therefore, if an attempt is made to resend a message that has not been received by the receiver, the data may inadvertently be written to the database twice in a Java mapping. Note also that you cannot call java.lang.System.exit() or java.lang.System.setProperties() within a Java mapping and that you cannot use a ClassLoader in the classes of an imported archive. For reading files from an imported Archive getClass().getResourceAsStream(String name) can be used.

Since:
SAP NetWeaver NEW YORK

Constructor Summary
protected AbstractTransformation()
           
 
Method Summary
 AbstractHelper getHelper()
          Return an AbstractHelper for this Java mapping program.
 AbstractTrace getTrace()
          the the method returns null before the method setHelper is called. during the mapping runtime this is executed: calling constructor(); calling setHelper(...); calling transform(
 void setHelper(AbstractHelper helper)
          ONLY FOR XI INTERNAL USE!
abstract  void transform(TransformationInput in, TransformationOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTransformation

protected AbstractTransformation()
Method Detail

transform

public abstract void transform(TransformationInput in,
                               TransformationOutput out)
                        throws StreamTransformationException
Parameters:
in - the transformation input
out - the transformation output
Throws:
StreamTransformationException

getTrace

public final AbstractTrace getTrace()
the the method returns null before the method setHelper is called. during the mapping runtime this is executed: calling constructor(); calling setHelper(...); calling transform(...,...);

Returns:
a trace Object for writing trace information

getHelper

public final AbstractHelper getHelper()
Return an AbstractHelper for this Java mapping program.

Returns:
the AbstractHelper for this Java mapping program.

setHelper

public final void setHelper(AbstractHelper helper)
ONLY FOR XI INTERNAL USE! Is called from the runtime before transform(TransformationInput, TransformationOutput) is called to set the AbstractHelper object.

Parameters:
helper - the AbstractHelper for this Java mapping program.
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] SAP_XIAF [sap.com] com.sap.aii.mapping.lib.facade api BC-XI


Copyright 2014 SAP AG Complete Copyright Notice