|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.davesag.generica.servlet.plugin.HibernatePlugIn
Implements the PlugIn interface to configure the Hibernate data
persistence library and then go on to intialise your WebApp.
You must have a hibernate.cfg.xml file in the root of your
CLASSPATH for this to work.
The configured net.sf.hibernate.SessionFactory is stored in the
ServletContext under the key Constants.HSF_KEY.
Place the following into your struts-config file to use it.
<plugin
class="org.davesag.generica.servlet.plugin.HibernatePlugIn">
<set-property property="webapp" value="your.webappImpl"/>
</plugin>
| Field Summary | |
protected SessionFactory |
theFactory
The SessionFactory we create must be held on to so we can
destroy it later. |
protected String |
theHibernateConfigFile
The hibernate config file to use. |
protected WebApp |
theWebApp
The WebApp implementation to startup and shutdown. |
| Constructor Summary | |
HibernatePlugIn()
Default constuctor used by ActionServlet as per the PlugIn interface guidelines. |
|
| Method Summary | |
void |
destroy()
Destroys the SessionFactory instance and then runs the
shutdown method of the WebApp |
void |
init(ActionServlet servlet,
ModuleConfig config)
Initializes the SessionFactory and then if a WebApp has
been specified, will start it up. |
void |
setHibernateConfigFile(String f)
sets the Hibernate Config File to use based on the value provided in the <set-property name="hibernateConfigFile"
value="myHibernate.cfg.xml"/> part of the plugin
definition in your struts-config.xml file. |
void |
setWebapp(String webappimpl)
sets the Webapp property based on the value provided in the
<set-property name="webapp"
value="your.webappimpl"/> part of the plugin
definition in your struts-config.xml file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected WebApp theWebApp
protected String theHibernateConfigFile
protected SessionFactory theFactory
SessionFactory we create must be held on to so we can
destroy it later.
| Constructor Detail |
public HibernatePlugIn()
| Method Detail |
public void setWebapp(String webappimpl)
<set-property name="webapp"
value="your.webappimpl"/> part of the plugin
definition in your struts-config.xml file.
webappimpl - The fully qualified class name of the WebApp
implementation that will be used to startup and
shutdown your app.public void setHibernateConfigFile(String f)
<set-property name="hibernateConfigFile"
value="myHibernate.cfg.xml"/> part of the plugin
definition in your struts-config.xml file.
f - The name of your config file.
public void init(ActionServlet servlet,
ModuleConfig config)
throws ServletException
SessionFactory and then if a WebApp has
been specified, will start it up.
init in interface PlugInservlet - the ActionServlet instance under which
the plugin will run.config - the ModuleConfig for the module under
which the plugin will run. Unused in this case.
ServletException - if something went wrong.public void destroy()
SessionFactory instance and then runs the
shutdown method of the WebApp
destroy in interface PlugIn
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||