org.apache.ftpserver
Class FtpServer

java.lang.Object
  extended by org.apache.ftpserver.FtpServer

public class FtpServer
extends java.lang.Object

This is the starting point of all the servers. It invokes a new listener thread. Server implementation is used to create the server socket and handle client connection.


Constructor Summary
FtpServer()
          Creates a server with the default configuration
FtpServer(FtpServerContext serverContext)
          Constructor.
 
Method Summary
 void addListener(java.lang.String name, Listener listener)
           
 CommandFactory getCommandFactory()
          Retrieve the command factory used with this server
 ConnectionConfig getConnectionConfig()
          Retrieve the connection configuration this server
 FileSystemManager getFileSystem()
          Retrieve the file system used with this server
 java.util.Map<java.lang.String,Ftplet> getFtplets()
          Get all Ftplets registered at this server
 Listener getListener(java.lang.String name)
          Get a specific listener identified by its name
 java.util.Map<java.lang.String,Listener> getListeners()
          Get all listeners available one this server
 MessageResource getMessageResource()
          Retrieve the message resource used with this server
 FtpServerContext getServerContext()
          Get the root server context.
 UserManager getUserManager()
          Retrieve the user manager used with this server
 boolean isStopped()
          Get the server status.
 boolean isSuspended()
          Is the server suspended
 void resume()
          Resume the server handler
 void setCommandFactory(CommandFactory commandFactory)
          Set the command factory to be used for this server
 void setConnectionConfig(ConnectionConfig connectionConfig)
          Set the message resource to be used with this server
 void setFileSystem(FileSystemManager fileSystem)
          Set the file system to be used for this server
 void setFtplets(java.util.Map<java.lang.String,Ftplet> ftplets)
          Set the Ftplets to be active for this server.
 void setListeners(java.util.Map<java.lang.String,Listener> listeners)
          Set the listeners for this server, replaces existing listeners
 void setMessageResource(MessageResource messageResource)
          Set the message resource to be used with this server
 void setServerContext(FtpServerContext serverContext)
          Set a custom server context to be used for this server
 void setUserManager(UserManager userManager)
          Set the user manager to be used for this server
 void start()
          Start the server.
 void stop()
          Stop the server.
 void suspend()
          Suspend further requests
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FtpServer

public FtpServer()
          throws java.lang.Exception
Creates a server with the default configuration

Throws:
java.lang.Exception

FtpServer

public FtpServer(FtpServerContext serverContext)
          throws java.lang.Exception
Constructor. Set a custom the server context.

Throws:
java.lang.Exception - TODO consider removing
Method Detail

start

public void start()
           throws java.lang.Exception
Start the server. Open a new listener thread.

Throws:
java.lang.Exception

stop

public void stop()
Stop the server. Stop the listener thread.


isStopped

public boolean isStopped()
Get the server status.


suspend

public void suspend()
Suspend further requests


resume

public void resume()
Resume the server handler


isSuspended

public boolean isSuspended()
Is the server suspended


getServerContext

public FtpServerContext getServerContext()
Get the root server context.


setServerContext

public void setServerContext(FtpServerContext serverContext)
Set a custom server context to be used for this server

Parameters:
serverContext - The custom server context

getListeners

public java.util.Map<java.lang.String,Listener> getListeners()
Get all listeners available one this server

Returns:
The current listeners

getListener

public Listener getListener(java.lang.String name)
Get a specific listener identified by its name

Parameters:
name - The name of the listener
Returns:
The Listener matching the provided name

addListener

public void addListener(java.lang.String name,
                        Listener listener)

setListeners

public void setListeners(java.util.Map<java.lang.String,Listener> listeners)
Set the listeners for this server, replaces existing listeners

Parameters:
listeners - The listeners to use for this server with the name as the key and the listener as the value
Throws:
java.lang.IllegalStateException - If a custom server context has been set

getFtplets

public java.util.Map<java.lang.String,Ftplet> getFtplets()
Get all Ftplets registered at this server

Returns:
All Ftplets

setFtplets

public void setFtplets(java.util.Map<java.lang.String,Ftplet> ftplets)
Set the Ftplets to be active for this server. Replaces existing Ftplets

Parameters:
ftplets - Ftplets as a map with the name as the key and the Ftplet as the value
Throws:
java.lang.IllegalStateException - If a custom server context has been set

getUserManager

public UserManager getUserManager()
Retrieve the user manager used with this server

Returns:
The user manager

setUserManager

public void setUserManager(UserManager userManager)
Set the user manager to be used for this server

Parameters:
userManager - The UserManager
Throws:
java.lang.IllegalStateException - If a custom server context has been set

getFileSystem

public FileSystemManager getFileSystem()
Retrieve the file system used with this server

Returns:
The FileSystemManager

setFileSystem

public void setFileSystem(FileSystemManager fileSystem)
Set the file system to be used for this server

Parameters:
fileSystem - The FileSystemManager
Throws:
java.lang.IllegalStateException - If a custom server context has been set

getCommandFactory

public CommandFactory getCommandFactory()
Retrieve the command factory used with this server

Returns:
The CommandFactory

setCommandFactory

public void setCommandFactory(CommandFactory commandFactory)
Set the command factory to be used for this server

Parameters:
commandFactory - The CommandFactory
Throws:
java.lang.IllegalStateException - If a custom server context has been set

getMessageResource

public MessageResource getMessageResource()
Retrieve the message resource used with this server

Returns:
The MessageResource

setMessageResource

public void setMessageResource(MessageResource messageResource)
Set the message resource to be used with this server

Parameters:
messageResource - The MessageResource
Throws:
java.lang.IllegalStateException - If a custom server context has been set

getConnectionConfig

public ConnectionConfig getConnectionConfig()
Retrieve the connection configuration this server

Returns:
The MessageResource

setConnectionConfig

public void setConnectionConfig(ConnectionConfig connectionConfig)
Set the message resource to be used with this server

Parameters:
messageResource - The MessageResource
Throws:
java.lang.IllegalStateException - If a custom server context has been set


Copyright © 2003-2008 The Apache Software Foundation. All Rights Reserved.