Package org.apache.openjpa.tools.maven
Class AbstractOpenJpaMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.openjpa.tools.maven.AbstractOpenJpaMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
AbstractOpenJpaEnhancerMojo,AbstractOpenJpaMappingToolMojo
public abstract class AbstractOpenJpaMojo extends org.apache.maven.plugin.AbstractMojoBase class for OpenJPA maven tasks.- Version:
- $Id$
-
-
Field Summary
Fields Modifier and Type Field Description protected FileclassesLocation wherepersistence-enabledclasses are located.protected List<String>compileClasspathElementsList of all class path elements that will be searched for thepersistence-enabledclasses and resources expected by PCEnhancer.protected static StringOPTION_CONNECTION_DRIVER_NAMEthe string used for passing information about the connectionDriverNameprotected static StringOPTION_CONNECTION_PROPERTIESthe string used for passing information about the connectionPropertiesprotected static StringOPTION_PROPERTIESThe properties option is used for passing information about the persistence.xml classpath resource and the default unitprotected static StringOPTION_PROPERTIES_FILEthe properties option is used for passing information about the persistence.xml file locationprotected org.apache.maven.project.MavenProjectprojectThe Maven Project Objectprotected FileworkDirThe working directory for putting persistence.xml and other stuff into if we need to.
-
Constructor Summary
Constructors Constructor Description AbstractOpenJpaMojo()default ct
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected OptionscreateOptions()This function will usually get called bygetOptions()protected voidextendRealmClasspath()This will prepare the current ClassLoader and add all jars and local classpaths (e.g. target/classes) needed by the OpenJPA task.protected List<File>findEntityClassFiles()Locates and returns a list of class files found under specified class directory.protected List<String>getClasspathElements()This function retrieves the injected classpath elements for the current mojo.protected FilegetEntityClasses()The File where the class files of the entities to enhance resideprotected String[]getFilePaths(List<File> files)protected abstract OptionsgetOptions()Get the options for the various OpenJPA tools.protected booleanskipMojo()Determine if the mojo execution should get skipped.-
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
-
-
-
Field Detail
-
workDir
@Parameter(property="openjpa.workdir", defaultValue="${project.build.directory}/openjpa-work", required=true) protected File workDirThe working directory for putting persistence.xml and other stuff into if we need to.
-
classes
@Parameter(property="openjpa.classes", defaultValue="${project.build.outputDirectory}", required=true) protected File classesLocation wherepersistence-enabledclasses are located.
-
OPTION_CONNECTION_DRIVER_NAME
protected static final String OPTION_CONNECTION_DRIVER_NAME
the string used for passing information about the connectionDriverName- See Also:
- Constant Field Values
-
OPTION_CONNECTION_PROPERTIES
protected static final String OPTION_CONNECTION_PROPERTIES
the string used for passing information about the connectionProperties- See Also:
- Constant Field Values
-
compileClasspathElements
@Parameter(defaultValue="${project.compileClasspathElements}", required=true, readonly=true) protected List<String> compileClasspathElementsList of all class path elements that will be searched for thepersistence-enabledclasses and resources expected by PCEnhancer.
-
project
@Parameter(defaultValue="${project}", required=true, readonly=true) protected org.apache.maven.project.MavenProject projectThe Maven Project Object
-
OPTION_PROPERTIES_FILE
protected static final String OPTION_PROPERTIES_FILE
the properties option is used for passing information about the persistence.xml file location- See Also:
- Constant Field Values
-
OPTION_PROPERTIES
protected static final String OPTION_PROPERTIES
The properties option is used for passing information about the persistence.xml classpath resource and the default unit- See Also:
- Constant Field Values
-
-
Method Detail
-
getEntityClasses
protected File getEntityClasses()
The File where the class files of the entities to enhance reside- Returns:
- normaly the entity classes are located in target/classes
-
getClasspathElements
protected List<String> getClasspathElements()
This function retrieves the injected classpath elements for the current mojo.- Returns:
- List of classpath elements for the compile phase
-
getOptions
protected abstract Options getOptions() throws org.apache.maven.plugin.MojoExecutionException
Get the options for the various OpenJPA tools.- Returns:
- populated Options
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
skipMojo
protected boolean skipMojo()
Determine if the mojo execution should get skipped.
This is the case if:skipistrue- if the mojo gets executed on a project with packaging type 'pom' and
forceMojoExecutionisfalse
- Returns:
trueif the mojo execution should be skipped.
-
createOptions
protected Options createOptions() throws org.apache.maven.plugin.MojoExecutionException
This function will usually get called bygetOptions()- Returns:
- the Options filled with the initial values
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
extendRealmClasspath
protected void extendRealmClasspath() throws org.apache.maven.plugin.MojoExecutionExceptionThis will prepare the current ClassLoader and add all jars and local classpaths (e.g. target/classes) needed by the OpenJPA task.- Throws:
org.apache.maven.plugin.MojoExecutionException- on any error inside the mojo
-
findEntityClassFiles
protected List<File> findEntityClassFiles() throws org.apache.maven.plugin.MojoExecutionException
Locates and returns a list of class files found under specified class directory.- Returns:
- list of class files.
- Throws:
org.apache.maven.plugin.MojoExecutionException- if there was an error scanning class file resources.
-
-