tags:

views:

346

answers:

3

I found this very simple description on Apache FtpServer's document:

Integration with Spring Framework

Apache FtpServer uses Spring Framework to implement the configuration. That also means that we get the added benefit of full integration with regular Spring XML configuration. For example, you can embed the "server" element where ever you like within you Spring configuration, and with FtpServer on the classpath, Spring will wire up the server for you.

Nothing else about:

  1. Where should I put this configure file?
  2. What should the file name be?
  3. How could the application find that file?

Do I have study Spring's Configure Framework to know all about it?

+2  A: 

There is documentation about that, and it wasn't too hard to find. It's on this page:

http://mina.apache.org/ftpserver/running-ftpserver-stand-alone-in-5-minutes.html

Turns out that you specify the XML configuration file simply on the command line when starting the server:

bin/ftpd.sh res/conf/ftpd-typical.xml

For Windows:

bin/ftpd.bat res/conf/ftpd-typical.xml

I just tried this for myself: I downloaded the server, fired off the command, and... it started serving.

Carl Smotricz
I've found that also, it seems that I have read source code ftpd to see how it use the configuration file.
ablmf
I finally found that : 1. to embed an FtpServer, configure file is not needed. 2. BUT you have to give a user.properties file otherwise anonymous user would not be able to login.
ablmf
Good work! Glad you got it running OK.
Carl Smotricz
+1  A: 
Juha Syrjälä
I also expected that would work without any configure file, until I found that no client could login but keeps getting 530 authentication fail. Here is my code : http://pastebin.com/d49bc7e7e
ablmf
Your code explicitly creates a PropertiesUserManagerFactory object that reads values from a file. Instead, create an UserManager instance that accepts requests from every user.
Juha Syrjälä
A: 

Spring's config mechanism is surprisingly simple yet flexible - essentially just an XML file defining a bunch of objects and their relationships (by specifying constructor parameters, invoking setters and so on - just like you would do from code).

One key point is that it wires together objects that are otherwise perfectly normal (no "Spring magic"). So you can take Spring components and use them independently of the config mechanism - handy for testing and re-use in other frameworks, or take external components and use them in a Spring project with no changes.

SimonJ