org.jasig.portal.tools.dbloader
Class HibernateDbLoader

java.lang.Object
  extended by org.jasig.portal.tools.dbloader.HibernateDbLoader
All Implemented Interfaces:
IDbLoader

public class HibernateDbLoader
extends Object
implements IDbLoader

Can drop and/or create tables based on an XML table definition file and populate tables based on a XML data definition file. Table creation is done using the Hibernate mapping APIs to allow for a full range of database support.

Version:
$Revision: 19776 $
Author:
Eric Dalquist

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
HibernateDbLoader()
           
 
Method Summary
protected  List<String> createScript(Collection<org.hibernate.mapping.Table> tables, org.hibernate.dialect.Dialect dialect, org.hibernate.engine.Mapping mapping, String defaultCatalog, String defaultSchema)
          Generate create scripts and add them to the script list
protected  List<String> dropScript(Collection<org.hibernate.mapping.Table> tables, org.hibernate.dialect.Dialect dialect, String defaultCatalog, String defaultSchema)
          Generate the drop scripts and add them to the script list
 org.hibernate.dialect.Dialect getDialect()
           
protected  org.hibernate.dialect.Dialect getDialect(String dialectName)
          Load the appropriate database dialect
protected  ITableDataProvider loadTables(DbLoaderConfiguration configuration)
           
protected  void populateTables(DbLoaderConfiguration configuration, Map<String,Map<String,Integer>> tableColumnTypes)
           
 void process(DbLoaderConfiguration configuration)
          Executes database loading based on the provided configuration
 void setDataSource(DataSource dataSource)
           
 void setDialect(org.hibernate.dialect.Dialect dialect)
           
 void setTransactionManager(PlatformTransactionManager transactionManager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

HibernateDbLoader

public HibernateDbLoader()
Method Detail

setDataSource

public void setDataSource(DataSource dataSource)
Parameters:
jdbcTemplate - the jdbcTemplate to set

setTransactionManager

public void setTransactionManager(PlatformTransactionManager transactionManager)
Parameters:
transactionTemplate - the transactionTemplate to set

getDialect

public org.hibernate.dialect.Dialect getDialect()
Returns:
the dialect

setDialect

public void setDialect(org.hibernate.dialect.Dialect dialect)
Parameters:
dialect - the dialect to set

process

public void process(DbLoaderConfiguration configuration)
             throws ParserConfigurationException,
                    SAXException,
                    IOException
Description copied from interface: IDbLoader
Executes database loading based on the provided configuration

Specified by:
process in interface IDbLoader
Throws:
ParserConfigurationException
SAXException
IOException

loadTables

protected ITableDataProvider loadTables(DbLoaderConfiguration configuration)
                                 throws ParserConfigurationException,
                                        SAXException,
                                        IOException
Throws:
ParserConfigurationException
SAXException
IOException

getDialect

protected org.hibernate.dialect.Dialect getDialect(String dialectName)
Load the appropriate database dialect


dropScript

protected List<String> dropScript(Collection<org.hibernate.mapping.Table> tables,
                                  org.hibernate.dialect.Dialect dialect,
                                  String defaultCatalog,
                                  String defaultSchema)
Generate the drop scripts and add them to the script list


createScript

protected List<String> createScript(Collection<org.hibernate.mapping.Table> tables,
                                    org.hibernate.dialect.Dialect dialect,
                                    org.hibernate.engine.Mapping mapping,
                                    String defaultCatalog,
                                    String defaultSchema)
Generate create scripts and add them to the script list


populateTables

protected void populateTables(DbLoaderConfiguration configuration,
                              Map<String,Map<String,Integer>> tableColumnTypes)
                       throws ParserConfigurationException,
                              SAXException,
                              IOException
Throws:
ParserConfigurationException
SAXException
IOException


Copyright © 2010 Jasig. All Rights Reserved.