org.codehaus.mojo.xmlbeans
Class AbstractXmlBeansPlugin

java.lang.Object
  extended byorg.apache.maven.plugin.AbstractMojo
      extended byorg.codehaus.mojo.xmlbeans.AbstractXmlBeansPlugin
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.codehaus.mojo.xmlbeans.PluginProperties
Direct Known Subclasses:
CompileXmlBeansMojo, TestXmlBeansMojo

public abstract class AbstractXmlBeansPlugin
extends org.apache.maven.plugin.AbstractMojo
implements org.codehaus.mojo.xmlbeans.PluginProperties

A Maven 2 plugin which parses xsd files and produces a corresponding object model based on the Apache XML Beans parser.

The plugin produces two sets of output files referred to as generated sources and generated classes. The former is then compiled to the build outputDirectory. The latter is generated in this directory.

Note that the descriptions for the goal's parameters have been blatently copied from http://xmlbeans.apache.org/docs/2.0.0/guide/antXmlbean.html for convenience.

Version:
$Id$
Author:
Brett Porter, Kris Bravo

Field Summary
protected  org.apache.maven.project.MavenProject project
          A reference to the Maven Project metadata.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractXmlBeansPlugin()
          Empty constructor for the XML Beans plugin.
 
Method Summary
 void execute()
          Map the parameters to the schema compilers parameter object, make sure the necessary output directories exist, then call on the schema compiler to produce the java objects and supporting resources.
abstract  java.io.File getBaseDir()
          Returns the directory where the schemas are located.
 java.io.File[] getClasspath()
          Returns a classpath for the compiler made up of artifacts from the project.
 java.lang.String getCompiler()
          Returns null.
 java.io.File[] getConfigFiles()
          Returns configuration files identified in the xmlConfigs string passed by the project configuration.
abstract  java.io.File getDefaultXmlConfigDir()
           
 org.xml.sax.EntityResolver getEntityResolver()
          Returns a null entity resolver.
 java.util.Collection getErrorListeners()
          Returns an empty collection the compiler will store error message Strings in.
 java.util.List getExtensions()
          Todo: Not certain of the purpose of this.
 java.io.File getGeneratedClassesDirectory()
          Returns the class directory of the project.
protected abstract  java.io.File getGeneratedSchemaDirectory()
           
 java.io.File getGeneratedSourceDirectory()
          Returns the directory for saving generated source files.
 java.io.File[] getJavaFiles()
          An array of other source files.
 java.lang.String getJavaSource()
          Returns the javasource parameter which specifies an option to the XmlBeans code generator.
 java.util.Set getMdefNamespaces()
          Returns null at this time.
 java.lang.String getMemoryInitialSize()
          Returns the initial size of the memory allocation for the schema compile process.
 java.lang.String getMemoryMaximumSize()
          Returns the maximum size of the memory allocation for the schema compile process.
 java.lang.String getName()
          Returns null at this time.
 java.io.File getOutputJar()
          Returns the location of the output jar file should one be produced.
 java.lang.String getRepackage()
          Todo: Not certain of the purpose of this.
abstract  java.io.File getSchemaDirectory()
          Returns the directory where the schemas are located.
abstract  java.io.File getStaleFile()
           
 java.io.File[] getWsdlFiles()
          Currently returns an empty file array.
 java.io.File[] getXsdFiles()
          Returns a file array of xsd files to translate to object models.
protected abstract  java.util.List getXsdJars()
           
 boolean isDebug()
          Returns the state of debuggin.
 boolean isDownload()
          Returns true if dependencies are to be downloaded by the schema compiler.
 boolean isJaxb()
          Returns true if jaxb is set.
 boolean isNoJavac()
          Returns True if generated source files are not to be compiled.
 boolean isNoPvr()
          Do not enforce the particle valid (restriction) rule if true.
 boolean isNoUpa()
          If true, do not enforce the unique particle attribution rule.
 boolean isQuiet()
          Returns true if the schema compiler should reduce verbosity.
 boolean isVerbose()
          Returns true if the schema compiler should increase verbosity.
 void setLocalRepository(org.apache.maven.artifact.repository.ArtifactRepository repository)
          Gives the plugin a reference to the local repository.
 void setPluginArtifacts(java.util.List pluginArtifacts)
           
