org.codehaus.enunciate.modules.xml
Class XMLDeploymentModule

java.lang.Object
  extended by org.codehaus.enunciate.modules.BasicDeploymentModule
      extended by org.codehaus.enunciate.modules.FreemarkerDeploymentModule
          extended by org.codehaus.enunciate.modules.xml.XMLDeploymentModule
All Implemented Interfaces:
EnunciateModelAware, DeploymentModule

public class XMLDeploymentModule
extends FreemarkerDeploymentModule

XML Module

The XML deployment module generates the consolidated WSDLs and schemas for the API..

Steps

generate

The only significant step in the XML deployment module is the "generate" step. This step generates the WSDLs and schemas for the API.

Configuration

The configuration for the XML deployment module is specified by the "xml" child element of the "modules" element of the enunciate configuration file. It supports the following attributes:

The "schema" element(s)

The "xml" element supports an arbitrary number of "schema" child elements that are used to configure the schema for a specified namespace. It supports the following attributes:

The "schema" element also supports a nested subelement, "appinfo" whose contents will be inlined into the schema "appinfo" annotation.

The "wsdl" element(s)

The "xml" element supports an arbitrary number of "wsdl" child elements that are used to configure the wsdl for a specified namespace. It supports the following attributes:

Artifacts

The XML deployment module exports artifacts for each WSDL and schema produced. The id of the artifact is the name of the prefix for the namespace of hte file appended with ".wsdl" (for wsdls) and ".xsd" (for schemas).

Author:
Ryan Heaton

Field Summary
 
Fields inherited from class org.codehaus.enunciate.modules.BasicDeploymentModule
enunciate
 
Constructor Summary
XMLDeploymentModule()
           
 
Method Summary
 void addSchemaConfig(SchemaConfig config)
          Add a custom schema configuration.
 void addWsdlConfig(WsdlConfig config)
          Add a custom wsdl configuration.
 void doFreemarkerGenerate()
          Generate using Freemarker.
 org.apache.commons.digester.RuleSet getConfigurationRules()
          Default implementation returns null.
 java.lang.String getName()
          The name of the deployment module.
protected  freemarker.template.ObjectWrapper getObjectWrapper()
          The object wrapper to use for the model.
protected  java.net.URL getTemplateURL()
          The URL to "xml.fmt".
 Validator getValidator()
          Get the validator for this module, or null if none.
 void init(Enunciate enunciate)
          Sets the enunciate mechanism.
 void initModel(EnunciateFreemarkerModel model)
          Initialize the model.
 boolean isDisableWadl()
          Whether to disable the WADL.
protected  boolean isUpToDate(java.io.File artifactDir)
          Whether the artifact directory is up-to-date.
protected  void prettyPrint(java.io.File file)
          Pretty-prints the specified xml file.
 void setDisableWadl(boolean disableWadl)
          Whether to disable the WADL.
 void setInlineWSDLSchemas(boolean inlineWSDLSchemas)
          Whether to inline the WSDL schemas.
 void setPrettyPrint(boolean prettyPrint)
          Whether to pretty-print the xml.
 void setValidateSchemas(boolean validateSchemas)
          Whether to validate the generated schemas in an attempt to catch possible errors that enunciate might have missed.
 
Methods inherited from class org.codehaus.enunciate.modules.FreemarkerDeploymentModule
close, doGenerate, getConfiguration, getModel, getModelInternal, getTemplateExceptionHandler, getTemplateLoader, processTemplate, processTemplate, processTemplate, processTemplate
 
Methods inherited from class org.codehaus.enunciate.modules.BasicDeploymentModule
debug, doBuild, doCompile, doPackage, getAliases, getBuildDir, getCompileDir, getEnunciate, getGenerateDir, getOrder, getPackageDir, info, isDisabled, setBuildDir, setCompileDir, setDisabled, setGenerateDir, setPackageDir, step, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLDeploymentModule

public XMLDeploymentModule()
Method Detail

getName

