Addition 2 on 25/07/2017: The bean will download the (jar) files as a zipped file on the receiver channel.
When moving across different clients, it can take some time to set up NWDS with all the jar files required for development. Otherwise, sometimes while staring a new development, it can take some time to find the jar files required. This blog describes a generic approach to find the jar files for a list of files.
The approach has been already covered in previous blogs like this link.
However, the class name is hardcoded and I was thinking of creating a generic solution where I can just plug an adapter module and it will retrieve the jar files for a list of classes.
Bean Name: FindClassPathBean
It doesn’t need any parameters and tries to find the jar files for each of the lines which are expected to be class names.
Create an ICO/iFlow with a SOAP sender and ftp adapter as receiver.
For this example, below is the list of classes for which we’re getting an error in NWDS as we don’t have the jar files set up in our project.
Remove the import and semi-colons to just get the class names.
This list of class names can be used in the test tool.
Chose Testing Tab->Send Test Message
Here in payload the list of classes can be supplied for which we’re interested in finding the jar files.
Send the message and we get the logs with the jar locations !
It’s really handy if we have a large set of files to work through.
The bean blanks out the message as we don’t want to write any file to the target FTP server. FTP adapter has been configured to ignore blank messages .
and from the adapter log indicates FILE_SUC_EMPTYPAYLOAD indicating empty message has been received by the FTP adapter. On a side note, I’m not sure why SAP chose this cryptic string instead of writing the text that an empty message has been received and nothing will be written to the end-point.
This enables us to navigate the file path as mentioned in this blog link .
This is the github link which has the EAR file which we can be deployed to the PI server and can be used straight away.
My test was done on a PO 7.4 system.
An idea was put forward in one of the comments to download the files.
The second revision reads the files and downloads the files as a zipped file in the target directory.
Put the class names. As a test I have put the class name of the bean itself.
The logs indicate the files being read.
The log confirms the file has been written.
if we download and open the file, it shows the jar files which have been added.
So using this bean, we’re able to display the jar paths and download the jar files as a single zipped file. internally, it’s using a set to store the class name and hence a jar file will be added to the zip only once even if it corresponds to multiple classes.