FTP-Server API

server
Class LogFileReader

java.lang.Object
  |
  +--java.util.Observable
        |
        +--server.LogFileReader

public class LogFileReader
extends Observable

An object, that are capeable of reading a logfile from an user. The Object can ONLY read a logfile from one user.


Constructor Summary
LogFileReader(File file, String login)
          This constructor is made primarily to read the ban-patterns.conf file.
LogFileReader(String login)
          Set Constructor that makes a LogFileReader, which is capeable of reading a logfile from a user with the passed login
 
Method Summary
 boolean contains(LogFileSession ses)
          Checks wether this LogFileReader contains the passed LogFileSession.
 boolean deleteSessions(LogFileSession[] logFileSessions)
          Deletes LogFileSessions from a user.
 String getLogin()
          The login, som that the object were instantiated with.
 LogFileSession getSession(int i)
          Gets a session with the passed number.
 int[] getSessionNumbers()
          Reads the logfile, and findes numbers of the sessions contained in the file.
static void setLogFileUpdate(Object arg, File file)
          Notifies all obervers on the file (LogFile), that change has been made to the logFile.
 
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
 

Constructor Detail

LogFileReader

public LogFileReader(String login)
Set Constructor that makes a LogFileReader, which is capeable of reading a logfile from a user with the passed login

Parameters:
login - loginname.

LogFileReader

public LogFileReader(File file,
                     String login)
This constructor is made primarily to read the ban-patterns.conf file. Although it can read all logfiles handed to it. In this case, the login is not used for anything else than a nice identification for the programmer...

Parameters:
file - file to read.
login - the loginname, that this logfile represents.
Method Detail

contains

public boolean contains(LogFileSession ses)
Checks wether this LogFileReader contains the passed LogFileSession. The sessions are compared with the LogFileSession.equals(LogFileSession) method.

Parameters:
ses - Session to find
Returns:
true if found

getLogin

public String getLogin()
The login, som that the object were instantiated with.

Returns:
loginname

getSession

public LogFileSession getSession(int i)
Gets a session with the passed number.

Parameters:
i - the sessionnumber that should be found.
Returns:
null, if the sessionnumber is not found

deleteSessions

public boolean deleteSessions(LogFileSession[] logFileSessions)
Deletes LogFileSessions from a user. If the method returns false, and something in the process has made the logfile inconsistent, a file named xxx.log.bakcup (where xxx=login) will be made. This file contains the original information.

Parameters:
logFileSessions - The sessions that should be deleted
Returns:
true if the deletion went well

setLogFileUpdate

public static void setLogFileUpdate(Object arg,
                                    File file)
Notifies all obervers on the file (LogFile), that change has been made to the logFile.

Parameters:
arg - The LogFileSession that is added, or null if a LogFileSession has been deleted
file - the file that has been updated

getSessionNumbers

public int[] getSessionNumbers()
Reads the logfile, and findes numbers of the sessions contained in the file.

Returns:
an empty array, if there are no sessions in the file, nulll if the Logfile is not found

FTP-Server API