| 73 | * saving or loading the database) must first obtain the write lock. |
| 74 | */ |
| 75 | public class MemoryUserDatabase implements UserDatabase { |
| 76 | |
| 77 | private static final Log log = LogFactory.getLog(MemoryUserDatabase.class); |
| 78 | private static final StringManager sm = StringManager.getManager(MemoryUserDatabase.class); |
| 79 | |
| 80 | |
| 81 | // ----------------------------------------------------------- Constructors |
| 82 | |
| 83 | /** |
| 84 | * Create a new instance with default values. |
| 85 | */ |
| 86 | public MemoryUserDatabase() { |
| 87 | this(null); |
| 88 | } |
| 89 | |
| 90 | |
| 91 | /** |
| 92 | * Create a new instance with the specified values. |
| 93 | * |
| 94 | * @param id Unique global identifier of this user database |
| 95 | */ |
| 96 | public MemoryUserDatabase(String id) { |
| 97 | this.id = id; |
| 98 | } |
| 99 | |
| 100 | // ----------------------------------------------------- Instance Variables |
| 101 | |
| 102 | /** |
| 103 | * The set of {@link Group}s defined in this database, keyed by group name. |
| 104 | */ |
| 105 | protected final Map<String,Group> groups = new ConcurrentHashMap<>(); |
| 106 | |
| 107 | /** |
| 108 | * The unique global identifier of this user database. |
| 109 | */ |
| 110 | protected final String id; |
| 111 | |
| 112 | /** |
| 113 | * The relative (to <code>catalina.base</code>) or absolute pathname to the XML file in which we will save our |
| 114 | * persistent information. |
| 115 | */ |
| 116 | protected String pathname = "conf/tomcat-users.xml"; |
| 117 | |
| 118 | /** |
| 119 | * The relative or absolute pathname to the file in which our old information is stored while renaming is in |
| 120 | * progress. |
| 121 | */ |
| 122 | protected String pathnameOld = pathname + ".old"; |
| 123 | |
| 124 | /** |
| 125 | * The relative or absolute pathname of the file in which we write our new information prior to renaming. |
| 126 | */ |
| 127 | protected String pathnameNew = pathname + ".new"; |
| 128 | |
| 129 | /** |
| 130 | * A flag, indicating if the user database is read only. |
| 131 | */ |
| 132 | protected boolean readonly = true; |
nothing calls this directly
no test coverage detected