Forked from SriniBlog/ReadDynamicConfiguration.java
Created
February 9, 2018 01:23
-
-
Save viksingh/79e5fe4d9ab7a9d05515b27d9624f330 to your computer and use it in GitHub Desktop.
Learn to Read Dynamic Configuration in SAP PI Java Mapping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Author: Vanamala Srinivas | |
* Website: www.sriniblog.com | |
* Note: This is just a snippet and use it as a reference. | |
* Complete Blog: http://sriniblog.com/read-write-dynamic-configuration-in-sap-pi-using-java-mapping/ | |
*/ | |
public void transform(TransformationInput arg0, TransformationOutput arg1) throws StreamTransformationException | |
{ | |
trace = (AbstractTrace) getTrace(); //Capture trace object and write trace for debugging purpose. | |
DynConfig = arg0.getDynamicConfiguration(); //get the DynamicConfiguration Running Instance | |
if( DynConfig == null){ | |
throw new StreamTransformationException("Unable to load the Dynamic Configuration Object!"); | |
} | |
//Define the Key that we want to read | |
DynamicConfigurationKey Key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName"); | |
//Read Dynamic Configuration | |
try{ | |
String FileName = DynConfig.get(Key); //get method to read the key | |
if( FileName != null && !FileName.equals("") ){ | |
trace.addInfo("Dynamic Configuration for Filename = " + FileName); | |
}else{ | |
trace.addInfo("Unable to Read the Dynamic Configuration for File Parameter!"); | |
} | |
}catch(Exception ee){ | |
trace.addInfo("Unable to Read the Dynamic Configuration for File Parameter!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment