public abstract class AbstractSchemaMojo extends AbstractMojo
Modifier and Type | Field and Description |
---|---|
protected String[] |
classes
Specifies the names of specific Java classes to search for @
PermazenType or @JFieldType annotations. |
protected String[] |
packages
Specifies Java package names under which to search for classes with @
PermazenType or @JFieldType annotations. |
protected MavenProject |
project |
protected String |
schemaVersionProperty
The name of a Maven property to set to the auto-generated schema version number.
|
protected String |
storageIdGeneratorClass
The
StorageIdGenerator to use for generating Permazen storage ID's. |
Constructor and Description |
---|
AbstractSchemaMojo() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addDependencyClasspathElements(List<String> elements) |
void |
execute() |
protected abstract void |
execute(Permazen jdb) |
protected void |
generate(SchemaModel schema,
File file)
Generate schema XML file, overwriting any previous file.
|
protected abstract File |
getClassOutputDirectory() |
protected boolean |
verify(Permazen jdb,
Iterator<? extends File> otherVersionFiles)
Check schema for structural conflicts with other schema versions defined by an iteration of XML files.
|
protected boolean |
verify(SchemaModel schema,
File file,
boolean matchNames)
Verify that the provided schema is "same version" compatible
with the schema defined by the specified XML file.
|
getLog, getPluginContext, setLog, setPluginContext
@Parameter protected String[] packages
PermazenType
or @JFieldType
annotations.
If no <classes>
or <packages>
are configured, then by default this plugin
searches all classes in the output directory.
@Parameter protected String[] classes
PermazenType
or @JFieldType
annotations.
If no <classes>
or <packages>
are configured, then by default this plugin
searches all classes in the output directory.
@Parameter protected String storageIdGeneratorClass
The StorageIdGenerator
to use for generating Permazen storage ID's.
By default, a DefaultStorageIdGenerator
is used.
To configure a custom StorageIdGenerator
, specify its class name like this:
The specified class (<configuration> <storageIdGeneratorClass>com.example.MyStorageIdGenerator</storageIdGeneratorClass> ... </configuration>
com.example.MyStorageIdGenerator
in this example) must be available either
as part of the project being built or in one of the project's dependencies.@Parameter(defaultValue="") protected String schemaVersionProperty
-1
is configured.
This auto-generated version number is based on
hashing the generated schema.@Parameter(defaultValue="${project}", readonly=true) protected MavenProject project
protected abstract File getClassOutputDirectory()
protected abstract void addDependencyClasspathElements(List<String> elements) throws DependencyResolutionRequiredException
protected abstract void execute(Permazen jdb) throws MojoExecutionException, MojoFailureException
public final void execute() throws MojoExecutionException, MojoFailureException
protected void generate(SchemaModel schema, File file) throws MojoExecutionException
schema
- database schemafile
- schema XML output fileMojoExecutionException
- if an unexpected error occursprotected boolean verify(SchemaModel schema, File file, boolean matchNames) throws MojoExecutionException
schema
- actual schemafile
- expected schema XML filematchNames
- whether schema must match exactly, or only be compatible withMojoExecutionException
- if an unexpected error occursprotected boolean verify(Permazen jdb, Iterator<? extends File> otherVersionFiles) throws MojoExecutionException
jdb
- database instanceotherVersionFiles
- iteration of other schema version XML filesMojoExecutionException
- if an unexpected error occursCopyright © 2022. All rights reserved.