Skip to Content
Author's profile photo Gagandeep Batra

Part1:Step By Step Approach to Use of Picking the file from multiple folders, PGP encryption, Java Mapping using NWDS, Dynamic Receiver folder creation in PI/PO Single Stack 7.31 sp7.

Hello Friends,

Today I got a Chance to learn in the following requirement hope this will help to you also.

Requirement is like that we have to Pick the file from multiple folders, encrypt them and put in the Encrypt folders under the same folder.

For that we have tried multiple options to do without ESR object but at not find any suitable options.

Like we tried to do this using Dynamic Configuration bean with variable substitution but problem with variable substitution is that it will automatic convert the special character like, : ;< >/ \ etc. with underscore(_). So it not work when you referring to the current directory in Variable substitution.

One other option that we didn’t try is Run OS command if you like that one you can try but this will not work when you talking about FTP/SFTP

Finally do this with JAVA mapping using…

I divided this blog with 2 Parts because the length of the blog:

Part1: JAVA mapping & ESR Part

Part2 : PGP configuration & ID part



Open NWDS->

File->New->Java Project


Give Name Like: Dynamic_Directory

Then Next

Click on Libraries then Add External Jar’s

Click on Libraries then Add External Jar’s

Select the Library files for mapping .

You can download the libaray files from server refer following blog for that:


Then Finish.

Now right click on src folder and select New file

Give Name Like

And write the following code in this file



import java.text.*;

import java.util.*;

public class Dynamic_Directory implements StreamTransformation {

    private Map param;

    public void setParameter(Map map1) {

        this.param = map1;


    public void execute(InputStream inputstream, OutputStream outputstream) throws StreamTransformationException {

        try {

              AbstractTrace  trace = null;

            String directory=null;

              trace = (AbstractTrace)param.get(StreamTransformationConstants.MAPPING_TRACE );

            param.put(DynamicConfigurationKey.create(, StreamTransformationConstants.DYNAMIC_CONFIGURATION), “”);

            DynamicConfiguration conf = (DynamicConfiguration) param.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

          DynamicConfigurationKey key1 = DynamicConfigurationKey.create(, “Directory”);

            String directory_name =conf.get(key1);

              trace.addInfo(“Directory is “+directory_name);

            directory = directory_name+“/Ency”;



              trace.addInfo(“Directory after update “+directory);

              conf.put(key1, directory);

            // b) Just copy input file to output file

            byte[] b = new byte[inputstream.available()];



        } catch (Exception exception) {




Now Create Jar file for that Goto

File->Export->Java->jar File.

Select your project file you can also select java source file by click export java source file.

Following jar file will created on you Disk

It’s Time for ESR

In ESR we just need two objects

  1. Operation Mapping and
  2. Java Mapping

Create Name Space:

Create Imported Archive: IA_Dynamic_Directory

Import the Jar File

Create opetration Mapping with dummy interface name:


And refer the java mapping as below:

Part 2: Part2: Step By Step Approach to Use of Picking the file from multiple folders, PGP encryption, Java Mapping using NWDS, Dynamic Receiver folder creation in PI/PO Single Stack 7.31 sp7.



Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Iñaki Vila
      Iñaki Vila

      Great job Gagandeep Batra!, thank you for sharing a complete hard scenario.

      Don't you think this development deserves a document better than a multiple blog?


      Author's profile photo Gagandeep Batra
      Gagandeep Batra
      Blog Post Author

      Thanks Inaki..

      ya will take care next time ..:)