org.apache.ftpserver.usermanager
Class PropertiesUserManager

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.ftpserver.usermanager.AbstractUserManager
          extended byorg.apache.ftpserver.usermanager.PropertiesUserManager
All Implemented Interfaces:
org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.logger.LogEnabled, UserManagerInterface

public class PropertiesUserManager
extends AbstractUserManager

Properties file based UserManager implementation. We use user.properties file to store user data.

Author:
Rana Bhattacharyya

Field Summary
 
Fields inherited from class org.apache.ftpserver.usermanager.AbstractUserManager
mConfig, mstAdminName
 
Fields inherited from interface org.apache.ftpserver.usermanager.UserManagerInterface
ROLE
 
Constructor Summary
PropertiesUserManager()
          Instantiate user manager - default constructor.
 
Method Summary
 boolean authenticate(java.lang.String user, java.lang.String password)
          User authenticate method
 void configure(org.apache.avalon.framework.configuration.Configuration conf)
          Set configuration
 void contextualize(org.apache.avalon.framework.context.Context context)
          Set application context
 void delete(java.lang.String usrName)
          Delete an user.
 void dispose()
          Close the user manager - remove existing entries.
 boolean doesExist(java.lang.String name)
          User existance check
 java.util.List getAllUserNames()
          Get all user names.
 User getUserByName(java.lang.String userName)
          Load user data.
 void reload()
          Reload the user data if necessary
 void save(User usr)
          Save user data.
 
Methods inherited from class org.apache.ftpserver.usermanager.AbstractUserManager
getAdminName, getBaseDirectory, getConfig, initialize
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesUserManager

public PropertiesUserManager()
                      throws java.lang.Exception
Instantiate user manager - default constructor.

Method Detail

contextualize

public void contextualize(org.apache.avalon.framework.context.Context context)
                   throws org.apache.avalon.framework.context.ContextException
Set application context

Specified by:
contextualize in interface org.apache.avalon.framework.context.Contextualizable
Overrides:
contextualize in class AbstractUserManager
Throws:
org.apache.avalon.framework.context.ContextException

configure

public void configure(org.apache.avalon.framework.configuration.Configuration conf)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Set configuration

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Overrides:
configure in class AbstractUserManager
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

save

public void save(User usr)
          throws java.io.IOException
Save user data. Store the properties.

Throws:
java.io.IOException

delete

public void delete(java.lang.String usrName)
            throws java.io.IOException
Delete an user. Removes all this user entries from the properties. After removing the corresponding from the properties, save the data.

Throws:
java.io.IOException

getAllUserNames

public java.util.List getAllUserNames()
Get all user names.


getUserByName

public User getUserByName(java.lang.String userName)
Load user data.


doesExist

public boolean doesExist(java.lang.String name)
User existance check

Parameters:
name - user name

authenticate

public boolean authenticate(java.lang.String user,
                            java.lang.String password)
User authenticate method


reload

public void reload()
            throws java.lang.Exception
Reload the user data if necessary

Specified by:
reload in interface UserManagerInterface
Overrides:
reload in class AbstractUserManager
Throws:
java.lang.Exception

dispose

public void dispose()
Close the user manager - remove existing entries.

Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable
Overrides:
dispose in class AbstractUserManager


Copyright © -2005 . All Rights Reserved.