FileDocCategorySizeDatePackage
HomesUserDatabase.javaAPI DocApache Tomcat 6.0.143778Fri Jul 20 04:20:32 BST 2007org.apache.catalina.startup

HomesUserDatabase

public final class HomesUserDatabase extends Object implements UserDatabase
Concrete implementation of the UserDatabase interface considers all directories in a directory whose pathname is specified to our constructor to be "home" directories for those users.
author
Craig R. McClanahan
version
$Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $

Fields Summary
private Hashtable
homes
The set of home directories for all defined users, keyed by username.
private UserConfig
userConfig
The UserConfig listener with which we are associated.
Constructors Summary
public HomesUserDatabase()
Initialize a new instance of this user database component.


        super();

    
Methods Summary
public java.lang.StringgetHome(java.lang.String user)
Return an absolute pathname to the home directory for the specified user.

param
user User for which a home directory should be retrieved


        return ((String) homes.get(user));

    
public UserConfiggetUserConfig()
Return the UserConfig listener with which we are associated.



    // ----------------------------------------------------------- Properties


                  
       

        return (this.userConfig);

    
public java.util.EnumerationgetUsers()
Return an enumeration of the usernames defined on this server.


        return (homes.keys());

    
private voidinit()
Initialize our set of users and home directories.


        String homeBase = userConfig.getHomeBase();
        File homeBaseDir = new File(homeBase);
        if (!homeBaseDir.exists() || !homeBaseDir.isDirectory())
            return;
        String homeBaseFiles[] = homeBaseDir.list();

        for (int i = 0; i < homeBaseFiles.length; i++) {
            File homeDir = new File(homeBaseDir, homeBaseFiles[i]);
            if (!homeDir.isDirectory() || !homeDir.canRead())
                continue;
            homes.put(homeBaseFiles[i], homeDir.toString());
        }


    
public voidsetUserConfig(UserConfig userConfig)
Set the UserConfig listener with which we are associated.

param
userConfig The new UserConfig listener


        this.userConfig = userConfig;
        init();