CAMEL-8023: Model and component javadoc documentation

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/06f6e1d6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/06f6e1d6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/06f6e1d6

Branch: refs/heads/master
Commit: 06f6e1d645af93ee3afe7f241184a71c3f4f5b06
Parents: 2a5dda6
Author: Claus Ibsen <davscl...@apache.org>
Authored: Mon Feb 9 10:48:51 2015 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Mon Feb 9 10:48:51 2015 +0100

----------------------------------------------------------------------
 .../component/validator/ValidatorEndpoint.java  | 34 +++++++++++-
 .../camel/component/xslt/XsltComponent.java     | 18 ++++++
 .../camel/component/xslt/XsltEndpoint.java      | 58 +++++++++++++++++++-
 3 files changed, 107 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/06f6e1d6/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorEndpoint.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorEndpoint.java
 
b/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorEndpoint.java
index 87bc68d..e8c7e2e 100644
--- 
a/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorEndpoint.java
+++ 
b/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorEndpoint.java
@@ -20,6 +20,7 @@ import java.io.InputStream;
 import javax.xml.XMLConstants;
 import javax.xml.validation.SchemaFactory;
 
+import org.apache.camel.spi.Metadata;
 import org.w3c.dom.ls.LSResourceResolver;
 
 import org.apache.camel.Component;
@@ -44,9 +45,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
 
     private static final Logger LOG = 
LoggerFactory.getLogger(ValidatorEndpoint.class);
 
-    @UriPath
+    @UriPath @Metadata(required = "true")
     private String resourceUri;
-    @UriParam
+    @UriParam(defaultValue = XMLConstants.W3C_XML_SCHEMA_NS_URI)
     private String schemaLanguage = XMLConstants.W3C_XML_SCHEMA_NS_URI;
     @UriParam
     private SchemaFactory schemaFactory;
@@ -138,6 +139,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
         return schemaLanguage;
     }
 
+    /**
+     * Configures the W3C XML Schema Namespace URI.
+     */
     public void setSchemaLanguage(String schemaLanguage) {
         this.schemaLanguage = schemaLanguage;
     }
@@ -146,6 +150,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
         return schemaFactory;
     }
 
+    /**
+     * To use a custom javax.xml.validation.SchemaFactory
+     */
     public void setSchemaFactory(SchemaFactory schemaFactory) {
         this.schemaFactory = schemaFactory;
     }
@@ -154,6 +161,11 @@ public class ValidatorEndpoint extends DefaultEndpoint {
         return errorHandler;
     }
 
+    /**
+     * To use a custom 
org.apache.camel.processor.validation.ValidatorErrorHandler.
+     * <p/>
+     * The default error handler captures the errors and throws an exception.
+     */
     public void setErrorHandler(ValidatorErrorHandler errorHandler) {
         this.errorHandler = errorHandler;
     }
@@ -162,6 +174,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
         return useDom;
     }
 
+    /**
+     * Whether DOMSource/DOMResult or SaxSource/SaxResult should be used by 
the validator.
+     */
     public void setUseDom(boolean useDom) {
         this.useDom = useDom;
     }
@@ -170,6 +185,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
         return useSharedSchema;
     }
 
+    /**
+     * Whether the Schema instance should be shared or not. This option is 
introduced to work around a JDK 1.6.x bug. Xerces should not have this issue.
+     */
     public void setUseSharedSchema(boolean useSharedSchema) {
         this.useSharedSchema = useSharedSchema;
     }
@@ -178,6 +196,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
         return resourceResolver;
     }
 
+    /**
+     * To use a custom LSResourceResolver
+     */
     public void setResourceResolver(LSResourceResolver resourceResolver) {
         this.resourceResolver = resourceResolver;
     }
@@ -186,6 +207,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
         return failOnNullBody;
     }
 
+    /**
+     * Whether to fail if no body exists.
+     */
     public void setFailOnNullBody(boolean failOnNullBody) {
         this.failOnNullBody = failOnNullBody;
     }
@@ -194,6 +218,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
         return failOnNullHeader;
     }
 
+    /**
+     * Whether to fail if no header exists when validating against a header.
+     */
     public void setFailOnNullHeader(boolean failOnNullHeader) {
         this.failOnNullHeader = failOnNullHeader;
     }
@@ -202,6 +229,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
         return headerName;
     }
 
