org.apache.openjpa.tools.maven
Class AbstractOpenJpaMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by 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.AbstractMojo

Base class for OpenJPA maven tasks.

Version:
$Id$

Field Summary
protected  File classes
          Location where persistence-enabled classes are located.
protected  List<String> compileClasspathElements
          List of all class path elements that will be searched for the persistence-enabled classes and resources expected by PCEnhancer.
protected static String OPTION_CONNECTION_DRIVER_NAME
          the string used for passing information about the connectionDriverName
protected static String OPTION_CONNECTION_PROPERTIES
          the string used for passing information about the connectionProperties
protected static String OPTION_PROPERTIES
          The properties option is used for passing information about the persistence.xml classpath resource and the default unit
protected static String OPTION_PROPERTIES_FILE
          the properties option is used for passing information about the persistence.xml file location
protected  org.apache.maven.project.MavenProject project
          The Maven Project Object
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractOpenJpaMojo()
          default ct
 
Method Summary
protected  Options createOptions()
          This function will usually get called by getOptions()
protected  void extendRealmClasspath()
          This will prepare the current ClassLoader and add all jars and local classpaths (e.g.
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  File getEntityClasses()
          The File where the class files of the entities to enhance reside
protected  String[] getFilePaths(List<File> files)
           
protected abstract  Options getOptions()
          Get the options for the various OpenJPA tools.
protected  boolean skipMojo()
          Determine if the mojo execution should get skipped.
 
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.apache.maven.plugin.Mojo
execute
 

Field Detail

classes

protected File classes
Location where persistence-enabled classes 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

protected List<String> compileClasspathElements
List of all class path elements that will be searched for the persistence-enabled classes and resources expected by PCEnhancer.


project

protected org.apache.maven.project.MavenProject project
The 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
Constructor Detail

AbstractOpenJpaMojo

public AbstractOpenJpaMojo()
default ct

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()
Get the options for the various OpenJPA tools.

Returns:
populated Options

skipMojo

protected boolean skipMojo()

Determine if the mojo execution should get skipped.

This is the case if:

Returns:
true if the mojo execution should be skipped.

createOptions

protected Options createOptions()
This function will usually get called by getOptions()

Returns:
the Options filled with the initial values

extendRealmClasspath

protected void extendRealmClasspath()
                             throws org.apache.maven.plugin.MojoExecutionException
This 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.

getFilePaths

protected String[] getFilePaths(List<File> files)
Parameters:
files - List of files
Returns:
the paths of the given files as String[]


Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.