Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Lightweight Bartering Grid
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## lbg.protocol.data
Class EmbeddedFTPServer

    java.lang.Object
      lbg.protocol.data.EmbeddedFTPServer

    public class EmbeddedFTPServer

extends java.lang.Object

An FTP server with minimal functionnalities. Its main purpose is to be easily used (i.e. not too much hassle).

Author:
  Xavier Dalem

Constructor Summary
`EmbeddedFTPServer(java.lang.String hostname, java.lang.String sharedDirectory)`

Method Summary
`void` | `forceNewUser()` Sets new user login and password for FTP Server. The server needs to be restarted for this change to take effect.
`static void` | `main(java.lang.String[] argv)`
`void` | `setConfig(int port)` Sets the FTP server configuration. If a server is already running, it will need to be restarted for the changes to take effect.
`void` | `setConfig(int port, java.lang.String user, java.lang.String password)` Sets the FTP server configuration. If a server is already running, it will need to be restarted for the changes to take effect.
`void` | `start()` Load an FTP Server and start it. If a server is already running, do nothing.
`void` | `stop()` Stops the associated FTP Server if it's running. All reference to it are lost, except the given properties if any. Does nothing if no server is active.
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### EmbeddedFTPServer

    public EmbeddedFTPServer(java.lang.String hostname,
                             java.lang.String sharedDirectory)

Method Detail

### setConfig

    public void setConfig(int port)
                   throws GridException

  Sets the FTP server configuration.
  If a server is already running, it will need to be restarted for the changes to take effect. If no user information is given, it is either recovered from what was previously set or generated randomly.

  Parameters:
    `port` - FTP Requests port
  Throws:
    `GridException` - if the parameters are invalid
  See Also:
    `start()`, `stop()`

### setConfig

    public void setConfig(int port,
                          java.lang.String user,
                          java.lang.String password)
                   throws GridException

  Sets the FTP server configuration.
  If a server is already running, it will need to be restarted for the changes to take effect.

  Parameters:
    `port` - FTP Requests port
    `user` - User name
    `password` - Associated password
  Throws:
    `GridException` - if the parameters are invalid
  See Also:
    `start()`, `stop()`

### start

    public void start()
               throws GridException

  Load an FTP Server and start it.
  If a server is already running, do nothing. If you want to restart a server, stop it then call this method.
  The config of the server is based on the following properties, used in this order (the laters thus replacing props from the formers)
  1. Apache FtpServer built-in defaults
  2. LBG Custom defaults. Quick security patch (no default users) and default ports.
  3. The set that was previously given with a call to setFTPConfig()

  Throws:
    `GridException`
  See Also:
    `setConfig(int)`, `setConfig(int, String, String)`, `stop()`

### stop

    public void stop()

  Stops the associated FTP Server if it's running.
  All reference to it are lost, except the given properties if any.
  Does nothing if no server is active.

  See Also:
    `setConfig(int)`, `setConfig(int, String, String)`

### forceNewUser

    public void forceNewUser()
                      throws GridException

  Sets new user login and password for FTP Server.
  The server needs to be restarted for this change to take effect. This is tedious in order to remember that all users currently relying on the running server are doomed.

  Throws:
    `GridException` - If the former user couldn't be deleted.

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### main

    public static void main(java.lang.String[] argv)
                     throws java.lang.Exception

  Throws:
    `java.lang.Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Lightweight Bartering Grid
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

> Copyright (c) 2005-2008, Cyril Briquet, parts Xavier Dalem.