org.codehaus.enunciate.config
Class EnunciateConfiguration

java.lang.Object
  extended by org.codehaus.enunciate.config.EnunciateConfiguration
All Implemented Interfaces:
org.xml.sax.ErrorHandler

public class EnunciateConfiguration
extends java.lang.Object
implements org.xml.sax.ErrorHandler

Base configuration object for enunciate.

Author:
Ryan Heaton

Constructor Summary
EnunciateConfiguration()
          Create a new enunciate configuration.
EnunciateConfiguration(java.lang.ClassLoader loader)
          Create a new enunciate configuration.
EnunciateConfiguration(java.util.Collection<DeploymentModule> modules)
          Construct an enunciate configuration with the specified set of modules.
 
Method Summary
 void addApiExcludePattern(java.lang.String pattern)
          The API exclude pattern.
 void addAPIImport(APIImport apiImport)
          Add an API import to the configuration.
 void addApiIncludePattern(java.lang.String pattern)
          The API include pattern.
 void addCustomResourceParameterAnnotation(java.lang.String annotation)
          Add a custom annotation that can be applied to indicate a resource parameter.
 void addDisabledRule(java.lang.String ruleId)
          Add a disabled rule.
 void addModule(DeploymentModule module)
          Add a module to the list of modules.
 void addSoapEndpointLocation(java.lang.String serviceName, java.lang.String relativePath)
          Adds a custom soap endpoint location for an SOAP service.
protected  org.apache.commons.digester.Digester createDigester()
          Create the digester.
protected  java.util.Iterator discoverModules(java.lang.ClassLoader loader)
          Discover the deployment modules.
 void error(org.xml.sax.SAXParseException error)
          Handle an error.
 void fatalError(org.xml.sax.SAXParseException fatal)
          Handle a fatal.
 java.util.SortedSet<DeploymentModule> getAllModules()
          The list of all deployment modules specified in the configuration.
 java.util.Set<java.lang.String> getApiExcludePatterns()
          The patterns for API excludes.
 java.util.List<APIImport> getAPIImports()
          Get the list of API imports for this configuration.
 java.util.Set<java.lang.String> getApiIncludePatterns()
          The patterns for API includes.
 java.util.Map<java.lang.String,java.lang.String> getContentTypesToIds()
          The map of content types to ids.
 java.util.Set<java.lang.String> getCustomResourceParameterAnnotations()
          The set of custom annotations that can be applied to indicate a resource parameter.
 java.lang.String getDefaultRestSubcontext()
          The default rest context.
 java.lang.String getDefaultSoapSubcontext()
          The default soap context.
 java.lang.String getDeploymentContext()
          The context at which the deployed app will be mounted.
 java.lang.String getDeploymentHost()
          The hostname of the host that will host the deployed app.
 java.lang.String getDeploymentProtocol()
          The protocol that will be used when the app is deployed.
 java.lang.String getDescription()
          The description for this enunciated API.
 java.util.Set<java.lang.String> getDisabledRules()
          The disabled rules.
 java.util.List<DeploymentModule> getEnabledModules()
          The list of enabled modules in the configuration.
 java.lang.String getLabel()
          The label for this enunciate project.
 java.util.Map<java.lang.String,java.lang.String> getNamespacesToPrefixes()
          The map of namespaces to prefixes.
 java.util.Map<java.lang.String,java.lang.String> getSoapServices2Paths()
          Get the map of SOAP service names to custom paths.
 Validator getValidator()
          The configured validator, if any.
 WebAppConfig getWebAppConfig()
          The configuration for the web app.
 boolean isAllowEmptyNamespace()
          Whether to allow the empty namespace on type/element definitions.
 boolean isExcludeUnreferencedClasses()
          Whether to exclude classes that are not statically referenced (default: true).
 boolean isForceJAXWSSpecCompliance()
          Whether to force parameter names to be JAX-WS compliant.
 boolean isIncludeReferencedClasses()
          Whether to include statically-referenced type definitions (default: true).
 boolean isIncludeReferenceTrailInErrors()
          Whether to include referencing type information in error messages.
 void load(java.io.File file)
          Loads the configuration specified by the given config file.
 void load(java.io.InputStream in)
          Loads the configuration specified by the given stream.
 void load(java.io.Reader in)
          Loads the configuration specified by the given stream.
 void putContentType(java.lang.String type, java.lang.String id)
          Configures a content type.
 void putNamespace(java.lang.String namespace, java.lang.String prefix)
          Configures a namespace for the specified prefix.
 void setAllowEmptyNamespace(boolean allowEmptyNamespace)
          Whether to allow the empty namespace on type/element definitions.
 void setDefaultRestSubcontext(java.lang.String defaultRestSubcontext)
          The default rest context.
 void setDefaultSoapSubcontext(java.lang.String defaultSoapSubcontext)
          The default soap context.
 void setDeploymentContext(java.lang.String deploymentContext)
          The context at which the deployed app will be mounted.
 void setDeploymentHost(java.lang.String deploymentHost)
          The hostname of the host that will host the deployed app.
 void setDeploymentProtocol(java.lang.String deploymentProtocol)
          The protocol that will be used when the app is deployed.
 void setDescription(java.lang.String description)
          The description for this enunciated API.
 void setExcludeUnreferencedClasses(boolean excludeUnreferencedClasses)
          Whether to exclude classes that are not statically referenced.
 void setForceJAXWSSpecCompliance(boolean forceJAXWSSpecCompliance)
          Whether to force parameter names to be JAX-WS compliant.
 void setIncludeReferencedClasses(boolean includeReferencedClasses)
          Whether to include statically-referenced type definitions (default: true).
 void setIncludeReferenceTrailInErrors(boolean includeReferenceTrailInErrors)
          Whether to include referencing type information in error messages.
 void setLabel(java.lang.String label)
          The label for this enunciate project.
 void setValidator(Validator validator)
          The validator to use.
 void setWebAppConfig(WebAppConfig webAppConfig)
          The configuration for the web app.
 void warning(org.xml.sax.SAXParseException warning)
          Handle a warning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnunciateConfiguration

public EnunciateConfiguration()
Create a new enunciate configuration. The module list will be constructed using Sun's discovery mechanism.


EnunciateConfiguration

public EnunciateConfiguration(java.lang.ClassLoader loader)
Create a new enunciate configuration. The module list will be constructed using Sun's discovery mechanism and the specified classloader.

Parameters:
loader - the classloader to use.

EnunciateConfiguration

public EnunciateConfiguration(java.util.Collection<DeploymentModule> modules)
Construct an enunciate configuration with the specified set of modules.

Parameters:
modules - The modules.
Method Detail

discoverModules

protected java.util.Iterator discoverModules(java.lang.ClassLoader loader)
Discover the deployment modules.

Parameters:
loader - The classloader, or null if none.
Returns:
An iterator over the deployment modules.

getLabel

public java.lang.String getLabel()
The label for this enunciate project.

Returns:
The label for this enunciate project.

setLabel

public void setLabel(java.lang.String label)
The label for this enunciate project.

Parameters:
label - The label for this enunciate project.

getDescription

public java.lang.String getDescription()
The description for this enunciated API.

Returns:
The description for this enunciated API.

setDescription

public void setDescription(java.lang.String description)
The description for this enunciated API.

Parameters:
description - The description for this enunciated API.

getValidator

public Validator getValidator()
The configured validator, if any.

Returns:
The configured validator, or null if none.

setValidator

public void setValidator(Validator validator)
The validator to use.

Parameters:
validator - The validator to use.

getDisabledRules

public java.util.Set<java.lang.String> getDisabledRules()
The disabled rules.

Returns:
The disabled rules.

addDisabledRule

public void addDisabledRule(java.lang.String ruleId)
Add a disabled rule.

Parameters:
ruleId - The id of the rule to disable.

getApiIncludePatterns

public java.util.Set<java.lang.String> getApiIncludePatterns()
The patterns for API includes.

Returns:
The patterns for API includes.

addApiIncludePattern

public void addApiIncludePattern(java.lang.String pattern)
The API include pattern.

Parameters:
pattern - The API include pattern.

getApiExcludePatterns

public java.util.Set<java.lang.String> getApiExcludePatterns()
The patterns for API excludes.

Returns:
The patterns for API excludes.

addApiExcludePattern

public void addApiExcludePattern(java.lang.String pattern)
The API exclude pattern.

Parameters:
pattern - The API exclude pattern.

getDeploymentProtocol

