public class MemoryUserDatabase extends Object implements UserDatabase
Concrete implementation of UserDatabase for an in-memory
database backed by an XML data file.
| Constructor and Description |
|---|
MemoryUserDatabase() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Finalize access to the underlying persistence layer.
|
User |
createUser(String username)
Create and return a new
User defined in this user database. |
User |
findUser(String username)
Return the existing
User with the specified username,
if any; otherwise return null. |
User[] |
findUsers()
Return the set of
Users defined in this user database. |
String |
getPathname() |
boolean |
isOpen()
Return true if open() has been called.
|
void |
open()
Initiate access to the underlying persistence layer.
|
void |
removeUser(User user)
Remove the specified
User from this database. |
void |
save()
Save any pending changes to the underlying persistence layer.
|
void |
setPathname(String pathname) |
public String getPathname()
public void setPathname(String pathname)
public void close()
throws Exception
UserDatabaseFinalize access to the underlying persistence layer.
close in interface UserDatabaseException - if a database access error occurspublic User createUser(String username)
UserDatabaseCreate and return a new User defined in this user database.
createUser in interface UserDatabaseusername - Username of the new userpublic User findUser(String username)
UserDatabaseReturn the existing User with the specified username,
if any; otherwise return null.
findUser in interface UserDatabaseusername - Username of the user to retrievepublic User[] findUsers()
UserDatabaseReturn the set of Users defined in this user database.
findUsers in interface UserDatabasepublic void open()
throws Exception
UserDatabaseInitiate access to the underlying persistence layer.
open in interface UserDatabaseException - if a database access error occurspublic void removeUser(User user)
UserDatabaseUser from this database.removeUser in interface UserDatabaseuser - User to be removedpublic void save()
throws Exception
UserDatabaseSave any pending changes to the underlying persistence layer.
save in interface UserDatabaseException - if a database access error occurspublic boolean isOpen()
UserDatabaseReturn true if open() has been called.
isOpen in interface UserDatabaseCopyright © 2000-2017 Apache Software Foundation. All Rights Reserved.