protected abstract  void updateProject(org.apache.maven.project.MavenProject project, org.apache.xmlbeans.impl.tool.SchemaCompiler.Parameters compilerParams)
           
 void validate()
          No validation beyond those done by the maven plugin occur at this time.
 
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
A reference to the Maven Project metadata.

Constructor Detail

AbstractXmlBeansPlugin

public AbstractXmlBeansPlugin()
Empty constructor for the XML Beans plugin.

Method Detail

execute

public final void execute()
                   throws org.apache.maven.plugin.MojoExecutionException

Map the parameters to the schema compilers parameter object, make sure the necessary output directories exist, then call on the schema compiler to produce the java objects and supporting resources.

Specified by:
execute in interface org.apache.maven.plugin.Mojo
Throws:
org.apache.maven.plugin.MojoExecutionException - Errors occurred during compile.

updateProject

protected abstract void updateProject(org.apache.maven.project.MavenProject project,
                                      org.apache.xmlbeans.impl.tool.SchemaCompiler.Parameters compilerParams)
                               throws org.apache.maven.artifact.DependencyResolutionRequiredException
Throws:
org.apache.maven.artifact.DependencyResolutionRequiredException

getXsdJars

protected abstract java.util.List getXsdJars()

getGeneratedSchemaDirectory

protected abstract java.io.File getGeneratedSchemaDirectory()

setLocalRepository

public final void setLocalRepository(org.apache.maven.artifact.repository.ArtifactRepository repository)
Gives the plugin a reference to the local repository.

Parameters:
repository - The local repository.

getBaseDir

public abstract java.io.File getBaseDir()
Description copied from interface: org.codehaus.mojo.xmlbeans.PluginProperties
Returns the directory where the schemas are located. Note that this is the base directory of the schema compiler, not the maven project.

Specified by:
getBaseDir in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
The schema directory.

getStaleFile

public abstract java.io.File getStaleFile()

getDefaultXmlConfigDir

public abstract java.io.File getDefaultXmlConfigDir()

getSchemaDirectory

public abstract java.io.File getSchemaDirectory()
Returns the directory where the schemas are located. Note that this is the base directory of the schema compiler, not the maven project.

Returns:
The schema directory.

getClasspath

public final java.io.File[] getClasspath()
Returns a classpath for the compiler made up of artifacts from the project.

Specified by:
getClasspath in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
Array of classpath entries.

getCompiler

public final java.lang.String getCompiler()
Returns null. Currently the compiler preference isn't passwed to the xml beans compiler.

Specified by:
getCompiler in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
null.

getConfigFiles

public final java.io.File[] getConfigFiles()
                                    throws XmlBeansException
Returns configuration files identified in the xmlConfigs string passed by the project configuration. If none were identified, a check is made for the default xsd config directory src/xsdconfig.

Specified by:
getConfigFiles in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
An array of configuration files.
Throws:
XmlBeansException

getEntityResolver

public final org.xml.sax.EntityResolver getEntityResolver()
Returns a null entity resolver.

Specified by:
getEntityResolver in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
entityResolver set to null.

getErrorListeners

public final java.util.Collection getErrorListeners()
Returns an empty collection the compiler will store error message Strings in.

Specified by:
getErrorListeners in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
An empty ArrayList.

getExtensions

public final java.util.List getExtensions()
Todo: Not certain of the purpose of this.

Specified by:
getExtensions in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
null at this time.

getJavaFiles

public final java.io.File[] getJavaFiles()
An array of other source files. Currently an empty array.