+    /**
+     * To validate against a header instead of the message body.
+     */
     public void setHeaderName(String headerName) {
         this.headerName = headerName;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/06f6e1d6/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java 
b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java
index 06e981c..427bed3 100644
--- 
a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java
@@ -23,6 +23,7 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.builder.xml.XsltUriResolver;
 import org.apache.camel.converter.jaxp.XmlConverter;
 import org.apache.camel.impl.UriEndpointComponent;
+import org.apache.camel.spi.Metadata;
 import org.apache.camel.util.ResourceHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -36,7 +37,9 @@ public class XsltComponent extends UriEndpointComponent {
 
     private XmlConverter xmlConverter;
     private URIResolver uriResolver;
+    @Metadata(defaultValue = "true")
     private boolean contentCache = true;
+    @Metadata(defaultValue = "false")
     private boolean saxon;
 
     public XsltComponent() {
@@ -47,6 +50,9 @@ public class XsltComponent extends UriEndpointComponent {
         return xmlConverter;
     }
 
+    /**
+     * To use a custom implementation of {@link 
org.apache.camel.converter.jaxp.XmlConverter}
+     */
     public void setXmlConverter(XmlConverter xmlConverter) {
         this.xmlConverter = xmlConverter;
     }
@@ -55,6 +61,9 @@ public class XsltComponent extends UriEndpointComponent {
         return uriResolver;
     }
 
+    /**
+     * To use a custom javax.xml.transform.URIResolver
+     */
     public void setUriResolver(URIResolver uriResolver) {
         this.uriResolver = uriResolver;
     }
@@ -63,6 +72,11 @@ public class XsltComponent extends UriEndpointComponent {
         return contentCache;
     }
 
+    /**
+     * Cache for the resource content (the stylesheet file) when it is loaded.
+     * If set to false Camel will reload the stylesheet file on each message 
processing. This is good for development.
+     * A cached stylesheet can be forced to reload at runtime via JMX using 
the clearCachedStylesheet operation.
+     */
     public void setContentCache(boolean contentCache) {
         this.contentCache = contentCache;
     }
@@ -71,6 +85,10 @@ public class XsltComponent extends UriEndpointComponent {
         return saxon;
     }
 
+    /**
+     * Whether to use Saxon as the transformerFactoryClass.
+     * If enabled then the class net.sf.saxon.TransformerFactoryImpl. You 
would need to add Saxon to the classpath.
+     */
     public void setSaxon(boolean saxon) {
         this.saxon = saxon;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/06f6e1d6/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java 
b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
index da56d48..e8b16ec 100644
--- a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
@@ -34,6 +34,7 @@ import org.apache.camel.builder.xml.ResultHandlerFactory;
 import org.apache.camel.builder.xml.XsltBuilder;
 import org.apache.camel.converter.jaxp.XmlConverter;
 import org.apache.camel.impl.ProcessorEndpoint;
+import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriPath;
@@ -53,7 +54,7 @@ public class XsltEndpoint extends ProcessorEndpoint {
     private volatile XsltBuilder xslt;
     private Map<String, Object> parameters;
 
-    @UriPath
+    @UriPath @Metadata(required = "true")
     private String resourceUri;
     @UriParam(defaultValue = "true")
     private boolean contentCache = true;
@@ -154,6 +155,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
         return resourceUri;
     }
 
+    /**
+     * The name of the template to load from classpath or file system
+     */
     public void setResourceUri(String resourceUri) {
         this.resourceUri = resourceUri;
     }
@@ -162,6 +166,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
         return converter;
     }
 
+    /**
+     * To use a custom implementation of {@link 
org.apache.camel.converter.jaxp.XmlConverter}
+     */
     public void setConverter(XmlConverter converter) {
         this.converter = converter;
     }
@@ -170,6 +177,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
         return transformerFactoryClass;
     }
 
+    /**
+     * To use a custom XSLT transformer factory, specified as a FQN class name
+     */
     public void setTransformerFactoryClass(String transformerFactoryClass) {
         this.transformerFactoryClass = transformerFactoryClass;
     }
@@ -178,6 +188,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
         return transformerFactory;
     }
 
+    /**
+     * To use a custom XSLT transformer factory
+     */
     public void setTransformerFactory(TransformerFactory transformerFactory) {
         this.transformerFactory = transformerFactory;
     }
@@ -186,6 +199,10 @@ public class XsltEndpoint extends ProcessorEndpoint {
         return saxon;
     }
 
+    /**
+     * Whether to use Saxon as the transformerFactoryClass.
+     * If enabled then the class net.sf.saxon.TransformerFactoryImpl. You 
would need to add Saxon to the classpath.
+     */
     public void setSaxon(boolean saxon) {
         this.saxon = saxon;
     }
@@ -194,6 +211,10 @@ public class XsltEndpoint extends ProcessorEndpoint {
         return resultHandlerFactory;
     }
 
+    /**
+     * Allows you to use a custom 
org.apache.camel.builder.xml.ResultHandlerFactory which is capable of
+     * using custom org.apache.camel.builder.xml.ResultHandler types.
+     */
     public void setResultHandlerFactory(ResultHandlerFactory 
resultHandlerFactory) {
         this.resultHandlerFactory = resultHandlerFactory;
     }
@@ -202,6 +223,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
         return failOnNullBody;
     }
 
