@Mojo(name="enhance-entities",
threadSafe=false,
requiresDependencyResolution=COMPILE,
requiresProject=true,
defaultPhase=PROCESS_CLASSES)
public class OpenJPAEnhancerMojo
extends org.wisdom.maven.mojos.AbstractWisdomWatcherMojo
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
addDefaultConstructor
The JPA spec requires that all persistent classes define a no-arg constructor.
|
protected java.io.File |
classes
Location where
persistence-enabled classes are located. |
protected java.util.List<java.lang.String> |
compileClasspathElements
List of all class path elements that will be searched for the
persistence-enabled classes and resources expected by
PCEnhancer. |
private java.lang.String |
connectionDriverName
This setting can be used to override any openjpa.ConnectionDriverName set in the
persistence.xml.
|
private java.lang.String |
connectionProperties
Used to define the credentials or any other connection properties.
|
protected boolean |
enforcePropertyRestrictions
Whether to throw an exception when it appears that a property access entity
is not obeying the restrictions placed on property access.
|
private java.lang.String |
excludes
Comma separated list of excludes to scan searchDir to pass to the jobs.
|
private java.lang.String |
includes
Comma separated list of includes to scan searchDir to pass to the jobs.
|
private static java.lang.String |
META_PERSISTENCE_HEADER |
private static java.lang.String |
OPTION_ADD_DEFAULT_CONSTRUCTOR
used for passing the addDefaultConstructor parameter to the enhancer tool
|
static java.lang.String |
OPTION_CONNECTION_DRIVER_NAME
The string used for passing information about the connectionDriverName.
|
static java.lang.String |
OPTION_CONNECTION_PROPERTIES
the string used for passing information about the connectionProperties.
|
private static java.lang.String |
OPTION_ENFORCE_PROPERTY_RESTRICTION
used for passing the enforcePropertyRestrictions parameter to the enhnacer tool
|
static java.lang.String |
OPTION_PROPERTIES_FILE
The properties option is used for passing information about the persistence.xml file location.
|
private static java.lang.String |
OPTION_USE_TEMP_CLASSLOADER
used for passing the tmpClassLoader parameter to the enhnacer tool
|
private java.lang.String |
persistenceXmlFile
Used if a non-default file location for the persistence.xml should be used
If not specified, the default one in META-INF/persistence.xml will be used.
|
protected boolean |
tmpClassLoader
Tell the PCEnhancer to use a temporary classloader for enhancement.
|
private java.util.Properties |
toolProperties
Additional properties passed to the OpenJPA tools.
|
protected java.io.File |
workDir
The working directory for putting persistence.xml and
other stuff into if we need to.
|
| Constructor and Description |
|---|
OpenJPAEnhancerMojo() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(java.io.File file)
Checks whether the given file is managed by the current watcher.
|
private void |
enhance(java.util.List<java.io.File> files)
Processes a list of class file resources that are to be enhanced.
|
private java.io.File |
ensurePersistenceXml() |
void |
execute()
Perform whatever build-process behavior this
Mojo implements. |
protected void |
extendRealmClasspath()
This will prepare the current ClassLoader and add all jars and local
classpaths (e.g.
|
boolean |
fileCreated(java.io.File file)
Notifies the watcher that a new file is created.
|
boolean |
fileDeleted(java.io.File file)
Notifies the watcher that a file was deleted.
|
boolean |
fileUpdated(java.io.File file)
Notifies the watcher that a file has been modified.
|
protected java.util.List<java.io.File> |
findEntityClassFiles()
Locates and returns a list of class files found under specified class
directory.
|
protected java.lang.String[] |
getFilePaths(java.util.List<java.io.File> files) |
protected org.apache.openjpa.lib.util.Options |
getOptions()
Get the options for the OpenJPA enhancer tool.
|
private java.lang.String |
getPathInBundle(java.io.File persistence) |
getFilteredVersion, getOutputFile, getOutputFile, getResources, project, removeFromWatching, session, setSessiongetExternalAssetsDirectory, getExternalAssetsOutputDirectory, getInternalAssetOutputDirectory, getInternalAssetsDirectory, getNodeManager, getWisdomRootDirectory, setNodeManager@Parameter(defaultValue="${project.build.directory}/openjpa-work",
required=true)
protected java.io.File workDir
@Parameter(defaultValue="${project.build.outputDirectory}",
readonly=true)
protected java.io.File classes
persistence-enabled classes are located.@Parameter(defaultValue="**/*.class") private java.lang.String includes
@Parameter(defaultValue="") private java.lang.String excludes
@Parameter private java.util.Properties toolProperties
@Parameter(defaultValue="target/classes/META-INF/persistence.xml") private java.lang.String persistenceXmlFile
@Parameter private java.lang.String connectionDriverName
This setting can be used to override any openjpa.ConnectionDriverName set in the persistence.xml. It can also be used if the persistence.xml contains no connection information at all.
Sample:
<connectionDriverName>com.mchange.v2.c3p0.ComboPooledDataSource</connectionDriverName>
This is most times used in conjunction with connectionProperties.
public static final java.lang.String OPTION_CONNECTION_DRIVER_NAME
@Parameter private java.lang.String connectionProperties
Used to define the credentials or any other connection properties.
Sample:
<connectionProperties> driverClass=com.mysql.jdbc.Driver, jdbcUrl=jdbc:mysql://localhost/mydatabase, user=root, password=, minPoolSize=5, acquireRetryAttempts=3, maxPoolSize=20 </connectionProperties>
This is most times used in conjunction with connectionDriverName.
public static final java.lang.String OPTION_CONNECTION_PROPERTIES
@Parameter(defaultValue="${project.compileClasspathElements}",
required=true,
readonly=true)
protected java.util.List<java.lang.String> compileClasspathElements
persistence-enabled classes and resources expected by
PCEnhancer.public static final java.lang.String OPTION_PROPERTIES_FILE
@Parameter(defaultValue="true") protected boolean addDefaultConstructor
private static final java.lang.String OPTION_ADD_DEFAULT_CONSTRUCTOR
@Parameter(defaultValue="false") protected boolean enforcePropertyRestrictions
private static final java.lang.String OPTION_ENFORCE_PROPERTY_RESTRICTION
@Parameter(defaultValue="false") protected boolean tmpClassLoader
private static final java.lang.String OPTION_USE_TEMP_CLASSLOADER
private static final java.lang.String META_PERSISTENCE_HEADER
public void execute()
throws org.apache.maven.plugin.MojoExecutionException,
org.apache.maven.plugin.MojoFailureException
Mojo implements.
Mojo inside the Maven system, and allows
the Mojo to communicate errors.org.apache.maven.plugin.MojoExecutionException - if an unexpected problem occurs. Throwing this
exception causes a "BUILD ERROR" message to be displayed.org.apache.maven.plugin.MojoFailureException - if an expected problem (such as a compilation
failure) occurs. Throwing this exception causes a "BUILD FAILURE" message to be displayed.private java.lang.String getPathInBundle(java.io.File persistence)
public boolean accept(java.io.File file)
file - is the file.public boolean fileCreated(java.io.File file)
throws org.wisdom.maven.WatchingException
file - is the file.org.wisdom.maven.WatchingException - if the watcher failed to process the given file.public boolean fileUpdated(java.io.File file)
throws org.wisdom.maven.WatchingException
file - is the file.org.wisdom.maven.WatchingException - if the watcher failed to process the given file.public boolean fileDeleted(java.io.File file)
throws org.wisdom.maven.WatchingException
file - the fileorg.wisdom.maven.WatchingException - if the watcher failed to process the given file.private java.io.File ensurePersistenceXml()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprotected void extendRealmClasspath()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException - on any error inside the mojoprotected java.util.List<java.io.File> findEntityClassFiles()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException - if there was an error scanning class file
resources.protected java.lang.String[] getFilePaths(java.util.List<java.io.File> files)
files - List of filesprotected org.apache.openjpa.lib.util.Options getOptions()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprivate void enhance(java.util.List<java.io.File> files)
throws org.apache.maven.plugin.MojoExecutionException
files - class file resources to enhance.org.apache.maven.plugin.MojoExecutionException - if the enhancer encountered a failureCopyright © 2013-2015 Wisdom Framework. All Rights Reserved.