With Java (IO or NIO) file API (and libraries on top of it) you can (under 
Windows) open UNC path or mapped drives, but you can’t impersonate other 
(network) tokens/logins.

What you could do is use a SMB/CIFS client like jCIFS(-ng) or SMBj (I think 
there are also some minimal NFS clients) and implement the listing monitoring. 
Commons-vfs provides some functions for that. 

Alternative is using WebDAV, ftp/s or sftp as application protocols with their 
associated libraries (also supported in commons-vfs).

I can’t recommend VFS for all transactional/automated loads and using an 
underlying lib might be easier and better in your case.

If none of that works for you, maybe a fuse solution is also acceptable or - 
under Linux - mounting sub fikesystem while specifying the mount credentials. 

Gruss
Bernd

Thomas, Patrick R wrote on 13. May 2024 19:38 (GMT +02:00):

> I have Java application that runs in WildFly 10 as a Windows server. It
> uses a service account to run. It monitors multiple folders for data files
> that come from other systems. The current folders reside on the
> application server. The folders have to be moved to NAS. The way the NAS
> is configured, it requires a username and password that is unrelated to
> the service account. I need to refactor my code to use Apache Commons to
> be able to monitor across the network. I have not been able to find a
> realistic solution to have my application login to a NAS location and
> monitor multiple folders. Every solution I have found is for reading a
> single file. Has anyone done this before?
> 
> Thank you,
> 
> Patrick R. Thomas
> 
> 
> ______________________________________________________________________
> The contents of this message, together with any attachments, are intended
> only for the use of the person(s) to which they are addressed and may
> contain confidential and/or privileged information. Further, any medical
> information herein is confidential and protected by law. It is unlawful
> for unauthorized persons to use, review, copy, disclose, or disseminate
> confidential medical information. If you are not the intended recipient,
> immediately advise the sender and delete this message and any attachments.
> Any distribution, or copying of this message, or any attachment, is
> prohibited.


Gruß
Bernd
— 
https://bernd.eckenfels.net

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to