|
||||||||||
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
public final class MemoryUserDatabase
Concrete implementation of UserDatabase
for an in-memory
database backed by an XML data file.
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 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
Finalize access to the underlying persistence layer.
close
in interface UserDatabase
java.lang.Exception
- if a database access error occurspublic User createUser(java.lang.String username)
Create and return a new User
defined in this user database.
createUser
in interface UserDatabase
username
- Username of the new user
IllegalArgumentExceptionif
- the specified username
is not uniquepublic User findUser(java.lang.String username)
Return the existing User
with the specified username,
if any; otherwise return null
.
findUser
in interface UserDatabase
username
- Username of the user to retrievepublic User[] findUsers()
Return the set of User
s defined in this user database.
findUsers
in interface UserDatabase
public void open() throws java.lang.Exception
Initiate access to the underlying persistence layer.
open
in interface UserDatabase
java.lang.Exception
- if a database access error occurspublic void removeUser(User user)
User
from this database.
removeUser
in interface UserDatabase
user
- User to be removed
java.lang.IllegalArgumentException
- if the specified user is not
associated with this databasepublic void save() throws java.lang.Exception
Save any pending changes to the underlying persistence layer.
save
in interface UserDatabase
java.lang.Exception
- if a database access error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |