Dashboard Builder Commons 6.0.0.Beta1

org.jboss.dashboard.database.hibernate
Class HibernateInitializer

java.lang.Object
  extended by org.jboss.dashboard.database.hibernate.HibernateInitializer
All Implemented Interfaces:
Startable

@ApplicationScoped
public class HibernateInitializer
extends Object
implements Startable

Class that initializes the Hibernate framework. It reads all the *.hbm.xml files and push them as part of the Hibernate configuration. Furthermore, initializes a SessionFactory object that will be used further by transactions. To do so it reads first the configuration stored into the HibernateProperties factory bean.


Field Summary
protected  boolean c3p0Enabled
           
protected  boolean cacheEnabled
           
protected  DatabaseAutoSynchronizer databaseAutoSynchronizer
           
protected  String databaseName
           
protected  String[] databaseStructureVerificationExcludedClassNames
           
protected  boolean enableDatabaseAutoSynchronization
           
protected  boolean enableDatabaseStructureVerification
           
protected  org.hibernate.cfg.Configuration hbmConfig
           
protected  HibernateSessionFactoryProvider hibernateSessionFactoryProvider
           
protected  String[] nativeToHiloReplaceableDialects
           
protected  boolean performNativeToHiloReplace
           
protected  List processedJars
           
 
Constructor Summary
HibernateInitializer()
           
 
Method Summary
 boolean createCustomCacheRegion(String regionName)
          Create a custom cache region
 void evictAllCaches()
          Evict all cache information.
 CacheConfigurationManager getCacheConfigurationManager()
           
 DatabaseAutoSynchronizer getDatabaseAutoSynchronizer()
           
 String getDatabaseName()
           
 String[] getDatabaseStructureVerificationExcludedClassNames()
           
 org.hibernate.cfg.Configuration getHbmConfig()
           
 Properties getHibernateProperties()
           
 String[] getNativeToHiloReplaceableDialects()
           
 Priority getPriority()
           
 org.hibernate.SessionFactory getSessionFactory()
           
 boolean isC3p0Enabled()
           
 boolean isCacheEnabled()
           
protected  boolean isDatabase(String dbId)
           
 boolean isEnableDatabaseAutoSynchronization()
           
 boolean isEnableDatabaseStructureVerification()
           
 boolean isH2Database()
           
 boolean isMySQLDatabase()
           
 boolean isOracleDatabase()
           
 boolean isPerformNativeToHiloReplace()
           
 boolean isPostgresDatabase()
           
 boolean isSQLServerDatabase()
           
protected  void loadFiles(org.hibernate.cfg.Configuration hbmConfig)
           
protected  void loadFiles(org.hibernate.cfg.Configuration hbmConfig, File jarFile)
           
protected  void processHibernateProperties(Properties p)
           
protected  String processXMLContents(String fileName, String fileContent)
           
protected  String readXMLForFile(InputStream is)
           
 void setC3p0Enabled(boolean c3p0Enabled)
           
 void setCacheEnabled(boolean cacheEnabled)
           
 void setDatabaseStructureVerificationExcludedClassNames(String[] databaseStructureVerificationExcludedClassNames)
           
 void setEnableDatabaseAutoSynchronization(boolean enableDatabaseAutoSynchronization)
           
 void setEnableDatabaseStructureVerification(boolean enableDatabaseStructureVerification)
           
 void setNativeToHiloReplaceableDialects(String[] nativeToHiloReplaceableDialects)
           
 void setPerformNativeToHiloReplace(boolean performNativeToHiloReplace)
           
 void start()
           
protected  void verifyHibernateConfig()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

performNativeToHiloReplace

@Inject
protected boolean performNativeToHiloReplace

nativeToHiloReplaceableDialects

@Inject
protected String[] nativeToHiloReplaceableDialects

enableDatabaseStructureVerification

@Inject
protected boolean enableDatabaseStructureVerification

enableDatabaseAutoSynchronization

@Inject
protected boolean enableDatabaseAutoSynchronization

databaseStructureVerificationExcludedClassNames

@Inject
protected String[] databaseStructureVerificationExcludedClassNames

hibernateSessionFactoryProvider

