org.codehaus.enunciate.modules.c
Class CDeploymentModule

java.lang.Object
  extended by org.codehaus.enunciate.modules.BasicDeploymentModule
      extended by org.codehaus.enunciate.modules.FreemarkerDeploymentModule
          extended by org.codehaus.enunciate.modules.c.CDeploymentModule
All Implemented Interfaces:
EnunciateModelAware, DeploymentModule, FacetAware

public class CDeploymentModule
extends FreemarkerDeploymentModule
implements FacetAware

C Module

The C module generates C data structures and (de)serialization functions that can be used in conjunction with libxml2 to (de)serialize the REST resources as they are represented as XML data.

The order of the C deployment module is 0, as it doesn't depend on any artifacts exported by any other module.

Configuration

The C module is configured with the "c" element under the "modules" element of the enunciate configuration file. It supports the following attributes:

The "facets" element

The "facets" element is applicable to the C module to configure which facets are to be included/excluded from the C artifacts. For more information, see API Facets

Author:
Ryan Heaton

Field Summary
 
Fields inherited from class org.codehaus.enunciate.modules.BasicDeploymentModule
enunciate
 
Constructor Summary
CDeploymentModule()
           
 
Method Summary
 void addFacetExclude(java.lang.String name)
          Add a facet exclude.
 void addFacetInclude(java.lang.String name)
          Add a facet include.
 void doFreemarkerGenerate()
          Generate using Freemarker.
 org.apache.commons.digester.RuleSet getConfigurationRules()
          Default implementation returns null.
 java.lang.String getEnumConstantNamePattern()
          The pattern for converting an enum constant to a unique C-style type name.
 java.util.Set<java.lang.String> getFacetExcludes()
          The set of facets to exclude.
 java.util.Set<java.lang.String> getFacetIncludes()
          The set of facets to include.
 java.lang.String getLabel()
          The label for the C API.
 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.lang.String getSourceFileName()
          The name of the generated Ruby source file.
protected  java.net.URL getTemplateURL(java.lang.String template)
          Get a template URL for the template of the given name.
 java.lang.String getTypeDefinitionNamePattern()
          The pattern for converting a type definition to a unique C-style type name.
 Validator getValidator()
          Get the validator for this module, or null if none.
 boolean isDisabled()
          Whether this deployment module has been disabled, e.g.
 boolean isForceEnable()
          Whether to require this module (force-enable it).
 boolean isSeparateCommonCode()
          Whether to separate the common code from the project-specific code.
protected  java.lang.String readResource(java.lang.String resource)
          Reads a resource into string form.
static java.lang.String scrubIdentifier(java.lang.String identifier)
          Scrub a C identifier (removing any illegal characters, etc.).
 void setEnumConstantNamePattern(java.lang.String enumConstantNamePattern)
          The pattern for converting an enum constant to a unique C-style type name.
 void setForceEnable(boolean forceEnable)
          Whether to require this module (force-enable it).
 void setLabel(java.lang.String label)
          The label for the C API.
 void setSeparateCommonCode(boolean separateCommonCode)
          Whether to separate the common code from the project-specific code.
 void setTypeDefinitionNamePattern(java.lang.String typeDefinitionNamePattern)
          The pattern for converting a type definition to a unique C-style type name.
 
Methods inherited from class org.codehaus.enunciate.modules.FreemarkerDeploymentModule
close, doGenerate, getConfiguration, getModel, getModelInternal, getTemplateExceptionHandler, getTemplateLoader, initModel, 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, init, 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
 
Methods inherited from interface org.codehaus.enunciate.modules.DeploymentModule
close, getAliases, getOrder, init, step
 

Constructor Detail

CDeploymentModule

public CDeploymentModule()
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:
"c"

scrubIdentifier

public static java.lang.String scrubIdentifier(java.lang.String identifier)
Scrub a C identifier (removing any illegal characters, etc.).

Parameters:
identifier - The identifier.
Returns:
The identifier.

doFreemarkerGenerate

public void doFreemarkerGenerate()
                          throws java.io.IOException,
                                 freemarker.template.TemplateException,
                                 EnunciateException
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
EnunciateException

readResource

protected java.lang.String readResource(java.lang.String resource)
                                 throws java.io.IOException,
                                        EnunciateException
Reads a resource into string form.

Parameters:
resource - The resource to read.
Returns:
The string form of the resource.
Throws:
java.io.IOException
EnunciateException

getSourceFileName

protected java.lang.String getSourceFileName()
The name of the generated Ruby source file.

Returns:
The name of the generated Ruby source file.

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.

getTemplateURL

protected java.net.URL getTemplateURL(java.lang.String template)
Get a template URL for the template of the given name.

Parameters:
template - The specified template.
Returns:
The URL to the specified template.

getLabel

public java.lang.String getLabel()
The label for the C API.

Returns:
The label for the C API.

setLabel

public void setLabel(java.lang.String label)
The label for the C API.

Parameters:
label - The label for the C API.

getTypeDefinitionNamePattern

public java.lang.String getTypeDefinitionNamePattern()
The pattern for converting a type definition to a unique C-style type name.

Returns:
The pattern for converting a type definition to a unique C-style type name.

setTypeDefinitionNamePattern

public void setTypeDefinitionNamePattern(java.lang.String typeDefinitionNamePattern)
The pattern for converting a type definition to a unique C-style type name.

Parameters:
typeDefinitionNamePattern - The pattern for converting a type definition to a unique C-style type name.

getEnumConstantNamePattern

public java.lang.String getEnumConstantNamePattern()
The pattern for converting an enum constant to a unique C-style type name.

Returns:
The pattern for converting an enum constant to a unique C-style type name.

setEnumConstantNamePattern

public void setEnumConstantNamePattern(java.lang.String enumConstantNamePattern)
The pattern for converting an enum constant to a unique C-style type name.

Parameters:
enumConstantNamePattern - The pattern for converting an enum constant to a unique C-style type name.

isForceEnable

public boolean isForceEnable()
Whether to require this module (force-enable it).

Returns:
Whether to require this module (force-enable it).

setForceEnable

public void setForceEnable(boolean forceEnable)
Whether to require this module (force-enable it).

Parameters:
forceEnable - Whether to require this module (force-enable it).

isSeparateCommonCode

public boolean isSeparateCommonCode()
Whether to separate the common code from the project-specific code.

Returns:
Whether to separate the common code from the project-specific code.

setSeparateCommonCode

public void setSeparateCommonCode(boolean separateCommonCode)
Whether to separate the common code from the project-specific code.

Parameters:
separateCommonCode - Whether to separate the common code from the project-specific code.

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

getFacetIncludes

public java.util.Set<java.lang.String> getFacetIncludes()
The set of facets to include.

Specified by:
getFacetIncludes in interface FacetAware
Returns:
The set of facets to include.

addFacetInclude

public void addFacetInclude(java.lang.String name)
Add a facet include.

Parameters:
name - The name.

getFacetExcludes

public java.util.Set<java.lang.String> getFacetExcludes()
The set of facets to exclude.

Specified by:
getFacetExcludes in interface FacetAware
Returns:
The set of facets to exclude.

addFacetExclude

public void addFacetExclude(java.lang.String name)
Add a facet exclude.

Parameters:
name - The name.

isDisabled

public boolean isDisabled()
Description copied from interface: DeploymentModule
Whether this deployment module has been disabled, e.g. in the config file. Since the discovery mechanism is used to discover the modules on the classpath, it may be necessary to be able to disable a module.

Specified by:
isDisabled in interface DeploymentModule
Overrides:
isDisabled in class BasicDeploymentModule
Returns:
Whether this deployment module has been disabled.