+    /**
+     * Whether or not to throw an exception if the input body is null.
+     */
     public void setFailOnNullBody(boolean failOnNullBody) {
         this.failOnNullBody = failOnNullBody;
     }
@@ -210,6 +234,12 @@ public class XsltEndpoint extends ProcessorEndpoint {
         return output;
     }
 
+    /**
+     * Option to specify which output type to use.
+     * Possible values are: string, bytes, DOM, file. The first three options 
are all in memory based, where as file is streamed directly to a java.io.File.
+     * For file you must specify the filename in the IN header with the key 
Exchange.XSLT_FILE_NAME which is also CamelXsltFileName.
+     * Also any paths leading to the filename must be created beforehand, 
otherwise an exception is thrown at runtime.
+     */
     public void setOutput(XsltOutput output) {
         this.output = output;
     }
@@ -218,6 +248,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
         return transformerCacheSize;
     }
 
+    /**
+     * The number of javax.xml.transform.Transformer object that are cached 
for reuse to avoid calls to Template.newTransformer().
+     */
     public void setTransformerCacheSize(int transformerCacheSize) {
         this.transformerCacheSize = transformerCacheSize;
     }
@@ -226,6 +259,11 @@ public class XsltEndpoint extends ProcessorEndpoint {
         return errorListener;
     }
 
+    /**
+     *  Allows to configure to use a custom javax.xml.transform.ErrorListener. 
Beware when doing this then the default error
+     *  listener which captures any errors or fatal errors and store 
information on the Exchange as properties is not in use.
+     *  So only use this option for special use-cases.
+     */
     public void setErrorListener(ErrorListener errorListener) {
         this.errorListener = errorListener;
     }
@@ -234,6 +272,11 @@ public class XsltEndpoint extends ProcessorEndpoint {
         return contentCache;
     }
 
+    /**
+     * Cache for the resource content (the stylesheet file) when it is loaded.
+     * If set to false Camel will reload the stylesheet file on each message 
processing. This is good for development.
+     * A cached stylesheet can be forced to reload at runtime via JMX using 
the clearCachedStylesheet operation.
+     */
     public void setContentCache(boolean contentCache) {
         this.contentCache = contentCache;
     }
@@ -242,6 +285,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
         return uriResolver;
     }
 
+    /**
+     * To use a custom javax.xml.transform.URIResolver
+     */
     public void setUriResolver(URIResolver uriResolver) {
         this.uriResolver = uriResolver;
     }
@@ -250,6 +296,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
         return allowStAX;
     }
 
+    /**
+     * Whether to allow using StAX as the javax.xml.transform.Source.
+     */
     public void setAllowStAX(boolean allowStAX) {
         this.allowStAX = allowStAX;
     }
@@ -258,6 +307,10 @@ public class XsltEndpoint extends ProcessorEndpoint {
         return deleteOutputFile;
     }
 
+    /**
+     * If you have output=file then this option dictates whether or not the 
output file should be deleted when the Exchange
+     * is done processing. For example suppose the output file is a temporary 
file, then it can be a good idea to delete it after use.
+     */
     public void setDeleteOutputFile(boolean deleteOutputFile) {
         this.deleteOutputFile = deleteOutputFile;
     }
@@ -266,6 +319,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
         return parameters;
     }
 
+    /**
+     * Additional parameters to configure on the 
javax.xml.transform.Transformer.
+     */
     public void setParameters(Map<String, Object> parameters) {
         this.parameters = parameters;
     }

Reply via email to