com.Prominic.jFTPd
Class FTPEvent

java.lang.Object
  extended by com.Prominic.jFTPd.FTPEvent

public class FTPEvent
extends java.lang.Object

This is the [single] event that propagates inside the jFTPd. It is used for logging purposes, as an Observer is able to receive the events and log them.


Field Summary
protected  int action
           
protected  java.net.InetAddress address
           
protected  java.lang.Object[] args
           
static int CHANGE_DIR
          Sent after a change directory command.
static int CONNECT
          Sent when an user connects to the FTP server.
static int CREATE_DIR
          Sent after an mkdir command.
protected  java.util.Date date
           
static int DELETE
          Sent after a DELE command.
static int DISCONNECTED
          Sent after detecting that the conenction to the client has ended (ungracefully).
static int DOWNLOAD_BEGIN
          Sent after a file download begins.
static int DOWNLOAD_END
          Sent after the download ends successfully.
static int DOWNLOAD_ERROR
           
static int ERROR_MIN
          A tag value for error.
static int HOME_NOT_FOUND
           
static int INFO
           
static int LOGIN
          Sent after a successfull login.
static int LOGIN_FAILED
          Sent after a failed login.
static int MISC_ERROR
           
static int QUIT
          Sent after a QUIT command.
static int REMOVE_DIR
          Sent after a directory is removed.
static int RENAME
          Sent after a rename command.
static int UPLOAD_BEGIN
          Sent after an upload begins.
static int UPLOAD_END
          Sent after an upload ends.
static int UPLOAD_ERROR
           
protected  FTPUser user
           
 
Constructor Summary
FTPEvent(FTPUser user, java.net.InetAddress address, int action, java.lang.Object[] args)
          Default constructor.
 
Method Summary
 int getAction()
          Gets the event's type.
 java.net.InetAddress getAddress()
          Gets the user's address - passed via the constructor.
 java.lang.Object[] getArguments()
          Gets the action's arguments.
 java.util.Date getDate()
          Returns the time of the event.
 FTPUser getUser()
          Returns the user for whom the event has been generated.
 boolean isErrorEvent()
          Checks if the event is an error event (the action is greater than FTPEvent.ERROR_MIN).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONNECT

public static final int CONNECT
Sent when an user connects to the FTP server.

See Also:
Constant Field Values

LOGIN

public static final int LOGIN
Sent after a successfull login.

See Also:
Constant Field Values

LOGIN_FAILED

public static final int LOGIN_FAILED
Sent after a failed login.

See Also:
Constant Field Values

CHANGE_DIR

public static final int CHANGE_DIR
Sent after a change directory command.

See Also:
Constant Field Values

DOWNLOAD_BEGIN

public static final int DOWNLOAD_BEGIN
Sent after a file download begins.

See Also:
Constant Field Values

DOWNLOAD_END

public static final int DOWNLOAD_END
Sent after the download ends successfully.

See Also:
Constant Field Values

UPLOAD_BEGIN

public static final int UPLOAD_BEGIN
Sent after an upload begins.

See Also:
Constant Field Values

UPLOAD_END

public static final int UPLOAD_END
Sent after an upload ends.

See Also:
Constant Field Values

CREATE_DIR

public static final int CREATE_DIR
Sent after an mkdir command.

See Also:
Constant Field Values

DELETE

public static final int DELETE
Sent after a DELE command.

See Also:
Constant Field Values

REMOVE_DIR

public static final int REMOVE_DIR
Sent after a directory is removed.

See Also:
Constant Field Values

RENAME

public static final int RENAME
Sent after a rename command.

See Also:
Constant Field Values

QUIT

public static final int QUIT
Sent after a QUIT command.

See Also:
Constant Field Values

DISCONNECTED

public static final int DISCONNECTED
Sent after detecting that the conenction to the client has ended (ungracefully).

See Also:
Constant Field Values

INFO

public static final int INFO
See Also:
Constant Field Values

ERROR_MIN

public static final int ERROR_MIN
A tag value for error. If you define actions with values > ERROR_MIN they will be considered errors, and logged.

See Also:
Constant Field Values

HOME_NOT_FOUND

public static final int HOME_NOT_FOUND
See Also:
Constant Field Values

MISC_ERROR

public static final int MISC_ERROR
See Also:
Constant Field Values

DOWNLOAD_ERROR

public static final int DOWNLOAD_ERROR
See Also:
Constant Field Values

UPLOAD_ERROR

public static final int UPLOAD_ERROR
See Also:
Constant Field Values

user

protected FTPUser user

address

protected java.net.InetAddress address

action

protected int action

args

protected java.lang.Object[] args

date

protected java.util.Date date
Constructor Detail

FTPEvent

public FTPEvent(FTPUser user,
                java.net.InetAddress address,
                int action,
                java.lang.Object[] args)
Default constructor. Creates an Event with the given type and arguments.

Parameters:
user - - user to which the connection belongs to.
address - - address from which the user connected.
action - - FTPEvent.XXXXXXXXX values (Event type).
Method Detail

getAction

public int getAction()
Gets the event's type.

Returns:
- event type (action).

getAddress

public java.net.InetAddress getAddress()
Gets the user's address - passed via the constructor.

Returns:
user's ip.

getArguments

public java.lang.Object[] getArguments()
Gets the action's arguments.

Returns:
- array of Objects representing the action arguments.

getDate

public java.util.Date getDate()
Returns the time of the event.

Returns:
Date time of the event.

getUser

public FTPUser getUser()
Returns the user for whom the event has been generated.

Returns:
FTPUser the user using the connection.

isErrorEvent

public boolean isErrorEvent()
Checks if the event is an error event (the action is greater than FTPEvent.ERROR_MIN).

Returns:
true if the event is an error event.