org.jvnet.jaxb2.maven2
Class AbstractXJC2Mojo<O>

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.jvnet.jaxb2.maven2.AbstractXJC2Mojo<O>
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
RawXJC2Mojo

public abstract class AbstractXJC2Mojo<O>
extends org.apache.maven.plugin.AbstractMojo


Field Summary
protected  String catalogResolver
           
protected  org.apache.maven.model.Dependency[] plugins
           
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractXJC2Mojo()
           
 
Method Summary
protected  List<URL> createResourceEntryUrls(ResourceEntry resourceEntry, String defaultDirectory, String[] defaultIncludes, String[] defaultExcludes)
           
 boolean getAddCompileSourceRoot()
           
 boolean getAddTestCompileSourceRoot()
           
 List<String> getArgs()
           A list of extra XJC's command-line arguments (items must include the dash '-').
 org.apache.maven.artifact.factory.ArtifactFactory getArtifactFactory()
          Used internally to resolve plugins to their jar files.
 org.apache.maven.artifact.metadata.ArtifactMetadataSource getArtifactMetadataSource()
           
 org.apache.maven.artifact.resolver.ArtifactResolver getArtifactResolver()
           
 File getBindingDirectory()
           The source directory containing the *.xjb binding files.
 String[] getBindingExcludes()
          A list of regular expression file search patterns to specify the binding files to be excluded from the bindingIncludes.
 String[] getBindingIncludes()
           A list of regular expression file search patterns to specify the binding files to be processed.
 ResourceEntry[] getBindings()
          A list of binding resources which could includes file sets, URLs, Maven artifact resources.
 File getCatalog()
          Specify the catalog file to resolve external entity references (xjc's -catalog option)
 String getCatalogResolver()
          Provides the class name of the catalog resolver.
protected  URL getCatalogURL()
           
 List getClasspathElements()
          Project classpath.
 boolean getDebug()
           If 'true', the XJC compiler is set to debug mode (xjc's -debug option).
 boolean getDisableDefaultExcludes()
          If 'true', maven's default exludes are NOT added to all the excludes lists.
 boolean getEpisode()
           
 File getEpisodeFile()
           
 org.apache.maven.model.Dependency[] getEpisodes()
           
 boolean getExtension()
          If 'true', the XJC binding compiler will run in the extension mode (xjc's -extension option).
 boolean getForceRegenerate()
          If 'true', no up-to-date check is performed and the XJC always re-generates the sources.
 File getGenerateDirectory()
           Generated code will be written under this directory.
 String getGeneratePackage()
           The generated classes will all be placed under this Java package (xjc's -p option), unless otherwise specified in the schemas.
 org.apache.maven.artifact.repository.ArtifactRepository getLocalRepository()
           
 org.apache.maven.project.MavenProjectBuilder getMavenProjectBuilder()
          Artifact factory, needed to download source jars.
protected abstract  OptionsFactory<O> getOptionsFactory()
           
 File[] getOtherDepends()
          A list of of input files or URLs to consider during the up-to-date.
 List<org.apache.maven.artifact.Artifact> getPluginArtifacts()
           
 org.apache.maven.model.Dependency[] getPlugins()
          XJC plugins to be made available to XJC.
 String[] getProduces()
           
 org.apache.maven.project.MavenProject getProject()
           
 boolean getReadOnly()
          If 'true', the generated Java source files are set as read-only (xjc's -readOnly option).
 boolean getRemoveOldOutput()
           If 'true', the [generateDirectory] dir will be deleted before the XJC binding compiler recompiles the source files.
 File getSchemaDirectory()
          The source directory containing *.xsd schema files.
 String[] getSchemaExcludes()
          A list of regular expression file search patterns to specify the schemas to be excluded from the schemaIncludes list.
 String[] getSchemaIncludes()
           A list of regular expression file search patterns to specify the schemas to be processed.
 String getSchemaLanguage()
          Type of input schema language.
 ResourceEntry[] getSchemas()
          A list of schema resources which could includes file sets, URLs, Maven artifact resources.
 String getSpecVersion()
           
 boolean getStrict()
          If 'true', Perform strict validation of the input schema (xjc's -nv option).
 boolean getVerbose()
           If 'true', the plugin and the XJC compiler are both set to verbose mode (xjc's -verbose option).
 boolean getWriteCode()
          If 'false', the plugin will not write the generated code to disk.
protected  void logApiConfiguration()
           
protected  void logConfiguration()
           
 void setAddCompileSourceRoot(boolean addCompileSourceRoot)
           
 void setAddTestCompileSourceRoot(boolean addTestCompileSourceRoot)
           
 void setArgs(List<String> args)
           
 void setArtifactFactory(org.apache.maven.artifact.factory.ArtifactFactory artifactFactory)
           
 void setArtifactMetadataSource(org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource)
           
 void setArtifactResolver(org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver)
           
 void setBindingDirectory(File bindingDirectory)
           
 void setBindingExcludes(String[] bindingExcludes)
           
 void setBindingIncludes(String[] bindingIncludes)
           
 void setBindings(ResourceEntry[] bindings)
           
 void setCatalog(File catalog)
           
 void setCatalogResolver(String catalogResolver)
           
 void setClasspathElements(List classpathElements)
           
 void setDebug(boolean debug)
           
 void setDisableDefaultExcludes(boolean disableDefaultExcludes)
           
 void setEpisode(boolean episode)
           
 void setEpisodeFile(File episodeFile)
           
 void setEpisodes(org.apache.maven.model.Dependency[] episodes)
           
 void setExtension(boolean extension)
           
 void setForceRegenerate(boolean forceRegenerate)
           
 void setGenerateDirectory(File generateDirectory)
           
 void setGeneratePackage(String generatePackage)
           
 void setLocalRepository(org.apache.maven.artifact.repository.ArtifactRepository localRepository)
           
 void setMavenProjectBuilder(org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder)
           
 void setOtherDepends(File[] otherDepends)
           
 void setPluginArtifacts(List<org.apache.maven.artifact.Artifact> plugingArtifacts)
           
 void setPlugins(org.apache.maven.model.Dependency[] plugins)
           
 void setProduces(String[] produces)
           
 void setProject(org.apache.maven.project.MavenProject project)
           
 void setReadOnly(boolean readOnly)
           
 void setRemoveOldOutput(boolean removeOldOutput)
           
 void setSchemaDirectory(File schemaDirectory)
           
 void setSchemaExcludes(String[] schemaExcludes)
           
 void setSchemaIncludes(String[] schemaIncludes)
           
 void setSchemaLanguage(String schemaLanguage)
           
 void setSchemas(ResourceEntry[] schemas)
           
 void setSpecVersion(String specVersion)
           
 void setStrict(boolean strict)
           
 void setVerbose(boolean verbose)
           
 void setWriteCode(boolean writeCode)
           
 
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

catalogResolver

protected String catalogResolver

plugins

protected org.apache.maven.model.Dependency[] plugins
Constructor Detail

AbstractXJC2Mojo

public AbstractXJC2Mojo()
Method Detail

getSchemaLanguage

public String getSchemaLanguage()
Type of input schema language. One of: DTD, XMLSCHEMA, RELAXNG, RELAXNG_COMPACT, WSDL, AUTODETECT. If unspecified, it is assumed AUTODETECT.


setSchemaLanguage

public void setSchemaLanguage(String schemaLanguage)

getSchemaDirectory

public File getSchemaDirectory()
The source directory containing *.xsd schema files. Notice that binding files are searched by default in this directory.


setSchemaDirectory

public void setSchemaDirectory(File schemaDirectory)

getSchemaIncludes

public String[] getSchemaIncludes()

A list of regular expression file search patterns to specify the schemas to be processed. Searching is based from the root of schemaDirectory.

If left udefined, then all *.xsd files in schemaDirectory will be processed.


setSchemaIncludes

public void setSchemaIncludes(String[] schemaIncludes)

getSchemaExcludes

public String[] getSchemaExcludes()
A list of regular expression file search patterns to specify the schemas to be excluded from the schemaIncludes list. Searching is based from the root of schemaDirectory.


setSchemaExcludes

public void setSchemaExcludes(String[] schemaExcludes)

getSchemas

public ResourceEntry[] getSchemas()
A list of schema resources which could includes file sets, URLs, Maven artifact resources.


setSchemas

public void setSchemas(ResourceEntry[] schemas)

setBindingDirectory

public void setBindingDirectory(File bindingDirectory)

getBindingDirectory

public File getBindingDirectory()

The source directory containing the *.xjb binding files.

If left undefined, then the schemaDirectory is assumed.


getBindingIncludes

public String[] getBindingIncludes()

A list of regular expression file search patterns to specify the binding files to be processed. Searching is based from the root of bindingDirectory.

If left undefined, then all *.xjb files in schemaDirectory will be processed.


setBindingIncludes

public void setBindingIncludes(String[] bindingIncludes)

getBindingExcludes

public String[] getBindingExcludes()
A list of regular expression file search patterns to specify the binding files to be excluded from the bindingIncludes. Searching is based from the root of bindingDirectory.


setBindingExcludes

public void setBindingExcludes(String[] bindingExcludes)

getBindings

public ResourceEntry[] getBindings()
A list of binding resources which could includes file sets, URLs, Maven artifact resources.


setBindings

public void setBindings(ResourceEntry[] bindings)

getDisableDefaultExcludes

public boolean getDisableDefaultExcludes()
If 'true', maven's default exludes are NOT added to all the excludes lists.


setDisableDefaultExcludes

public void setDisableDefaultExcludes(boolean disableDefaultExcludes)

getCatalog

public File getCatalog()
Specify the catalog file to resolve external entity references (xjc's -catalog option)

Support TR9401, XCatalog, and OASIS XML Catalog format. See the catalog-resolver sample and this article for details.


setCatalog

public void setCatalog(File catalog)

getCatalogURL

protected URL getCatalogURL()
                     throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

getCatalogResolver

public String getCatalogResolver()
Provides the class name of the catalog resolver.

Returns:
Class name of the catalog resolver.

setCatalogResolver

public void setCatalogResolver(String catalogResolver)

getGeneratePackage

public String getGeneratePackage()

The generated classes will all be placed under this Java package (xjc's -p option), unless otherwise specified in the schemas.

If left unspecified, the package will be derived from the schemas only.


setGeneratePackage

public void setGeneratePackage(String generatePackage)

getGenerateDirectory

public File getGenerateDirectory()

Generated code will be written under this directory.

For instance, if you specify generateDirectory="doe/ray" and generatePackage="org.here", then files are generated to doe/ray/org/here.


setGenerateDirectory

public void setGenerateDirectory(File generateDirectory)

getAddCompileSourceRoot

public boolean getAddCompileSourceRoot()

setAddCompileSourceRoot

public void setAddCompileSourceRoot(boolean addCompileSourceRoot)

getAddTestCompileSourceRoot

public boolean getAddTestCompileSourceRoot()

setAddTestCompileSourceRoot

public void setAddTestCompileSourceRoot(boolean addTestCompileSourceRoot)

getReadOnly

public boolean getReadOnly()
If 'true', the generated Java source files are set as read-only (xjc's -readOnly option).


setReadOnly

public void setReadOnly(boolean readOnly)

getExtension

public boolean getExtension()
If 'true', the XJC binding compiler will run in the extension mode (xjc's -extension option). Otherwise, it will run in the strict conformance mode.


setExtension

public void setExtension(boolean extension)

getStrict

public boolean getStrict()
If 'true', Perform strict validation of the input schema (xjc's -nv option).


setStrict

public void setStrict(boolean strict)

getWriteCode

public boolean getWriteCode()
If 'false', the plugin will not write the generated code to disk.


setWriteCode

public void setWriteCode(boolean writeCode)

getVerbose

public boolean getVerbose()

If 'true', the plugin and the XJC compiler are both set to verbose mode (xjc's -verbose option).

It is automatically set to 'true' when maven is run in debug mode (mvn's -X option).


setVerbose

public void setVerbose(boolean verbose)

getDebug

public boolean getDebug()

If 'true', the XJC compiler is set to debug mode (xjc's -debug option).

It is automatically set to 'true' when maven is run in debug mode (mvn's -X option).


setDebug

public void setDebug(boolean debug)

getArgs

public List<String> getArgs()

A list of extra XJC's command-line arguments (items must include the dash '-').

Arguments set here take precedence over other mojo parameters.


setArgs

public void setArgs(List<String> args)

getForceRegenerate

public boolean getForceRegenerate()
If 'true', no up-to-date check is performed and the XJC always re-generates the sources.


setForceRegenerate

public void setForceRegenerate(boolean forceRegenerate)

getRemoveOldOutput

public boolean getRemoveOldOutput()

If 'true', the [generateDirectory] dir will be deleted before the XJC binding compiler recompiles the source files.

Note that if set to 'false', the up-to-date check might not work, since XJC does not regenerate all files (i.e. files for "any" elements under 'xjc/org/w3/_2001/xmlschema' directory).


setRemoveOldOutput

public void setRemoveOldOutput(boolean removeOldOutput)

getProduces

public String[] getProduces()

setProduces

public void setProduces(String[] produces)

getOtherDepends

public File[] getOtherDepends()
A list of of input files or URLs to consider during the up-to-date. By default it always considers: 1. schema files, 2. binding files, 3. catalog file, and 4. the pom.xml file of the project executing this plugin.


setOtherDepends

public void setOtherDepends(File[] otherDepends)

getEpisodeFile

public File getEpisodeFile()

setEpisodeFile

public void setEpisodeFile(File episodeFile)

getEpisode

public boolean getEpisode()

setEpisode

public void setEpisode(boolean episode)

getClasspathElements

public List getClasspathElements()
Project classpath. Used internally when runing the XJC compiler.


setClasspathElements

public void setClasspathElements(List classpathElements)

getPlugins

public org.apache.maven.model.Dependency[] getPlugins()
XJC plugins to be made available to XJC. They still need to be activated by using <args> and enable plugin activation option.


setPlugins

public void setPlugins(org.apache.maven.model.Dependency[] plugins)

getEpisodes

public org.apache.maven.model.Dependency[] getEpisodes()

setEpisodes

public void setEpisodes(org.apache.maven.model.Dependency[] episodes)

getSpecVersion

public String getSpecVersion()

setSpecVersion

public void setSpecVersion(String specVersion)

logConfiguration

protected void logConfiguration()
                         throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

getProject

public org.apache.maven.project.MavenProject getProject()

setProject

public void setProject(org.apache.maven.project.MavenProject project)

getArtifactResolver

public org.apache.maven.artifact.resolver.ArtifactResolver getArtifactResolver()

setArtifactResolver

public void setArtifactResolver(org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver)

getArtifactMetadataSource

public org.apache.maven.artifact.metadata.ArtifactMetadataSource getArtifactMetadataSource()

setArtifactMetadataSource

public void setArtifactMetadataSource(org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource)

getArtifactFactory

public org.apache.maven.artifact.factory.ArtifactFactory getArtifactFactory()
Used internally to resolve plugins to their jar files.


setArtifactFactory

public void setArtifactFactory(org.apache.maven.artifact.factory.ArtifactFactory artifactFactory)

getLocalRepository

public org.apache.maven.artifact.repository.ArtifactRepository getLocalRepository()

setLocalRepository

public void setLocalRepository(org.apache.maven.artifact.repository.ArtifactRepository localRepository)

getMavenProjectBuilder

public org.apache.maven.project.MavenProjectBuilder getMavenProjectBuilder()
Artifact factory, needed to download source jars.


setMavenProjectBuilder

public void setMavenProjectBuilder(org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder)

logApiConfiguration

protected void logApiConfiguration()

getPluginArtifacts

public List<org.apache.maven.artifact.Artifact> getPluginArtifacts()

setPluginArtifacts

public void setPluginArtifacts(List<org.apache.maven.artifact.Artifact> plugingArtifacts)

createResourceEntryUrls

protected List<URL> createResourceEntryUrls(ResourceEntry resourceEntry,
                                            String defaultDirectory,
                                            String[] defaultIncludes,
                                            String[] defaultExcludes)
                                     throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

getOptionsFactory

protected abstract OptionsFactory<O> getOptionsFactory()


Copyright © 2006-2011. All Rights Reserved.