Class PersistenceHelperDefaultImpl
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.fulcrum.security.spi.AbstractManager
org.apache.fulcrum.security.hibernate.PersistenceHelperDefaultImpl
- All Implemented Interfaces:
org.apache.avalon.framework.activity.Disposable
,org.apache.avalon.framework.activity.Initializable
,org.apache.avalon.framework.configuration.Configurable
,org.apache.avalon.framework.logger.LogEnabled
,org.apache.avalon.framework.service.Serviceable
,org.apache.avalon.framework.thread.ThreadSafe
,PersistenceHelper
public class PersistenceHelperDefaultImpl extends AbstractManager implements PersistenceHelper, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.activity.Disposable
This persistenceHelper expects you to either pass in a SessionFactory to use,
or it will create one from a hibernate.cfg.xml in the root of the classpath.
- Version:
- $Id: PersistenceHelperDefaultImpl.java 1374014 2012-08-16 19:47:27Z tv $
- Author:
- Eric Pugh
-
Field Summary
-
Constructor Summary
Constructors Constructor Description PersistenceHelperDefaultImpl()
-
Method Summary
Modifier and Type Method Description void
addEntity(SecurityEntity entity)
adds an entityvoid
configure(org.apache.avalon.framework.configuration.Configuration conf)
void
dispose()
org.hibernate.cfg.Configuration
getConfiguration()
org.hibernate.SessionFactory
getSessionFactory()
Lazy loads the sessionFactory if it hasn't been requested yet.void
initialize()
void
removeEntity(SecurityEntity entity)
Deletes an entity objectorg.hibernate.Session
retrieveSession()
Returns a hibernate session, or if is null, opens one.void
setSessionFactory(org.hibernate.SessionFactory sessionFactory)
In some environments we will load the session factory up and pass it in.void
updateEntity(SecurityEntity entity)
Stores changes made to an objectMethods inherited from class org.apache.fulcrum.security.spi.AbstractManager
getGroupManager, getPermissionManager, getRoleManager, getServiceManager, getUserManager, release, resolve, service
-
Constructor Details
-
PersistenceHelperDefaultImpl
public PersistenceHelperDefaultImpl()
-
-
Method Details
-
removeEntity
Deletes an entity object- Specified by:
removeEntity
in interfacePersistenceHelper
- Parameters:
entity
- The object to be removed- Throws:
DataBackendException
- if there was an error accessing the data backend.
-
updateEntity
Stores changes made to an object- Specified by:
updateEntity
in interfacePersistenceHelper
- Parameters:
entity
- The object to be saved- Throws:
DataBackendException
- if there was an error accessing the data backend.
-
addEntity
adds an entity- Specified by:
addEntity
in interfacePersistenceHelper
- Parameters:
entity
- The object to be saved- Throws:
DataBackendException
- if there was an error accessing the data backend.
-
retrieveSession
public org.hibernate.Session retrieveSession() throws org.hibernate.HibernateExceptionReturns a hibernate session, or if is null, opens one.- Specified by:
retrieveSession
in interfacePersistenceHelper
- Returns:
- An Open hibernate session.
- Throws:
org.hibernate.HibernateException
- generic exception
-
getConfiguration
public org.hibernate.cfg.Configuration getConfiguration()- Specified by:
getConfiguration
in interfacePersistenceHelper
- Returns:
- the hibernate configuration
-
setSessionFactory
public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)In some environments we will load the session factory up and pass it in.- Parameters:
sessionFactory
- The hibernateService to set.
-
getSessionFactory
public org.hibernate.SessionFactory getSessionFactory() throws org.hibernate.HibernateExceptionLazy loads the sessionFactory if it hasn't been requested yet.- Returns:
- the hibernate service
- Throws:
org.hibernate.HibernateException
-
initialize
- Specified by:
initialize
in interfaceorg.apache.avalon.framework.activity.Initializable
- Throws:
Exception
-
dispose
public void dispose()- Specified by:
dispose
in interfaceorg.apache.avalon.framework.activity.Disposable
- Overrides:
dispose
in classAbstractManager
-
configure
public void configure(org.apache.avalon.framework.configuration.Configuration conf) throws org.apache.avalon.framework.configuration.ConfigurationException- Specified by:
configure
in interfaceorg.apache.avalon.framework.configuration.Configurable
- Throws:
org.apache.avalon.framework.configuration.ConfigurationException
-