on 05-03-2012 5:34 PM
I need to use dynamic configuration to read in the input directory and replace a string and then put that back so that files are sent to the correct directory. However,I can’t read the dynamic configuration for the directory. Whenever I try to read the directory from the dynamic configuration its blank. I have confirmed this by running some tests. Using a constant value I can write back a new directory and the files appear in the right place. I just have a problem when I’m reading the directory name from the configuration. The code I was using is below, all I am doing with this example is reading the directory name and writing it back. It doesn't work and returns a null pointer exception. Any ideas?
I’m going to carry on searching SDN and see if anything turns up but I was wondering if you have any ideas? FYI – I reconfigured all the comms channels to use dynamic directory configuration.
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "FileName");
DynamicConfigurationKey keyDir = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "Directory");
String OrigDirPI = conf.get(keyDir); *** THIS IS THE BIT THAT FAILS*****
return "";
Hi,
Please try this:
String Name1 ="XXX";
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
conf.put(key1, Name1);
DynamicConfigurationKey key2 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Directory");
String directoryIn = conf.get(key2);
String DName ="/usr/sap/interfaces/DPG/eChannel/OUT/RUK/10151" + "__" + directoryIn;
conf.put(key2, DName);
return "";
Note: I dont have a systemas of now, so kindly chk for syntax errors.
Thanks
Amit Srivastava
Message was edited by: Amit Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
First of all ensure you message has dynamic configuration value for directory. Ensure communication channel set up to get this parameter from file system and you could see all dynamic parameters in message header using sxmb_moni transaction.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is the code I used to test the above comment.
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey FileNameKey = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "FileName");
conf.put(FileNameKey, FileName);
DynamicConfiguration conf2 = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey DirectoryKey = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "Directory");
String directoryIn = conf2.get(DirectoryKey);
String DName ="/usr/sap/interfaces/DPG/eChannel/OUT/RUK/10151" + "__" + directoryIn;
conf.put(DirectoryKey, DName);
return "";
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think your code seems right. But I'm seeing in the below link the code has two instances of Dynamic configuration namely dynamicConfiguration and dynamicConfiguration1. Each instance handles DIrectory and filename seperate. You might want to try creating as this link
See that helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.