Thanks Niklas for the reply.
I found out that the src and compiled ftp on the web site for download
do not have the functionality as you stated in  your code. So I
downloaded from svn and when I compile the code is throwing some lots of
class not found. I am not sure if this is because of my mistake or I am
not getting all the  file.  I was checking the code as it is throwing
error for files in import statement. And I don't see those files any
where in directory structure.
import org.apache.ftpserver.ftplet.Authority;
import org.apache.ftpserver.ftplet.Component;
import org.apache.ftpserver.ftplet.FileSystemManager;
import org.apache.ftpserver.ftplet.FtpStatistics;
import org.apache.ftpserver.ftplet.Ftplet;

May be you can point me in right direction. Before  I was using a jar
file
file:///C:/Apache%20FTP/ftpserver-dev/ftpserver-dev/common/lib/ftpserver-dev.jar
<cid:part1.06060105.09070203@dimatas.com> from compiled code as library
which had all the classes. I want to do the same using new code.
I appreciate your help.
Thanks,
Rajeev
Niklas Gustavsson wrote:
Hi Rajeev

Rajeev kamal wrote:
Hello,
I want to implement FTP in one of my application. I need to port FTP in such way that the user can stop and start the FTP, add users, do dir listing and do other ftp change. I am trying to use the Embed code but I
a) That code is not working

What code are you looking at? There might be something which is out of date in our documentation.

b) when I change the code, I can start and stop the ftp, but I don't know how to add users, and do other FTP parameter change.
A sample code or your suggestion will be very much appreciated.

The add (and remove and make other changes) to users, you need to get the UserManager used with your server. Something like this should work:

        FtpServer server = new FtpServer();
        FtpServerContext context = server.getServerContext();
        UserManager userManager = context.getUserManager();

        BaseUser userToAdd = new BaseUser();
        userToAdd.setName("rajeev");
        userToAdd.setPassword("secret");

        userManager.save(userToAdd);

In this case it's using the default UserManager which will store users in a properties file. If you need additional examples, feel free to get back here!

I'm not sure of what other FTP parameters you want to change, could you please specify?

/niklas




Reply via email to