com.Prominic.jFTPd
Class FTPRemoteCtrlImpl

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by com.Prominic.jFTPd.FTPRemoteCtrlImpl
All Implemented Interfaces:
RemoteController, java.io.Serializable, java.rmi.Remote

public class FTPRemoteCtrlImpl
extends java.rmi.server.UnicastRemoteObject
implements RemoteController

This class is a RMI wrapper for the FTPHandler. It offers all the informations the FTPHandler has to offer to any RMI client needed to monitor/administer the jFTPd server.

Author:
Iulian
See Also:
Serialized Form

Field Summary
(package private)  boolean authorized
           
(package private)  FTPHandler handler
           
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
FTPRemoteCtrlImpl(FTPHandler handler)
          Creates an FTPRemoteCtrlImpl object.
 
Method Summary
 boolean authorized()
          Returns the authorized state of the RMI connection.
 java.util.Hashtable getAllParameters()
           
 int getConnectionCount()
           
 java.util.Vector getConnections()
           
protected  FTPConnection getConnectionWithID(int id)
          Returns the FTPConnection with the given id.
 java.lang.String getParameter(java.lang.String key)
           
 java.lang.String getServerUptime()
          Creation date: (10-Dec-01 20:58:34)
 java.util.Vector getUserActivity(int id)
           
 boolean login(java.lang.String password)
          Login to the RMI controller.
 boolean serverRunning()
           
 void setParameter(java.lang.String key, java.lang.String value)
          Sets a configuration parameter value, unless the RMI connection is not authorised when it does nothing.
 void startService()
          Starts jFTPd or just returns if RMI connection is not authorised.
 void stopService()
          Stops jFTPd or just returns if RMI connection is not authorised.
 boolean terminateConnection(int id)
          Terminates a connection given the id.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

handler

FTPHandler handler

authorized

boolean authorized
Constructor Detail

FTPRemoteCtrlImpl

public FTPRemoteCtrlImpl(FTPHandler handler)
                  throws java.rmi.RemoteException
Creates an FTPRemoteCtrlImpl object.

Parameters:
handler - - the FTPHandler.
Throws:
java.rmi.RemoteException
Method Detail

authorized

public boolean authorized()
                   throws java.rmi.RemoteException
Returns the authorized state of the RMI connection.

Specified by:
authorized in interface RemoteController
Returns:
true if connection is authorised.
Throws:
java.rmi.RemoteException

getAllParameters

public java.util.Hashtable getAllParameters()
                                     throws java.rmi.RemoteException
Specified by:
getAllParameters in interface RemoteController
Returns:
if the RMI connection is authorised, it returns all configuration parameters of jFTPd otherwise it returns an empty Hashtable.
Throws:
java.rmi.RemoteException

getConnectionCount

public int getConnectionCount()
                       throws java.rmi.RemoteException
Specified by:
getConnectionCount in interface RemoteController
Returns:
the current connections number.
Throws:
java.rmi.RemoteException

getConnections

public java.util.Vector getConnections()
                                throws java.rmi.RemoteException
Specified by:
getConnections in interface RemoteController
Returns:
Vector of all currently active connections, or empty Vector if RMI connection is not authorised.
Throws:
java.rmi.RemoteException

getConnectionWithID

protected FTPConnection getConnectionWithID(int id)
Returns the FTPConnection with the given id.

Parameters:
id - - id of connection.
Returns:

getParameter

public java.lang.String getParameter(java.lang.String key)
                              throws java.rmi.RemoteException
Specified by:
getParameter in interface RemoteController
Returns:
the configuration parameter value, or null if RMI connection is not authorised.
Throws:
java.rmi.RemoteException

getServerUptime

public java.lang.String getServerUptime()
Creation date: (10-Dec-01 20:58:34)

Specified by:
getServerUptime in interface RemoteController
Returns:
java.lang.String - server uptime, or "Not authrised" if RMI connection is not authorised.

getUserActivity

public java.util.Vector getUserActivity(int id)
                                 throws java.rmi.RemoteException
Specified by:
getUserActivity in interface RemoteController
Returns:
returns a user activity (vector of commands issued by the user) unless the RMI connection is not authorised when it returns null.
Throws:
java.rmi.RemoteException

login

public boolean login(java.lang.String password)
              throws java.rmi.RemoteException
Login to the RMI controller. Must succeed, otherwise all method will return empty values.

Specified by:
login in interface RemoteController
Returns:
true if password matches the FTPHandler's password.
Throws:
java.rmi.RemoteException

serverRunning

public boolean serverRunning()
                      throws java.rmi.RemoteException
Specified by:
serverRunning in interface RemoteController
Returns:
true if server is running, but if tge RMI connection is not authorised, it returns false.
Throws:
java.rmi.RemoteException

setParameter

public void setParameter(java.lang.String key,
                         java.lang.String value)
                  throws java.rmi.RemoteException
Sets a configuration parameter value, unless the RMI connection is not authorised when it does nothing.

Specified by:
setParameter in interface RemoteController
Parameters:
key - - parameter name.
value - - parameter value.
Throws:
java.rmi.RemoteException

startService

public void startService()
                  throws java.rmi.RemoteException
Starts jFTPd or just returns if RMI connection is not authorised.

Specified by:
startService in interface RemoteController
Throws:
java.rmi.RemoteException

stopService

public void stopService()
                 throws java.rmi.RemoteException
Stops jFTPd or just returns if RMI connection is not authorised.

Specified by:
stopService in interface RemoteController
Throws:
java.rmi.RemoteException

terminateConnection

public boolean terminateConnection(int id)
                            throws java.rmi.RemoteException
Terminates a connection given the id. Does nothing if the RMI connection is not authorised.

Specified by:
terminateConnection in interface RemoteController
Parameters:
id - - connection id to be terminated.
Throws:
java.rmi.RemoteException