Powered By

Free XML Skins for Blogger

Powered by Blogger

Wednesday, December 31, 2008

Accessing Adapter-Specific Attributes in XI Message Mappings

Use

Sender adapters can write adapter-specific attributes to the message header; these can then be evaluated at configuration time (see: Structure linkAdapter-Specific Message Attributes in the Message Header). Java mapping programs can also change the attributes after the message has arrived (see also: Java Mapping of Adapter-Specific Attributes).

To change the adapter-specific attributes of the message header by using message mappings, you access the required classes of the mapping API by using a mapping runtime constant.

Integration

To access the classes DynamicConfiguration and DynamicConfigurationKey by using the mapping runtime constant DYNAMIC_CONFIGURATION, use the method getTransformationParameters() of the container object.

Example

The following program code for a user-defined function changes the value of the file adapter parameter FileName.

Accessing the File Adapter Adapter-Specific Attribute “FileName”

DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create(
“http://sap.com/xi/XI/System/File”,
“FileName”);

String valueOld = conf.get(key);
if (valueOld != null) {
String valueNew = valueOld.replaceAll(“input”,”output”);
conf.put(key, valueNew);
}

No comments: