org.codehaus.mojo.hibernate3
Class HibernateExporterMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.codehaus.mojo.hibernate3.HibernateExporterMojo
All Implemented Interfaces:
ContextEnabled, Mojo, ExporterMojo
Direct Known Subclasses:
GenericExporterMojo, Hbm2CfgXmlExporterMojo, Hbm2DDLExporterMojo, Hbm2DocExporterMojo, Hbm2HbmXmlExporterMojo, Hbm2JavaGeneratorMojo

public abstract class HibernateExporterMojo
extends AbstractMojo
implements ExporterMojo

Base class for the different hibernate3 goals based on the Ant tasks of hibernate tools.

Version:
$Id: HibernateExporterMojo.java 7374 2008-08-04 22:54:00Z jreyes $
Author:
Johann Reyes, Tim O'Brien

Field Summary
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
HibernateExporterMojo()
           
 
Method Summary
protected  void addDefaultComponent(String outputDirectory, String implementation, boolean jdk5)
          Adds a default goal.
protected  org.hibernate.tool.hbm2x.Exporter configureExporter(org.hibernate.tool.hbm2x.Exporter exporter)
          Configures the Exporter.
protected abstract  org.hibernate.tool.hbm2x.Exporter createExporter()
          Gets the hibernate tool exporter based on the goal that is being called.
protected  void doExecute()
          Executes the plugin in an isolated classloader.
 void execute()
           
protected  Component getComponent()
          Returns the parsed goal to the exporter.
protected  ComponentConfiguration getComponentConfiguration(String name)
          Returns the ComponentConfiguration for this maven goal.
 String getComponentProperty(String key)
          Returns the value from the componentProperties element which key is the one being passed.
 boolean getComponentProperty(String key, boolean defaultValue)
          Returns the value from the componentProperties element as a boolean value, or if a value is not found returns the default value.
 String getComponentProperty(String key, String defaultValue)
          Returns the value from the componentProperties element which key is the one being passed, or if is null or empty then returns the default value being specified.
 MavenProject getProject()
          Returns the MavenProject object.
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.codehaus.mojo.hibernate3.ExporterMojo
getName
 
Methods inherited from interface org.apache.maven.plugin.Mojo
getLog, setLog
 

Constructor Detail

HibernateExporterMojo

public HibernateExporterMojo()
Method Detail

getProject

public MavenProject getProject()
Description copied from interface: ExporterMojo
Returns the MavenProject object.

Specified by:
getProject in interface ExporterMojo
Returns:
MavenProject
See Also:
ExporterMojo.getProject()

getComponentProperty

public String getComponentProperty(String key)
Description copied from interface: ExporterMojo
Returns the value from the componentProperties element which key is the one being passed.

Specified by:
getComponentProperty in interface ExporterMojo
Parameters:
key - Key
Returns:
String
See Also:
ExporterMojo.getComponentProperty(String)

getComponentProperty

public boolean getComponentProperty(String key,
                                    boolean defaultValue)
Description copied from interface: ExporterMojo
Returns the value from the componentProperties element as a boolean value, or if a value is not found returns the default value.

Specified by:
getComponentProperty in interface ExporterMojo
Parameters:
key - Key
defaultValue - Default value
Returns:
boolean
See Also:
ExporterMojo.getComponentProperty(String,boolean)

execute

public void execute()
             throws MojoExecutionException,
                    MojoFailureException
Specified by:
execute in interface Mojo
Throws:
MojoExecutionException
MojoFailureException
See Also:
Mojo.execute()

addDefaultComponent

protected void addDefaultComponent(String outputDirectory,
                                   String implementation,
                                   boolean jdk5)
Adds a default goal.

Parameters:
outputDirectory - Default output directory
implementation - Default configuration implementation
jdk5 - Is this goal being setup for jdk15?

configureExporter

protected org.hibernate.tool.hbm2x.Exporter configureExporter(org.hibernate.tool.hbm2x.Exporter exporter)
                                                       throws MojoExecutionException
Configures the Exporter.

Parameters:
exporter - Exporter to configure
Returns:
Exporter
Throws:
MojoExecutionException - if there is an error configuring the exporter

getComponentConfiguration

protected ComponentConfiguration getComponentConfiguration(String name)
                                                    throws MojoExecutionException
Returns the ComponentConfiguration for this maven goal.

Parameters:
name - Configuration task name
Returns:
ComponentConfiguration
Throws:
MojoExecutionException - if there is an error finding the ConfigurationTask

getComponentProperty

public String getComponentProperty(String key,
                                   String defaultValue)
Description copied from interface: ExporterMojo
Returns the value from the componentProperties element which key is the one being passed, or if is null or empty then returns the default value being specified.

Specified by:
getComponentProperty in interface ExporterMojo
Parameters:
key - Key
defaultValue - Default value
Returns:
String
See Also:
ExporterMojo.getComponentProperty(String,String)

createExporter

protected abstract org.hibernate.tool.hbm2x.Exporter createExporter()
Gets the hibernate tool exporter based on the goal that is being called.

Returns:
Goal exporter

doExecute

protected void doExecute()
                  throws MojoExecutionException
Executes the plugin in an isolated classloader.

Throws:
MojoExecutionException - When there is an erro executing the plugin

getComponent

protected Component getComponent()
Returns the parsed goal to the exporter.

Returns:
Component


Copyright © 2005-2010 Codehaus. All Rights Reserved.