org.codehaus.enunciate.modules.objc
Class ObjCDeploymentModule

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

public class ObjCDeploymentModule
extends FreemarkerDeploymentModule
implements FacetAware

Objective C Module

The Objective C module generates Objective C classes 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 Objective C deployment module is 0, as it doesn't depend on any artifacts exported by any other module.

Configuration

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

In addition to the attributes specified above, the Objective C module configuration supports an arbitrary number of "package" child elements, used to explicitly assign package identifiers to each package. The "package" child element supports a "name" attribute (used to name the package) and an "identifier" attribute.

The "facets" element

The "facets" element is applicable to the Objective C module to configure which facets are to be included/excluded from the Objective 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
ObjCDeploymentModule()
           
 
Method Summary
 void addFacetExclude(java.lang.String name)
          Add a facet exclude.
 void addFacetInclude(java.lang.String name)
          Add a facet include.
 void addPackageIdentifier(PackageIdentifier conversion)
          Add a client package conversion.
 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 Ruby API.
 java.lang.String getName()
          The name of the deployment module.
protected  freemarker.template.ObjectWrapper getObjectWrapper()
          The object wrapper to use for the model.
 java.lang.String getPackageIdentifierPattern()
          The format string creating a package identifier from a package name.
 java.util.Map<java.lang.String,java.lang.String> getPackageIdentifiers()
          The package-to-module conversions.
protected  java.net.URL getTemplateURL(java.lang.String template)
          Get a template URL for the template of the given name.
 java.lang.String getTranslateIdTo()
          What to translate 'id' to when writing out objective-c code.
 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.
 void initModel(EnunciateFreemarkerModel model)
          Initialize the model.
 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 Ruby API.
 void setPackageIdentifierPattern(java.lang.String packageIdentifierPattern)
          The format string creating a package identifier from a package name.
 void setSeparateCommonCode(boolean separateCommonCode)
          Whether to separate the common code from the project-specific code.
 void setTranslateIdTo(java.lang.String translateIdTo)
          What to translate 'id' to when writing out objective-c 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, 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

ObjCDeploymentModule

public ObjCDeploymentModule()
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:
"obj-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.

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,
                                 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

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 Ruby API.

Returns:
The label for the Ruby API.

setLabel

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

Parameters:
label - The label for the Ruby API.

getPackageIdentifiers

public java.util.Map<java.lang.String,java.lang.String> getPackageIdentifiers()
The package-to-module conversions.

Returns:
The package-to-module conversions.

addPackageIdentifier

public void addPackageIdentifier(PackageIdentifier conversion)
Add a client package conversion.

Parameters:
conversion - The conversion to add.

getPackageIdentifierPattern

public java.lang.String getPackageIdentifierPattern()
The format string creating a package identifier from a package name.

Returns:
The format string creating a package identifier from a package name.

setPackageIdentifierPattern

public void setPackageIdentifierPattern(java.lang.String packageIdentifierPattern)
The format string creating a package identifier from a package name.

Parameters:
packageIdentifierPattern - The format string creating a package identifier from a package name.

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).

getTranslateIdTo

public java.lang.String getTranslateIdTo()
What to translate 'id' to when writing out objective-c code.

Returns:
What to translate 'id' to when writing out objective-c code.

setTranslateIdTo

public void setTranslateIdTo(java.lang.String translateIdTo)
What to translate 'id' to when writing out objective-c code.

Parameters:
translateIdTo - What to translate 'id' to when writing out objective-c code.

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.

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.

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

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.