|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.struts.examples.mailreader.memory.MemoryDatabasePlugIn
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.
| 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, toString, wait, wait, wait |
| Field Detail |
private MemoryUserDatabase database
MemoryUserDatabase object we construct and make available.
private org.apache.commons.logging.Log log
private org.apache.struts.action.ActionServlet servlet
ActionServlet owning this application.
private java.lang.String pathname
| Constructor Detail |
public MemoryDatabasePlugIn()
| Method Detail |
public java.lang.String getPathname()
public void setPathname(java.lang.String pathname)
public void destroy()
destroy in interface org.apache.struts.action.PlugIn
public void init(org.apache.struts.action.ActionServlet servlet,
org.apache.struts.config.ModuleConfig config)
throws javax.servlet.ServletException
init in interface org.apache.struts.action.PlugInservlet - The ActionServlet for this web applicationconfig - The ApplicationConfig for our owning module
javax.servlet.ServletException - if we cannot configure ourselves correctly
private java.lang.String calculatePath()
throws java.lang.Exception
java.lang.Exception - if an input/output error occurs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||