public java.lang.String getName()
Description copied from interface: DeploymentModule
The name of the deployment module. Identifies its section in the enunciate configuration.

Specified by:
getName in interface DeploymentModule
Overrides:
getName in class BasicDeploymentModule
Returns:
"xml"

getTemplateURL

protected java.net.URL getTemplateURL()
The URL to "xml.fmt".

Returns:
The URL to "xml.fmt".

addSchemaConfig

public void addSchemaConfig(SchemaConfig config)
Add a custom schema configuration.

Parameters:
config - The configuration to add.

addWsdlConfig

public void addWsdlConfig(WsdlConfig config)
Add a custom wsdl configuration.

Parameters:
config - The configuration to add.

init

public void init(Enunciate enunciate)
          throws EnunciateException
Description copied from class: BasicDeploymentModule
Sets the enunciate mechanism.

Specified by:
init in interface DeploymentModule
Overrides:
init in class BasicDeploymentModule
Parameters:
enunciate - The enunciate mechanism.
Throws:
EnunciateException

initModel

public void initModel(EnunciateFreemarkerModel model)
Description copied from interface: EnunciateModelAware
Initialize the model.

Specified by:
initModel in interface EnunciateModelAware
Overrides:
initModel in class FreemarkerDeploymentModule
Parameters:
model - The model to initialize.

doFreemarkerGenerate

public void doFreemarkerGenerate()
                          throws java.io.IOException,
                                 freemarker.template.TemplateException
Description copied from class: FreemarkerDeploymentModule
Generate using Freemarker. Same as FreemarkerDeploymentModule.doGenerate() but can throw a TemplateException.

Specified by:
doFreemarkerGenerate in class FreemarkerDeploymentModule
Throws:
java.io.IOException
freemarker.template.TemplateException

isUpToDate

protected boolean isUpToDate(java.io.File artifactDir)
Whether the artifact directory is up-to-date.

Parameters:
artifactDir - The artifact directory.
Returns:
Whether the artifact directory is up-to-date.

prettyPrint

protected void prettyPrint(java.io.File file)
Pretty-prints the specified xml file.

Parameters:
file - The file to pretty-print.

getObjectWrapper

protected freemarker.template.ObjectWrapper getObjectWrapper()
Description copied from class: FreemarkerDeploymentModule
The object wrapper to use for the model.

Overrides:
getObjectWrapper in class FreemarkerDeploymentModule
Returns:
The object wrapper to use for the model.

getConfigurationRules

public org.apache.commons.digester.RuleSet getConfigurationRules()
Description copied from class: BasicDeploymentModule
Default implementation returns null.

Specified by:
getConfigurationRules in interface DeploymentModule
Overrides:
getConfigurationRules in class BasicDeploymentModule
Returns:
null.

getValidator

public Validator getValidator()
Description copied from interface: DeploymentModule
Get the validator for this module, or null if none.

Specified by:
getValidator in interface DeploymentModule
Overrides:
getValidator in class BasicDeploymentModule
Returns:
null

setPrettyPrint

public void setPrettyPrint(boolean prettyPrint)
Whether to pretty-print the xml.

Parameters:
prettyPrint - Whether to pretty-print the xml.

setValidateSchemas

public void setValidateSchemas(boolean validateSchemas)
Whether to validate the generated schemas in an attempt to catch possible errors that enunciate might have missed.

Parameters:
validateSchemas - Whether to validate the generated schemas in an attempt to catch possible errors that enunciate might have missed.

setInlineWSDLSchemas

public void setInlineWSDLSchemas(boolean inlineWSDLSchemas)
Whether to inline the WSDL schemas.

Parameters:
inlineWSDLSchemas - Whether to inline the WSDL schemas.

isDisableWadl

public boolean isDisableWadl()
Whether to disable the WADL.

Returns:
Whether to disable the WADL.

setDisableWadl

public void setDisableWadl(boolean disableWadl)
Whether to disable the WADL.

Parameters:
disableWadl - Whether to disable the WADL.