Repository: camel Updated Branches: refs/heads/master f7cbecbb4 -> 93adc379a
CAMEL-8195: Add javadoc to model classes so we have EIP documentation out of the box Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/93adc379 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/93adc379 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/93adc379 Branch: refs/heads/master Commit: 93adc379a9707cbe38d501333ba07dd01ec08d1f Parents: f7cbecbb Author: Claus Ibsen <davscl...@apache.org> Authored: Tue Jan 20 10:27:31 2015 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue Jan 20 11:11:02 2015 +0100 ---------------------------------------------------------------------- .../org/apache/camel/model/LogDefinition.java | 20 +++++ .../org/apache/camel/model/LoopDefinition.java | 16 ++-- .../apache/camel/model/MarshalDefinition.java | 5 +- .../CircuitBreakerLoadBalancerDefinition.java | 17 ++++- .../CustomLoadBalancerDefinition.java | 3 + .../FailoverLoadBalancerDefinition.java | 22 ++++++ .../RandomLoadBalancerDefinition.java | 2 + .../RoundRobinLoadBalancerDefinition.java | 3 + .../StickyLoadBalancerDefinition.java | 6 ++ .../TopicLoadBalancerDefinition.java | 2 + .../WeightedLoadBalancerDefinition.java | 19 ++++- .../camel/model/rest/RestBindingDefinition.java | 26 +++++++ .../model/rest/RestConfigurationDefinition.java | 80 ++++++++++++++++++++ .../apache/camel/model/rest/RestDefinition.java | 31 ++++++++ .../model/rest/RestPropertyDefinition.java | 8 +- .../apache/camel/model/rest/VerbDefinition.java | 42 ++++++++++ .../camel/tools/apt/EipAnnotationProcessor.java | 2 +- 17 files changed, 290 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/93adc379/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java b/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java index 68d0993..f84fe5b 100644 --- a/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java @@ -130,6 +130,11 @@ public class LogDefinition extends NoOutputDefinition<LogDefinition> { return loggingLevel; } + /** + * Sets the logging level. + * <p/> + * The default value is INFO + */ public void setLoggingLevel(LoggingLevel loggingLevel) { this.loggingLevel = loggingLevel; } @@ -138,6 +143,9 @@ public class LogDefinition extends NoOutputDefinition<LogDefinition> { return message; } + /** + * Sets the log message (uses simple language) + */ public void setMessage(String message) { this.message = message; } @@ -146,6 +154,9 @@ public class LogDefinition extends NoOutputDefinition<LogDefinition> { return logName; } + /** + * Sets the name of the logger + */ public void setLogName(String logName) { this.logName = logName; } @@ -154,6 +165,9 @@ public class LogDefinition extends NoOutputDefinition<LogDefinition> { return marker; } + /** + * To use slf4j marker + */ public void setMarker(String marker) { this.marker = marker; } @@ -162,6 +176,9 @@ public class LogDefinition extends NoOutputDefinition<LogDefinition> { return loggerRef; } + /** + * To refer to a custom logger instance to lookup from ther registry. + */ public void setLoggerRef(String loggerRef) { this.loggerRef = loggerRef; } @@ -170,6 +187,9 @@ public class LogDefinition extends NoOutputDefinition<LogDefinition> { return logger; } + /** + * To use a custom logger instance + */ public void setLogger(Logger logger) { this.logger = logger; } http://git-wip-us.apache.org/repos/asf/camel/blob/93adc379/camel-core/src/main/java/org/apache/camel/model/LoopDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/LoopDefinition.java b/camel-core/src/main/java/org/apache/camel/model/LoopDefinition.java index ba64fab..e923550 100644 --- a/camel-core/src/main/java/org/apache/camel/model/LoopDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/LoopDefinition.java @@ -38,15 +38,6 @@ import org.apache.camel.spi.RouteContext; @XmlAccessorType(XmlAccessType.FIELD) public class LoopDefinition extends ExpressionNode { - - /** - * If the copy attribute is true, a copy of the input Exchange is used for each iteration. - * That means each iteration will start from a copy of the same message. - * <p/> - * By default loop will loop the same exchange all over, so each iteration may - * have different message content. - * - */ @XmlAttribute private Boolean copy; @@ -78,6 +69,13 @@ public class LoopDefinition extends ExpressionNode { return copy; } + /** + * If the copy attribute is true, a copy of the input Exchange is used for each iteration. + * That means each iteration will start from a copy of the same message. + * <p/> + * By default loop will loop the same exchange all over, so each iteration may + * have different message content. + */ public void setCopy(Boolean copy) { this.copy = copy; } http://git-wip-us.apache.org/repos/asf/camel/blob/93adc379/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java b/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java index 4a8029b..d0269d6 100644 --- a/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java @@ -144,7 +144,10 @@ public class MarshalDefinition extends NoOutputDefinition<MarshalDefinition> { public String getRef() { return ref; } - + + /** + * To refer to a custom data format to use as marshaller + */ public void setRef(String ref) { this.ref = ref; } http://git-wip-us.apache.org/repos/asf/camel/blob/93adc379/camel-core/src/main/java/org/apache/camel/model/loadbalancer/CircuitBreakerLoadBalancerDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/CircuitBreakerLoadBalancerDefinition.java b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/CircuitBreakerLoadBalancerDefinition.java index d970219..0d9e769 100644 --- a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/CircuitBreakerLoadBalancerDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/CircuitBreakerLoadBalancerDefinition.java @@ -34,6 +34,12 @@ import org.apache.camel.util.ObjectHelper; /** * Circuit break load balancer + * <p/> + * The Circuit Breaker load balancer is a stateful pattern that monitors all calls for certain exceptions. + * Initially the Circuit Breaker is in closed state and passes all messages. + * If there are failures and the threshold is reached, it moves to open state and rejects all calls until halfOpenAfter + * timeout is reached. After this timeout is reached, if there is a new call, it will pass and if the result is + * success the Circuit Breaker will move to closed state, or to open state if there was an error. */ @Label("eip,routing") @XmlRootElement(name = "circuitBreaker") @@ -83,6 +89,9 @@ public class CircuitBreakerLoadBalancerDefinition extends LoadBalancerDefinition return halfOpenAfter; } + /** + * The timeout in millis to use as threshold to move state from closed to half-open or open state + */ public void setHalfOpenAfter(Long halfOpenAfter) { this.halfOpenAfter = halfOpenAfter; } @@ -91,6 +100,9 @@ public class CircuitBreakerLoadBalancerDefinition extends LoadBalancerDefinition return threshold; } + /** + * Number of previous failed messages to use as threshold to move state from closed to half-open or open state + */ public void setThreshold(Integer threshold) { this.threshold = threshold; } @@ -99,11 +111,14 @@ public class CircuitBreakerLoadBalancerDefinition extends LoadBalancerDefinition return exceptions; } + /** + * A list of class names for specific exceptions to monitor. + * If no exceptions is configured then all exceptions is monitored + */ public void setExceptions(List<String> exceptions) { this.exceptions = exceptions; } - @Override public String toString() { return "CircuitBreakerLoadBalancer"; http://git-wip-us.apache.org/repos/asf/camel/blob/93adc379/camel-core/src/main/java/org/apache/camel/model/loadbalancer/CustomLoadBalancerDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/CustomLoadBalancerDefinition.java b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/CustomLoadBalancerDefinition.java index 27866c6..e7bbd8f 100644 --- a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/CustomLoadBalancerDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/CustomLoadBalancerDefinition.java @@ -46,6 +46,9 @@ public class CustomLoadBalancerDefinition extends LoadBalancerDefinition { return ref; } + /** + * Refers to the custom load balancer to lookup from the registry + */ public void setRef(String ref) { this.ref = ref; } http://git-wip-us.apache.org/repos/asf/camel/blob/93adc379/camel-core/src/main/java/org/apache/camel/model/loadbalancer/FailoverLoadBalancerDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/FailoverLoadBalancerDefinition.java b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/FailoverLoadBalancerDefinition.java index 11601ff..c091980 100644 --- a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/FailoverLoadBalancerDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/FailoverLoadBalancerDefinition.java @@ -33,6 +33,11 @@ import org.apache.camel.spi.RouteContext; /** * Failover load balancer + * + * The failover load balancer is capable of trying the next processor in case an Exchange failed with an exception during processing. + * You can constrain the failover to activate only when one exception of a list you specify occurs. + * If you do not specify a list any exception will cause fail over to occur. + * This balancer uses the same strategy for matching exceptions as the Exception Clause does for the onException. */ @Label("eip,routing") @XmlRootElement(name = "failover") @@ -80,6 +85,10 @@ public class FailoverLoadBalancerDefinition extends LoadBalancerDefinition { return exceptions; } + /** + * A list of class names for specific exceptions to monitor. + * If no exceptions is configured then all exceptions is monitored + */ public void setExceptions(List<String> exceptions) { this.exceptions = exceptions; } @@ -92,6 +101,13 @@ public class FailoverLoadBalancerDefinition extends LoadBalancerDefinition { return roundRobin; } + /** + * Whether or not the failover load balancer should operate in round robin mode or not. + * If not, then it will always start from the first endpoint when a new message is to be processed. + * In other words it restart from the top for every message. + * If round robin is enabled, then it keeps state and will continue with the next endpoint in a round robin fashion. + * When using round robin it will not stick to last known good endpoint, it will always pick the next endpoint to use. + */ public void setRoundRobin(Boolean roundRobin) { this.roundRobin = roundRobin; } @@ -100,6 +116,12 @@ public class FailoverLoadBalancerDefinition extends LoadBalancerDefinition { return maximumFailoverAttempts; } + /** + * A value to indicate after X failover attempts we should exhaust (give up). + * Use -1 to indicate never give up and continuously try to failover. Use 0 to never failover. + * And use e.g. 3 to failover at most 3 times before giving up. + * his option can be used whether or not roundRobin is enabled or not. + */ public void setMaximumFailoverAttempts(Integer maximumFailoverAttempts) { this.maximumFailoverAttempts = maximumFailoverAttempts; } http://git-wip-us.apache.org/repos/asf/camel/blob/93adc379/camel-core/src/main/java/org/apache/camel/model/loadbalancer/RandomLoadBalancerDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/RandomLoadBalancerDefinition.java b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/RandomLoadBalancerDefinition.java index a4d81f9..19a6ba1 100644 --- a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/RandomLoadBalancerDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/RandomLoadBalancerDefinition.java @@ -27,6 +27,8 @@ import org.apache.camel.spi.RouteContext; /** * Random load balancer + * + * The random load balancer selects a random endpoint for each exchange. */ @Label("eip,routing") @XmlRootElement(name = "random") http://git-wip-us.apache.org/repos/asf/camel/blob/93adc379/camel-core/src/main/java/org/apache/camel/model/loadbalancer/RoundRobinLoadBalancerDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/RoundRobinLoadBalancerDefinition.java b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/RoundRobinLoadBalancerDefinition.java index 924419f..c134444 100644 --- a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/RoundRobinLoadBalancerDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/RoundRobinLoadBalancerDefinition.java @@ -27,6 +27,9 @@ import org.apache.camel.spi.RouteContext; /** * Round robin load balancer + * + * The round robin load balancer will use the next endpoint for each message. + * This load balancer is not meant to work with failover, for that you should use the dedicated failover load balancer. */ @Label("eip,routing") @XmlRootElement(name = "roundRobin") http://git-wip-us.apache.org/repos/asf/camel/blob/93adc379/camel-core/src/main/java/org/apache/camel/model/loadbalancer/StickyLoadBalancerDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/StickyLoadBalancerDefinition.java b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/StickyLoadBalancerDefinition.java index 8c3984f..981a007 100644 --- a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/StickyLoadBalancerDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/StickyLoadBalancerDefinition.java @@ -30,6 +30,9 @@ import org.apache.camel.spi.RouteContext; /** * Sticky load balancer + * + * Sticky load balancing using an Expression to calculate a correlation key to perform the sticky load balancing; + * rather like jsessionid in the web or JMSXGroupID in JMS. */ @Label("eip,routing") @XmlRootElement(name = "sticky") @@ -50,6 +53,9 @@ public class StickyLoadBalancerDefinition extends LoadBalancerDefinition { return correlationExpression; } + /** + * The correlation expression to use to calculate the correlation key + */ public void setCorrelationExpression(ExpressionSubElementDefinition correlationExpression) { this.correlationExpression = correlationExpression; } http://git-wip-us.apache.org/repos/asf/camel/blob/93adc379/camel-core/src/main/java/org/apache/camel/model/loadbalancer/TopicLoadBalancerDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/TopicLoadBalancerDefinition.java b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/TopicLoadBalancerDefinition.java index 30e19b1..716e1af 100644 --- a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/TopicLoadBalancerDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/TopicLoadBalancerDefinition.java @@ -27,6 +27,8 @@ import org.apache.camel.spi.RouteContext; /** * Topic load balancer + * + * The topic load balancer sends to all destinations (rather like JMS Topics) */ @Label("eip,routing") @XmlRootElement(name = "topic") http://git-wip-us.apache.org/repos/asf/camel/blob/93adc379/camel-core/src/main/java/org/apache/camel/model/loadbalancer/WeightedLoadBalancerDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/WeightedLoadBalancerDefinition.java b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/WeightedLoadBalancerDefinition.java index 758437d..ce603b3 100644 --- a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/WeightedLoadBalancerDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/WeightedLoadBalancerDefinition.java @@ -18,7 +18,6 @@ package org.apache.camel.model.loadbalancer; import java.util.ArrayList; import java.util.List; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; @@ -35,6 +34,10 @@ import org.apache.camel.util.ObjectHelper; /** * Weighted load balancer + * + * The weighted load balancing policy allows you to specify a processing load distribution ratio for each server + * with respect to others. In addition to the weight, endpoint selection is then further refined using + * random distribution based on weight. */ @Label("eip,routing") @XmlRootElement(name = "weighted") @@ -81,6 +84,11 @@ public class WeightedLoadBalancerDefinition extends LoadBalancerDefinition { return roundRobin; } + /** + * To enable round robin mode. By default the weighted distribution mode is used. + * <p/> + * The default value is false. + */ public void setRoundRobin(Boolean roundRobin) { this.roundRobin = roundRobin; } @@ -93,6 +101,10 @@ public class WeightedLoadBalancerDefinition extends LoadBalancerDefinition { return distributionRatio; } + /** + * The distribution ratio is a delimited String consisting on integer weights separated by delimiters for example "2,3,5". + * The distributionRatio must match the number of endpoints and/or processors specified in the load balancer list. + */ public void setDistributionRatio(String distributionRatio) { this.distributionRatio = distributionRatio; } @@ -101,6 +113,11 @@ public class WeightedLoadBalancerDefinition extends LoadBalancerDefinition { return distributionRatioDelimiter; } + /** + * Delimiter used to specify the distribution ratio. + * <p/> + * The default value is , + */ public void setDistributionRatioDelimiter(String distributionRatioDelimiter) { this.distributionRatioDelimiter = distributionRatioDelimiter; } http://git-wip-us.apache.org/repos/asf/camel/blob/93adc379/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java index e479842..d7d7759 100644 --- a/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java @@ -229,6 +229,9 @@ public class RestBindingDefinition extends NoOutputDefinition<RestBindingDefinit return consumes; } + /** + * To define the content type what the REST service consumes (accept as input), such as application/xml or application/json + */ public void setConsumes(String consumes) { this.consumes = consumes; } @@ -237,6 +240,9 @@ public class RestBindingDefinition extends NoOutputDefinition<RestBindingDefinit return produces; } + /** + * To define the content type what the REST service produces (uses for output), such as application/xml or application/json + */ public void setProduces(String produces) { this.produces = produces; } @@ -245,6 +251,11 @@ public class RestBindingDefinition extends NoOutputDefinition<RestBindingDefinit return bindingMode; } + /** + * Sets the binding mode to use. + * <p/> + * The default value is auto + */ public void setBindingMode(RestBindingMode bindingMode) { this.bindingMode = bindingMode; } @@ -253,6 +264,9 @@ public class RestBindingDefinition extends NoOutputDefinition<RestBindingDefinit return type; } + /** + * Sets the class name to use for binding from input to POJO for the incoming data + */ public void setType(String type) { this.type = type; } @@ -261,6 +275,9 @@ public class RestBindingDefinition extends NoOutputDefinition<RestBindingDefinit return outType; } + /** + * Sets the class name to use for binding from POJO to output for the outgoing data + */ public void setOutType(String outType) { this.outType = outType; } @@ -269,6 +286,10 @@ public class RestBindingDefinition extends NoOutputDefinition<RestBindingDefinit return skipBindingOnErrorCode; } + /** + * Whether to skip binding on output if there is a custom HTTP error code header. + * This allows to build custom error messages that do not bind to json / xml etc, as success messages otherwise will do. + */ public void setSkipBindingOnErrorCode(Boolean skipBindingOnErrorCode) { this.skipBindingOnErrorCode = skipBindingOnErrorCode; } @@ -277,6 +298,11 @@ public class RestBindingDefinition extends NoOutputDefinition<RestBindingDefinit return enableCORS; } + /** + * Whether to enable CORS headers in the HTTP response. + * <p/> + * The default value is false. + */ public void setEnableCORS(Boolean enableCORS) { this.enableCORS = enableCORS; } http://git-wip-us.apache.org/repos/asf/camel/blob/93adc379/camel-core/src/main/java/org/apache/camel/model/rest/RestConfigurationDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestConfigurationDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestConfigurationDefinition.java index f4a8172..25e6cfd 100644 --- a/camel-core/src/main/java/org/apache/camel/model/rest/RestConfigurationDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestConfigurationDefinition.java @@ -91,6 +91,12 @@ public class RestConfigurationDefinition { return component; } + /** + * The Camel Rest component to use for the REST transport, such as restlet, spark-rest. + * If no component has been explicit configured, then Camel will lookup if there is a Camel component + * that integrates with the Rest DSL, or if a org.apache.camel.spi.RestConsumerFactory is registered in the registry. + * If either one is found, then that is being used. + */ public void setComponent(String component) { this.component = component; } @@ -99,6 +105,11 @@ public class RestConfigurationDefinition { return scheme; } + /** + * The scheme to use for exposing the REST service. Usually http or https is supported. + * <p/> + * The default value is http + */ public void setScheme(String scheme) { this.scheme = scheme; } @@ -107,6 +118,9 @@ public class RestConfigurationDefinition { return host; } + /** + * The hostname to use for exposing the REST service. + */ public void setHost(String host) { this.host = host; } @@ -115,6 +129,15 @@ public class RestConfigurationDefinition { return port; } + /** + * The port number to use for exposing the REST service. + * Notice if you use servlet component then the port number configured here does not apply, + * as the port number in use is the actual port number the servlet component is using. + * eg if using Apache Tomcat its the tomcat http port, if using Apache Karaf its the HTTP service in Karaf + * that uses port 8181 by default etc. Though in those situations setting the port number here, + * allows tooling and JMX to know the port number, so its recommended to set the port number + * to the number that the servlet engine uses. + */ public void setPort(String port) { this.port = port; } @@ -123,6 +146,10 @@ public class RestConfigurationDefinition { return contextPath; } + /** + * Sets a leading context-path the REST services will be using. + * This can be used when using components such as SERVLET where the deployed web application is deployed using a context-path. + */ public void setContextPath(String contextPath) { this.contextPath = contextPath; } @@ -131,6 +158,9 @@ public class RestConfigurationDefinition { return hostNameResolver; } + /** + * If no hostname has been explicit configured, then this resolver is used to compute the hostname the REST service will be using. + */ public void setHostNameResolver(RestHostNameResolver hostNameResolver) { this.hostNameResolver = hostNameResolver; } @@ -139,6 +169,11 @@ public class RestConfigurationDefinition { return bindingMode; } + /** + * Sets the binding mode to use. + * <p/> + * The default value is auto + */ public void setBindingMode(RestBindingMode bindingMode) { this.bindingMode = bindingMode; } @@ -147,6 +182,10 @@ public class RestConfigurationDefinition { return skipBindingOnErrorCode; } + /** + * Whether to skip binding on output if there is a custom HTTP error code header. + * This allows to build custom error messages that do not bind to json / xml etc, as success messages otherwise will do. + */ public void setSkipBindingOnErrorCode(Boolean skipBindingOnErrorCode) { this.skipBindingOnErrorCode = skipBindingOnErrorCode; } @@ -155,6 +194,11 @@ public class RestConfigurationDefinition { return enableCORS; } + /** + * Whether to enable CORS headers in the HTTP response. + * <p/> + * The default value is false. + */ public void setEnableCORS(Boolean enableCORS) { this.enableCORS = enableCORS; } @@ -163,6 +207,11 @@ public class RestConfigurationDefinition { return jsonDataFormat; } + /** + * Name of specific json data format to use. + * By default json-jackson will be used. + * Important: This option is only for setting a custom name of the data format, not to refer to an existing data format instance. + */ public void setJsonDataFormat(String jsonDataFormat) { this.jsonDataFormat = jsonDataFormat; } @@ -171,6 +220,11 @@ public class RestConfigurationDefinition { return xmlDataFormat; } + /** + * Name of specific XML data format to use. + * By default jaxb will be used. + * Important: This option is only for setting a custom name of the data format, not to refer to an existing data format instance. + */ public void setXmlDataFormat(String xmlDataFormat) { this.xmlDataFormat = xmlDataFormat; } @@ -179,6 +233,9 @@ public class RestConfigurationDefinition { return componentProperties; } + /** + * Allows to configure as many additional properties for the rest component in use. + */ public void setComponentProperties(List<RestPropertyDefinition> componentProperties) { this.componentProperties = componentProperties; } @@ -187,6 +244,9 @@ public class RestConfigurationDefinition { return endpointProperties; } + /** + * Allows to configure as many additional properties for the rest endpoint in use. + */ public void setEndpointProperties(List<RestPropertyDefinition> endpointProperties) { this.endpointProperties = endpointProperties; } @@ -195,6 +255,9 @@ public class RestConfigurationDefinition { return consumerProperties; } + /** + * Allows to configure as many additional properties for the rest consumer in use. + */ public void setConsumerProperties(List<RestPropertyDefinition> consumerProperties) { this.consumerProperties = consumerProperties; } @@ -203,6 +266,20 @@ public class RestConfigurationDefinition { return dataFormatProperties; } + /** + * Allows to configure as many additional properties for the data formats in use. + * For example set property prettyPrint to true to have json outputted in pretty mode. + * The properties can be prefixed to denote the option is only for either JSON or XML and for either the IN or the OUT. + * The prefixes are: + * <ul> + * <li>json.in.</li> + * <li>json.out.</li> + * <li>xml.in.</li> + * <li>xml.out.</li> + * </ul> + * For example a key with value "xml.out.mustBeJAXBElement" is only for the XML data format for the outgoing. + * A key without a prefix is a common key for all situations. + */ public void setDataFormatProperties(List<RestPropertyDefinition> dataFormatProperties) { this.dataFormatProperties = dataFormatProperties; } @@ -211,6 +288,9 @@ public class RestConfigurationDefinition { return corsHeaders; } + /** + * Allows to configure custom CORS headers. + */ public void setCorsHeaders(List<RestPropertyDefinition> corsHeaders) { this.corsHeaders = corsHeaders; } http://git-wip-us.apache.org/repos/asf/camel/blob/93adc379/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java index a5a2158..78bdff0 100644 --- a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java @@ -73,6 +73,9 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition> return path; } + /** + * Path of the rest service, such as "/foo" + */ public void setPath(String path) { this.path = path; } @@ -81,6 +84,10 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition> return consumes; } + /** + * To define the content type what the REST service consumes (accept as input), such as application/xml or application/json. + * This option will override what may be configured on a parent level + */ public void setConsumes(String consumes) { this.consumes = consumes; } @@ -89,6 +96,10 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition> return produces; } + /** + * To define the content type what the REST service produces (uses for output), such as application/xml or application/json + * This option will override what may be configured on a parent level + */ public void setProduces(String produces) { this.produces = produces; } @@ -97,6 +108,12 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition> return bindingMode; } + /** + * Sets the binding mode to use. + * This option will override what may be configured on a parent level + * <p/> + * The default value is auto + */ public void setBindingMode(RestBindingMode bindingMode) { this.bindingMode = bindingMode; } @@ -105,6 +122,9 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition> return verbs; } + /** + * The HTTP verbs this REST service accepts and uses + */ public void setVerbs(List<VerbDefinition> verbs) { this.verbs = verbs; } @@ -113,6 +133,11 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition> return skipBindingOnErrorCode; } + /** + * Whether to skip binding on output if there is a custom HTTP error code header. + * This allows to build custom error messages that do not bind to json / xml etc, as success messages otherwise will do. + * This option will override what may be configured on a parent level + */ public void setSkipBindingOnErrorCode(Boolean skipBindingOnErrorCode) { this.skipBindingOnErrorCode = skipBindingOnErrorCode; } @@ -121,6 +146,12 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition> return enableCORS; } + /** + * Whether to enable CORS headers in the HTTP response. + * This option will override what may be configured on a parent level + * <p/> + * The default value is false. + */ public void setEnableCORS(Boolean enableCORS) { this.enableCORS = enableCORS; } http://git-wip-us.apache.org/repos/asf/camel/blob/93adc379/camel-core/src/main/java/org/apache/camel/model/rest/RestPropertyDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestPropertyDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestPropertyDefinition.java index 146ddfc..254ad5b 100644 --- a/camel-core/src/main/java/org/apache/camel/model/rest/RestPropertyDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestPropertyDefinition.java @@ -37,6 +37,9 @@ public class RestPropertyDefinition { @XmlAttribute(required = true) String value; + /** + * Property key + */ public void setKey(String key) { this.key = key; } @@ -44,7 +47,10 @@ public class RestPropertyDefinition { public String getKey() { return key; } - + + /** + * Property value + */ public void setValue(String value) { this.value = value; } http://git-wip-us.apache.org/repos/asf/camel/blob/93adc379/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java index ba3fa38..e8686ff 100644 --- a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java @@ -93,6 +93,9 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition> return method; } + /** + * The HTTP verb such as GET or POST + */ public void setMethod(String method) { this.method = method; } @@ -101,6 +104,9 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition> return uri; } + /** + * Uri template of this REST service such as /{id}. + */ public void setUri(String uri) { this.uri = uri; } @@ -109,6 +115,10 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition> return consumes; } + /** + * To define the content type what the REST service consumes (accept as input), such as application/xml or application/json. + * This option will override what may be configured on a parent level + */ public void setConsumes(String consumes) { this.consumes = consumes; } @@ -117,6 +127,10 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition> return produces; } + /** + * To define the content type what the REST service produces (uses for output), such as application/xml or application/json + * This option will override what may be configured on a parent level + */ public void setProduces(String produces) { this.produces = produces; } @@ -125,6 +139,12 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition> return bindingMode; } + /** + * Sets the binding mode to use. + * This option will override what may be configured on a parent level + * <p/> + * The default value is auto + */ public void setBindingMode(RestBindingMode bindingMode) { this.bindingMode = bindingMode; } @@ -133,6 +153,11 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition> return skipBindingOnErrorCode; } + /** + * Whether to skip binding on output if there is a custom HTTP error code header. + * This allows to build custom error messages that do not bind to json / xml etc, as success messages otherwise will do. + * This option will override what may be configured on a parent level + */ public void setSkipBindingOnErrorCode(Boolean skipBindingOnErrorCode) { this.skipBindingOnErrorCode = skipBindingOnErrorCode; } @@ -141,6 +166,12 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition> return enableCORS; } + /** + * Whether to enable CORS headers in the HTTP response. + * This option will override what may be configured on a parent level + * <p/> + * The default value is false. + */ public void setEnableCORS(Boolean enableCORS) { this.enableCORS = enableCORS; } @@ -149,6 +180,10 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition> return type; } + /** + * Sets the class name to use for binding from input to POJO for the incoming data + * This option will override what may be configured on a parent level + */ public void setType(String type) { this.type = type; } @@ -157,6 +192,10 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition> return outType; } + /** + * Sets the class name to use for binding from POJO to output for the outgoing data + * This option will override what may be configured on a parent level + */ public void setOutType(String outType) { this.outType = outType; } @@ -203,6 +242,9 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition> return toOrRoute; } + /** + * To route from this REST service to a Camel endpoint, or an inlined route + */ public void setToOrRoute(OptionalIdentifiedDefinition<?> toOrRoute) { this.toOrRoute = toOrRoute; } http://git-wip-us.apache.org/repos/asf/camel/blob/93adc379/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java ---------------------------------------------------------------------- diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java index 4414f87..2bacbab 100644 --- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java +++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java @@ -157,7 +157,7 @@ public class EipAnnotationProcessor extends AbstractAnnotationProcessor { buffer.append("\n \"title\": \"").append(asTitle(eipModel.getName())).append("\","); buffer.append("\n \"description\": \"").append(safeNull(eipModel.getDescription())).append("\","); buffer.append("\n \"javaType\": \"").append(eipModel.getJavaType()).append("\","); - buffer.append("\n \"label\": \"").append(safeNull(eipModel.getLabel())).append("\","); + buffer.append("\n \"label\": \"").append(safeNull(eipModel.getLabel())); buffer.append("\n },"); buffer.append("\n \"properties\": {");