net.sf.hermesftp.usermanager
Interface UserManager

All Known Implementing Classes:
XmlFileUserManager

public interface UserManager

Generic description of user management classes.

Author:
Lars Behnke

Method Summary
 boolean authenticate(java.lang.String user, java.lang.String password, FtpSessionContext ctx)
          Validates the passed user credentials.
 void checkResourceConsumption(java.lang.String user, java.lang.String[] limitNames)
          Checks the resource consumption of the passed users.
 java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Long>> getAllStatistics()
          Returns the logged statistics for all user and all available dates (since the server was started).
 GroupDataList getGroupDataList(java.lang.String username)
          Returns object representations of all groups the passed user belongs to.
 UserData getUserData(java.lang.String username)
          Returns object representations of all registered users.
 java.util.List<UserData> getUserDataList()
          Returns object representations of all registered users.
 java.util.Map<java.lang.String,java.lang.Long> getUserStatistics(java.lang.String user)
          Returns the resource consumption statistics for a given user.
 boolean isLoaded()
          Checks if the configuration is loaded.
 void load()
          (Re)loads the configuration.
 void updateAverageStatistics(java.lang.String user, java.lang.String avgKeyName, long value)
          Registers the current user's transfer rate.
 void updateIncrementalStatistics(java.lang.String user, java.lang.String limitName, long value)
          Registers the current user's resource consumption.
 

Method Detail

updateIncrementalStatistics

void updateIncrementalStatistics(java.lang.String user,
                                 java.lang.String limitName,
                                 long value)
                                 throws FtpQuotaException
Registers the current user's resource consumption. That is, downloaded or uploaded bytes or files.

Parameters:
user - The user name.
limitName - The name of the consumption type (resource limit).
value - The consumed resources.
Throws:
FtpQuotaException - Thrown if resource limit has been reached.

updateAverageStatistics

void updateAverageStatistics(java.lang.String user,
                             java.lang.String avgKeyName,
                             long value)
Registers the current user's transfer rate. A mean value is calculated.

Parameters:
user - The user name.
avgKeyName - The key of the transfer rate (resource limit).
value - The consumed resources.

checkResourceConsumption

void checkResourceConsumption(java.lang.String user,
                              java.lang.String[] limitNames)
                              throws FtpQuotaException
Checks the resource consumption of the passed users. Only the passed limits are condidered.

Parameters:
user - The user name.
limitNames - The resource limits to condider.
Throws:
FtpQuotaException - Thrown if at least one limit has been reached.

getUserStatistics

java.util.Map<java.lang.String,java.lang.Long> getUserStatistics(java.lang.String user)
Returns the resource consumption statistics for a given user.

Parameters:
user - The user.
Returns:
The statistics.

getAllStatistics

java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Long>> getAllStatistics()
Returns the logged statistics for all user and all available dates (since the server was started).

Returns:
The statistics.

getUserData

UserData getUserData(java.lang.String username)
                     throws FtpConfigException
Returns object representations of all registered users.

Parameters:
username - The user's name.
Returns:
The user data.
Throws:
FtpConfigException - Error in configuration.

getUserDataList

java.util.List<UserData> getUserDataList()
                                         throws FtpConfigException
Returns object representations of all registered users.

Returns:
The users.
Throws:
FtpConfigException - Error in configuration.

getGroupDataList

GroupDataList getGroupDataList(java.lang.String username)
                               throws FtpConfigException
Returns object representations of all groups the passed user belongs to.

Parameters:
username - The user's name.
Returns:
The group data.
Throws:
FtpConfigException - Error in configuration.

authenticate

boolean authenticate(java.lang.String user,
                     java.lang.String password,
                     FtpSessionContext ctx)
                     throws FtpConfigException
Validates the passed user credentials.

Parameters:
user - The username.
password - The password
ctx - The context of the current session.
Returns:
True, if credentials are valid.
Throws:
FtpConfigException - Error on reading or processing a configuration file.

load

void load()
          throws FtpConfigException
(Re)loads the configuration.

Throws:
FtpConfigException - Error on reading or processing a configuration file.

isLoaded

boolean isLoaded()
                 throws FtpConfigException
Checks if the configuration is loaded.

Returns:
True, if configuration has already been loaded.
Throws:
FtpConfigException - Error on reading or processing a configuration file.


Copyright © 2005-2007 Lars Behnke. All Rights Reserved.