Specified by:
getJavaFiles in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
An empty file array.

getMdefNamespaces

public final java.util.Set getMdefNamespaces()
Returns null at this time. Passed to the schema compiler.

Specified by:
getMdefNamespaces in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
null.

getJavaSource

public final java.lang.String getJavaSource()
Description copied from interface: org.codehaus.mojo.xmlbeans.PluginProperties
Returns the javasource parameter which specifies an option to the XmlBeans code generator.

Specified by:
getJavaSource in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
null.

getMemoryInitialSize

public final java.lang.String getMemoryInitialSize()
Returns the initial size of the memory allocation for the schema compile process.

Specified by:
getMemoryInitialSize in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
The initial memory size value.

getMemoryMaximumSize

public final java.lang.String getMemoryMaximumSize()
Returns the maximum size of the memory allocation for the schema compile process.

Specified by:
getMemoryMaximumSize in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
The max memory size value.

getName

public final java.lang.String getName()
Returns null at this time. This is passed to the schema compiler.

Specified by:
getName in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
null.

getOutputJar

public final java.io.File getOutputJar()
Returns the location of the output jar file should one be produced.

Specified by:
getOutputJar in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
The jar file location.

getRepackage

public final java.lang.String getRepackage()
Todo: Not certain of the purpose of this.

Specified by:
getRepackage in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
null at this time.

getWsdlFiles

public final java.io.File[] getWsdlFiles()
Currently returns an empty file array.

Specified by:
getWsdlFiles in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
An empty file array.

getXsdFiles

public final java.io.File[] getXsdFiles()
                                 throws XmlBeansException
Returns a file array of xsd files to translate to object models.

Specified by:
getXsdFiles in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
An array of schema files to be parsed by the schema compiler.
Throws:
XmlBeansException

isDebug

public final boolean isDebug()
Returns the state of debuggin.

Specified by:
isDebug in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
true if debug mode.

isDownload

public final boolean isDownload()
Returns true if dependencies are to be downloaded by the schema compiler.

Specified by:
isDownload in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
true if resources should be downloaded.

isJaxb

public final boolean isJaxb()
Returns true if jaxb is set.

Specified by:
isJaxb in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
true if the jaxb flag on the schema compiler should be set.

isNoJavac

public final boolean isNoJavac()
Returns True if generated source files are not to be compiled.

Specified by:
isNoJavac in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
true if no compiling should occur.

isNoPvr

public final boolean isNoPvr()
Do not enforce the particle valid (restriction) rule if true.

Specified by:
isNoPvr in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
true if no enforcement should occur.

isNoUpa

public final boolean isNoUpa()
If true, do not enforce the unique particle attribution rule.

Specified by:
isNoUpa in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
particle attibution enforcement

isQuiet

public final boolean isQuiet()
Returns true if the schema compiler should reduce verbosity.

Specified by:
isQuiet in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
true if message suppression is on.

isVerbose

public final boolean isVerbose()
Returns true if the schema compiler should increase verbosity.

Specified by:
isVerbose in interface org.codehaus.mojo.xmlbeans.PluginProperties
Returns:
true if verbose mode is on.

validate

public final void validate()
                    throws XmlBeansException
No validation beyond those done by the maven plugin occur at this time.

Specified by:
validate in interface org.codehaus.mojo.xmlbeans.PluginProperties
Throws:
XmlBeansException - Currently not used.

setPluginArtifacts

public void setPluginArtifacts(java.util.List pluginArtifacts)

getGeneratedSourceDirectory

public java.io.File getGeneratedSourceDirectory()
Returns the directory for saving generated source files.

Returns:
The generated=sources directory.

getGeneratedClassesDirectory

public java.io.File getGeneratedClassesDirectory()
Returns the class directory of the project.

Returns:
The project build classes directory.


Copyright © {inceptionYear}-2007 null. All Rights Reserved.