|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.struts.examples.mailreader.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 java.lang.String |
pathname
Absolute pathname to the persistent file we use for loading and storing persistent data. |
private java.lang.String |
pathnameNew
|
private java.lang.String |
pathnameOld
|
private java.util.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(java.lang.String username)
Create and return a new User defined in this user database. |
User |
findUser(java.lang.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. |
java.lang.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(java.lang.String pathname)
|
Methods inherited from class java.lang.Object |
|
Field Detail |
private org.apache.commons.logging.Log log
private java.util.HashMap users
User
s associated with this UserDatabase, keyed by username.private java.lang.String pathname
private java.lang.String pathnameOld
private java.lang.String pathnameNew
Constructor Detail |
public MemoryUserDatabase()
Method Detail |
public java.lang.String getPathname()
public void setPathname(java.lang.String pathname)
public void close() throws java.lang.Exception
UserDatabase
Finalize access to the underlying persistence layer.
close
in interface UserDatabase
org.apache.struts.examples.mailreader.UserDatabase
java.lang.Exception
- if a database access error occurspublic User createUser(java.lang.String username)
UserDatabase
Create and return a new User
defined in this user database.
createUser
in interface UserDatabase
org.apache.struts.examples.mailreader.UserDatabase
username
- Username of the new userjava.lang.IllegalArgumentException
- if the specified username
is not uniquepublic User findUser(java.lang.String username) throws ExpiredPasswordException
UserDatabase
Return the existing User
with the specified username,
if any; otherwise return null
.
findUser
in interface UserDatabase
org.apache.struts.examples.mailreader.UserDatabase
username
- Username of the user to retrieveExpiredPasswordException
- 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 java.lang.Exception
UserDatabase
Initiate access to the underlying persistence layer.
open
in interface UserDatabase
org.apache.struts.examples.mailreader.UserDatabase
java.lang.Exception
- if a database access error occurspublic void removeUser(User user)
UserDatabase
User
from this database.removeUser
in interface UserDatabase
org.apache.struts.examples.mailreader.UserDatabase
user
- User to be removedjava.lang.IllegalArgumentException
- if the specified user is not
associated with this databasepublic void save() throws java.lang.Exception
UserDatabase
Save any pending changes to the underlying persistence layer.
save
in interface UserDatabase
org.apache.struts.examples.mailreader.UserDatabase
java.lang.Exception
- if a database access error occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |