Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts.examples.mailreader.memory
Class MemoryUserDatabase

    java.lang.Object
      |
      +--org.apache.struts.examples.mailreader.memory.MemoryUserDatabase

All Implemented Interfaces:
  UserDatabase

public class MemoryUserDatabase
extends java.lang.Object
implements UserDatabase

Concrete implementation of `UserDatabase` for an in-memory database backed by an XML data file.

Since:
  Struts 1.1
Version:
  $Rev: 54929 $ $Date: 2004-10-16 09:38:42 -0700 (Sat, 16 Oct 2004) $

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
`, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait`

Field Detail

### log

    private org.apache.commons.logging.Log log

  Logging output for this user database instance.

### users

    private java.util.HashMap users

  The `User`s associated with this UserDatabase, keyed by username.

### pathname

    private java.lang.String pathname

  Absolute pathname to the persistent file we use for loading and storing persistent data.

### pathnameOld

    private java.lang.String pathnameOld

### pathnameNew

    private java.lang.String pathnameNew

Constructor Detail

### MemoryUserDatabase

    public MemoryUserDatabase()

Method Detail

### getPathname

    public java.lang.String getPathname()

### setPathname

    public void setPathname(java.lang.String pathname)

### close

    public void close()
               throws java.lang.Exception

  Description copied from interface: `UserDatabase`

  Finalize access to the underlying persistence layer.

  Specified by:
    `close` in interface `UserDatabase`
  Following copied from interface: `org.apache.struts.examples.mailreader.UserDatabase`
  Throws:
    `java.lang.Exception` - if a database access error occurs

### createUser

    public User createUser(java.lang.String username)

  Description copied from interface: `UserDatabase`

  Create and return a new `User` defined in this user database.

  Specified by:
    `createUser` in interface `UserDatabase`
  Following copied from interface: `org.apache.struts.examples.mailreader.UserDatabase`
  Parameters:
    `username` - Username of the new user
  Throws:
    `java.lang.IllegalArgumentException` - if the specified username is not unique

### findUser

    public User findUser(java.lang.String username)
                  throws ExpiredPasswordException

  Description copied from interface: `UserDatabase`

  Return the existing `User` with the specified username, if any; otherwise return `null`.

  Specified by:
    `findUser` in interface `UserDatabase`
  Following copied from interface: `org.apache.struts.examples.mailreader.UserDatabase`
  Parameters:
    `username` - Username of the user to retrieve
  Throws:
    `ExpiredPasswordException` - if user password has expired and must be changed

### findUsers

    public User[] findUsers()

  Description copied from interface: `UserDatabase`

  Return the set of `User`s defined in this user database.

  Specified by:
    `findUsers` in interface `UserDatabase`

### open

    public void open()
              throws java.lang.Exception

  Description copied from interface: `UserDatabase`

  Initiate access to the underlying persistence layer.

  Specified by:
    `open` in interface `UserDatabase`
  Following copied from interface: `org.apache.struts.examples.mailreader.UserDatabase`
  Throws:
    `java.lang.Exception` - if a database access error occurs

### removeUser

    public void removeUser(User user)

  Description copied from interface: `UserDatabase`
  Remove the specified `User` from this database.
  Specified by:
    `removeUser` in interface `UserDatabase`
  Following copied from interface: `org.apache.struts.examples.mailreader.UserDatabase`
  Parameters:
    `user` - User to be removed
  Throws:
    `java.lang.IllegalArgumentException` - if the specified user is not associated with this database

### save

    public void save()
              throws java.lang.Exception

  Description copied from interface: `UserDatabase`

  Save any pending changes to the underlying persistence layer.

  Specified by:
    `save` in interface `UserDatabase`
  Following copied from interface: `org.apache.struts.examples.mailreader.UserDatabase`
  Throws:
    `java.lang.Exception` - if a database access error occurs

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2004 - The Apache Software Foundation