Dashboard Builder Commons 6.0.0.Final

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  DatabaseAutoSynchronizer databaseAutoSynchronizer
           
protected  String databaseName
           
protected  DataSourceManager databaseSourceManager
           
static String DB_DB2
           
static String DB_H2
           
static String DB_MYSQL
           
static String DB_ORACLE
           
static String DB_POSTGRES
           
static String DB_SQLSERVER
           
static String DB_TEIID
           
protected  org.hibernate.cfg.Configuration hbmConfig
           
protected  HibernateSessionFactoryProvider hibernateSessionFactoryProvider
           
protected  DataSource localDataSource
           
protected  String[] nativeToHiloReplaceableDialects
           
protected  String[] nativeToSequenceReplaceableDialects
           
protected  Map<String,String> supportedDialects
           
protected  String[] verificationExcludedClassNames
           
 
Constructor Summary
HibernateInitializer()
           
 
Method Summary
 void evictAllCaches()
          Evict all cache information.
 String getDatabaseName()
           
 DataSource getLocalDataSource()
           
 Priority getPriority()
           
 org.hibernate.SessionFactory getSessionFactory()
           
protected  String inferDatabaseName()
           
 String inferDatabaseName(DataSource ds)
           
protected  boolean isDatabase(String dbId)
           
 boolean isDB2Database()
           
 boolean isH2Database()
           
 boolean isMySQLDatabase()
           
 boolean isOracleDatabase()
           
 boolean isPostgresDatabase()
           
 boolean isSQLServerDatabase()
           
 boolean isTeiidDatabase()
           
protected  void loadHibernateDescriptors(org.hibernate.cfg.Configuration hbmConfig)
           
protected  String processXMLContents(String fileContent)
           
protected  String readXMLForFile(String fileName, InputStream is)
           
 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

DB_H2

public static final String DB_H2
See Also:
Constant Field Values

DB_POSTGRES

public static final String DB_POSTGRES
See Also:
Constant Field Values

DB_MYSQL

public static final String DB_MYSQL
See Also:
Constant Field Values

DB_ORACLE

public static final String DB_ORACLE
See Also:
Constant Field Values

DB_SQLSERVER

public static final String DB_SQLSERVER
See Also:
Constant Field Values

DB_DB2

public static final String DB_DB2
See Also:
Constant Field Values

DB_TEIID

public static final String DB_TEIID
See Also:
Constant Field Values

hibernateSessionFactoryProvider

@Inject
protected HibernateSessionFactoryProvider hibernateSessionFactoryProvider

databaseAutoSynchronizer

@Inject
protected DatabaseAutoSynchronizer databaseAutoSynchronizer

databaseSourceManager

@Inject
protected DataSourceManager databaseSourceManager

supportedDialects

@Inject
protected Map<String,String> supportedDialects

nativeToSequenceReplaceableDialects

@Inject
protected String[] nativeToSequenceReplaceableDialects

nativeToHiloReplaceableDialects

@Inject
protected String[] nativeToHiloReplaceableDialects

verificationExcludedClassNames

@Inject
protected String[] verificationExcludedClassNames

hbmConfig

protected org.hibernate.cfg.Configuration hbmConfig

databaseName

protected String databaseName

localDataSource

protected DataSource localDataSource
Constructor Detail

HibernateInitializer

public HibernateInitializer()
Method Detail

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

getDatabaseName

public String getDatabaseName()

isOracleDatabase

public boolean isOracleDatabase()

isPostgresDatabase

public boolean isPostgresDatabase()

isSQLServerDatabase

public boolean isSQLServerDatabase()

isMySQLDatabase

public boolean isMySQLDatabase()

isH2Database

public boolean isH2Database()

isDB2Database

public boolean isDB2Database()

isTeiidDatabase

public boolean isTeiidDatabase()

isDatabase

protected boolean isDatabase(String dbId)

getLocalDataSource

public DataSource getLocalDataSource()
                              throws Exception
Throws:
Exception

inferDatabaseName

protected String inferDatabaseName()
                            throws Exception
Throws:
Exception

inferDatabaseName

public String inferDatabaseName(DataSource ds)
                         throws Exception
Throws:
Exception

verifyHibernateConfig

protected void verifyHibernateConfig()
                              throws Exception
Throws:
Exception

loadHibernateDescriptors

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

readXMLForFile

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

processXMLContents

protected String processXMLContents(String fileContent)

evictAllCaches

public void evictAllCaches()
Evict all cache information.


Dashboard Builder Commons 6.0.0.Final

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