public java.lang.String getDeploymentProtocol()
The protocol that will be used when the app is deployed. Default: "http".

Returns:
The protocol that will be used when the app is deployed. Default: "http".

setDeploymentProtocol

public void setDeploymentProtocol(java.lang.String deploymentProtocol)
The protocol that will be used when the app is deployed. Default: "http".

Parameters:
deploymentProtocol - The protocol that will be used when the app is deployed. Default: "http".

getDeploymentHost

public java.lang.String getDeploymentHost()
The hostname of the host that will host the deployed app.

Returns:
The hostname of the host that will host the deployed app.

setDeploymentHost

public void setDeploymentHost(java.lang.String deploymentHost)
The hostname of the host that will host the deployed app.

Parameters:
deploymentHost - The hostname of the host that will host the deployed app.

isForceJAXWSSpecCompliance

public boolean isForceJAXWSSpecCompliance()
Whether to force parameter names to be JAX-WS compliant.

Returns:
Whether to force parameter names to be JAX-WS compliant.

setForceJAXWSSpecCompliance

public void setForceJAXWSSpecCompliance(boolean forceJAXWSSpecCompliance)
Whether to force parameter names to be JAX-WS compliant.

Parameters:
forceJAXWSSpecCompliance - Whether to force parameter names to be JAX-WS compliant.

isAllowEmptyNamespace

public boolean isAllowEmptyNamespace()
Whether to allow the empty namespace on type/element definitions.

Returns:
Whether to allow the empty namespace on type/element definitions.

setAllowEmptyNamespace

public void setAllowEmptyNamespace(boolean allowEmptyNamespace)
Whether to allow the empty namespace on type/element definitions.

Parameters:
allowEmptyNamespace - Whether to allow the empty namespace on type/element definitions.

isIncludeReferenceTrailInErrors

public boolean isIncludeReferenceTrailInErrors()
Whether to include referencing type information in error messages.

Returns:
Whether to include referencing type information in error messages.

setIncludeReferenceTrailInErrors

public void setIncludeReferenceTrailInErrors(boolean includeReferenceTrailInErrors)
Whether to include referencing type information in error messages.

Parameters:
includeReferenceTrailInErrors - Whether to include referencing type information in error messages.

isIncludeReferencedClasses

public boolean isIncludeReferencedClasses()
Whether to include statically-referenced type definitions (default: true).

Returns:
Whether to include statically-referenced type definitions.

setIncludeReferencedClasses

public void setIncludeReferencedClasses(boolean includeReferencedClasses)
Whether to include statically-referenced type definitions (default: true).

Parameters:
includeReferencedClasses - Whether to include statically-referenced type definitions.

isExcludeUnreferencedClasses

public boolean isExcludeUnreferencedClasses()
Whether to exclude classes that are not statically referenced (default: true).

Returns:
Whether to exclude classes that are not statically referenced.

setExcludeUnreferencedClasses

public void setExcludeUnreferencedClasses(boolean excludeUnreferencedClasses)
Whether to exclude classes that are not statically referenced.

Parameters:
excludeUnreferencedClasses - Whether to exclude classes that are not statically referenced.

getWebAppConfig

public WebAppConfig getWebAppConfig()
The configuration for the web app.

Returns:
The configuration for web app.

setWebAppConfig

public void setWebAppConfig(WebAppConfig webAppConfig)
The configuration for the web app.

Parameters:
webAppConfig - The configuration for the web app.

getDeploymentContext

public java.lang.String getDeploymentContext()
The context at which the deployed app will be mounted.

Returns:
The context at which the deployed app will be mounted.

setDeploymentContext

public void setDeploymentContext(java.lang.String deploymentContext)
The context at which the deployed app will be mounted.

Parameters:
deploymentContext - The context at which the deployed app will be mounted.

putNamespace

public void putNamespace(java.lang.String namespace,
                         java.lang.String prefix)
Configures a namespace for the specified prefix.

Parameters:
namespace - The namespace.
prefix - The prefix.

putContentType

public void putContentType(java.lang.String type,
                           java.lang.String id)
Configures a content type.

Parameters:
type - The value of the content type.
id - The id of the content type.

getDefaultSoapSubcontext

public java.lang.String getDefaultSoapSubcontext()
The default soap context.

Returns:
The default soap context.

setDefaultSoapSubcontext

