Hello Urmila,
Sure. First a bit about the requirement I had to implement. The files are in a location consisting of a fixed path and a variable path starting from that fixed path. The elements forming the variable path I receive from a web service which calls ACE to get the list of files. The fixed path is a mounted location on SUSE Linux (you may be able to do the same with your SFPT location, not sure though how that would work – I am very much a Windows person).
I am using standard Java code to access the location, I have attached the Java class of which the template is generated by the JCN wizard. You can of course always use a library to access the SFTP location, just google. Baeldung is always a good source of information. If you use a library (including its dependencies) you can include those in a 'lib' folder inside the Java project generated by the wizard (I use the Java perspective of the toolkit for this) and include them in the project's build path (right click the Java project, select Properties -> Java Build Path -> Libraries tab).
Good luck,
Willem
Original Message:
Sent: 2/27/2024 7:56:00 AM
From: Urmila V M
Subject: RE: Java Compute Node for SFTP List files.
Hello Willem,
I have exactly the same requirement & won't be able to use FileExist/FileIterator node. Can you please guide me on how list of SFTP files can be fetched using JCN?
Thanks & Regards,
Urmila V M
------------------------------
Urmila V M
------------------------------
Original Message:
Sent: Fri February 23, 2024 02:44 AM
From: Willem Kunkels
Subject: Java Compute Node for SFTP List files.
Hi Dan,
Thank you for your swift reply (and the useful links). I have used a JavaCompute node to get the list, that works fine. I have submitted an RFE (APPC-I-885) to request a mid-flow node to do that.
Best regards,
Willem
------------------------------
Willem Kunkels
Senior Software Engineer
Koopman International BV
Amsterdam
+31204947893
Original Message:
Sent: Wed February 21, 2024 10:35 AM
From: Daniel Robinson
Subject: Java Compute Node for SFTP List files.
Hi Willem,
Unfortunately, the only way that you can currently do this is to use a Java Compute Node. As well as writing code to access the variable path provided by the web service, you will also need to implement code for handling the ftp connection, accessing the credentials needed, as well as code to generate the list of file names (which I assume would get written to the Local Environment tree).
Some info about using the local environment tree to pass information from one node to another :
https://www.ibm.com/docs/en/app-connect/11.0.0?topic=tree-using-scratchpad-areas-in-local-environment
Some info about accessing the local environment tree from Java :
https://www.ibm.com/docs/en/app-connect/12.0?topic=node-updating-local-environment-javacompute#ac30470_
I hope that the above is useful and that you can achieve your desired result. Also consider raising an RFE to have a mid flow node that can do what you need.
------------------------------
Daniel Robinson
Original Message:
Sent: Wed February 21, 2024 05:10 AM
From: Willem Kunkels
Subject: Java Compute Node for SFTP List files.
Hi Dan,
I was hoping I could use this node so that I can list files in a folder of which the variable part of the path to the folder is passed by a web service. Unfortunately, I cannot place the FileExists inside a flow, there is no connector on the left hand side of the node. Do you know of another way to get a list of filename inside a flow based on a variable path which is determined inside the flow?
Regards,
Willem
------------------------------
Willem Kunkels
Senior Software Engineer
Koopman International BV
Amsterdam
+31204947893
Original Message:
Sent: Fri May 05, 2023 05:41 AM
From: Daniel Robinson
Subject: Java Compute Node for SFTP List files.
Hello,
We do have the File Exists node and the File Iterator node available since ACE v12.0.6.0 . It sounds like these might be a good fit for what you have asked for. I'll include the links to the docs and some explanatory text below :
https://www.ibm.com/docs/en/app-connect/12.0?topic=nodes-fileexists-node
The File Exists node is similar to the File Input node, except it does not read any of the file contents and you can set it to 'List Mode'. You can use the FileExists node to process a file from a directory without needing to read the file contents. The metadata for the file is propagated down the flow without processing the contents of the file. The file contents can then be read and processed by another node (such as a FileRead node) later in the flow. You can also choose whether to delete the file or leave it in the file directory after it is propagated through the flow.
https://www.ibm.com/docs/en/app-connect/12.0?topic=nodes-fileiterator-node
You can use the FileIterator node along with the ListMode capability of the FileExists node. When the FileExists detects multiple files, it propagates a list of these files in the LocalEnvironment. A FileIterator node processes this list and for each entry propagates a LocalEnvironment that is compatible with the FileRead node for that specific file. The FileIterator node allows each file to be processed one at a time. If an exception occurs for a particular propagation, the exception is stored, and the remaining file entries are processed to completion.
I hope that proves to be of some use to you.
Regards,
Dan
------------------------------
Daniel Robinson
Original Message:
Sent: Thu May 04, 2023 08:01 AM
From: Tony Ferlisi
Subject: Java Compute Node for SFTP List files.
Hello,
Does anyone have a example of a Java Compute node that will login to remote folder and list the files in a directory.
Thanks @Matthias Blomme for the command line feature you provided, would be great if it would use policies to get login credentials.
------------------------------
Regards,
Tony Ferlisi
------------------------------