|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Observable com.Prominic.jFTPd.FTPHandler
public class FTPHandler
This is the main part of the server. It parses the command line, reads the configuration file, starts up the server on the specified port and fires FTPConnection's for each connection to the FTP port. Also, it initialises JSSL for secure connections to the FTP server.
Field Summary | |
---|---|
(package private) AdminConnection |
adminConnection
|
(package private) java.lang.String |
adminPassword
|
(package private) boolean |
anonDelete
|
(package private) java.lang.String |
anonDirectory
|
(package private) boolean |
anonDownload
|
(package private) boolean |
anonOnly
|
(package private) boolean |
anonUpload
|
(package private) java.lang.String |
basePath
|
(package private) java.util.Vector |
connections
|
(package private) int |
connTimeout
|
private java.lang.String |
currentUsersDatDefaultGroup
|
private java.lang.String |
currentUsersDatDefaultMask
|
private java.lang.String |
currentUsersDatDefaultOwner
|
private java.lang.String |
currentUsersDatDefaultReadAccess
|
(package private) int |
currentUsersDatFormat
|
(package private) boolean |
debug
|
(package private) boolean |
DEBUG
|
(package private) java.lang.String |
debugFilename
|
(package private) boolean |
echoError
|
(package private) boolean |
echoLog
|
(package private) java.lang.String |
errorFilename
|
private static javax.net.ssl.SSLSocketFactory |
factory
|
(package private) IdleKiller |
idleKiller
|
(package private) int |
kDefaultPort
|
private static javax.net.ssl.KeyManagerFactory |
kmf
|
private static java.security.KeyStore |
ks
|
(package private) boolean |
logActions
|
(package private) boolean |
logError
|
(package private) java.io.RandomAccessFile |
logFile
|
(package private) java.lang.String |
logFilename
|
(package private) FTPLogger |
logger
|
(package private) int |
maxConnections
|
(package private) int |
passConnTimeout
|
(package private) int |
passiveHighPort
|
(package private) int |
passiveLowPort
|
(package private) char |
pathSeparator
|
(package private) boolean |
permDelete
|
(package private) boolean |
permDownload
|
(package private) boolean |
permUpload
|
(package private) int |
port
|
(package private) boolean |
rmiStarted
|
(package private) FTPUserListSecuritySource |
securitySource
|
(package private) GenericServer |
server
|
(package private) boolean |
serverOn
|
private static javax.net.ssl.SSLContext |
sslcontext
|
private long |
totalBytesDownloaded
|
private long |
totalBytesUploaded
|
private int |
totalFilesDownloaded
|
private int |
totalFilesUploaded
|
(package private) boolean |
useGUI
|
(package private) java.lang.String |
userFilename
|
(package private) java.util.Properties |
userParamHash
|
(package private) int |
usersUpdateInterval
|
Constructor Summary | |
---|---|
FTPHandler(AdminConnection _adminConnection)
Default constructor - it initialises the defaults. |
Method Summary | |
---|---|
protected void |
addConnection(Connection c)
Adds a connection to the internal list of collections. |
void |
doConnection(java.net.Socket s)
Fired when a connection is made to the FTP port. |
java.util.Hashtable |
getAllParameters()
Returns all configuration parameters. |
java.lang.String |
getBasePath()
Returns the base path. |
Connection[] |
getConnections()
Returns an array of currently openened connections. |
int |
getMaxConnections()
Maximum number of connections accepted by FTP server. |
java.lang.String |
getParameter(java.lang.String key)
Gets the key's value (where key represents a configuration parameter). |
java.lang.String |
getParameter(java.lang.String key,
java.lang.String def)
Gets the key's value (where key represents a configuration parameter). |
int |
getPort()
Returns the jFTPd port number. |
java.lang.String |
getServerUptime()
Returns the server uptime in humanly readable form. |
static javax.net.ssl.SSLSocketFactory |
getSSLSocketFactory()
Returns the SSLSocket Factory. |
long |
getTotalBytesDownloaded()
Gets the total bytes that were downloaded since jFTPd started. |
long |
getTotalBytesUploaded()
Gets the total bytes that were uploaded since jFTPd started. |
int |
getTotalFilesDownloaded()
Gets the total number of files that were downloaded since jFTPd started. |
int |
getTotalFilesUploaded()
Gets the total number of files that were uploaded since jFTPd started. |
java.util.Hashtable |
getUserParams()
Returns all configuration parameters. |
void |
initKeystore()
Initialises the keystore. |
protected boolean |
isTrue(java.lang.String s)
Checks if the configuration parameter 's' has value true (not equal to O, false or no. |
void |
notifyDone(Connection conn)
Called when a connection ended. |
java.lang.String |
password()
Returns the admin password. |
protected void |
removeConnection(Connection c)
Removes a connection from the internal list of connections, as well as updating the total server counters (files dl/up, bytes dl/up) with the values from the connection. |
boolean |
serverRunning()
Checks the server status. |
void |
setParameter(java.lang.String key,
java.lang.String value)
Sets a configuration parameter's value. |
private void |
setTotalBytesDownloaded(long newTotalBytesDownloaded)
Updates the counter for total bytes downloaded. |
private void |
setTotalBytesUploaded(long newTotalBytesUploaded)
Updates the counter for total bytes uploaded. |
private void |
setTotalFilesDownloaded(int newTotalFilesDownloaded)
Updates the counter for total files downloaded. |
private void |
setTotalFilesUploaded(int newTotalFilesUploaded)
Updates the counter for total files uploaded. |
void |
setupDone()
Called when setting up the the server configuration is done (it will start up the server using startService unless the requirement is to start up in GUI mode). |
void |
startRMI()
Starts up the RMI listener on port given by rmiport in the configuration file (or 1101 if no value is found for it). |
void |
startService()
Starts the server itself. |
void |
stopService()
Stops the server, shuts down the idle killer thread and also interrupts the AdminConnection. |
Methods inherited from class java.util.Observable |
---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
final boolean DEBUG
java.lang.String basePath
java.util.Vector connections
char pathSeparator
GenericServer server
boolean permDownload
boolean permUpload
boolean permDelete
IdleKiller idleKiller
java.io.RandomAccessFile logFile
boolean logActions
java.lang.String logFilename
java.lang.String errorFilename
java.lang.String debugFilename
boolean debug
boolean logError
int port
boolean serverOn
boolean useGUI
int maxConnections
int connTimeout
java.lang.String userFilename
java.util.Properties userParamHash
int kDefaultPort
FTPUserListSecuritySource securitySource
FTPLogger logger
int usersUpdateInterval
boolean echoLog
boolean echoError
int passiveLowPort
int passiveHighPort
java.lang.String adminPassword
boolean anonOnly
boolean anonUpload
boolean anonDownload
boolean anonDelete
java.lang.String anonDirectory
boolean rmiStarted
int passConnTimeout
int currentUsersDatFormat
AdminConnection adminConnection
private java.lang.String currentUsersDatDefaultOwner
private java.lang.String currentUsersDatDefaultGroup
private java.lang.String currentUsersDatDefaultMask
private java.lang.String currentUsersDatDefaultReadAccess
private int totalFilesUploaded
private int totalFilesDownloaded
private long totalBytesUploaded
private long totalBytesDownloaded
private static java.security.KeyStore ks
private static javax.net.ssl.KeyManagerFactory kmf
private static javax.net.ssl.SSLContext sslcontext
private static javax.net.ssl.SSLSocketFactory factory
Constructor Detail |
---|
public FTPHandler(AdminConnection _adminConnection)
_adminConnection
- - admin connection.Method Detail |
---|
protected void addConnection(Connection c)
c
- - the new connection.public void doConnection(java.net.Socket s)
doConnection
in interface ConnectionHandler
s
- Socket - FTP client socket.public java.util.Hashtable getAllParameters()
public java.lang.String getBasePath()
public Connection[] getConnections()
getConnections
in interface ConnectionHandler
public int getMaxConnections()
public java.lang.String getParameter(java.lang.String key)
key
- - configuration parameter
public java.lang.String getParameter(java.lang.String key, java.lang.String def)
key
- - configuration parameterdef
- - default value, in case the parameter was not defined.
public int getPort()
public java.lang.String getServerUptime()
public long getTotalBytesDownloaded()
public long getTotalBytesUploaded()
public int getTotalFilesDownloaded()
public int getTotalFilesUploaded()
public java.util.Hashtable getUserParams()
protected boolean isTrue(java.lang.String s)
s
- - parameter name
public void notifyDone(Connection conn)
notifyDone
in interface ConnectionHandler
conn
- = the connection which has ended.public java.lang.String password()
protected void removeConnection(Connection c)
c
- - the connection to be removed.public boolean serverRunning()
public void setParameter(java.lang.String key, java.lang.String value)
setParameter
in interface ConnectionHandler
key
- - parameter's name.value
- - parameter's value.private void setTotalBytesDownloaded(long newTotalBytesDownloaded)
newTotalBytesDownloaded
- long - new value for the counterprivate void setTotalBytesUploaded(long newTotalBytesUploaded)
newTotalBytesUploaded
- long - new value for the counterprivate void setTotalFilesDownloaded(int newTotalFilesDownloaded)
newTotalFilesDownloaded
- int - new value for the counterprivate void setTotalFilesUploaded(int newTotalFilesUploaded)
newTotalFilesUploaded
- int - new value for the counterpublic void setupDone()
public void startRMI()
public void startService()
startService
in interface ConnectionHandler
public void initKeystore()
public static javax.net.ssl.SSLSocketFactory getSSLSocketFactory()
public void stopService()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |