|
|||||||||
| 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 Users 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 Users 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
Users 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
UserDatabaseFinalize access to the underlying persistence layer.
close in interface UserDatabaseorg.apache.struts.examples.mailreader.UserDatabasejava.lang.Exception - if a database access error occurspublic User createUser(java.lang.String username)
UserDatabaseCreate and return a new User defined in this user database.
createUser in interface UserDatabaseorg.apache.struts.examples.mailreader.UserDatabaseusername - Username of the new userjava.lang.IllegalArgumentException - if the specified username
is not unique
public User findUser(java.lang.String username)
throws ExpiredPasswordException
UserDatabaseReturn the existing User with the specified username,
if any; otherwise return null.
findUser in interface UserDatabaseorg.apache.struts.examples.mailreader.UserDatabaseusername - Username of the user to retrieveExpiredPasswordException - if user password has expired
and must be changedpublic User[] findUsers()
UserDatabaseReturn the set of Users defined in this user database.
findUsers in interface UserDatabase
public void open()
throws java.lang.Exception
UserDatabaseInitiate access to the underlying persistence layer.
open in interface UserDatabaseorg.apache.struts.examples.mailreader.UserDatabasejava.lang.Exception - if a database access error occurspublic void removeUser(User user)
UserDatabaseUser from this database.removeUser in interface UserDatabaseorg.apache.struts.examples.mailreader.UserDatabaseuser - User to be removedjava.lang.IllegalArgumentException - if the specified user is not
associated with this database
public void save()
throws java.lang.Exception
UserDatabaseSave any pending changes to the underlying persistence layer.
save in interface UserDatabaseorg.apache.struts.examples.mailreader.UserDatabasejava.lang.Exception - if a database access error occurs
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||