org.codehaus.mojo.jaxb2
Class AbstractXjcMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.codehaus.mojo.jaxb2.AbstractXjcMojo
All Implemented Interfaces:
ContextEnabled, Mojo
Direct Known Subclasses:
TestXjcMojo, XjcMojo

public abstract class AbstractXjcMojo
extends AbstractMojo

Abstract class for for parsing xsd and binding resources to produce a corresponding object model based on the JAXB Xjc parsing engine


Field Summary
protected  String arguments
          Space separated string of extra arguments, for instance -Xfluent-api -episode somefile; These will be passed on to XJC as "-Xfluent-api" "-episode" "somefile" options.
protected  String bindingFiles
          List of files to use for bindings, comma delimited.
protected  File catalog
          Catalog file to resolve external entity references support TR9401, XCatalog, and OASIS XML Catalog format.
protected  boolean clearOutputDir
          Clears the output directory on each run.
protected  boolean dtd
          Treat input schemas as XML DTD (experimental, unsupported).
protected  boolean explicitAnnotation
          Allow generation of explicit annotations that are needed for JAXB2 to work on RetroTranslator.
protected  boolean extension
          Allow to use the JAXB Vendor Extensions.
protected  boolean failOnNoSchemas
          Fails the mojo if no schemas are found.
protected  File generatedResourcesDirectory
          The optional directory where generated resources can be placed, generated by addons/plugins.
protected  String httpproxy
          Set HTTP/HTTPS proxy.
protected  String includeSchemasOutputPath
          The output path to include in your jar/war/etc if you wish to include your schemas in your artifact.
protected  boolean npa
          Suppress generation of package level annotations (package-info.java).
protected  boolean nv
          Do not perform strict validation of the input schema(s).
protected  String packageName
          The package in which the source files will be generated.
protected  boolean quiet
          Suppress compiler output.
protected  boolean readOnly
          Generated files will be in read-only mode.
protected  boolean relaxng
          Treat input schemas as RELAX NG (experimental, unsupported).
protected  boolean relaxngCompact
          Treat input as RELAX NG compact syntax (experimental,unsupported).
protected  String schemaFiles
          List of files to use for schemas, comma delimited.
protected  String schemaListFileName
          A filename containing the list of files to use for schemas, comma delimited.
protected  String target
          Avoid generating code that relies on any current JAXB 2.x features.
protected  boolean verbose
          Be extra verbose.
protected  boolean wsdl
          Treat input as WSDL and compile schemas inside it (experimental,unsupported).
protected  boolean xmlschema
          Treat input as W3C XML Schema (default).
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractXjcMojo()
           
 
Method Summary
protected abstract  void addCompileSourceRoot(MavenProject project)
           
protected abstract  void addResource(MavenProject project, Resource resource)
           
protected  void copyXSDs()
           
 void execute()
           
protected abstract  File getBindingDirectory()
           
 File[] getBindingFiles()
          Returns a file array of xjb files to translate to object models.
protected abstract  List getClasspathElements(MavenProject project)
           
protected abstract  File getOutputDirectory()
           
protected abstract  File getSchemaDirectory()
           
protected  void getSchemasFromFileListing(List<URL> files)
          getSchemasFromFileListing gets all the entries in the given schemaListFileName and adds them to the list of files to send to xjc
protected abstract  File getStaleFile()
           
 URL[] getXSDFiles()
          Returns a file array of xsd files to translate to object models.
 
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

generatedResourcesDirectory

protected File generatedResourcesDirectory
The optional directory where generated resources can be placed, generated by addons/plugins.

Is defined by:

packageName

protected String packageName
The package in which the source files will be generated.

Is defined by:

catalog

protected File catalog
Catalog file to resolve external entity references support TR9401, XCatalog, and OASIS XML Catalog format.

Is defined by:

httpproxy

protected String httpproxy
Set HTTP/HTTPS proxy. Format is [user[:password]@]proxyHost[:proxyPort]

Is defined by:

bindingFiles

protected String bindingFiles
List of files to use for bindings, comma delimited. If none, then all xjb files are used in the bindingDirectory.

Is defined by:

schemaFiles

protected String schemaFiles
List of files to use for schemas, comma delimited. If none, then all xsd files are used in the schemaDirectory. Note: you can only use either the 'schemaFiles' or the 'schemaListFileName' option (you may not use both at once!).

