1

I am having fun (sort of) developing a Java 7 FileSystem implementation for use with FTP servers; for this I need an FTP client library (for the runtime aspect) and an FTP server library (for tests).

So, let us start with...

The FileSystem API

A FileSystem is an abstraction, introduced in Java 7, allowing to accessing a tree of Paths. Think directories and files and you won't be far from reality (note that symbolic link support is also there but we will get it out of the picture for now).

A FileSystem is a collection of FileStores; a FileSystem can potentially have more than one FileStore but this is FTP; only one FileStore (see here). One important aspect of a FileStore is that it describes what "attributes" are available (see AttributeView).

Once you have implemented FileStore, FileSystem and Path, you can then do such niceties as, for instance, copy a remote file to a local file using Files.copy():

final Path ftpsrc = ftpfs.getPath(somePathHere);
// Paths.get() gets a path from the default JRE filesystem
final Path localdst = Paths.get(somePathHere);
Files.copy(ftpsrc, localdst);

The client side

What I need on the client side is a minimal library to implement FTP with at least basic authentication support, passive/active mode, binary transfer mode, SSL/TLS support. Download resume is not required.

Right now, my choice is:

commons-net:commons-net:3.3

It has good reputation, its license matches my needs (I will eventually publish the project using dual LGPLv3/ASL 2.0 licensing) and implements all I want.

But it implements much more than FTP proper. While it does the job, it looks like a 2 squared-mile brick to squash a mouse. Is there an alternative library with as friendly a license as this one but doesn't try and implement anything beyond FTP?

The server side

What is needed here is a pure Java implementation; I need to be able to instantiate an FTP serve so that I can test my implementation against it. Right now, I have elected this one:

org.apache.ftpserver:ftpserver-code:1.0.6 (server).

The reasons I have chosen it are pretty much the same as for commons-net. But maybe there is a better one?

  • Welcome to Software Recommendations! If you are looking for an alternative to something, please do point out what of the current solution is lacking. WHY do you look for a different solution? Also your question needs far more details on what you do, in what environment you use it and what you want to optimize against. Currently every and any FTP Library in Java would match which is too broad for this site. – Angelo Fuchs Mar 15 '14 at 19:34
  • Also, why do you need a server to test something? Why not mock it for the automation? Or is that something that you would consider "an alternative"? – Angelo Fuchs Mar 15 '14 at 19:36
  • @AngeloNeuschitzer simple enough; I want to test that my FileSystem implementation works without requiring that an FTP server be installed on the system. – fge Mar 15 '14 at 19:39
  • @AngeloNeuschitzer edited the post to answer your first requirement; on the client side I am looking for a potentially more lightweight solution – fge Mar 15 '14 at 19:41
  • 1
    @AngeloNeuschitzer because I am implementing a FileSystem for FTP, and FTP only – fge Mar 15 '14 at 19:45

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.