Class AbstractWizardMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.tentackle.maven.plugin.wizard.AbstractWizardMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
InitMojo,OperationMojo,PdoMojo
public abstract class AbstractWizardMojo extends org.apache.maven.plugin.AbstractMojoBase wizard mojo.- Author:
- harald
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringentityAliasesThe entity aliases.protected java.util.List<org.apache.maven.shared.model.fileset.FileSet>filesetsThe list of file sets containing the model.
If set, the modelDir is ignored.protected java.lang.StringmodelDefaultsThe model defaults.protected java.io.FilemodelDirDirectory holding the model files to be processed.
Ignored if fileset explicitly given.
-
Constructor Summary
Constructors Constructor Description AbstractWizardMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<java.lang.String,PackageInfo>createPackageMap()Creates a map of package names to package infos.voidexecute()protected org.tentackle.model.EntityAliasesgetEntityAliases()Gets the entity aliases.protected org.tentackle.model.ModelDefaultsgetModelDefaults()Gets the model defaults.<T extends Profile>
java.util.List<T>getProfiles(java.lang.Class<T> clazz)Gets the profiles.java.io.FilegetStatusDir()Gets the status directory.java.io.FilegetTemplateDir()Gets the template directory.protected voidinstallTemplates()Copies the templates to the template directory.
Overwrites any existing templates.protected voidloadModel()Loads the model.protected intprocessFileSet(org.apache.maven.shared.model.fileset.FileSet fileSet)Processes a fileset to load the model.protected voidvalidate()Validates the configuration.
-
-
-
Field Detail
-
modelDir
@Parameter(defaultValue="${project.build.directory}/wurbel/model", property="tentackle.modelDir") protected java.io.File modelDirDirectory holding the model files to be processed.
Ignored if fileset explicitly given.
-
modelDefaults
@Parameter(property="tentackle.modelDefaults") protected java.lang.String modelDefaults
The model defaults.
-
entityAliases
@Parameter(property="tentackle.entityAliases") protected java.lang.String entityAliases
The entity aliases.
-
filesets
@Parameter protected java.util.List<org.apache.maven.shared.model.fileset.FileSet> filesets
The list of file sets containing the model.
If set, the modelDir is ignored.
-
-
Method Detail
-
getProfiles
public <T extends Profile> java.util.List<T> getProfiles(java.lang.Class<T> clazz) throws org.apache.maven.plugin.MojoExecutionException
Gets the profiles.- Type Parameters:
T- the profile type- Parameters:
clazz- the concrete profile class- Returns:
- the list of profiles
- Throws:
org.apache.maven.plugin.MojoExecutionException- if profile names are not unique
-
getTemplateDir
public java.io.File getTemplateDir()
Gets the template directory.- Returns:
- the directory holding the wizard templates
-
getStatusDir
public java.io.File getStatusDir()
Gets the status directory.- Returns:
- the status dir
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
getModelDefaults
protected org.tentackle.model.ModelDefaults getModelDefaults() throws org.apache.maven.plugin.MojoExecutionExceptionGets the model defaults.- Returns:
- the defaults, null if none
- Throws:
org.apache.maven.plugin.MojoExecutionException- if parsing the model defaults failed
-
getEntityAliases
protected org.tentackle.model.EntityAliases getEntityAliases() throws org.apache.maven.plugin.MojoExecutionExceptionGets the entity aliases.- Returns:
- the aliases, null if none
- Throws:
org.apache.maven.plugin.MojoExecutionException- if parsing the aliases failed
-
loadModel
protected void loadModel() throws org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionExceptionLoads the model.Notice: the model is only needed by the
PdoMojo, but we configure it for the whole plugin.- Throws:
org.apache.maven.plugin.MojoFailureException- if the model is inconsistentorg.apache.maven.plugin.MojoExecutionException- if loading failed due to some other error
-
processFileSet
protected int processFileSet(org.apache.maven.shared.model.fileset.FileSet fileSet) throws org.apache.maven.plugin.MojoExecutionExceptionProcesses a fileset to load the model.- Parameters:
fileSet- the fileset containing the model- Returns:
- the number of errors
- Throws:
org.apache.maven.plugin.MojoExecutionException- if model defaults or entity aliases could not be determined
-
validate
protected void validate() throws org.apache.maven.plugin.MojoExecutionExceptionValidates the configuration.- Throws:
org.apache.maven.plugin.MojoExecutionException- if project not set or misconfigured
-
installTemplates
protected void installTemplates() throws org.apache.maven.plugin.MojoExecutionExceptionCopies the templates to the template directory.
Overwrites any existing templates.- Throws:
org.apache.maven.plugin.MojoExecutionException- if failed
-
createPackageMap
protected java.util.Map<java.lang.String,PackageInfo> createPackageMap() throws org.apache.maven.plugin.MojoExecutionException
Creates a map of package names to package infos.- Returns:
- the packages
- Throws:
org.apache.maven.plugin.MojoExecutionException- if split package detected
-
-