org.jibx.maven
Class AbstractJibxMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.jibx.maven.AbstractJibxMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
AbstractBaseBindingMojo, AbstractCodeGenMojo, DocumentCompareMojo

public abstract class AbstractJibxMojo
extends org.apache.maven.plugin.AbstractMojo

Runs the JiBX binding compiler.

Author:
Andreas Brenk, Frank Mena, Don Corley

Field Summary
protected  org.apache.maven.project.MavenProject project
          The maven project.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractJibxMojo()
           
 
Method Summary
 List<String> addDependentArtifact(org.apache.maven.artifact.Artifact artifact, IncludeBaseBinding includeDependentBinding, List<String> bindingSet)
           
 List<String> addDependentBinding(IncludeBaseBinding includeDependentBinding, List<String> bindingSet)
          Add bindings that are containted in artifacts.
 List<String> addManualDependentBinding(IncludeBaseBinding includeDependentBinding, List<String> bindingSet)
          Add bindings on the filesystem.
protected  void checkConfiguration()
          Verifies the plugins configuration and sets default values if needed.
abstract  void execute()
          Determines if running in single- or multi-module mode, collects all bindings and finally runs the binding compiler.
 List<String> extractBaseBindingFile(List<String> pathList, ZipFile zip, String directory, String groupId, String artifactId, String filePathInJar)
          Extract the base binding file(s) from the dependent artifacts.
protected  String fixFilePath(String filePath, String defaultPath)
          Fix this file path.
protected  String getBaseBindingDirectory()
          Get the base binding files directory.
 String[] getBaseBindings(String[] bindings)
          Get the binding path name for a includeBaseBinding binding.
 String getFullPath(String dir)
          Fix this directory path so it starts at the root project dir.
protected  List<String> getIncludedFiles(String path, ArrayList<String> includeFiles, ArrayList<String> excludeFiles)
          Returns all bindings in the given directory according to the configured include/exclude patterns.
protected  String getProjectBasedir(org.apache.maven.project.MavenProject project)
          Returns the basedir of the given project.
protected abstract  Set<String> getProjectCompileClasspathElements(org.apache.maven.project.MavenProject project)
          Returns the build output directory of the given project.
protected  String getSchemaBindingDirectory()
          Get the binding files directory.
 
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
 

Field Detail

project

protected org.apache.maven.project.MavenProject project
The maven project.

Constructor Detail

AbstractJibxMojo

public AbstractJibxMojo()
Method Detail

execute

public abstract void execute()
                      throws org.apache.maven.plugin.MojoExecutionException,
                             org.apache.maven.plugin.MojoFailureException
Determines if running in single- or multi-module mode, collects all bindings and finally runs the binding compiler.

Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException

getProjectBasedir

protected String getProjectBasedir(org.apache.maven.project.MavenProject project)
Returns the basedir of the given project.


checkConfiguration

protected void checkConfiguration()
Verifies the plugins configuration and sets default values if needed. Note: Remember to call inherited methods first.


getIncludedFiles

protected List<String> getIncludedFiles(String path,
                                        ArrayList<String> includeFiles,
                                        ArrayList<String> excludeFiles)
                                 throws org.apache.maven.plugin.MojoExecutionException,
                                        org.apache.maven.plugin.MojoFailureException
Returns all bindings in the given directory according to the configured include/exclude patterns.

Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException

fixFilePath

protected String fixFilePath(String filePath,
                             String defaultPath)
Fix this file path. If it is absolute, leave it alone, if it is relative prepend the default path or the base path.

Parameters:
filePath - The path to fix
defaultPath - The base path to use.
Returns:
The absolute path to this file.

getProjectCompileClasspathElements

protected abstract Set<String> getProjectCompileClasspathElements(org.apache.maven.project.MavenProject project)
                                                           throws org.apache.maven.plugin.MojoExecutionException
Returns the build output directory of the given project.

Throws:
org.apache.maven.plugin.MojoExecutionException - if DependencyResolutionRequiredException occurs

getBaseBindings

public String[] getBaseBindings(String[] bindings)
Get the binding path name for a includeBaseBinding binding. This method actually unjars the binding file(s) from dependent resources.

Parameters:
basedir -
includeBinding -
Returns:

addManualDependentBinding

public List<String> addManualDependentBinding(IncludeBaseBinding includeDependentBinding,
                                              List<String> bindingSet)
Add bindings on the filesystem.

Parameters:
includeDependentBinding -
bindingSet -
Returns:

addDependentBinding

public List<String> addDependentBinding(IncludeBaseBinding includeDependentBinding,
                                        List<String> bindingSet)
Add bindings that are containted in artifacts.

Parameters:
includeDependentBinding -
bindingSet -
Returns:

addDependentArtifact

public List<String> addDependentArtifact(org.apache.maven.artifact.Artifact artifact,
                                         IncludeBaseBinding includeDependentBinding,
                                         List<String> bindingSet)

extractBaseBindingFile

public List<String> extractBaseBindingFile(List<String> pathList,
                                           ZipFile zip,
                                           String directory,
                                           String groupId,
                                           String artifactId,
                                           String filePathInJar)
Extract the base binding file(s) from the dependent artifacts.

Parameters:
pathList -
zip -
directory -
groupId -
artifactId -
filePathInJar -
Returns:

getBaseBindingDirectory

protected String getBaseBindingDirectory()
Get the base binding files directory.

Returns:
The binding files directory.

getSchemaBindingDirectory

protected String getSchemaBindingDirectory()
Get the binding files directory.

Returns:
The binding files directory.

getFullPath

public String getFullPath(String dir)
Fix this directory path so it starts at the root project dir.

Parameters:
dir -
Returns:


Copyright © 2005-2011 jibx.org. All Rights Reserved.