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 MemoryDatabasePlugIn

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

All Implemented Interfaces:
  org.apache.struts.action.PlugIn

public final class MemoryDatabasePlugIn
extends java.lang.Object
implements org.apache.struts.action.PlugIn

MemoryDatabasePlugIn initializes and finalizes the persistent storage of User and Subscription information for the Struts Demonstration Application, using an in-memory database backed by an XML file.

IMPLEMENTATION WARNING - If this web application is run from a WAR file, or in another environment where reading and writing of the web application resource is impossible, the initial contents will be copied to a file in the web application temporary directory provided by the container. This is for demonstration purposes only - you should NOT assume that files written here will survive a restart of your servlet container.

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

Field Summary
`private MemoryUserDatabase` | `database` The `MemoryUserDatabase` object we construct and make available.
`private org.apache.commons.logging.Log` | `log` Logging output for this plug in instance.
`private java.lang.String` | `pathname` The web application resource path of our persistent database storage file.
`private org.apache.struts.action.ActionServlet` | `servlet` The `ActionServlet` owning this application.

Constructor Summary
`MemoryDatabasePlugIn()`

Method Summary
`private java.lang.String` | `calculatePath()` Calculate and return an absolute pathname to the XML file to contain our persistent storage information.
`void` | `destroy()` Gracefully shut down this database, releasing any resources that were allocated at initialization.
`java.lang.String` | `getPathname()`
`void` | `init(org.apache.struts.action.ActionServlet servlet, org.apache.struts.config.ModuleConfig config)` Initialize and load our initial database from persistent storage.
`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

### database

    private MemoryUserDatabase database

  The `MemoryUserDatabase` object we construct and make available.

### log

    private org.apache.commons.logging.Log log

  Logging output for this plug in instance.

### servlet

    private org.apache.struts.action.ActionServlet servlet

  The `ActionServlet` owning this application.

### pathname

    private java.lang.String pathname

  The web application resource path of our persistent database storage file.

Constructor Detail

### MemoryDatabasePlugIn

    public MemoryDatabasePlugIn()

Method Detail

### getPathname

    public java.lang.String getPathname()

### setPathname

    public void setPathname(java.lang.String pathname)

### destroy

    public void destroy()

  Gracefully shut down this database, releasing any resources that were allocated at initialization.
  Specified by:
    `destroy` in interface `org.apache.struts.action.PlugIn`

### init

    public void init(org.apache.struts.action.ActionServlet servlet,
                     org.apache.struts.config.ModuleConfig config)
              throws javax.servlet.ServletException

  Initialize and load our initial database from persistent storage.
  Specified by:
    `init` in interface `org.apache.struts.action.PlugIn`
  Parameters:
    `servlet` - The ActionServlet for this web application
    `config` - The ApplicationConfig for our owning module
  Throws:
    `javax.servlet.ServletException` - if we cannot configure ourselves correctly

### calculatePath

    private java.lang.String calculatePath()
                                    throws java.lang.Exception

  Calculate and return an absolute pathname to the XML file to contain our persistent storage information.
  Throws:
    `java.lang.Exception` - if an input/output 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