public void setDefaultSoapSubcontext(java.lang.String defaultSoapSubcontext)
The default soap context.

Parameters:
defaultSoapSubcontext - The default soap context.

getDefaultRestSubcontext

public java.lang.String getDefaultRestSubcontext()
The default rest context.

Returns:
The default rest context.

setDefaultRestSubcontext

public void setDefaultRestSubcontext(java.lang.String defaultRestSubcontext)
The default rest context.

Parameters:
defaultRestSubcontext - The default rest context.

addSoapEndpointLocation

public void addSoapEndpointLocation(java.lang.String serviceName,
                                    java.lang.String relativePath)
Adds a custom soap endpoint location for an SOAP service.

Parameters:
serviceName - The service name.
relativePath - The relative path to the service.

addAPIImport

public void addAPIImport(APIImport apiImport)
Add an API import to the configuration.

Parameters:
apiImport - The API import to add to the configuration.

getAPIImports

public java.util.List<APIImport> getAPIImports()
Get the list of API imports for this configuration.

Returns:
the list of API imports for this configuration.

getNamespacesToPrefixes

public java.util.Map<java.lang.String,java.lang.String> getNamespacesToPrefixes()
The map of namespaces to prefixes.

Returns:
The map of namespaces to prefixes.

getContentTypesToIds

public java.util.Map<java.lang.String,java.lang.String> getContentTypesToIds()
The map of content types to ids.

Returns:
The map of content types to ids.

getSoapServices2Paths

public java.util.Map<java.lang.String,java.lang.String> getSoapServices2Paths()
Get the map of SOAP service names to custom paths.

Returns:
The map of soap service names to custom paths.

getAllModules

public java.util.SortedSet<DeploymentModule> getAllModules()
The list of all deployment modules specified in the configuration.

Returns:
The list of all deployment modules specified in the configuration.

addModule

public void addModule(DeploymentModule module)
Add a module to the list of modules.

Parameters:
module - The module to add.

getCustomResourceParameterAnnotations

public java.util.Set<java.lang.String> getCustomResourceParameterAnnotations()
The set of custom annotations that can be applied to indicate a resource parameter.

Returns:
The set of custom annotations that can be applied to indicate a resource parameter.

addCustomResourceParameterAnnotation

public void addCustomResourceParameterAnnotation(java.lang.String annotation)
Add a custom annotation that can be applied to indicate a resource parameter.

Parameters:
annotation - The FQN of the annotation.

getEnabledModules

public java.util.List<DeploymentModule> getEnabledModules()
The list of enabled modules in the configuration.

Returns:
The list of enabled modules in the configuration.

load

public void load(java.io.File file)
          throws java.io.IOException,
                 org.xml.sax.SAXException
Loads the configuration specified by the given config file.

Parameters:
file - The file.
Throws:
java.io.IOException
org.xml.sax.SAXException

load

public void load(java.io.InputStream in)
          throws java.io.IOException,
                 org.xml.sax.SAXException
Loads the configuration specified by the given stream.

Parameters:
in - The stream.
Throws:
java.io.IOException
org.xml.sax.SAXException

load

public void load(java.io.Reader in)
          throws java.io.IOException,
                 org.xml.sax.SAXException
Loads the configuration specified by the given stream.

Parameters:
in - The stream.
Throws:
java.io.IOException
org.xml.sax.SAXException

createDigester

protected org.apache.commons.digester.Digester createDigester()
                                                       throws org.xml.sax.SAXException
Create the digester.

Returns:
The digester that was created.
Throws:
org.xml.sax.SAXException

warning

public void warning(org.xml.sax.SAXParseException warning)
             throws org.xml.sax.SAXException
Handle a warning.

Specified by:
warning in interface org.xml.sax.ErrorHandler
Parameters:
warning - The warning.
Throws:
org.xml.sax.SAXException

error

public void error(org.xml.sax.SAXParseException error)
           throws org.xml.sax.SAXException
Handle an error.

Specified by:
error in interface org.xml.sax.ErrorHandler
Parameters:
error - The error.
Throws:
org.xml.sax.SAXException

fatalError

public void fatalError(org.xml.sax.SAXParseException fatal)
                throws org.xml.sax.SAXException
Handle a fatal.

Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Parameters:
fatal - The fatal.
Throws:
org.xml.sax.SAXException