Package io.milton.ftp

Class MiltonFtpAdapter

java.lang.Object
io.milton.ftp.MiltonFtpAdapter
All Implemented Interfaces:
Service, Stoppable, org.apache.ftpserver.ftplet.FileSystemFactory

public class MiltonFtpAdapter extends Object implements org.apache.ftpserver.ftplet.FileSystemFactory, Service
Adapts a milton resource factory into an FTP file system, which allows integration with Apache FTP. ie with this class a milton data source can be accessed by webdav and FTP simultaneously. Implements the Service interface from Berry to allow starting or stopping. The default behaviour is to start the FTP server as part of object construction
Author:
bradm
  • Constructor Details

    • MiltonFtpAdapter

      public MiltonFtpAdapter(ResourceFactory resourceFactory, org.apache.ftpserver.FtpServer server)
      Just sets dependencies. Does NOT start the server
      Parameters:
      resourceFactory -
      server -
    • MiltonFtpAdapter

      public MiltonFtpAdapter(ResourceFactory wrapped, org.apache.ftpserver.ftplet.UserManager userManager) throws org.apache.ftpserver.ftplet.FtpException
      Throws:
      org.apache.ftpserver.ftplet.FtpException
    • MiltonFtpAdapter

      public MiltonFtpAdapter(ResourceFactory wrapped, org.apache.ftpserver.ftplet.UserManager userManager, FtpActionListener actionListener) throws org.apache.ftpserver.ftplet.FtpException
      Creates and starts the FTP server on port 21
      Parameters:
      wrapped -
      userManager -
      actionListener -
      Throws:
      org.apache.ftpserver.ftplet.FtpException
    • MiltonFtpAdapter

      public MiltonFtpAdapter(ResourceFactory wrapped, org.apache.ftpserver.ftplet.UserManager userManager, int port) throws org.apache.ftpserver.ftplet.FtpException
      Creates and starts the FTP server on the given port
      Parameters:
      wrapped -
      userManager -
      port -
      Throws:
      org.apache.ftpserver.ftplet.FtpException
    • MiltonFtpAdapter

      public MiltonFtpAdapter(ResourceFactory wrapped, org.apache.ftpserver.ftplet.UserManager userManager, FtpActionListener actionListener, int port, boolean autoStart) throws org.apache.ftpserver.ftplet.FtpException
      Creates and optionally starts the server
      Parameters:
      wrapped -
      userManager -
      actionListener -
      port -
      autoStart - - whether or not to start the server. If false the server can be started with the start() method
      Throws:
      org.apache.ftpserver.ftplet.FtpException
  • Method Details

    • close

      public void close()
    • getResource

      public Resource getResource(Path path, String host) throws NotAuthorizedException, BadRequestException
      Throws:
      NotAuthorizedException
      BadRequestException
    • createFileSystemView

      public org.apache.ftpserver.ftplet.FileSystemView createFileSystemView(org.apache.ftpserver.ftplet.User user) throws org.apache.ftpserver.ftplet.FtpException
      Specified by:
      createFileSystemView in interface org.apache.ftpserver.ftplet.FileSystemFactory
      Throws:
      org.apache.ftpserver.ftplet.FtpException
    • start

      public void start()
      Specified by:
      start in interface Service
    • stop

      public void stop()
      Specified by:
      stop in interface Stoppable