package sample;
import java.io.*;
import com.sap.aii.mapping.api.*;
public class MyJavaMapping extends AbstractTransformation {
DynamicConfiguration conf; // used for dynamic configuration
// (adapter-specific message attributes)
InputParameters param; // used for input parameters
// the method "transform" is called by Java Mapping Runtime
public void transform (TransformationInput arg0, TransformationOutput arg1)
throws StreamTransformationException {
conf = arg0.getDynamicConfiguration(); // provide dynamic configuration
param = arg0.getInputParameters(); // provide input parameters
this.execute(arg0.getInputPayload().getInputStream(),
arg1.getOutputPayload().getOutputStream());
}
// the method "execute" is called by "transform" and "main"
public void execute (InputStream in, OutputStream out)
throws StreamTransformationException {
// Add your code here
}
// reading dynamic values
String getDynamicValue(String namespace, String name){
if (conf == null) // in test mode, dynamic parameters cannot be used.
return ""; // Use default values instead
DynamicConfigurationKey key =
DynamicConfigurationKey.create(namespace, name);
return conf.get(key);
}
// reading input parameters
String getInputParameter(String name){
if (param == null){ // in test mode, input parameters cannot be used.
return ""; // Use default values instead
} else {
return (String) param.getValue(name);
}
}
// the method "main" is using files for input and output
public static void main(String[] args) {
try {
InputStream in = new FileInputStream(new File("in.xml"));
OutputStream out = new FileOutputStream(new File("out.xml"));
MyJavaMapping myMapping = new MyJavaMapping();
myMapping.execute(in, out);
} catch (Exception e) {
e.printStackTrace();
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
37 | |
10 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 | |
2 |