@Inject
protected HibernateSessionFactoryProvider hibernateSessionFactoryProvider

databaseAutoSynchronizer

@Inject
protected DatabaseAutoSynchronizer databaseAutoSynchronizer

hbmConfig

protected org.hibernate.cfg.Configuration hbmConfig

databaseName

protected String databaseName

c3p0Enabled

protected boolean c3p0Enabled

cacheEnabled

protected boolean cacheEnabled

processedJars

protected List processedJars
Constructor Detail

HibernateInitializer

public HibernateInitializer()
Method Detail

getHibernateProperties

public Properties getHibernateProperties()

getCacheConfigurationManager

public CacheConfigurationManager getCacheConfigurationManager()

getDatabaseAutoSynchronizer

public DatabaseAutoSynchronizer getDatabaseAutoSynchronizer()

isEnableDatabaseStructureVerification

public boolean isEnableDatabaseStructureVerification()

setEnableDatabaseStructureVerification

public void setEnableDatabaseStructureVerification(boolean enableDatabaseStructureVerification)

getHbmConfig

public org.hibernate.cfg.Configuration getHbmConfig()

isPerformNativeToHiloReplace

public boolean isPerformNativeToHiloReplace()

setPerformNativeToHiloReplace

public void setPerformNativeToHiloReplace(boolean performNativeToHiloReplace)

getNativeToHiloReplaceableDialects

public String[] getNativeToHiloReplaceableDialects()

setNativeToHiloReplaceableDialects

public void setNativeToHiloReplaceableDialects(String[] nativeToHiloReplaceableDialects)

getDatabaseStructureVerificationExcludedClassNames

public String[] getDatabaseStructureVerificationExcludedClassNames()

setDatabaseStructureVerificationExcludedClassNames

public void setDatabaseStructureVerificationExcludedClassNames(String[] databaseStructureVerificationExcludedClassNames)

isC3p0Enabled

public boolean isC3p0Enabled()

setC3p0Enabled

public void setC3p0Enabled(boolean c3p0Enabled)

isCacheEnabled

public boolean isCacheEnabled()

setCacheEnabled

public void setCacheEnabled(boolean cacheEnabled)

isEnableDatabaseAutoSynchronization

public boolean isEnableDatabaseAutoSynchronization()

setEnableDatabaseAutoSynchronization

public void setEnableDatabaseAutoSynchronization(boolean enableDatabaseAutoSynchronization)

getSessionFactory

public org.hibernate.SessionFactory getSessionFactory()

getPriority

public Priority getPriority()
Specified by:
getPriority in interface Startable

start

public void start()
           throws Exception
Specified by:
start in interface Startable
Throws:
Exception

processHibernateProperties

protected void processHibernateProperties(Properties p)

verifyHibernateConfig

protected void verifyHibernateConfig()
                              throws Exception
Throws:
Exception

loadFiles

protected void loadFiles(org.hibernate.cfg.Configuration hbmConfig)
                  throws IOException
Throws:
IOException

loadFiles

protected void loadFiles(org.hibernate.cfg.Configuration hbmConfig,
                         File jarFile)
                  throws IOException
Throws:
IOException

readXMLForFile

protected String readXMLForFile(InputStream is)
                         throws IOException
Throws:
IOException

processXMLContents

protected String processXMLContents(String fileName,
                                    String fileContent)

getDatabaseName

public String getDatabaseName()

evictAllCaches

public void evictAllCaches()
Evict all cache information.


createCustomCacheRegion

public boolean createCustomCacheRegion(String regionName)
Create a custom cache region

Parameters:
regionName - name for the region
Returns:
true if it was created.

isOracleDatabase

public boolean isOracleDatabase()

isPostgresDatabase

public boolean isPostgresDatabase()

isSQLServerDatabase

public boolean isSQLServerDatabase()

isMySQLDatabase

public boolean isMySQLDatabase()

isH2Database

public boolean isH2Database()

isDatabase

protected boolean isDatabase(String dbId)

Dashboard Builder Commons 6.0.0.Beta1

Copyright © 2012-2013 JBoss by Red Hat. All Rights Reserved.