Skip to Content
Author's profile photo Praveen Tirumareddy

Step by Step Dynamically choosing target folder using JAVA mapping with SFTP adapter.

Hello All,

Business Requirement: We had to route the file to different folder using company-code as routing condition available in the file name. Since there was no transformation required so it was basically a pass-through scenario. But since we had to fix the receiver directory during runtime we decided to use java mapping to set dynamic configuration Filename and Directory parameters. We have SFTP as sender and Reciver channels and we were using ICO for configuration.

Its basically a pass-through scenario with choosing the directory/Filename during Runtime.

So it gives an insight of three aspects:

  1. How to configure Pass-through scenario and still use Java Mapping.
  2. How  to put things together with ICO with SFTP adapter.
  3. How to work on java mapping using Eclipse Editor with new API’s.

ESR Objects:

  • We need to create below mentioned objects
    • Sender Data Type (Dummy structure)
    • Sender Message Type
    • Sender Service Interface
    • Receiver Data Type(Dummy structure)
    • Receiver Message Type
    • Receiver Service Interface
  • Imported Archive

ImportedArchive.jpg

  • PFA Java Mapping Sample Code which can be edited as per requirement.(Step by Step explained in below section)

  • Operation Mapping.

operationMapping.jpg

Note: We need not worry about sender structure not matching the input File.

ID-ICO Configuration.

  • ICO Inbound Processing:

ICOInboundProcess.jpg

Note: We have to leave the SWCV of sender Interface blank otherwise we might get an error as Adapter engine expects the the file in sender Data Type.


  • ICO Receiver:

ICOReceiverDetermin.jpg

  • ICO Receiver Interfaces:

ICOInterfaceDetermine.jpg























  • ICO OutBound Processing

ICOOutboundProcess.jpg


  • ICO Sender Channel with Advanced module Parameter

SenderChannel.jpg

Note: We don’t need to add anything in Module parameter for content conversion.Just need to leave with default entry.


  • ICO Receiver Channel with Advanced module Parameter

ReceiverChannel.jpg


Note: We don’t need to add anything in Module parameter for content conversion.Just need to leave with default entry.


Java Mapping Using Eclipse Editor.


  • Step 1

Step1NewProject.jpg

  • Step 2

Step2NewProjectName.jpg

  • Step 3: Right Click on Project-> Properties -> Java Build Path -> Add External Jars.

Step3AddExternalJars.jpg

  • Step 4

Step4AddNewClass.jpg



  • Step 5

Step5NewClass.jpg


  • Step 6: Now paste the code provide and edit as per your requirement.


  • Step 7: Right Click on Package you are working –> Export


  • Step 8:

Step7JarCreation.jpg


  • Step 9:

Step9JarCreation.jpg

  • Just Press on Finish and import it through Imported Archive as mentioned above.

I  know this might not be a difficult one but now this gives us lot of flexibility with other scenarios.

  • PGP Encryption:Supposedly if we want encryption we can add pgp module parameters and do encryption in the receiver channel.
  • Complex Dynamic Filename configuration.

Hope this solves few problems.

Please share if it requires any changes.

thanks and regards

Praveen Tirumareddy.






Assigned Tags

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

      Great job Praven!, thank you for sharing. It will be extremly helpful.

      Author's profile photo Praveen Tirumareddy
      Praveen Tirumareddy
      Blog Post Author

      Thank you Iñaki 🙂

      Author's profile photo mvavilala mvavilala
      mvavilala mvavilala

      Hi Praveen,

      Good Job.. This is very useful

      Author's profile photo Praveen Tirumareddy
      Praveen Tirumareddy
      Blog Post Author

      thanks Madhu 🙂

      Author's profile photo Former Member
      Former Member

      Hi Praveen,

      This seems very useful for my scenario.

      But I have one doubt, how do you specify directory in your receiver SFTP.

      I am picking up the file from logical path and placing it on SFTP based on file name (country wise) which I need to place in country specific folders.

      Could you please help on how to configure receiver SFTP channel to place the file on dynamic directory based on file name.

      and also can you please share the Java mapping code. Thanks in advance.

      Author's profile photo Former Member
      Former Member

      Hi Praveen

       

      Awesome explanation however i cannot see the java program here.

       

      can you please help

       

      neha

       

      Author's profile photo rishabh sharma
      rishabh sharma

      Hi Praveen,

       

      This is a wonderful explanation but I could not see the code here.

      Can you please provide the code because I have a similar requirement.

      Thanks in advance.

       

      Regards,

      Rishabh

       

      Author's profile photo sindhu kumaresan
      sindhu kumaresan

      May i know where can i get this java code