org.hibernate.tool.hbm2x
Class AbstractExporter

java.lang.Object
  extended by 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

Field Summary
protected  org.apache.commons.logging.Log log
           
protected  String[] templatePaths
           
 
Constructor Summary
AbstractExporter()
           
AbstractExporter(org.hibernate.cfg.Configuration cfg, File outputdir)
           
 
Method Summary
protected  void cleanUpContext()
           
protected abstract  void doStart()
           
 ArtifactCollector getArtifactCollector()
           
 Cfg2HbmTool getCfg2HbmTool()
           
 Cfg2JavaTool getCfg2JavaTool()
           
 org.hibernate.cfg.Configuration getConfiguration()
           
protected  File getFileForClassName(File baseDir, String className, String extension)
           
 String getName()
           
 File getOutputDirectory()
           
 Properties getProperties()
           
protected  TemplateHelper getTemplateHelper()
           
 String[] getTemplatePath()
           
 String[] getTemplatePaths()
           
 void setArtifactCollector(ArtifactCollector collector)
           
 void setConfiguration(org.hibernate.cfg.Configuration cfg)
           
 void setOutputDirectory(File outputdir)
           
 void setProperties(Properties properties)
           
protected  void setTemplateHelper(TemplateHelper vh)
           
 void setTemplatePath(String[] templatePaths)
           
protected  void setupContext()
          Setup the context variables used by the exporter.
protected  void setupTemplates()
           
 void start()
          Builds template context and performs file generation Subclasses mostly implement doStart() instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.apache.commons.logging.Log log

templatePaths

protected String[] templatePaths
Constructor Detail

AbstractExporter

public AbstractExporter(org.hibernate.cfg.Configuration cfg,
                        File outputdir)

AbstractExporter

public AbstractExporter()
Method Detail

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()