1 17 18 19 package org.apache.catalina.startup; 20 21 22 import java.io.File ; 23 import java.util.Hashtable ; 24 import java.util.Enumeration ; 25 26 27 35 36 public final class HomesUserDatabase 37 implements UserDatabase { 38 39 40 42 43 46 public HomesUserDatabase() { 47 48 super(); 49 50 } 51 52 53 55 56 59 private Hashtable homes = new Hashtable (); 60 61 62 65 private UserConfig userConfig = null; 66 67 68 70 71 74 public UserConfig getUserConfig() { 75 76 return (this.userConfig); 77 78 } 79 80 81 86 public void setUserConfig(UserConfig userConfig) { 87 88 this.userConfig = userConfig; 89 init(); 90 91 } 92 93 94 96 97 102 public String getHome(String user) { 103 104 return ((String ) homes.get(user)); 105 106 } 107 108 109 112 public Enumeration getUsers() { 113 114 return (homes.keys()); 115 116 } 117 118 119 121 122 125 private void init() { 126 127 String homeBase = userConfig.getHomeBase(); 128 File homeBaseDir = new File (homeBase); 129 if (!homeBaseDir.exists() || !homeBaseDir.isDirectory()) 130 return; 131 String homeBaseFiles[] = homeBaseDir.list(); 132 133 for (int i = 0; i < homeBaseFiles.length; i++) { 134 File homeDir = new File (homeBaseDir, homeBaseFiles[i]); 135 if (!homeDir.isDirectory() || !homeDir.canRead()) 136 continue; 137 homes.put(homeBaseFiles[i], homeDir.toString()); 138 } 139 140 141 } 142 143 144 } 145 | Popular Tags |