Hello Brad,
  Actually Ralph's idea sounds great (why does it need to be a
DisposableBean, Ralph? my knowledge of Spring is <= null) and it start
FtpServer automatically , no need to provide a Main class.

 He builds a web application with that single file and the changes stated in
his mail (yeah, read it carefully! basically you need to add a bean
definition in your Spring file pointing to the class he developed).

Niklas I do think that using Spring lifecycle is better than a
ContextListener. For example, with Spring it is very easy to deploy the
whole thing as a "resource adapter" instead of a web-application . Spring
 v2 documentation states that this is useful when you need to deploy
something to an application server where you would previously use an empty
Web Applicaton.  It seems like our use case here!


By the way, I have provided a sample project in Jira. It uses a
ContextListener to start FtpServer inside a web application.  The
ftpd-typical.xml file should be edited to configure the usermanager and
provide the SSL keystore. After that you can build & deploy the app!.









2008/10/15 Sisk, Brad <[EMAIL PROTECTED]>

> You wrote:
>
>
>
> "Something like this worked for me:
>
> package my.ftp
>
> import org.apache.ftpserver.FtpServer;
> import org.springframework.beans.factory.DisposableBean;
>
> public class FtpWrapper implements DisposableBean  {
>
>    private FtpServer server;
>
>    private FtpWrapper() { }
>
>    public void setFTPServer(FtpServer server)
>    {
>        this.server = server;
>        init();
>    }
>
>    private void init() {
>        try {
>            server.start();  "
>       ...etc...
>
>  I appreciate your suggestion, Ralph. But if I'm not mistaken, it looks
> like you've posted a solution for a standalone Java app-not the Spring
> approach to bean instantiation. For example, your solution directly
> instantiates FtpServer the way a main() method would-rather than using
> the Spring BeanFactory or ApplicationContext approach.
>
> As I originally posted, I already know how to launch FTPServer using
> Java. That's not what I'm asking about. My question was about how one
> does the same thing in a deployed Spring application. Spring.  In
> Spring, you are not supposed to directly instantiate any object-but
> rather let Spring instantiate them by calling Spring's BeanFactory
> methods.
>
> However, for the BeanFactory instantiation to work, one has to have the
> proper XML configuration file written. THIS is the question I was
> asking:  What is the XML I have to write to force Spring to
> automatically call FtpServer.start()?
>
> See, I need to know how to make SPRING call server.start()---using XML.
> I 'm not asking how to write a Java method call.
>
>
>
>

Reply via email to