|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.struts.webapp.example.memory.MemoryUserDatabase
Concrete implementation of UserDatabase
for an in-memory
database backed by an XML data file.
Field Summary | |
private org.apache.commons.logging.Log |
log
Logging output for this user database instance. |
private String |
pathname
Absolute pathname to the persistent file we use for loading and storing persistent data. |
private String |
pathnameNew
|
private String |
pathnameOld
|
private HashMap |
users
The User s associated with this UserDatabase, keyed by username. |
Constructor Summary | |
MemoryUserDatabase()
|
Method Summary | |
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 User s defined in this user database. |
String |
getPathname()
|
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)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private org.apache.commons.logging.Log log
private HashMap users
User
s associated with this UserDatabase, keyed by username.
private String pathname
private String pathnameOld
private String pathnameNew
Constructor Detail |
public MemoryUserDatabase()
Method Detail |
public String getPathname()
public void setPathname(String pathname)
public void close() throws Exception
UserDatabase
Finalize access to the underlying persistence layer.
close
in interface UserDatabase
Exception
- if a database access error occurspublic User createUser(String username)
UserDatabase
Create and return a new User
defined in this user database.
createUser
in interface UserDatabase
username
- Username of the new userpublic User findUser(String username) throws ExpiredPasswordException
UserDatabase
Return the existing User
with the specified username,
if any; otherwise return null
.
findUser
in interface UserDatabase
username
- Username of the user to retrieve
ExpiredPasswordException
- if user password has expired
and must be changedpublic User[] findUsers()
UserDatabase
Return the set of User
s defined in this user database.
findUsers
in interface UserDatabase
public void open() throws Exception
UserDatabase
Initiate access to the underlying persistence layer.
open
in interface UserDatabase
Exception
- if a database access error occurspublic void removeUser(User user)
UserDatabase
User
from this database.
removeUser
in interface UserDatabase
user
- User to be removedpublic void save() throws Exception
UserDatabase
Save any pending changes to the underlying persistence layer.
save
in interface UserDatabase
Exception
- if a database access error occurs
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |