org.icenigrid.gridsam.core.plugin.persistence.hibernate
Class HibernatePersistenceStore

java.lang.Object
  extended by org.hibernate.jmx.StatisticsService
      extended by org.icenigrid.gridsam.core.plugin.persistence.hibernate.HibernatePersistenceStore
All Implemented Interfaces:
java.util.EventListener, org.apache.hivemind.events.RegistryShutdownListener, org.hibernate.jmx.StatisticsServiceMBean, org.hibernate.stat.Statistics, PersistenceStore
Direct Known Subclasses:
HibernateFileJobInstanceStore, HibernateJobInstanceStore

public abstract class HibernatePersistenceStore
extends org.hibernate.jmx.StatisticsService
implements PersistenceStore, org.apache.hivemind.events.RegistryShutdownListener

PersistenceStore implementation that uses Hibernate to persist java objects

Author:
wwhl

Field Summary
 java.lang.ThreadLocal oHibernateSession
          the hibernate session thread-local
 
Constructor Summary
HibernatePersistenceStore(org.hibernate.cfg.Configuration pHibernateConf)
          create a new HibernatePersistenceStore
HibernatePersistenceStore(java.util.List pProps)
          create a HibernatePersistenceStore with a list of InlineProperties that is aggregated to become a single Properties.
HibernatePersistenceStore(java.util.Properties pHibernateProps)
          create a new HibernatePersistenceStore
HibernatePersistenceStore(java.lang.String pName)
          create a new HibernatePersistenceStore with a transient database
 
Method Summary
 Transaction begin()
          begin a persistence store transaction
 void close()
          close the persistence store connection
protected  void closeSession()
          close the current hibernate session
 void flush()
          flush all updates to persistent storage
protected  org.hibernate.Session getSession()
          retrieve a hibernate session for the current thread
 org.hibernate.jmx.StatisticsService getStatistics()
          get statistics
 void registryDidShutdown()
          the registry is closing down the store
protected abstract  void revise(org.hibernate.cfg.Configuration pHibernateConf)
          revise the configuration before the hibernate session builder is created
 
Methods inherited from class org.hibernate.jmx.StatisticsService
clear, getCloseStatementCount, getCollectionFetchCount, getCollectionLoadCount, getCollectionRecreateCount, getCollectionRemoveCount, getCollectionRoleNames, getCollectionStatistics, getCollectionUpdateCount, getConnectCount, getEntityDeleteCount, getEntityFetchCount, getEntityInsertCount, getEntityLoadCount, getEntityNames, getEntityStatistics, getEntityUpdateCount, getFlushCount, getOptimisticFailureCount, getPrepareStatementCount, getQueries, getQueryCacheHitCount, getQueryCacheMissCount, getQueryCachePutCount, getQueryExecutionCount, getQueryExecutionMaxTime, getQueryExecutionMaxTimeQueryString, getQueryStatistics, getSecondLevelCacheHitCount, getSecondLevelCacheMissCount, getSecondLevelCachePutCount, getSecondLevelCacheRegionNames, getSecondLevelCacheStatistics, getSessionCloseCount, getSessionOpenCount, getStartTime, getSuccessfulTransactionCount, getTransactionCount, isStatisticsEnabled, logSummary, setSessionFactory, setSessionFactoryJNDIName, setStatisticsEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

oHibernateSession

public final java.lang.ThreadLocal oHibernateSession
the hibernate session thread-local

Constructor Detail

HibernatePersistenceStore

public HibernatePersistenceStore(java.lang.String pName)
                          throws PersistenceException
create a new HibernatePersistenceStore with a transient database

Parameters:
pName - the name to identify this transient storage in the lifetime of this VM
Throws:
PersistenceException - if the hibernate mechanics cannot be created

HibernatePersistenceStore

public HibernatePersistenceStore(java.util.List pProps)
                          throws PersistenceException
create a HibernatePersistenceStore with a list of InlineProperties that is aggregated to become a single Properties. Same as calling HibernateJobInstanceStore(Properties)

Parameters:
pProps - List of InlineProperties
Throws:
PersistenceException

HibernatePersistenceStore

public HibernatePersistenceStore(java.util.Properties pHibernateProps)
                          throws PersistenceException
create a new HibernatePersistenceStore

Parameters:
pHibernateProps - the hibernate properties
Throws:
PersistenceException - if the hibernate mechanics cannot be created

HibernatePersistenceStore

public HibernatePersistenceStore(org.hibernate.cfg.Configuration pHibernateConf)
                          throws PersistenceException
create a new HibernatePersistenceStore

Parameters:
pHibernateConf - the hibernate configuration
Throws:
PersistenceException - if the hibernate mechanics cannot be created
Method Detail

revise

protected abstract void revise(org.hibernate.cfg.Configuration pHibernateConf)
                        throws PersistenceException
revise the configuration before the hibernate session builder is created

Parameters:
pHibernateConf - the configuration
Throws:
PersistenceException - if the configuration is invalid

getSession

protected org.hibernate.Session getSession()
                                    throws org.hibernate.HibernateException
retrieve a hibernate session for the current thread

Returns:
Session the hibernate session
Throws:
org.hibernate.HibernateException - if the session cannot be created

closeSession

protected void closeSession()
                     throws org.hibernate.HibernateException
close the current hibernate session

Throws:
org.hibernate.HibernateException

begin

public Transaction begin()
                  throws PersistenceException
begin a persistence store transaction

Specified by:
begin in interface PersistenceStore
Throws:
PersistenceException - if the transaction cannot be started

getStatistics

public org.hibernate.jmx.StatisticsService getStatistics()
get statistics

Returns:
StatisticsService hibernate statistics

flush

public void flush()
           throws PersistenceException,
                  java.util.ConcurrentModificationException
flush all updates to persistent storage

Specified by:
flush in interface PersistenceStore
Throws:
PersistenceException - if data fails to be flushed
java.util.ConcurrentModificationException

close

public void close()
close the persistence store connection

Specified by:
close in interface PersistenceStore

registryDidShutdown

public void registryDidShutdown()
the registry is closing down the store

Specified by:
registryDidShutdown in interface org.apache.hivemind.events.RegistryShutdownListener


Copyright © 2009. All Rights Reserved.