Is defined by:

schemaListFileName

protected String schemaListFileName
A filename containing the list of files to use for schemas, comma delimited. If none, then all xsd files are used in the schemaDirectory. Note: you can only use either the 'schemaFiles' or the 'schemaListFileName' option (you may not use both at once!).

Is defined by:

dtd

protected boolean dtd
Treat input schemas as XML DTD (experimental, unsupported).

Is defined by:
default-value:
false

npa

protected boolean npa
Suppress generation of package level annotations (package-info.java).

Is defined by:
default-value:
false

nv

protected boolean nv
Do not perform strict validation of the input schema(s).

Is defined by:
default-value:
false

relaxng

protected boolean relaxng
Treat input schemas as RELAX NG (experimental, unsupported).

Is defined by:
default-value:
false

relaxngCompact

protected boolean relaxngCompact
Treat input as RELAX NG compact syntax (experimental,unsupported).

Is defined by:
default-value:
false

quiet

protected boolean quiet
Suppress compiler output.

Is defined by:
default-value:
false

readOnly

protected boolean readOnly
Generated files will be in read-only mode.

Is defined by:
default-value:
false

verbose

protected boolean verbose
Be extra verbose.

Is defined by:
default-value:
false

wsdl

protected boolean wsdl
Treat input as WSDL and compile schemas inside it (experimental,unsupported).

Is defined by:
default-value:
false

xmlschema

protected boolean xmlschema
Treat input as W3C XML Schema (default).

Is defined by:
default-value:
true

extension

protected boolean extension
Allow to use the JAXB Vendor Extensions.

Is defined by:
default-value:
false

explicitAnnotation

protected boolean explicitAnnotation
Allow generation of explicit annotations that are needed for JAXB2 to work on RetroTranslator.

Is defined by:
default-value:
false

arguments

protected String arguments
Space separated string of extra arguments, for instance -Xfluent-api -episode somefile; These will be passed on to XJC as "-Xfluent-api" "-episode" "somefile" options.

Is defined by:
expression:
${xjc.arguments}

includeSchemasOutputPath

protected String includeSchemasOutputPath
The output path to include in your jar/war/etc if you wish to include your schemas in your artifact.

Is defined by:

clearOutputDir

protected boolean clearOutputDir
Clears the output directory on each run. Defaults to 'true' but if false, will not clear the directory.

Is defined by:
default-value:
true

target

protected String target
Avoid generating code that relies on any current JAXB 2.x features. This will allow the generated code to run with earlier JAXB 2.x runtime.

Since:
1.3
Is defined by:

failOnNoSchemas

protected boolean failOnNoSchemas
Fails the mojo if no schemas are found.

Since:
1.3
Is defined by:
default-value:
true
Constructor Detail

AbstractXjcMojo

public AbstractXjcMojo()
Method Detail

execute

public void execute()
             throws MojoExecutionException
Throws:
MojoExecutionException

addCompileSourceRoot

protected abstract void addCompileSourceRoot(MavenProject project)

addResource

protected abstract void addResource(MavenProject project,
                                    Resource resource)

copyXSDs

protected void copyXSDs()
                 throws MojoExecutionException
Throws:
MojoExecutionException

getSchemasFromFileListing

protected void getSchemasFromFileListing(List<URL> files)
                                  throws MojoExecutionException
getSchemasFromFileListing gets all the entries in the given schemaListFileName and adds them to the list of files to send to xjc

Throws:
MojoExecutionException - if an error occurs

getBindingFiles

public final File[] getBindingFiles()
Returns a file array of xjb files to translate to object models.

Returns:
An array of schema files to be parsed by the schema compiler.

getXSDFiles

public final URL[] getXSDFiles()
                        throws MojoExecutionException
Returns a file array of xsd files to translate to object models.

Returns:
An array of schema files to be parsed by the schema compiler.
Throws:
MojoExecutionException

getStaleFile

protected abstract File getStaleFile()

getOutputDirectory

protected abstract File getOutputDirectory()

getSchemaDirectory

protected abstract File getSchemaDirectory()

getBindingDirectory

protected abstract File getBindingDirectory()

getClasspathElements

protected abstract List getClasspathElements(MavenProject project)
                                      throws DependencyResolutionRequiredException
Throws:
DependencyResolutionRequiredException


Copyright © 2005-2012 Codehaus. All Rights Reserved.