org.hibernate.tool.hbm2x
Class AbstractExporter
java.lang.Object
org.hibernate.tool.hbm2x.AbstractExporter
- All Implemented Interfaces:
- Exporter
- Direct Known Subclasses:
- DocExporter, GenericExporter, Hbm2DDLExporter, HibernateConfigurationExporter, QueryExporter
public abstract class AbstractExporter
- extends Object
- implements Exporter
Base exporter for the template and direct output generation.
Sets up the template environment
- Author:
- max and david
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected org.apache.commons.logging.Log log
templatePaths
protected String[] templatePaths
AbstractExporter
public AbstractExporter(org.hibernate.cfg.Configuration cfg,
File outputdir)
AbstractExporter
public AbstractExporter()
setOutputDirectory
public void setOutputDirectory(File outputdir)
- Specified by:
setOutputDirectory
in interface Exporter
- Parameters:
outputdir
- basedirectory to be used for generated files.
setConfiguration
public void setConfiguration(org.hibernate.cfg.Configuration cfg)
- Specified by:
setConfiguration
in interface Exporter
- Parameters:
cfg
- An Hibernate org.hibernate.Configuration
or subclass instance that defines the hibernate meta model to be exported.
getFileForClassName
protected File getFileForClassName(File baseDir,
String className,
String extension)
- Parameters:
className
-
- Returns:
getOutputDirectory
public File getOutputDirectory()
- Specified by:
getOutputDirectory
in interface Exporter
getConfiguration
public org.hibernate.cfg.Configuration getConfiguration()
- Specified by:
getConfiguration
in interface Exporter
start
public void start()
- Builds template context and performs file generation
Subclasses mostly implement doStart() instead.
- Specified by:
start
in interface Exporter
doStart
protected abstract void doStart()
getTemplatePaths
public String[] getTemplatePaths()
setTemplatePath
public void setTemplatePath(String[] templatePaths)
- Specified by:
setTemplatePath
in interface Exporter
- Parameters:
templatePaths
- array of directories used sequentially to lookup templates
getTemplatePath
public String[] getTemplatePath()
- Specified by:
getTemplatePath
in interface Exporter
setupTemplates
protected void setupTemplates()
setupContext
protected void setupContext()
- Setup the context variables used by the exporter. Subclasses should call super.setupContext() to ensure all needed variables are in the context.
cleanUpContext
protected void cleanUpContext()
setTemplateHelper
protected void setTemplateHelper(TemplateHelper vh)
getTemplateHelper
protected TemplateHelper getTemplateHelper()
setProperties
public void setProperties(Properties properties)
- Specified by:
setProperties
in interface Exporter
- Parameters:
properties
- set of properties to be used by exporter.
setArtifactCollector
public void setArtifactCollector(ArtifactCollector collector)
- Specified by:
setArtifactCollector
in interface Exporter
- Parameters:
collector
- Instance to be consulted when adding a new file.
getArtifactCollector
public ArtifactCollector getArtifactCollector()
- Specified by:
getArtifactCollector
in interface Exporter
- Returns:
- artifact collector
getProperties
public Properties getProperties()
- Specified by:
getProperties
in interface Exporter
getName
public String getName()
getCfg2HbmTool
public Cfg2HbmTool getCfg2HbmTool()
getCfg2JavaTool
public Cfg2JavaTool getCfg2JavaTool()