You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/08/10 17:08:25 UTC
[1/7] camel git commit: CAMEL-9482: Generate json schema model for
camel-spring
Repository: camel
Updated Branches:
refs/heads/master 629d63a2e -> 34950ceee
CAMEL-9482: Generate json schema model for camel-spring
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/34950cee
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/34950cee
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/34950cee
Branch: refs/heads/master
Commit: 34950ceee931f9a9e92d45f1c8b29d52254992cd
Parents: 532371a
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Aug 10 19:08:00 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Aug 10 19:08:13 2016 +0200
----------------------------------------------------------------------
.../org/apache/camel/spi/ThreadPoolProfile.java | 2 +-
...bstractCamelConsumerTemplateFactoryBean.java | 3 +-
.../xml/AbstractCamelEndpointFactoryBean.java | 7 ++++-
.../core/xml/AbstractCamelFactoryBean.java | 3 +-
...bstractCamelProducerTemplateFactoryBean.java | 5 ++--
...bstractCamelRedeliveryPolicyFactoryBean.java | 24 ++++++++++++++++
.../xml/AbstractCamelThreadPoolFactoryBean.java | 10 +++++++
.../apt/CamelContextAnnotationProcessor.java | 29 ++++++++++++++++----
8 files changed, 71 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/34950cee/camel-core/src/main/java/org/apache/camel/spi/ThreadPoolProfile.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/spi/ThreadPoolProfile.java b/camel-core/src/main/java/org/apache/camel/spi/ThreadPoolProfile.java
index 429af5b..2f84c63 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/ThreadPoolProfile.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/ThreadPoolProfile.java
@@ -200,7 +200,7 @@ public class ThreadPoolProfile implements Serializable, Cloneable {
}
/**
- * Sets whethre to allow core threads to timeout
+ * Sets whether to allow core threads to timeout
*
* @param allowCoreThreadTimeOut <tt>true</tt> to allow timeout
*/
http://git-wip-us.apache.org/repos/asf/camel/blob/34950cee/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelConsumerTemplateFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelConsumerTemplateFactoryBean.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelConsumerTemplateFactoryBean.java
index 877b51a..971c415 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelConsumerTemplateFactoryBean.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelConsumerTemplateFactoryBean.java
@@ -23,6 +23,7 @@ import javax.xml.bind.annotation.XmlTransient;
import org.apache.camel.ConsumerTemplate;
import org.apache.camel.impl.DefaultConsumerTemplate;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.util.ServiceHelper;
/**
@@ -36,7 +37,7 @@ public abstract class AbstractCamelConsumerTemplateFactoryBean extends AbstractC
@XmlTransient
private ConsumerTemplate template;
- @XmlAttribute
+ @XmlAttribute @Metadata(description = "Sets a custom maximum cache size to use in the backing cache pools.")
private Integer maximumCacheSize;
public ConsumerTemplate getObject() throws Exception {
http://git-wip-us.apache.org/repos/asf/camel/blob/34950cee/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelEndpointFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelEndpointFactoryBean.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelEndpointFactoryBean.java
index 72bd289..b7d68f1 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelEndpointFactoryBean.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelEndpointFactoryBean.java
@@ -30,19 +30,24 @@ import org.apache.camel.Endpoint;
import org.apache.camel.ExchangePattern;
import org.apache.camel.NoSuchEndpointException;
import org.apache.camel.model.PropertyDefinition;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.util.URISupport;
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class AbstractCamelEndpointFactoryBean extends AbstractCamelFactoryBean<Endpoint> {
- @XmlAttribute(required = false)
+ @XmlAttribute
@Deprecated
+ @Metadata(description = "Not in use")
private Boolean singleton;
@XmlAttribute(required = true)
+ @Metadata(description = "Sets the URI to use to resolve the endpoint. Notice that additional options can be configured using a series of property.")
private String uri;
@XmlAttribute
@Deprecated
+ @Metadata(description = "Sets the exchange pattern of the endpoint")
private ExchangePattern pattern;
@XmlElementRef
+ @Metadata(description = "To configure additional endpoint options using a XML style which is similar as configuring Spring or Blueprint beans.")
private List<PropertyDefinition> properties = new ArrayList<PropertyDefinition>();
@XmlTransient
private Endpoint endpoint;
http://git-wip-us.apache.org/repos/asf/camel/blob/34950cee/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java
index cae7a71..9689136 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java
@@ -24,12 +24,13 @@ import javax.xml.bind.annotation.XmlTransient;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.model.IdentifiedType;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.util.ObjectHelper;
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class AbstractCamelFactoryBean<T> extends IdentifiedType implements CamelContextAware {
- @XmlAttribute
+ @XmlAttribute @Metadata(description = "Id of CamelContext to use if there are multiple CamelContexts in the same JVM")
private String camelContextId;
@XmlTransient
private CamelContext camelContext;
http://git-wip-us.apache.org/repos/asf/camel/blob/34950cee/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelProducerTemplateFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelProducerTemplateFactoryBean.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelProducerTemplateFactoryBean.java
index 956ebba..8690be0 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelProducerTemplateFactoryBean.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelProducerTemplateFactoryBean.java
@@ -25,6 +25,7 @@ import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.impl.DefaultProducerTemplate;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.util.ServiceHelper;
/**
@@ -37,9 +38,9 @@ import org.apache.camel.util.ServiceHelper;
public abstract class AbstractCamelProducerTemplateFactoryBean extends AbstractCamelFactoryBean<ProducerTemplate> {
@XmlTransient
private ProducerTemplate template;
- @XmlAttribute(required = false)
+ @XmlAttribute @Metadata(description = "Sets the default endpoint URI used by default for sending message exchanges")
private String defaultEndpoint;
- @XmlAttribute
+ @XmlAttribute @Metadata(description = "Sets a custom maximum cache size to use in the backing cache pools.")
private Integer maximumCacheSize;
public ProducerTemplate getObject() throws Exception {
http://git-wip-us.apache.org/repos/asf/camel/blob/34950cee/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelRedeliveryPolicyFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelRedeliveryPolicyFactoryBean.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelRedeliveryPolicyFactoryBean.java
index f353415..98b3813 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelRedeliveryPolicyFactoryBean.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelRedeliveryPolicyFactoryBean.java
@@ -23,6 +23,7 @@ import javax.xml.bind.annotation.XmlAttribute;
import org.apache.camel.CamelContext;
import org.apache.camel.LoggingLevel;
import org.apache.camel.processor.RedeliveryPolicy;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.util.CamelContextHelper;
/**
@@ -34,46 +35,69 @@ import org.apache.camel.util.CamelContextHelper;
public abstract class AbstractCamelRedeliveryPolicyFactoryBean extends AbstractCamelFactoryBean<RedeliveryPolicy> {
@XmlAttribute
+ @Metadata(description = "Sets the maximum number of times a message exchange will be redelivered. Setting a negative value will retry forever.")
private String maximumRedeliveries;
@XmlAttribute
+ @Metadata(defaultValue = "1000", description = "Sets the maximum redelivery delay. Use -1 if you wish to have no maximum")
private String redeliveryDelay;
@XmlAttribute
+ @Metadata(defaultValue = "false", description = "Sets whether asynchronous delayed redelivery is allowed. This is disabled by default. When enabled it allows Camel to schedule a future task for delayed"
+ + " redelivery which prevents current thread from blocking while waiting. Exchange which is transacted will however always use synchronous delayed redelivery because"
+ + " the transaction must execute in the same thread context.")
private String asyncDelayedRedelivery;
@XmlAttribute
+ @Metadata(defaultValue = "2", description = "Sets the multiplier used to increase the delay between redeliveries if useExponentialBackOff is enabled")
private String backOffMultiplier;
@XmlAttribute
+ @Metadata(defaultValue = "false", description = "Enables/disables exponential backoff using the backOffMultiplier to increase the time between retries")
private String useExponentialBackOff;
@XmlAttribute
+ @Metadata(defaultValue = "0.15", description = "Sets the factor used for collision avoidance if enabled via useCollisionAvoidance.")
private String collisionAvoidanceFactor;
@XmlAttribute
+ @Metadata(defaultValue = "false", description = "Enables/disables collision avoidance which adds some randomization to the backoff timings to reduce contention probability")
private String useCollisionAvoidance;
@XmlAttribute
+ @Metadata(defaultValue = "60000", description = "Sets the maximum redelivery delay. Use -1 if you wish to have no maximum")
private String maximumRedeliveryDelay;
@XmlAttribute
+ @Metadata(defaultValue = "ERROR", description = "Sets the logging level to use for log messages when retries have been exhausted.")
private LoggingLevel retriesExhaustedLogLevel;
@XmlAttribute
+ @Metadata(defaultValue = "DEBUG", description = "Sets the logging level to use for log messages when retries are attempted.")
private LoggingLevel retryAttemptedLogLevel;
@XmlAttribute
+ @Metadata(defaultValue = "true", description = "Sets whether to log retry attempts")
private String logRetryAttempted;
@XmlAttribute
+ @Metadata(defaultValue = "true", description = "Sets whether stack traces should be logged or not")
private String logStackTrace;
@XmlAttribute
+ @Metadata(defaultValue = "false", description = "Sets whether stack traces should be logged or not")
private String logRetryStackTrace;
@XmlAttribute
+ @Metadata(defaultValue = "false", description = "Sets whether errors should be logged even if its handled")
private String logHandled;
@XmlAttribute
+ @Metadata(defaultValue = "false", description = "Sets whether errors should be logged even if its continued")
private String logContinued;
@XmlAttribute
+ @Metadata(defaultValue = "true", description = "Sets whether exhausted exceptions should be logged or not")
private String logExhausted;
@XmlAttribute
+ @Metadata(defaultValue = "false", description = "Sets whether to log exhausted errors including message history")
private String logExhaustedMessageHistory;
@XmlAttribute
+ @Metadata(defaultValue = "false", description = "Disables redelivery by setting maximum redeliveries to 0.")
private String disableRedelivery;
@XmlAttribute
+ @Metadata(description = "Sets an optional delay pattern to use instead of fixed delay.")
private String delayPattern;
@XmlAttribute
+ @Metadata(defaultValue = "true", description = "Controls whether to allow redelivery while stopping/shutting down a route that uses error handling.")
private String allowRedeliveryWhileStopping;
@XmlAttribute
+ @Metadata(description = "Sets the reference of the instance of {@link org.apache.camel.spi.ExchangeFormatter} to generate the log message from exchange.")
private String exchangeFormatterRef;
public RedeliveryPolicy getObject() throws Exception {
http://git-wip-us.apache.org/repos/asf/camel/blob/34950cee/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelThreadPoolFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelThreadPoolFactoryBean.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelThreadPoolFactoryBean.java
index 98439d6..f2f7f65 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelThreadPoolFactoryBean.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelThreadPoolFactoryBean.java
@@ -26,6 +26,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.camel.ThreadPoolRejectedPolicy;
import org.apache.camel.builder.ThreadPoolProfileBuilder;
import org.apache.camel.builder.xml.TimeUnitAdapter;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.ThreadPoolProfile;
import org.apache.camel.util.CamelContextHelper;
@@ -38,23 +39,32 @@ import org.apache.camel.util.CamelContextHelper;
public abstract class AbstractCamelThreadPoolFactoryBean extends AbstractCamelFactoryBean<ExecutorService> {
@XmlAttribute(required = true)
+ @Metadata(description = "Sets the core pool size (threads to keep minimum in pool)")
private String poolSize;
@XmlAttribute
+ @Metadata(description = "Sets the maximum pool size")
private String maxPoolSize;
@XmlAttribute
+ @Metadata(description = "Sets the keep alive time for inactive threads")
private String keepAliveTime;
@XmlAttribute
@XmlJavaTypeAdapter(TimeUnitAdapter.class)
+ @Metadata(description = "Sets the time unit used for keep alive time", defaultValue = "SECONDS")
private TimeUnit timeUnit = TimeUnit.SECONDS;
@XmlAttribute
+ @Metadata(description = "Sets the maximum number of tasks in the work queue. Use -1 for an unbounded queue")
private String maxQueueSize;
@XmlAttribute
+ @Metadata(description = "Sets whether to allow core threads to timeout")
private String allowCoreThreadTimeOut;
@XmlAttribute
+ @Metadata(description = "Sets the handler for tasks which cannot be executed by the thread pool.", defaultValue = "CallerRuns")
private ThreadPoolRejectedPolicy rejectedPolicy = ThreadPoolRejectedPolicy.CallerRuns;
@XmlAttribute(required = true)
+ @Metadata(description = "To use a custom thread name / pattern")
private String threadName;
@XmlAttribute
+ @Metadata(description = "Whether to use a scheduled thread pool", defaultValue = "false")
private Boolean scheduled;
public ExecutorService getObject() throws Exception {
http://git-wip-us.apache.org/repos/asf/camel/blob/34950cee/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java
index 9f10d0f..f8e6b71 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java
@@ -36,6 +36,7 @@ import javax.lang.model.util.ElementFilter;
import javax.lang.model.util.Elements;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@@ -237,6 +238,11 @@ public class CamelContextAnnotationProcessor extends AbstractAnnotationProcessor
processElements(roundEnv, classElement, elements, fieldElement, eipOptions, prefix);
}
+ XmlElementRef elementRef = fieldElement.getAnnotation(XmlElementRef.class);
+ if (elementRef != null) {
+ processElement(roundEnv, classElement, null, elementRef, fieldElement, eipOptions, prefix);
+ }
+
XmlElement element = fieldElement.getAnnotation(XmlElement.class);
if (element != null) {
if ("rests".equals(fieldName)) {
@@ -244,7 +250,7 @@ public class CamelContextAnnotationProcessor extends AbstractAnnotationProcessor
} else if ("routes".equals(fieldName)) {
processRoutes(roundEnv, classElement, element, fieldElement, fieldName, eipOptions, prefix);
} else {
- processElement(roundEnv, classElement, element, fieldElement, eipOptions, prefix);
+ processElement(roundEnv, classElement, element, null, fieldElement, eipOptions, prefix);
}
}
}
@@ -284,6 +290,10 @@ public class CamelContextAnnotationProcessor extends AbstractAnnotationProcessor
String defaultValue = findDefaultValue(fieldElement, fieldTypeName);
String docComment = findJavaDoc(elementUtils, fieldElement, fieldName, name, classElement, true);
+ if (isNullOrEmpty(docComment)) {
+ Metadata metadata = fieldElement.getAnnotation(Metadata.class);
+ docComment = metadata != null ? metadata.description() : null;
+ }
boolean required = attribute.required();
// metadata may overrule element required
required = findRequired(fieldElement, required);
@@ -352,16 +362,16 @@ public class CamelContextAnnotationProcessor extends AbstractAnnotationProcessor
eipOptions.add(ep);
}
- private void processElement(RoundEnvironment roundEnv, TypeElement classElement, XmlElement element, VariableElement fieldElement,
+ private void processElement(RoundEnvironment roundEnv, TypeElement classElement, XmlElement element, XmlElementRef elementRef, VariableElement fieldElement,
Set<EipOption> eipOptions, String prefix) {
Elements elementUtils = processingEnv.getElementUtils();
String fieldName;
fieldName = fieldElement.getSimpleName().toString();
- if (element != null) {
+ if (element != null || elementRef != null) {
String kind = "element";
- String name = element.name();
+ String name = element != null ? element.name() : elementRef.name();
if (isNullOrEmpty(name) || "##default".equals(name)) {
name = fieldName;
}
@@ -372,7 +382,11 @@ public class CamelContextAnnotationProcessor extends AbstractAnnotationProcessor
String defaultValue = findDefaultValue(fieldElement, fieldTypeName);
String docComment = findJavaDoc(elementUtils, fieldElement, fieldName, name, classElement, true);
- boolean required = element.required();
+ if (isNullOrEmpty(docComment)) {
+ Metadata metadata = fieldElement.getAnnotation(Metadata.class);
+ docComment = metadata != null ? metadata.description() : null;
+ }
+ boolean required = element != null ? element.required() : elementRef.required();
// metadata may overrule element required
required = findRequired(fieldElement, required);
@@ -443,7 +457,10 @@ public class CamelContextAnnotationProcessor extends AbstractAnnotationProcessor
String defaultValue = findDefaultValue(fieldElement, fieldTypeName);
String docComment = findJavaDoc(elementUtils, fieldElement, fieldName, name, classElement, true);
-
+ if (isNullOrEmpty(docComment)) {
+ Metadata metadata = fieldElement.getAnnotation(Metadata.class);
+ docComment = metadata != null ? metadata.description() : null;
+ }
boolean required = false;
required = findRequired(fieldElement, required);
[5/7] camel git commit: CAMEL-9482: Generate json schema model for
camel-spring
Posted by da...@apache.org.
CAMEL-9482: Generate json schema model for camel-spring
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/06e3b155
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/06e3b155
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/06e3b155
Branch: refs/heads/master
Commit: 06e3b155bd9607797f62a9f08eb2237d56a15e91
Parents: 3f14b02
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Aug 10 12:58:23 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Aug 10 19:08:13 2016 +0200
----------------------------------------------------------------------
.../camel/spring/CamelContextFactoryBean.java | 2 +-
.../apt/CamelContextAnnotationProcessor.java | 36 ++++++++++++++++++--
.../apache/camel/tools/apt/helper/Strings.java | 15 ++++++++
.../org/apache/camel/tools/apt/StringsTest.java | 30 ++++++++++++++++
4 files changed, 79 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/06e3b155/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
index 60547ee..652b84c 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
@@ -122,7 +122,7 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
private String useBreadcrumb;
@XmlAttribute
private String allowUseOriginalMessage;
- @XmlAttribute @Metadata(defaultValue = "true")
+ @XmlAttribute
private String runtimeEndpointRegistryEnabled;
@XmlAttribute
private String managementNamePattern;
http://git-wip-us.apache.org/repos/asf/camel/blob/06e3b155/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java
index 3538ef6..bf0b3b0 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java
@@ -79,10 +79,11 @@ public class CamelContextAnnotationProcessor extends AbstractAnnotationProcessor
}
protected void processModelClass(final RoundEnvironment roundEnv, final TypeElement classElement) {
- // must be from org.apache.camel.model
+ // must be from camel-spring or camel-core-xml
final String javaTypeName = canonicalClassName(classElement.getQualifiedName().toString());
String packageName = javaTypeName.substring(0, javaTypeName.lastIndexOf("."));
- if (!javaTypeName.startsWith("org.apache.camel.spring")) {
+ boolean valid = javaTypeName.startsWith("org.apache.camel.spring") || javaTypeName.startsWith("org.apache.camel.core.xml");
+ if (!valid) {
return;
}
@@ -381,9 +382,38 @@ public class CamelContextAnnotationProcessor extends AbstractAnnotationProcessor
}
}
+ // is it a definition/factory-bean type then its a oneOf
+ TreeSet oneOfTypes = new TreeSet<String>();
+ if (fieldTypeName.endsWith("Definition") || fieldTypeName.endsWith("FactoryBean")) {
+ TypeElement definitionClass = findTypeElement(roundEnv, fieldTypeElement.asType().toString());
+ if (definitionClass != null) {
+ XmlRootElement rootElement = definitionClass.getAnnotation(XmlRootElement.class);
+ if (rootElement != null) {
+ String childName = rootElement.name();
+ if (childName != null) {
+ oneOfTypes.add(childName);
+ }
+ }
+ }
+ } else if (fieldTypeName.endsWith("Definition>") || fieldTypeName.endsWith("FactoryBean>")) {
+ // its a list so we need to load the generic type
+ String typeName = Strings.between(fieldTypeName, "<", ">");
+ TypeElement definitionClass = findTypeElement(roundEnv, typeName);
+ if (definitionClass != null) {
+ XmlRootElement rootElement = definitionClass.getAnnotation(XmlRootElement.class);
+ if (rootElement != null) {
+ String childName = rootElement.name();
+ if (childName != null) {
+ oneOfTypes.add(childName);
+ }
+ }
+ }
+ }
+ boolean oneOf = !oneOfTypes.isEmpty();
+
boolean deprecated = fieldElement.getAnnotation(Deprecated.class) != null;
- EipOption ep = new EipOption(name, kind, fieldTypeName, required, defaultValue, docComment, deprecated, isEnum, enums, false, null);
+ EipOption ep = new EipOption(name, kind, fieldTypeName, required, defaultValue, docComment, deprecated, isEnum, enums, oneOf, oneOfTypes);
eipOptions.add(ep);
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/06e3b155/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/Strings.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/Strings.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/Strings.java
index 30b826f..7037140 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/Strings.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/Strings.java
@@ -100,4 +100,19 @@ public final class Strings {
return quote + text + quote;
}
+ /**
+ * Clips the text between the start and end markers
+ */
+ public static String between(String text, String start, String end) {
+ int pos = text.indexOf(start);
+ if (pos > 0) {
+ text = text.substring(pos + 1);
+ }
+ int pos2 = text.lastIndexOf(end);
+ if (pos2 > 0) {
+ text = text.substring(0, pos2);
+ }
+ return text;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/camel/blob/06e3b155/tooling/apt/src/test/java/org/apache/camel/tools/apt/StringsTest.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/test/java/org/apache/camel/tools/apt/StringsTest.java b/tooling/apt/src/test/java/org/apache/camel/tools/apt/StringsTest.java
new file mode 100644
index 0000000..3903d53
--- /dev/null
+++ b/tooling/apt/src/test/java/org/apache/camel/tools/apt/StringsTest.java
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.tools.apt;
+
+import org.junit.Test;
+
+import static org.apache.camel.tools.apt.helper.Strings.between;
+import static org.junit.Assert.assertEquals;
+
+public class StringsTest {
+
+ @Test
+ public void testBetween() {
+ assertEquals("org.apache.camel.model.OnCompletionDefinition", between("java.util.List<org.apache.camel.model.OnCompletionDefinition>", "<", ">"));
+ }
+}
[3/7] camel git commit: CAMEL-9482: Generate json schema model for
camel-spring
Posted by da...@apache.org.
CAMEL-9482: Generate json schema model for camel-spring
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3f14b029
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3f14b029
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3f14b029
Branch: refs/heads/master
Commit: 3f14b0295acc72fc9534de7fb1cac9fbc21383f1
Parents: 87ba55d
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Aug 10 12:29:01 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Aug 10 19:08:13 2016 +0200
----------------------------------------------------------------------
.../camel/spring/CamelContextFactoryBean.java | 19 +-
.../apt/CamelContextAnnotationProcessor.java | 664 +++++++++++++++++++
.../javax.annotation.processing.Processor | 1 +
3 files changed, 675 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/3f14b029/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
index 42def32..60547ee 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
@@ -63,6 +63,7 @@ import org.apache.camel.model.remote.KubernetesConfigurationDefinition;
import org.apache.camel.model.remote.RibbonConfigurationDefinition;
import org.apache.camel.model.rest.RestConfigurationDefinition;
import org.apache.camel.model.rest.RestDefinition;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.PackageScanFilter;
import org.apache.camel.spi.Registry;
import org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer;
@@ -99,7 +100,7 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
private String dependsOn;
@XmlAttribute
private String trace;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "true")
private String messageHistory;
@XmlAttribute
private String logExhaustedMessageBody;
@@ -111,34 +112,34 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
private String handleFault;
@XmlAttribute
private String errorHandlerRef;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "true")
private String autoStartup;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "true")
private String shutdownEager;
@XmlAttribute
private String useMDCLogging;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "true")
private String useBreadcrumb;
@XmlAttribute
private String allowUseOriginalMessage;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "true")
private String runtimeEndpointRegistryEnabled;
@XmlAttribute
private String managementNamePattern;
@XmlAttribute
private String threadNamePattern;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "Default")
private ShutdownRoute shutdownRoute;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "CompleteCurrentTaskOnly")
private ShutdownRunningTask shutdownRunningTask;
@XmlAttribute
@Deprecated
private Boolean lazyLoadTypeConverters;
@XmlAttribute
private Boolean typeConverterStatisticsEnabled;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "Override")
private TypeConverterExists typeConverterExists;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "WARN")
private LoggingLevel typeConverterExistsLoggingLevel;
@XmlElement(name = "properties")
private PropertiesDefinition properties;
http://git-wip-us.apache.org/repos/asf/camel/blob/3f14b029/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java
new file mode 100644
index 0000000..3538ef6
--- /dev/null
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java
@@ -0,0 +1,664 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.tools.apt;
+
+import java.io.PrintWriter;
+import java.util.Comparator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.ElementFilter;
+import javax.lang.model.util.Elements;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.tools.apt.helper.JsonSchemaHelper;
+import org.apache.camel.tools.apt.helper.Strings;
+
+import static org.apache.camel.tools.apt.helper.JsonSchemaHelper.sanitizeDescription;
+import static org.apache.camel.tools.apt.helper.Strings.canonicalClassName;
+import static org.apache.camel.tools.apt.helper.Strings.isNullOrEmpty;
+import static org.apache.camel.tools.apt.helper.Strings.safeNull;
+
+/**
+ * Process camel-spring's <camelContext> and generate json schema documentation
+ */
+@SupportedAnnotationTypes({"javax.xml.bind.annotation.*", "org.apache.camel.spi.Label"})
+@SupportedSourceVersion(SourceVersion.RELEASE_8)
+public class CamelContextAnnotationProcessor extends AbstractAnnotationProcessor {
+
+ private static final String ONE_OF_TYPE_NAME = "";
+ private boolean skipUnwanted = true;
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ try {
+ if (roundEnv.processingOver()) {
+ return true;
+ }
+
+ Set<? extends Element> elements = roundEnv.getElementsAnnotatedWith(XmlRootElement.class);
+ for (Element element : elements) {
+ if (element instanceof TypeElement) {
+ processModelClass(roundEnv, (TypeElement) element);
+ }
+ }
+ } catch (Throwable e) {
+ dumpExceptionToErrorFile("camel-apt-error.log", "Error processing CamelContext model", e);
+ }
+ return true;
+ }
+
+ protected void processModelClass(final RoundEnvironment roundEnv, final TypeElement classElement) {
+ // must be from org.apache.camel.model
+ final String javaTypeName = canonicalClassName(classElement.getQualifiedName().toString());
+ String packageName = javaTypeName.substring(0, javaTypeName.lastIndexOf("."));
+ if (!javaTypeName.startsWith("org.apache.camel.spring")) {
+ return;
+ }
+
+ // skip abstract classes
+ if (classElement.getModifiers().contains(Modifier.ABSTRACT)) {
+ return;
+ }
+
+ // skip unwanted classes which are "abstract" holders
+ if (skipUnwanted) {
+ if (classElement.getQualifiedName().toString().equals(ONE_OF_TYPE_NAME)) {
+ return;
+ }
+ }
+
+ final XmlRootElement rootElement = classElement.getAnnotation(XmlRootElement.class);
+ if (rootElement == null) {
+ return;
+ }
+
+ String aName = rootElement.name();
+ if (isNullOrEmpty(aName) || "##default".equals(aName)) {
+ XmlType typeElement = classElement.getAnnotation(XmlType.class);
+ aName = typeElement.name();
+ }
+ final String name = aName;
+
+ // lets use the xsd name as the file name
+ String fileName;
+ if (isNullOrEmpty(name) || "##default".equals(name)) {
+ fileName = classElement.getSimpleName().toString() + ".json";
+ } else {
+ fileName = name + ".json";
+ }
+
+ // write json schema
+ Func1<PrintWriter, Void> handler = new Func1<PrintWriter, Void>() {
+ @Override
+ public Void call(PrintWriter writer) {
+ writeJSonSchemeDocumentation(writer, roundEnv, classElement, rootElement, javaTypeName, name);
+ return null;
+ }
+ };
+ processFile(packageName, fileName, handler);
+ }
+
+ protected void writeJSonSchemeDocumentation(PrintWriter writer, RoundEnvironment roundEnv, TypeElement classElement, XmlRootElement rootElement,
+ String javaTypeName, String modelName) {
+ // gather eip information
+ EipModel eipModel = findEipModelProperties(roundEnv, classElement, javaTypeName, modelName);
+
+ // collect eip information
+ Set<EipOption> eipOptions = new TreeSet<EipOption>(new EipOptionComparator(eipModel));
+ findClassProperties(writer, roundEnv, eipOptions, classElement, classElement, "", modelName);
+
+ String json = createParameterJsonSchema(eipModel, eipOptions);
+ writer.println(json);
+ }
+
+ public String createParameterJsonSchema(EipModel eipModel, Set<EipOption> options) {
+ StringBuilder buffer = new StringBuilder("{");
+ // eip model
+ buffer.append("\n \"model\": {");
+ buffer.append("\n \"kind\": \"").append("model").append("\",");
+ buffer.append("\n \"name\": \"").append(eipModel.getName()).append("\",");
+ if (eipModel.getTitle() != null) {
+ buffer.append("\n \"title\": \"").append(eipModel.getTitle()).append("\",");
+ } else {
+ // fallback and use name as title
+ 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 },");
+
+ buffer.append("\n \"properties\": {");
+ boolean first = true;
+ for (EipOption entry : options) {
+ if (first) {
+ first = false;
+ } else {
+ buffer.append(",");
+ }
+ buffer.append("\n ");
+ // as its json we need to sanitize the docs
+ String doc = entry.getDocumentation();
+ doc = sanitizeDescription(doc, false);
+ buffer.append(JsonSchemaHelper.toJson(entry.getName(), entry.getKind(), entry.isRequired(), entry.getType(), entry.getDefaultValue(), doc,
+ entry.isDeprecated(), false, null, null, entry.isEnumType(), entry.getEnums(), entry.isOneOf(), entry.getOneOfTypes(), null, null, false));
+ }
+ buffer.append("\n }");
+
+ buffer.append("\n}\n");
+ return buffer.toString();
+ }
+
+ protected EipModel findEipModelProperties(RoundEnvironment roundEnv, TypeElement classElement, String javaTypeName, String name) {
+ EipModel model = new EipModel();
+ model.setJavaType(javaTypeName);
+ model.setName(name);
+
+ Metadata metadata = classElement.getAnnotation(Metadata.class);
+ if (metadata != null) {
+ if (!Strings.isNullOrEmpty(metadata.label())) {
+ model.setLabel(metadata.label());
+ }
+ if (!Strings.isNullOrEmpty(metadata.title())) {
+ model.setTitle(metadata.title());
+ }
+ }
+
+ // favor to use class javadoc of component as description
+ if (model.getJavaType() != null) {
+ Elements elementUtils = processingEnv.getElementUtils();
+ TypeElement typeElement = findTypeElement(roundEnv, model.getJavaType());
+ if (typeElement != null) {
+ String doc = elementUtils.getDocComment(typeElement);
+ if (doc != null) {
+ // need to sanitize the description first (we only want a summary)
+ doc = sanitizeDescription(doc, true);
+ // the javadoc may actually be empty, so only change the doc if we got something
+ if (!Strings.isNullOrEmpty(doc)) {
+ model.setDescription(doc);
+ }
+ }
+ }
+ }
+
+ return model;
+ }
+
+ protected void findClassProperties(PrintWriter writer, RoundEnvironment roundEnv, Set<EipOption> eipOptions,
+ TypeElement originalClassType, TypeElement classElement, String prefix, String modelName) {
+ while (true) {
+ List<VariableElement> fieldElements = ElementFilter.fieldsIn(classElement.getEnclosedElements());
+ for (VariableElement fieldElement : fieldElements) {
+
+ String fieldName = fieldElement.getSimpleName().toString();
+
+ XmlAttribute attribute = fieldElement.getAnnotation(XmlAttribute.class);
+ if (attribute != null) {
+ boolean skip = processAttribute(roundEnv, originalClassType, classElement, fieldElement, fieldName, attribute, eipOptions, prefix, modelName);
+ if (skip) {
+ continue;
+ }
+ }
+
+ XmlElements elements = fieldElement.getAnnotation(XmlElements.class);
+ if (elements != null) {
+ processElements(roundEnv, classElement, elements, fieldElement, eipOptions, prefix);
+ }
+
+ XmlElement element = fieldElement.getAnnotation(XmlElement.class);
+ if (element != null) {
+ if ("rests".equals(fieldName)) {
+ processRests(roundEnv, classElement, element, fieldElement, fieldName, eipOptions, prefix);
+ } else if ("routes".equals(fieldName)) {
+ processRoutes(roundEnv, classElement, element, fieldElement, fieldName, eipOptions, prefix);
+ } else {
+ processElement(roundEnv, classElement, element, fieldElement, eipOptions, prefix);
+ }
+ }
+ }
+
+ // check super classes which may also have fields
+ TypeElement baseTypeElement = null;
+ TypeMirror superclass = classElement.getSuperclass();
+ if (superclass != null) {
+ String superClassName = canonicalClassName(superclass.toString());
+ baseTypeElement = findTypeElement(roundEnv, superClassName);
+ }
+ if (baseTypeElement != null) {
+ classElement = baseTypeElement;
+ } else {
+ break;
+ }
+ }
+ }
+
+ private boolean processAttribute(RoundEnvironment roundEnv, TypeElement originalClassType, TypeElement classElement, VariableElement fieldElement,
+ String fieldName, XmlAttribute attribute, Set<EipOption> eipOptions, String prefix, String modelName) {
+ Elements elementUtils = processingEnv.getElementUtils();
+
+ String name = attribute.name();
+ if (isNullOrEmpty(name) || "##default".equals(name)) {
+ name = fieldName;
+ }
+
+ // lets skip some unwanted attributes
+ if (skipUnwanted) {
+ }
+
+ name = prefix + name;
+ TypeMirror fieldType = fieldElement.asType();
+ String fieldTypeName = fieldType.toString();
+ TypeElement fieldTypeElement = findTypeElement(roundEnv, fieldTypeName);
+
+ String defaultValue = findDefaultValue(fieldElement, fieldTypeName);
+ String docComment = findJavaDoc(elementUtils, fieldElement, fieldName, name, classElement, true);
+ boolean required = attribute.required();
+ // metadata may overrule element required
+ required = findRequired(fieldElement, required);
+
+ // gather enums
+ Set<String> enums = new TreeSet<String>();
+ boolean isEnum = fieldTypeElement != null && fieldTypeElement.getKind() == ElementKind.ENUM;
+ if (isEnum) {
+ TypeElement enumClass = findTypeElement(roundEnv, fieldTypeElement.asType().toString());
+ // find all the enum constants which has the possible enum value that can be used
+ List<VariableElement> fields = ElementFilter.fieldsIn(enumClass.getEnclosedElements());
+ for (VariableElement var : fields) {
+ if (var.getKind() == ElementKind.ENUM_CONSTANT) {
+ String val = var.toString();
+ enums.add(val);
+ }
+ }
+ }
+
+ boolean deprecated = fieldElement.getAnnotation(Deprecated.class) != null;
+
+ EipOption ep = new EipOption(name, "attribute", fieldTypeName, required, defaultValue, docComment, deprecated, isEnum, enums, false, null);
+ eipOptions.add(ep);
+
+ return false;
+ }
+
+ /**
+ * Special for processing an @XmlElement routes field
+ */
+ private void processRoutes(RoundEnvironment roundEnv, TypeElement originalClassType, XmlElement element,
+ VariableElement fieldElement, String fieldName, Set<EipOption> eipOptions, String prefix) {
+
+ TypeMirror fieldType = fieldElement.asType();
+ String fieldTypeName = fieldType.toString();
+
+ Set<String> oneOfTypes = new TreeSet<String>();
+ oneOfTypes.add("route");
+
+ EipOption ep = new EipOption("route", "element", fieldTypeName, false, "", "Contains the Camel routes", false, false, null, true, oneOfTypes);
+ eipOptions.add(ep);
+ }
+
+ /**
+ * Special for processing an @XmlElement rests field
+ */
+ private void processRests(RoundEnvironment roundEnv, TypeElement originalClassType, XmlElement element,
+ VariableElement fieldElement, String fieldName, Set<EipOption> eipOptions, String prefix) {
+
+ TypeMirror fieldType = fieldElement.asType();
+ String fieldTypeName = fieldType.toString();
+
+ Set<String> oneOfTypes = new TreeSet<String>();
+ oneOfTypes.add("rest");
+
+ EipOption ep = new EipOption("rest", "element", fieldTypeName, false, "", "Contains the rest services defined using the rest-dsl", false, false, null, true, oneOfTypes);
+ eipOptions.add(ep);
+ }
+
+ private void processElement(RoundEnvironment roundEnv, TypeElement classElement, XmlElement element, VariableElement fieldElement,
+ Set<EipOption> eipOptions, String prefix) {
+ Elements elementUtils = processingEnv.getElementUtils();
+
+ String fieldName;
+ fieldName = fieldElement.getSimpleName().toString();
+ if (element != null) {
+
+ String kind = "element";
+ String name = element.name();
+ if (isNullOrEmpty(name) || "##default".equals(name)) {
+ name = fieldName;
+ }
+ name = prefix + name;
+ TypeMirror fieldType = fieldElement.asType();
+ String fieldTypeName = fieldType.toString();
+ TypeElement fieldTypeElement = findTypeElement(roundEnv, fieldTypeName);
+
+ String defaultValue = findDefaultValue(fieldElement, fieldTypeName);
+ String docComment = findJavaDoc(elementUtils, fieldElement, fieldName, name, classElement, true);
+ boolean required = element.required();
+ // metadata may overrule element required
+ required = findRequired(fieldElement, required);
+
+ // gather enums
+ Set<String> enums = new LinkedHashSet<String>();
+ boolean isEnum = fieldTypeElement != null && fieldTypeElement.getKind() == ElementKind.ENUM;
+ if (isEnum) {
+ TypeElement enumClass = findTypeElement(roundEnv, fieldTypeElement.asType().toString());
+ // find all the enum constants which has the possible enum value that can be used
+ List<VariableElement> fields = ElementFilter.fieldsIn(enumClass.getEnclosedElements());
+ for (VariableElement var : fields) {
+ if (var.getKind() == ElementKind.ENUM_CONSTANT) {
+ String val = var.toString();
+ enums.add(val);
+ }
+ }
+ }
+
+ boolean deprecated = fieldElement.getAnnotation(Deprecated.class) != null;
+
+ EipOption ep = new EipOption(name, kind, fieldTypeName, required, defaultValue, docComment, deprecated, isEnum, enums, false, null);
+ eipOptions.add(ep);
+ }
+ }
+
+ private void processElements(RoundEnvironment roundEnv, TypeElement classElement, XmlElements elements, VariableElement fieldElement,
+ Set<EipOption> eipOptions, String prefix) {
+ Elements elementUtils = processingEnv.getElementUtils();
+
+ String fieldName;
+ fieldName = fieldElement.getSimpleName().toString();
+ if (elements != null) {
+ String kind = "element";
+ String name = fieldName;
+ name = prefix + name;
+
+ TypeMirror fieldType = fieldElement.asType();
+ String fieldTypeName = fieldType.toString();
+
+ String defaultValue = findDefaultValue(fieldElement, fieldTypeName);
+ String docComment = findJavaDoc(elementUtils, fieldElement, fieldName, name, classElement, true);
+
+ boolean required = false;
+ required = findRequired(fieldElement, required);
+
+ // gather oneOf of the elements
+ Set<String> oneOfTypes = new TreeSet<String>();
+ for (XmlElement element : elements.value()) {
+ String child = element.name();
+ oneOfTypes.add(child);
+ }
+
+ EipOption ep = new EipOption(name, kind, fieldTypeName, required, defaultValue, docComment, false, false, null, true, oneOfTypes);
+ eipOptions.add(ep);
+ }
+ }
+
+ private String findDefaultValue(VariableElement fieldElement, String fieldTypeName) {
+ String defaultValue = null;
+ Metadata metadata = fieldElement.getAnnotation(Metadata.class);
+ if (metadata != null) {
+ if (!Strings.isNullOrEmpty(metadata.defaultValue())) {
+ defaultValue = metadata.defaultValue();
+ }
+ }
+ if (defaultValue == null) {
+ // if its a boolean type, then we use false as the default
+ if ("boolean".equals(fieldTypeName) || "java.lang.Boolean".equals(fieldTypeName)) {
+ defaultValue = "false";
+ }
+ }
+
+ return defaultValue;
+ }
+
+ private boolean findRequired(VariableElement fieldElement, boolean defaultValue) {
+ Metadata metadata = fieldElement.getAnnotation(Metadata.class);
+ if (metadata != null) {
+ if (!Strings.isNullOrEmpty(metadata.required())) {
+ defaultValue = "true".equals(metadata.required());
+ }
+ }
+ return defaultValue;
+ }
+
+ /**
+ * Capitializes the name as a title
+ *
+ * @param name the name
+ * @return as a title
+ */
+ private static String asTitle(String name) {
+ StringBuilder sb = new StringBuilder();
+ for (char c : name.toCharArray()) {
+ boolean upper = Character.isUpperCase(c);
+ boolean first = sb.length() == 0;
+ if (first) {
+ sb.append(Character.toUpperCase(c));
+ } else if (upper) {
+ sb.append(' ');
+ sb.append(c);
+ } else {
+ sb.append(Character.toLowerCase(c));
+ }
+ }
+ return sb.toString().trim();
+ }
+
+ private static final class EipModel {
+
+ private String name;
+ private String title;
+ private String javaType;
+ private String label;
+ private String description;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getJavaType() {
+ return javaType;
+ }
+
+ public void setJavaType(String javaType) {
+ this.javaType = javaType;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ }
+
+ private static final class EipOption {
+
+ private String name;
+ private String kind;
+ private String type;
+ private boolean required;
+ private String defaultValue;
+ private String documentation;
+ private boolean deprecated;
+ private boolean enumType;
+ private Set<String> enums;
+ private boolean oneOf;
+ private Set<String> oneOfTypes;
+
+ private EipOption(String name, String kind, String type, boolean required, String defaultValue, String documentation, boolean deprecated,
+ boolean enumType, Set<String> enums, boolean oneOf, Set<String> oneOfTypes) {
+ this.name = name;
+ this.kind = kind;
+ this.type = type;
+ this.required = required;
+ this.defaultValue = defaultValue;
+ this.documentation = documentation;
+ this.deprecated = deprecated;
+ this.enumType = enumType;
+ this.enums = enums;
+ this.oneOf = oneOf;
+ this.oneOfTypes = oneOfTypes;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getKind() {
+ return kind;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public boolean isRequired() {
+ return required;
+ }
+
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ public String getDocumentation() {
+ return documentation;
+ }
+
+ public boolean isDeprecated() {
+ return deprecated;
+ }
+
+ public boolean isEnumType() {
+ return enumType;
+ }
+
+ public Set<String> getEnums() {
+ return enums;
+ }
+
+ public boolean isOneOf() {
+ return oneOf;
+ }
+
+ public Set<String> getOneOfTypes() {
+ return oneOfTypes;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ EipOption that = (EipOption) o;
+
+ if (!name.equals(that.name)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+ }
+
+ private static final class EipOptionComparator implements Comparator<EipOption> {
+
+ private final EipModel model;
+
+ private EipOptionComparator(EipModel model) {
+ this.model = model;
+ }
+
+ @Override
+ public int compare(EipOption o1, EipOption o2) {
+ int weigth = weigth(o1);
+ int weigth2 = weigth(o2);
+
+ if (weigth == weigth2) {
+ // keep the current order
+ return 1;
+ } else {
+ // sort according to weight
+ return weigth2 - weigth;
+ }
+ }
+
+ private int weigth(EipOption o) {
+ String name = o.getName();
+
+ // these should be first
+ if ("expression".equals(name)) {
+ return 10;
+ }
+
+ // these should be last
+ if ("description".equals(name)) {
+ return -10;
+ } else if ("id".equals(name)) {
+ return -9;
+ } else if ("pattern".equals(name) && "to".equals(model.getName())) {
+ // and pattern only for the to model
+ return -8;
+ }
+ return 0;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/3f14b029/tooling/apt/src/main/resources/META-INF/services/javax.annotation.processing.Processor
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/tooling/apt/src/main/resources/META-INF/services/javax.annotation.processing.Processor
index 5148414..a1fa0cb 100644
--- a/tooling/apt/src/main/resources/META-INF/services/javax.annotation.processing.Processor
+++ b/tooling/apt/src/main/resources/META-INF/services/javax.annotation.processing.Processor
@@ -14,5 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+org.apache.camel.tools.apt.CamelContextAnnotationProcessor
org.apache.camel.tools.apt.EipAnnotationProcessor
org.apache.camel.tools.apt.EndpointAnnotationProcessor
[6/7] camel git commit: CAMEL-9482: Generate json schema model for
camel-spring
Posted by da...@apache.org.
CAMEL-9482: Generate json schema model for camel-spring
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/532371ac
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/532371ac
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/532371ac
Branch: refs/heads/master
Commit: 532371ac491fcf19bce9709acd29645af1ed0b88
Parents: 2c6d13a
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Aug 10 18:08:17 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Aug 10 19:08:13 2016 +0200
----------------------------------------------------------------------
.../camel/core/xml/CamelJMXAgentDefinition.java | 153 +++++++++----------
.../xml/CamelPropertyPlaceholderDefinition.java | 67 +++++---
...elPropertyPlaceholderFunctionDefinition.java | 6 +
.../core/xml/CamelProxyFactoryDefinition.java | 30 +++-
.../xml/CamelServiceExporterDefinition.java | 19 ++-
.../CamelStreamCachingStrategyDefinition.java | 73 +++++++--
6 files changed, 221 insertions(+), 127 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/532371ac/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelJMXAgentDefinition.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelJMXAgentDefinition.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelJMXAgentDefinition.java
index 861c234..e1cf54f 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelJMXAgentDefinition.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelJMXAgentDefinition.java
@@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.camel.model.IdentifiedType;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.util.CollectionStringBuffer;
/**
@@ -31,112 +32,48 @@ import org.apache.camel.util.CollectionStringBuffer;
@XmlAccessorType(XmlAccessType.FIELD)
public class CamelJMXAgentDefinition extends IdentifiedType {
- /**
- * Disable JMI (default false)
- */
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "false")
private String disabled;
-
- /**
- * Only register processor if a custom id was defined for it.
- */
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "false")
private String onlyRegisterProcessorWithCustomId;
-
- /**
- * RMI connector registry port (default 1099)
- */
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "1099")
private String registryPort;
-
- /**
- * RMI connector server port (default -1 not used)
- */
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "-1")
private String connectorPort;
-
- /**
- * MBean server default domain name (default org.apache.camel)
- */
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "org.apache.camel")
private String mbeanServerDefaultDomain;
-
- /**
- * MBean object domain name (default org.apache.camel)
- */
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "org.apache.camel")
private String mbeanObjectDomainName;
-
- /**
- * JMX Service URL path (default /jmxrmi)
- */
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "/jmxrmi")
private String serviceUrlPath;
-
- /**
- * A flag that indicates whether the agent should be created
- */
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "false")
private String createConnector;
-
- /**
- * A flag that indicates whether the platform mbean server should be used
- */
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "true")
private String usePlatformMBeanServer;
-
- /**
- * A flag that indicates whether to register mbeans always
- */
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "false")
private String registerAlways;
-
- /**
- * A flag that indicates whether to register mbeans when starting new routes
- */
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "false")
private String registerNewRoutes;
-
- /**
- * Level of granularity for performance statistics enabled
- */
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "Default")
private String statisticsLevel;
-
- /**
- * A flag that indicates whether Load statistics is enabled
- */
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "false")
private String loadStatisticsEnabled;
-
- /**
- * A flag that indicates whether endpoint runtime statistics is enabled
- */
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "true")
private String endpointRuntimeStatisticsEnabled;
-
- /**
- * A flag that indicates whether to include hostname in JMX MBean names.
- */
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "false")
private String includeHostName;
-
- /**
- * A flag that indicates whether to use hostname or IP Address in the service url.
- */
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "false")
private String useHostIPAddress;
-
- /**
- * A flag that indicates whether to remove detected sensitive information (such as passwords) from MBean names and attributes.
- */
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "true")
private String mask;
public String getDisabled() {
return disabled;
}
+ /**
+ * Disable JMI (default false)
+ */
public void setDisabled(String disabled) {
this.disabled = disabled;
}
@@ -145,6 +82,9 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
return onlyRegisterProcessorWithCustomId;
}
+ /**
+ * Only register processor if a custom id was defined for it.
+ */
public void setOnlyRegisterProcessorWithCustomId(String onlyRegisterProcessorWithCustomId) {
this.onlyRegisterProcessorWithCustomId = onlyRegisterProcessorWithCustomId;
}
@@ -153,6 +93,9 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
return registryPort;
}
+ /**
+ * RMI connector registry port (default 1099)
+ */
public void setRegistryPort(String registryPort) {
this.registryPort = registryPort;
}
@@ -161,6 +104,9 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
return connectorPort;
}
+ /**
+ * RMI connector server port (default -1 not used)
+ */
public void setConnectorPort(String connectorPort) {
this.connectorPort = connectorPort;
}
@@ -169,6 +115,9 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
return mbeanServerDefaultDomain;
}
+ /**
+ * MBean server default domain name (default org.apache.camel)
+ */
public void setMbeanServerDefaultDomain(String mbeanServerDefaultDomain) {
this.mbeanServerDefaultDomain = mbeanServerDefaultDomain;
}
@@ -177,6 +126,9 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
return mbeanObjectDomainName;
}
+ /**
+ * MBean object domain name (default org.apache.camel)
+ */
public void setMbeanObjectDomainName(String mbeanObjectDomainName) {
this.mbeanObjectDomainName = mbeanObjectDomainName;
}
@@ -185,6 +137,9 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
return serviceUrlPath;
}
+ /**
+ * JMX Service URL path (default /jmxrmi)
+ */
public void setServiceUrlPath(String serviceUrlPath) {
this.serviceUrlPath = serviceUrlPath;
}
@@ -193,6 +148,9 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
return createConnector;
}
+ /**
+ * A flag that indicates whether the agent should be created
+ */
public void setCreateConnector(String createConnector) {
this.createConnector = createConnector;
}
@@ -201,6 +159,9 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
return usePlatformMBeanServer;
}
+ /**
+ * A flag that indicates whether the platform mbean server should be used
+ */
public void setUsePlatformMBeanServer(String usePlatformMBeanServer) {
this.usePlatformMBeanServer = usePlatformMBeanServer;
}
@@ -209,6 +170,9 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
return statisticsLevel;
}
+ /**
+ * Level of granularity for performance statistics enabled
+ */
public void setStatisticsLevel(String statisticsLevel) {
this.statisticsLevel = statisticsLevel;
}
@@ -217,6 +181,9 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
return registerAlways;
}
+ /**
+ * A flag that indicates whether to register mbeans always
+ */
public void setRegisterAlways(String registerAlways) {
this.registerAlways = registerAlways;
}
@@ -225,6 +192,9 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
return registerNewRoutes;
}
+ /**
+ * A flag that indicates whether to register mbeans when starting new routes
+ */
public void setRegisterNewRoutes(String registerNewRoutes) {
this.registerNewRoutes = registerNewRoutes;
}
@@ -233,6 +203,9 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
return loadStatisticsEnabled;
}
+ /**
+ * A flag that indicates whether Load statistics is enabled
+ */
public void setLoadStatisticsEnabled(String loadStatisticsEnabled) {
this.loadStatisticsEnabled = loadStatisticsEnabled;
}
@@ -241,6 +214,9 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
return endpointRuntimeStatisticsEnabled;
}
+ /**
+ * A flag that indicates whether endpoint runtime statistics is enabled
+ */
public void setEndpointRuntimeStatisticsEnabled(String endpointRuntimeStatisticsEnabled) {
this.endpointRuntimeStatisticsEnabled = endpointRuntimeStatisticsEnabled;
}
@@ -249,6 +225,9 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
return includeHostName;
}
+ /**
+ * A flag that indicates whether to include hostname in JMX MBean names.
+ */
public void setIncludeHostName(String includeHostName) {
this.includeHostName = includeHostName;
}
@@ -257,6 +236,9 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
return mask;
}
+ /**
+ * A flag that indicates whether to remove detected sensitive information (such as passwords) from MBean names and attributes.
+ */
public void setMask(String mask) {
this.mask = mask;
}
@@ -265,6 +247,9 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
return useHostIPAddress;
}
+ /**
+ * A flag that indicates whether to use hostname or IP Address in the service url.
+ */
public void setUseHostIPAddress(String useHostIPAddress) {
this.useHostIPAddress = useHostIPAddress;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/532371ac/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderDefinition.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderDefinition.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderDefinition.java
index b07fdc0..d0802e9 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderDefinition.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderDefinition.java
@@ -24,9 +24,10 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.camel.model.IdentifiedType;
+import org.apache.camel.spi.Metadata;
/**
- * <code>PropertyPlaceholderDefinition</code> represents a <propertyPlaceholder/> element.
+ * Properties placeholder
*
* @version
*/
@@ -36,37 +37,26 @@ public class CamelPropertyPlaceholderDefinition extends IdentifiedType {
@XmlAttribute(required = true)
private String location;
-
@XmlAttribute
private String encoding;
-
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "true")
private Boolean cache;
-
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "false")
private Boolean ignoreMissingLocation;
-
@XmlAttribute
private String propertiesResolverRef;
-
@XmlAttribute
private String propertiesParserRef;
-
@XmlAttribute
private String propertyPrefix;
-
@XmlAttribute
private String propertySuffix;
-
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "true")
private Boolean fallbackToUnaugmentedProperty;
-
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "{{")
private String prefixToken;
-
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "}}")
private String suffixToken;
-
@XmlElement(name = "propertiesFunction")
private List<CamelPropertyPlaceholderFunctionDefinition> functions;
@@ -74,6 +64,10 @@ public class CamelPropertyPlaceholderDefinition extends IdentifiedType {
return location;
}
+ /**
+ * A list of locations to load properties. You can use comma to separate multiple locations.
+ * This option will override any default locations and only use the locations from this option.
+ */
public void setLocation(String location) {
this.location = location;
}
@@ -82,6 +76,12 @@ public class CamelPropertyPlaceholderDefinition extends IdentifiedType {
return encoding;
}
+ /**
+ * Encoding to use when loading properties file from the file system or classpath.
+ * <p/>
+ * If no encoding has been set, then the properties files is loaded using ISO-8859-1 encoding (latin-1)
+ * as documented by {@link java.util.Properties#load(java.io.InputStream)}
+ */
public void setEncoding(String encoding) {
this.encoding = encoding;
}
@@ -90,6 +90,9 @@ public class CamelPropertyPlaceholderDefinition extends IdentifiedType {
return cache;
}
+ /**
+ * Whether or not to cache loaded properties. The default value is true.
+ */
public void setCache(Boolean cache) {
this.cache = cache;
}
@@ -98,6 +101,9 @@ public class CamelPropertyPlaceholderDefinition extends IdentifiedType {
return propertiesResolverRef;
}
+ /**
+ * Reference to a custom PropertiesResolver to be used
+ */
public void setPropertiesResolverRef(String propertiesResolverRef) {
this.propertiesResolverRef = propertiesResolverRef;
}
@@ -106,6 +112,9 @@ public class CamelPropertyPlaceholderDefinition extends IdentifiedType {
return propertiesParserRef;
}
+ /**
+ * Reference to a custom PropertiesParser to be used
+ */
public void setPropertiesParserRef(String propertiesParserRef) {
this.propertiesParserRef = propertiesParserRef;
}
@@ -114,6 +123,9 @@ public class CamelPropertyPlaceholderDefinition extends IdentifiedType {
return propertyPrefix;
}
+ /**
+ * Optional prefix prepended to property names before resolution.
+ */
public void setPropertyPrefix(String propertyPrefix) {
this.propertyPrefix = propertyPrefix;
}
@@ -122,6 +134,9 @@ public class CamelPropertyPlaceholderDefinition extends IdentifiedType {
return propertySuffix;
}
+ /**
+ * Optional suffix appended to property names before resolution.
+ */
public void setPropertySuffix(String propertySuffix) {
this.propertySuffix = propertySuffix;
}
@@ -130,6 +145,10 @@ public class CamelPropertyPlaceholderDefinition extends IdentifiedType {
return fallbackToUnaugmentedProperty;
}
+ /**
+ * If true, first attempt resolution of property name augmented with propertyPrefix and propertySuffix
+ * before falling back the plain property name specified. If false, only the augmented property name is searched.
+ */
public void setFallbackToUnaugmentedProperty(Boolean fallbackToUnaugmentedProperty) {
this.fallbackToUnaugmentedProperty = fallbackToUnaugmentedProperty;
}
@@ -138,6 +157,9 @@ public class CamelPropertyPlaceholderDefinition extends IdentifiedType {
return ignoreMissingLocation;
}
+ /**
+ * Whether to silently ignore if a location cannot be located, such as a properties file not found.
+ */
public void setIgnoreMissingLocation(Boolean ignoreMissingLocation) {
this.ignoreMissingLocation = ignoreMissingLocation;
}
@@ -146,6 +168,10 @@ public class CamelPropertyPlaceholderDefinition extends IdentifiedType {
return prefixToken;
}
+ /**
+ * Sets the value of the prefix token used to identify properties to replace. Setting a value of
+ * {@code null} restores the default token {{
+ */
public void setPrefixToken(String prefixToken) {
this.prefixToken = prefixToken;
}
@@ -154,6 +180,10 @@ public class CamelPropertyPlaceholderDefinition extends IdentifiedType {
return suffixToken;
}
+ /**
+ * Sets the value of the suffix token used to identify properties to replace. Setting a value of
+ * {@code null} restores the default token }}
+ */
public void setSuffixToken(String suffixToken) {
this.suffixToken = suffixToken;
}
@@ -162,6 +192,9 @@ public class CamelPropertyPlaceholderDefinition extends IdentifiedType {
return functions;
}
+ /**
+ * List of custom properties function to use.
+ */
public void setFunctions(List<CamelPropertyPlaceholderFunctionDefinition> functions) {
this.functions = functions;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/532371ac/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderFunctionDefinition.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderFunctionDefinition.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderFunctionDefinition.java
index a7e328d..a3b1c19 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderFunctionDefinition.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderFunctionDefinition.java
@@ -21,6 +21,9 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.apache.camel.model.IdentifiedType;
+/**
+ * Function to use with properties placeholder
+ */
@XmlRootElement(name = "propertiesFunction")
public class CamelPropertyPlaceholderFunctionDefinition extends IdentifiedType {
@@ -31,6 +34,9 @@ public class CamelPropertyPlaceholderFunctionDefinition extends IdentifiedType {
return ref;
}
+ /**
+ * Reference to the custom properties function to lookup in the registry
+ */
public void setRef(String ref) {
this.ref = ref;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/532371ac/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelProxyFactoryDefinition.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelProxyFactoryDefinition.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelProxyFactoryDefinition.java
index fa1b3a5..e0149e0 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelProxyFactoryDefinition.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelProxyFactoryDefinition.java
@@ -20,9 +20,10 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.camel.model.IdentifiedType;
+import org.apache.camel.spi.Metadata;
/**
- * The <proxy> tag element.
+ * To proxy a service call using a interface
*
* @version
*/ // to fudge the XSD generation
@@ -31,23 +32,22 @@ public class CamelProxyFactoryDefinition extends IdentifiedType {
@XmlAttribute
private String serviceUrl;
-
- @XmlAttribute
+ @XmlAttribute @Deprecated
private String serviceRef;
-
@XmlAttribute
private Class<?> serviceInterface;
-
@XmlAttribute
private String camelContextId;
-
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "true")
private Boolean binding;
public String getServiceUrl() {
return serviceUrl;
}
+ /**
+ * The camel endpoint uri used to send the message to when calling the service from the interface.
+ */
public void setServiceUrl(String serviceUrl) {
this.serviceUrl = serviceUrl;
}
@@ -56,6 +56,11 @@ public class CamelProxyFactoryDefinition extends IdentifiedType {
return serviceRef;
}
+ /**
+ * The camel endpoint reference used to send the message to when calling the service from the interface.
+ *
+ * @deprecated use serviceUrl instead with the ref endpoint.
+ */
public void setServiceRef(String serviceRef) {
this.serviceRef = serviceRef;
}
@@ -64,6 +69,9 @@ public class CamelProxyFactoryDefinition extends IdentifiedType {
return serviceInterface;
}
+ /**
+ * Java interfaces to use as facade for the service to be proxied
+ */
public void setServiceInterface(Class<?> serviceInterface) {
this.serviceInterface = serviceInterface;
}
@@ -72,6 +80,9 @@ public class CamelProxyFactoryDefinition extends IdentifiedType {
return camelContextId;
}
+ /**
+ * The id of the CamelContext to use, if there is multiple CamelContext in the same JVM.
+ */
public void setCamelContextId(String camelContextId) {
this.camelContextId = camelContextId;
}
@@ -80,6 +91,11 @@ public class CamelProxyFactoryDefinition extends IdentifiedType {
return binding;
}
+ /**
+ * Camel parameter binding is enabled by default, which will use binding information from the method signature
+ * parameters to bind to the Exchange/Message with the following annotations.
+ * If disabled then a {@link org.apache.camel.component.bean.CamelInvocationHandler} is used.
+ */
public void setBinding(Boolean binding) {
this.binding = binding;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/532371ac/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelServiceExporterDefinition.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelServiceExporterDefinition.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelServiceExporterDefinition.java
index 8986011..9c75131 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelServiceExporterDefinition.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelServiceExporterDefinition.java
@@ -22,22 +22,19 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.apache.camel.model.IdentifiedType;
/**
- * The <export> tag element.
+ * Used for export a service using Spring Remoting to hide the network call using an interface.
*
* @version
*/
@XmlRootElement(name = "export")
public class CamelServiceExporterDefinition extends IdentifiedType {
- @XmlAttribute
+ @XmlAttribute(required = true)
private String uri;
-
@XmlAttribute
private String serviceRef;
-
@XmlAttribute
private Class<?> serviceInterface;
-
@XmlAttribute
private String camelContextId;
@@ -45,6 +42,9 @@ public class CamelServiceExporterDefinition extends IdentifiedType {
return uri;
}
+ /**
+ * Camel endpoint uri to use a remote transport when calling the service
+ */
public void setUri(String uri) {
this.uri = uri;
}
@@ -53,6 +53,9 @@ public class CamelServiceExporterDefinition extends IdentifiedType {
return serviceRef;
}
+ /**
+ * Reference to the service name to lookup in the registry.
+ */
public void setServiceRef(String serviceRef) {
this.serviceRef = serviceRef;
}
@@ -61,6 +64,9 @@ public class CamelServiceExporterDefinition extends IdentifiedType {
return serviceInterface;
}
+ /**
+ * Java interfaces to use as facade for the service to be exported
+ */
public void setServiceInterface(Class<?> serviceInterface) {
this.serviceInterface = serviceInterface;
}
@@ -69,6 +75,9 @@ public class CamelServiceExporterDefinition extends IdentifiedType {
return camelContextId;
}
+ /**
+ * The id of the CamelContext to use, if there is multiple CamelContext in the same JVM.
+ */
public void setCamelContextId(String camelContextId) {
this.camelContextId = camelContextId;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/532371ac/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelStreamCachingStrategyDefinition.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelStreamCachingStrategyDefinition.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelStreamCachingStrategyDefinition.java
index 6498ecc..d9a2657 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelStreamCachingStrategyDefinition.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelStreamCachingStrategyDefinition.java
@@ -22,9 +22,10 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.camel.model.IdentifiedType;
+import org.apache.camel.spi.Metadata;
/**
- * The JAXB type class for the configuration of stream caching
+ * Stream caching configuration.
*
* @version
*/
@@ -32,43 +33,38 @@ import org.apache.camel.model.IdentifiedType;
@XmlAccessorType(XmlAccessType.FIELD)
public class CamelStreamCachingStrategyDefinition extends IdentifiedType {
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "false")
private String enabled;
-
@XmlAttribute
private String spoolDirectory;
-
@XmlAttribute
private String spoolChiper;
-
@XmlAttribute
private String spoolThreshold;
-
@XmlAttribute
private String spoolUsedHeapMemoryThreshold;
-
@XmlAttribute
private String spoolUsedHeapMemoryLimit;
-
@XmlAttribute
private String spoolRules;
-
@XmlAttribute
private String bufferSize;
-
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "true")
private String removeSpoolDirectoryWhenStopping;
-
@XmlAttribute
private String statisticsEnabled;
-
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "false")
private String anySpoolRules;
public String getEnabled() {
return enabled;
}
+ /**
+ * Sets whether the stream caching is enabled.
+ * <p/>
+ * <b>Notice:</b> This cannot be changed at runtime.
+ */
public void setEnabled(String enabled) {
this.enabled = enabled;
}
@@ -77,6 +73,12 @@ public class CamelStreamCachingStrategyDefinition extends IdentifiedType {
return spoolDirectory;
}
+ /**
+ * Sets the spool (temporary) directory to use for overflow and spooling to disk.
+ * <p/>
+ * If no spool directory has been explicit configured, then a temporary directory
+ * is created in the <tt>java.io.tmpdir</tt> directory.
+ */
public void setSpoolDirectory(String spoolDirectory) {
this.spoolDirectory = spoolDirectory;
}
@@ -85,6 +87,11 @@ public class CamelStreamCachingStrategyDefinition extends IdentifiedType {
return spoolChiper;
}
+ /**
+ * Sets a chiper name to use when spooling to disk to write with encryption.
+ * <p/>
+ * By default the data is not encrypted.
+ */
public void setSpoolChiper(String spoolChiper) {
this.spoolChiper = spoolChiper;
}
@@ -93,6 +100,12 @@ public class CamelStreamCachingStrategyDefinition extends IdentifiedType {
return spoolThreshold;
}
+ /**
+ * Threshold in bytes when overflow to disk is activated.
+ * <p/>
+ * The default threshold is {@link org.apache.camel.StreamCache#DEFAULT_SPOOL_THRESHOLD} bytes (eg 128kb).
+ * Use <tt>-1</tt> to disable overflow to disk.
+ */
public void setSpoolThreshold(String spoolThreshold) {
this.spoolThreshold = spoolThreshold;
}
@@ -101,6 +114,9 @@ public class CamelStreamCachingStrategyDefinition extends IdentifiedType {
return spoolUsedHeapMemoryThreshold;
}
+ /**
+ * Sets a percentage (1-99) of used heap memory threshold to activate spooling to disk.
+ */
public void setSpoolUsedHeapMemoryThreshold(String spoolUsedHeapMemoryThreshold) {
this.spoolUsedHeapMemoryThreshold = spoolUsedHeapMemoryThreshold;
}
@@ -109,6 +125,10 @@ public class CamelStreamCachingStrategyDefinition extends IdentifiedType {
return spoolUsedHeapMemoryLimit;
}
+ /**
+ * Sets what the upper bounds should be when spoolUsedHeapMemoryThreshold
+ * is in use.
+ */
public void setSpoolUsedHeapMemoryLimit(String spoolUsedHeapMemoryLimit) {
this.spoolUsedHeapMemoryLimit = spoolUsedHeapMemoryLimit;
}
@@ -117,6 +137,10 @@ public class CamelStreamCachingStrategyDefinition extends IdentifiedType {
return spoolRules;
}
+ /**
+ * Reference to one or more custom {@link org.apache.camel.spi.StreamCachingStrategy.SpoolRule} to use.
+ * Multiple rules can be separated by comma.
+ */
public void setSpoolRules(String spoolRules) {
this.spoolRules = spoolRules;
}
@@ -125,6 +149,11 @@ public class CamelStreamCachingStrategyDefinition extends IdentifiedType {
return bufferSize;
}
+ /**
+ * Sets the buffer size to use when allocating in-memory buffers used for in-memory stream caches.
+ * <p/>
+ * The default size is {@link org.apache.camel.util.IOHelper#DEFAULT_BUFFER_SIZE}
+ */
public void setBufferSize(String bufferSize) {
this.bufferSize = bufferSize;
}
@@ -133,6 +162,11 @@ public class CamelStreamCachingStrategyDefinition extends IdentifiedType {
return removeSpoolDirectoryWhenStopping;
}
+ /**
+ * Whether to remove the temporary directory when stopping.
+ * <p/>
+ * This option is default <tt>true</tt>
+ */
public void setRemoveSpoolDirectoryWhenStopping(String removeSpoolDirectoryWhenStopping) {
this.removeSpoolDirectoryWhenStopping = removeSpoolDirectoryWhenStopping;
}
@@ -141,6 +175,9 @@ public class CamelStreamCachingStrategyDefinition extends IdentifiedType {
return statisticsEnabled;
}
+ /**
+ * Sets whether statistics is enabled.
+ */
public void setStatisticsEnabled(String statisticsEnabled) {
this.statisticsEnabled = statisticsEnabled;
}
@@ -149,6 +186,14 @@ public class CamelStreamCachingStrategyDefinition extends IdentifiedType {
return anySpoolRules;
}
+ /**
+ * Sets whether if just any of the {@link org.apache.camel.spi.StreamCachingStrategy.SpoolRule} rules
+ * returns <tt>true</tt> then shouldSpoolCache(long) returns <tt>true</tt>.
+ * If this option is <tt>false</tt>, then <b>all</b> the {@link org.apache.camel.spi.StreamCachingStrategy.SpoolRule} must
+ * return <tt>true</tt>.
+ * <p/>
+ * The default value is <tt>false</tt> which means that all the rules must return <tt>true</tt>.
+ */
public void setAnySpoolRules(String anySpoolRules) {
this.anySpoolRules = anySpoolRules;
}
[4/7] camel git commit: Polished
Posted by da...@apache.org.
Polished
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/87ba55d8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/87ba55d8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/87ba55d8
Branch: refs/heads/master
Commit: 87ba55d89cd37dd51a593926b7a03b9552a5bf97
Parents: 629d63a
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Aug 10 11:22:33 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Aug 10 19:08:13 2016 +0200
----------------------------------------------------------------------
.../camel/spring/CamelContextFactoryBean.java | 91 ++++++++++----------
1 file changed, 45 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/87ba55d8/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
index a9da06b..42def32 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
@@ -95,64 +95,64 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
implements FactoryBean<SpringCamelContext>, InitializingBean, DisposableBean, ApplicationContextAware, ApplicationListener<ApplicationEvent> {
private static final Logger LOG = LoggerFactory.getLogger(CamelContextFactoryBean.class);
- @XmlAttribute(name = "depends-on", required = false)
+ @XmlAttribute(name = "depends-on")
private String dependsOn;
- @XmlAttribute(required = false)
+ @XmlAttribute
private String trace;
- @XmlAttribute(required = false)
+ @XmlAttribute
private String messageHistory;
- @XmlAttribute(required = false)
+ @XmlAttribute
private String logExhaustedMessageBody;
- @XmlAttribute(required = false)
+ @XmlAttribute
private String streamCache;
- @XmlAttribute(required = false)
+ @XmlAttribute
private String delayer;
- @XmlAttribute(required = false)
+ @XmlAttribute
private String handleFault;
- @XmlAttribute(required = false)
+ @XmlAttribute
private String errorHandlerRef;
- @XmlAttribute(required = false)
+ @XmlAttribute
private String autoStartup;
- @XmlAttribute(required = false)
+ @XmlAttribute
private String shutdownEager;
- @XmlAttribute(required = false)
+ @XmlAttribute
private String useMDCLogging;
- @XmlAttribute(required = false)
+ @XmlAttribute
private String useBreadcrumb;
- @XmlAttribute(required = false)
+ @XmlAttribute
private String allowUseOriginalMessage;
- @XmlAttribute(required = false)
+ @XmlAttribute
private String runtimeEndpointRegistryEnabled;
- @XmlAttribute(required = false)
+ @XmlAttribute
private String managementNamePattern;
- @XmlAttribute(required = false)
+ @XmlAttribute
private String threadNamePattern;
- @XmlAttribute(required = false)
+ @XmlAttribute
private ShutdownRoute shutdownRoute;
- @XmlAttribute(required = false)
+ @XmlAttribute
private ShutdownRunningTask shutdownRunningTask;
- @XmlAttribute(required = false)
+ @XmlAttribute
@Deprecated
private Boolean lazyLoadTypeConverters;
- @XmlAttribute(required = false)
+ @XmlAttribute
private Boolean typeConverterStatisticsEnabled;
- @XmlAttribute(required = false)
+ @XmlAttribute
private TypeConverterExists typeConverterExists;
- @XmlAttribute(required = false)
+ @XmlAttribute
private LoggingLevel typeConverterExistsLoggingLevel;
- @XmlElement(name = "properties", required = false)
+ @XmlElement(name = "properties")
private PropertiesDefinition properties;
- @XmlElement(name = "propertyPlaceholder", type = CamelPropertyPlaceholderDefinition.class, required = false)
+ @XmlElement(name = "propertyPlaceholder", type = CamelPropertyPlaceholderDefinition.class)
private CamelPropertyPlaceholderDefinition camelPropertyPlaceholder;
- @XmlElement(name = "package", required = false)
+ @XmlElement(name = "package")
private String[] packages = {};
- @XmlElement(name = "packageScan", type = PackageScanDefinition.class, required = false)
+ @XmlElement(name = "packageScan", type = PackageScanDefinition.class)
private PackageScanDefinition packageScan;
- @XmlElement(name = "contextScan", type = ContextScanDefinition.class, required = false)
+ @XmlElement(name = "contextScan", type = ContextScanDefinition.class)
private ContextScanDefinition contextScan;
- @XmlElement(name = "streamCaching", type = CamelStreamCachingStrategyDefinition.class, required = false)
+ @XmlElement(name = "streamCaching", type = CamelStreamCachingStrategyDefinition.class)
private CamelStreamCachingStrategyDefinition camelStreamCachingStrategy;
- @XmlElement(name = "jmxAgent", type = CamelJMXAgentDefinition.class, required = false)
+ @XmlElement(name = "jmxAgent", type = CamelJMXAgentDefinition.class)
private CamelJMXAgentDefinition camelJMXAgent;
@XmlElements({
@XmlElement(name = "hystrixConfiguration", type = HystrixConfigurationDefinition.class, required = false),
@@ -167,37 +167,37 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
@XmlElement(name = "export", type = CamelServiceExporterDefinition.class, required = false),
@XmlElement(name = "errorHandler", type = ErrorHandlerDefinition.class, required = false)})
private List<?> beans;
- @XmlElement(name = "routeBuilder", required = false)
+ @XmlElement(name = "routeBuilder")
private List<RouteBuilderDefinition> builderRefs = new ArrayList<RouteBuilderDefinition>();
- @XmlElement(name = "routeContextRef", required = false)
+ @XmlElement(name = "routeContextRef")
private List<RouteContextRefDefinition> routeRefs = new ArrayList<RouteContextRefDefinition>();
- @XmlElement(name = "restContextRef", required = false)
+ @XmlElement(name = "restContextRef")
private List<RestContextRefDefinition> restRefs = new ArrayList<RestContextRefDefinition>();
- @XmlElement(name = "threadPoolProfile", required = false)
+ @XmlElement(name = "threadPoolProfile")
private List<ThreadPoolProfileDefinition> threadPoolProfiles;
- @XmlElement(name = "threadPool", required = false)
+ @XmlElement(name = "threadPool")
private List<CamelThreadPoolFactoryBean> threadPools;
- @XmlElement(name = "endpoint", required = false)
+ @XmlElement(name = "endpoint")
private List<CamelEndpointFactoryBean> endpoints;
- @XmlElement(name = "dataFormats", required = false)
+ @XmlElement(name = "dataFormats")
private DataFormatsDefinition dataFormats;
- @XmlElement(name = "redeliveryPolicyProfile", required = false)
+ @XmlElement(name = "redeliveryPolicyProfile")
private List<CamelRedeliveryPolicyFactoryBean> redeliveryPolicies;
- @XmlElement(name = "onException", required = false)
+ @XmlElement(name = "onException")
private List<OnExceptionDefinition> onExceptions = new ArrayList<OnExceptionDefinition>();
- @XmlElement(name = "onCompletion", required = false)
+ @XmlElement(name = "onCompletion")
private List<OnCompletionDefinition> onCompletions = new ArrayList<OnCompletionDefinition>();
- @XmlElement(name = "intercept", required = false)
+ @XmlElement(name = "intercept")
private List<InterceptDefinition> intercepts = new ArrayList<InterceptDefinition>();
- @XmlElement(name = "interceptFrom", required = false)
+ @XmlElement(name = "interceptFrom")
private List<InterceptFromDefinition> interceptFroms = new ArrayList<InterceptFromDefinition>();
- @XmlElement(name = "interceptSendToEndpoint", required = false)
+ @XmlElement(name = "interceptSendToEndpoint")
private List<InterceptSendToEndpointDefinition> interceptSendToEndpoints = new ArrayList<InterceptSendToEndpointDefinition>();
- @XmlElement(name = "restConfiguration", required = false)
+ @XmlElement(name = "restConfiguration")
private RestConfigurationDefinition restConfiguration;
- @XmlElement(name = "rest", required = false)
+ @XmlElement(name = "rest")
private List<RestDefinition> rests = new ArrayList<RestDefinition>();
- @XmlElement(name = "route", required = false)
+ @XmlElement(name = "route")
private List<RouteDefinition> routes = new ArrayList<RouteDefinition>();
@XmlTransient
private SpringCamelContext context;
@@ -209,7 +209,6 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
private BeanPostProcessor beanPostProcessor;
@XmlTransient
private boolean implicitId;
-
@Override
public Class<SpringCamelContext> getObjectType() {
[2/7] camel git commit: CAMEL-9482: Generate json schema model for
camel-spring
Posted by da...@apache.org.
CAMEL-9482: Generate json schema model for camel-spring
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2c6d13ae
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2c6d13ae
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2c6d13ae
Branch: refs/heads/master
Commit: 2c6d13ae67b66a485cf8182bf558b766a7b58a97
Parents: cb85dc6
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Aug 10 17:33:56 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Aug 10 19:08:13 2016 +0200
----------------------------------------------------------------------
.../CamelConsumerTemplateFactoryBean.java | 5 +-
.../CamelProducerTemplateFactoryBean.java | 3 +-
.../CamelRedeliveryPolicyFactoryBean.java | 2 +-
.../spring/CamelRestContextFactoryBean.java | 2 +
.../spring/CamelRouteContextFactoryBean.java | 4 +-
.../spring/CamelThreadPoolFactoryBean.java | 2 +-
.../camel/spring/ErrorHandlerDefinition.java | 214 ++++++++++++++++++-
.../apache/camel/spring/ErrorHandlerType.java | 2 +-
8 files changed, 221 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/2c6d13ae/components/camel-spring/src/main/java/org/apache/camel/spring/CamelConsumerTemplateFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelConsumerTemplateFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelConsumerTemplateFactoryBean.java
index 9f6aafc..7207adf 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelConsumerTemplateFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelConsumerTemplateFactoryBean.java
@@ -33,10 +33,9 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
/**
- * A Spring {@link org.springframework.beans.factory.FactoryBean} for creating a new {@link org.apache.camel.ConsumerTemplate}
- * instance with a minimum of XML
+ * Configures a {@link ConsumerTemplate}
*
- * @version
+ * @version
*/
@XmlRootElement(name = "consumerTemplate")
@XmlAccessorType(XmlAccessType.FIELD)
http://git-wip-us.apache.org/repos/asf/camel/blob/2c6d13ae/components/camel-spring/src/main/java/org/apache/camel/spring/CamelProducerTemplateFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelProducerTemplateFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelProducerTemplateFactoryBean.java
index a9b6251..bc5bfce 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelProducerTemplateFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelProducerTemplateFactoryBean.java
@@ -33,8 +33,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
/**
- * A Spring {@link FactoryBean} for creating a new {@link org.apache.camel.ProducerTemplate}
- * instance with a minimum of XML
+ * Configures a {@link ProducerTemplate}
*
* @version
*/
http://git-wip-us.apache.org/repos/asf/camel/blob/2c6d13ae/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRedeliveryPolicyFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRedeliveryPolicyFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRedeliveryPolicyFactoryBean.java
index 9b4305c..17c1fe7 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRedeliveryPolicyFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRedeliveryPolicyFactoryBean.java
@@ -30,7 +30,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
/**
- * A {@link org.springframework.beans.factory.FactoryBean} which instantiates {@link org.apache.camel.processor.RedeliveryPolicy} objects
+ * Configuration of redelivery policy.
*
* @version
*/
http://git-wip-us.apache.org/repos/asf/camel/blob/2c6d13ae/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRestContextFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRestContextFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRestContextFactoryBean.java
index 09f183c..2458ed2 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRestContextFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRestContextFactoryBean.java
@@ -28,6 +28,8 @@ import org.apache.camel.model.rest.RestDefinition;
import org.springframework.beans.factory.FactoryBean;
/**
+ * Configuration of REST services using rest-dsl using XML
+ *
* @version
*/
@XmlRootElement(name = "restContext")
http://git-wip-us.apache.org/repos/asf/camel/blob/2c6d13ae/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRouteContextFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRouteContextFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRouteContextFactoryBean.java
index 621cced..88f2cf0 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRouteContextFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRouteContextFactoryBean.java
@@ -28,7 +28,9 @@ import org.apache.camel.model.RouteDefinition;
import org.springframework.beans.factory.FactoryBean;
/**
- * @version
+ * Configuration of routes using XML
+ *
+ * @version
*/
@XmlRootElement(name = "routeContext")
@XmlAccessorType(XmlAccessType.FIELD)
http://git-wip-us.apache.org/repos/asf/camel/blob/2c6d13ae/components/camel-spring/src/main/java/org/apache/camel/spring/CamelThreadPoolFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelThreadPoolFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelThreadPoolFactoryBean.java
index b82b3f9..05b9926 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelThreadPoolFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelThreadPoolFactoryBean.java
@@ -31,7 +31,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
/**
- * A {@link org.springframework.beans.factory.FactoryBean} which instantiates {@link java.util.concurrent.ExecutorService} objects
+ * Configuration of thread pools
*
* @version
*/
http://git-wip-us.apache.org/repos/asf/camel/blob/2c6d13ae/components/camel-spring/src/main/java/org/apache/camel/spring/ErrorHandlerDefinition.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/ErrorHandlerDefinition.java b/components/camel-spring/src/main/java/org/apache/camel/spring/ErrorHandlerDefinition.java
index 80fcdb8..9c787e5 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/ErrorHandlerDefinition.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/ErrorHandlerDefinition.java
@@ -24,24 +24,26 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.apache.camel.LoggingLevel;
import org.apache.camel.model.IdentifiedType;
+import org.apache.camel.processor.RedeliveryPolicy;
+import org.apache.camel.spi.Metadata;
/**
- * The <errorHandler> tag element.
+ * Error handler settings
*
* @version
*/
@XmlRootElement(name = "errorHandler")
@XmlAccessorType(XmlAccessType.FIELD)
public class ErrorHandlerDefinition extends IdentifiedType {
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "DefaultErrorHandler", required = "true")
private ErrorHandlerType type = ErrorHandlerType.DefaultErrorHandler;
@XmlAttribute
private String deadLetterUri;
@XmlAttribute
private String deadLetterHandleNewException;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "ERROR")
private LoggingLevel level;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "WARN")
private LoggingLevel rollbackLoggingLevel;
@XmlAttribute
private String logName;
@@ -66,4 +68,208 @@ public class ErrorHandlerDefinition extends IdentifiedType {
@XmlElement
private CamelRedeliveryPolicyFactoryBean redeliveryPolicy;
+ public ErrorHandlerType getType() {
+ return type;
+ }
+
+ /**
+ * The type of the error handler
+ */
+ public void setType(ErrorHandlerType type) {
+ this.type = type;
+ }
+
+ public String getDeadLetterUri() {
+ return deadLetterUri;
+ }
+
+ /**
+ * The dead letter endpoint uri for the Dead Letter error handler.
+ */
+ public void setDeadLetterUri(String deadLetterUri) {
+ this.deadLetterUri = deadLetterUri;
+ }
+
+ public String getDeadLetterHandleNewException() {
+ return deadLetterHandleNewException;
+ }
+
+ /**
+ * Whether the dead letter channel should handle (and ignore) any new exception that may been thrown during sending the
+ * message to the dead letter endpoint.
+ * <p/>
+ * The default value is <tt>true</tt> which means any such kind of exception is handled and ignored. Set this to <tt>false</tt>
+ * to let the exception be propagated back on the {@link org.apache.camel.Exchange}. This can be used in situations
+ * where you use transactions, and want to use Camel's dead letter channel to deal with exceptions during routing,
+ * but if the dead letter channel itself fails because of a new exception being thrown, then by setting this to <tt>false</tt>
+ * the new exceptions is propagated back and set on the {@link org.apache.camel.Exchange}, which allows the transaction
+ * to detect the exception, and rollback.
+ */
+ public void setDeadLetterHandleNewException(String deadLetterHandleNewException) {
+ this.deadLetterHandleNewException = deadLetterHandleNewException;
+ }
+
+ public LoggingLevel getLevel() {
+ return level;
+ }
+
+ /**
+ * Logging level to use when using the logging error handler type.
+ */
+ public void setLevel(LoggingLevel level) {
+ this.level = level;
+ }
+
+ public LoggingLevel getRollbackLoggingLevel() {
+ return rollbackLoggingLevel;
+ }
+
+ /**
+ * Sets the logging level to use for logging transactional rollback.
+ * <p/>
+ * This option is default WARN.
+ */
+ public void setRollbackLoggingLevel(LoggingLevel rollbackLoggingLevel) {
+ this.rollbackLoggingLevel = rollbackLoggingLevel;
+ }
+
+ public String getLogName() {
+ return logName;
+ }
+
+ /**
+ * Name of the logger to use for the logging error handler
+ */
+ public void setLogName(String logName) {
+ this.logName = logName;
+ }
+
+ public Boolean getUseOriginalMessage() {
+ return useOriginalMessage;
+ }
+
+ /**
+ * Will use the original input message when an {@link org.apache.camel.Exchange} is moved to the dead letter queue.
+ * <p/>
+ * <b>Notice:</b> this only applies when all redeliveries attempt have failed and the {@link org.apache.camel.Exchange} is doomed for failure.
+ * <br/>
+ * Instead of using the current inprogress {@link org.apache.camel.Exchange} IN body we use the original IN body instead. This allows
+ * you to store the original input in the dead letter queue instead of the inprogress snapshot of the IN body.
+ * For instance if you route transform the IN body during routing and then failed. With the original exchange
+ * store in the dead letter queue it might be easier to manually re submit the {@link org.apache.camel.Exchange} again as the IN body
+ * is the same as when Camel received it. So you should be able to send the {@link org.apache.camel.Exchange} to the same input.
+ * <p/>
+ * By default this feature is off.
+ */
+ public void setUseOriginalMessage(Boolean useOriginalMessage) {
+ this.useOriginalMessage = useOriginalMessage;
+ }
+
+ public String getTransactionTemplateRef() {
+ return transactionTemplateRef;
+ }
+
+ /**
+ * References to the {@link org.springframework.transaction.support.TransactionTemplate} to use with the transaction error handler.
+ */
+ public void setTransactionTemplateRef(String transactionTemplateRef) {
+ this.transactionTemplateRef = transactionTemplateRef;
+ }
+
+ public String getTransactionManagerRef() {
+ return transactionManagerRef;
+ }
+
+ /**
+ * References to the {@link org.springframework.transaction.PlatformTransactionManager} to use with the transaction error handler.
+ */
+ public void setTransactionManagerRef(String transactionManagerRef) {
+ this.transactionManagerRef = transactionManagerRef;
+ }
+
+ public String getOnRedeliveryRef() {
+ return onRedeliveryRef;
+ }
+
+ /**
+ * Sets a reference to a processor that should be processed <b>before</b> a redelivery attempt.
+ * <p/>
+ * Can be used to change the {@link org.apache.camel.Exchange} <b>before</b> its being redelivered.
+ */
+ public void setOnRedeliveryRef(String onRedeliveryRef) {
+ this.onRedeliveryRef = onRedeliveryRef;
+ }
+
+ public String getOnExceptionOccurredRef() {
+ return onExceptionOccurredRef;
+ }
+
+ /**
+ * Sets a reference to a processor that should be processed <b>just after</b> an exception occurred.
+ * Can be used to perform custom logging about the occurred exception at the exact time it happened.
+ * <p/>
+ * Important: Any exception thrown from this processor will be ignored.
+ */
+ public void setOnExceptionOccurredRef(String onExceptionOccurredRef) {
+ this.onExceptionOccurredRef = onExceptionOccurredRef;
+ }
+
+ public String getOnPrepareFailureRef() {
+ return onPrepareFailureRef;
+ }
+
+ /**
+ * Sets a reference to a processor to prepare the {@link org.apache.camel.Exchange} before
+ * handled by the failure processor / dead letter channel. This allows for example to enrich the message
+ * before sending to a dead letter queue.
+ */
+ public void setOnPrepareFailureRef(String onPrepareFailureRef) {
+ this.onPrepareFailureRef = onPrepareFailureRef;
+ }
+
+ public String getRetryWhileRef() {
+ return retryWhileRef;
+ }
+
+ /**
+ * Sets a reference to an retry while expression.
+ * <p/>
+ * Will continue retrying until expression evaluates to <tt>false</tt>.
+ */
+ public void setRetryWhileRef(String retryWhileRef) {
+ this.retryWhileRef = retryWhileRef;
+ }
+
+ public String getRedeliveryPolicyRef() {
+ return redeliveryPolicyRef;
+ }
+
+ /**
+ * Sets a reference to a {@link RedeliveryPolicy} to be used for redelivery settings.
+ */
+ public void setRedeliveryPolicyRef(String redeliveryPolicyRef) {
+ this.redeliveryPolicyRef = redeliveryPolicyRef;
+ }
+
+ public String getExecutorServiceRef() {
+ return executorServiceRef;
+ }
+
+ /**
+ * Sets a reference to a thread pool to be used by the error handler
+ */
+ public void setExecutorServiceRef(String executorServiceRef) {
+ this.executorServiceRef = executorServiceRef;
+ }
+
+ public CamelRedeliveryPolicyFactoryBean getRedeliveryPolicy() {
+ return redeliveryPolicy;
+ }
+
+ /**
+ * Sets the redelivery settings
+ */
+ public void setRedeliveryPolicy(CamelRedeliveryPolicyFactoryBean redeliveryPolicy) {
+ this.redeliveryPolicy = redeliveryPolicy;
+ }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/2c6d13ae/components/camel-spring/src/main/java/org/apache/camel/spring/ErrorHandlerType.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/ErrorHandlerType.java b/components/camel-spring/src/main/java/org/apache/camel/spring/ErrorHandlerType.java
index cd34fc7..9f58a50 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/ErrorHandlerType.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/ErrorHandlerType.java
@@ -26,7 +26,7 @@ import org.apache.camel.builder.NoErrorHandlerBuilder;
import org.apache.camel.spring.spi.TransactionErrorHandlerBuilder;
/**
- * Used to configure the errorHandler type
+ * Used to configure the error handler type
*
* @version
*/
[7/7] camel git commit: CAMEL-9482: Generate json schema model for
camel-spring
Posted by da...@apache.org.
CAMEL-9482: Generate json schema model for camel-spring
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/cb85dc66
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/cb85dc66
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/cb85dc66
Branch: refs/heads/master
Commit: cb85dc663c4af23ab019a1ed7351dd5fdb407197
Parents: 06e3b15
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Aug 10 17:13:06 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Aug 10 19:08:13 2016 +0200
----------------------------------------------------------------------
.../camel/spring/CamelContextFactoryBean.java | 188 ++++++++++++++++++-
.../camel/spring/CamelEndpointFactoryBean.java | 2 +-
.../apt/CamelContextAnnotationProcessor.java | 9 +
3 files changed, 190 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/cb85dc66/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
index 652b84c..16233d4 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
@@ -83,10 +83,7 @@ import org.springframework.context.event.ContextRefreshedEvent;
import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
/**
- * A Spring {@link FactoryBean} to create and initialize a
- * {@link SpringCamelContext} and install routes either explicitly configured in
- * Spring XML or found by searching the classpath for Java classes which extend
- * {@link RouteBuilder} using the nested {@link #setPackages(String[])}.
+ * CamelContext using XML configuration.
*
* @version
*/
@@ -124,9 +121,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
private String allowUseOriginalMessage;
@XmlAttribute
private String runtimeEndpointRegistryEnabled;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "#name#")
private String managementNamePattern;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "Camel (#camelId#) thread ##counter# - #name#")
private String threadNamePattern;
@XmlAttribute @Metadata(defaultValue = "Default")
private ShutdownRoute shutdownRoute;
@@ -424,6 +421,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return routes;
}
+ /**
+ * Contains the Camel routes
+ */
public void setRoutes(List<RouteDefinition> routes) {
this.routes = routes;
}
@@ -432,6 +432,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return rests;
}
+ /**
+ * Contains the rest services defined using the rest-dsl
+ */
public void setRests(List<RestDefinition> rests) {
this.rests = rests;
}
@@ -440,6 +443,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return restConfiguration;
}
+ /**
+ * Configuration for rest-dsl
+ */
public void setRestConfiguration(RestConfigurationDefinition restConfiguration) {
this.restConfiguration = restConfiguration;
}
@@ -448,6 +454,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return endpoints;
}
+ /**
+ * Configuration of endpoints
+ */
public void setEndpoints(List<CamelEndpointFactoryBean> endpoints) {
this.endpoints = endpoints;
}
@@ -460,6 +469,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return intercepts;
}
+ /**
+ * Configuration of interceptors.
+ */
public void setIntercepts(List<InterceptDefinition> intercepts) {
this.intercepts = intercepts;
}
@@ -468,6 +480,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return interceptFroms;
}
+ /**
+ * Configuration of interceptors that triggers from the beginning of routes.
+ */
public void setInterceptFroms(List<InterceptFromDefinition> interceptFroms) {
this.interceptFroms = interceptFroms;
}
@@ -476,6 +491,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return interceptSendToEndpoints;
}
+ /**
+ * Configuration of interceptors that triggers sending messages to endpoints.
+ */
public void setInterceptSendToEndpoints(List<InterceptSendToEndpointDefinition> interceptSendToEndpoints) {
this.interceptSendToEndpoints = interceptSendToEndpoints;
}
@@ -484,6 +502,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return properties;
}
+ /**
+ * Configuration of CamelContext properties such as limit of debug logging and other general options.
+ */
public void setProperties(PropertiesDefinition properties) {
this.properties = properties;
}
@@ -541,6 +562,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return camelPropertyPlaceholder;
}
+ /**
+ * Configuration of property placeholder
+ */
public void setCamelPropertyPlaceholder(CamelPropertyPlaceholderDefinition camelPropertyPlaceholder) {
this.camelPropertyPlaceholder = camelPropertyPlaceholder;
}
@@ -549,10 +573,16 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return camelStreamCachingStrategy;
}
+ /**
+ * Configuration of stream caching.
+ */
public void setCamelStreamCachingStrategy(CamelStreamCachingStrategyDefinition camelStreamCachingStrategy) {
this.camelStreamCachingStrategy = camelStreamCachingStrategy;
}
+ /**
+ * Configuration of JMX.
+ */
public void setCamelJMXAgent(CamelJMXAgentDefinition agent) {
camelJMXAgent = agent;
}
@@ -561,6 +591,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return trace;
}
+ /**
+ * Sets whether tracing is enabled or not.
+ */
public void setTrace(String trace) {
this.trace = trace;
}
@@ -569,6 +602,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return messageHistory;
}
+ /**
+ * Sets whether message history is enabled or not.
+ */
public void setMessageHistory(String messageHistory) {
this.messageHistory = messageHistory;
}
@@ -577,6 +613,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return logExhaustedMessageBody;
}
+ /**
+ * Sets whether to log exhausted message body with message history.
+ */
public void setLogExhaustedMessageBody(String logExhaustedMessageBody) {
this.logExhaustedMessageBody = logExhaustedMessageBody;
}
@@ -585,6 +624,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return streamCache;
}
+ /**
+ * Sets whether stream caching is enabled or not.
+ */
public void setStreamCache(String streamCache) {
this.streamCache = streamCache;
}
@@ -593,6 +635,10 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return delayer;
}
+ /**
+ * Sets a delay value in millis that a message is delayed at every step it takes in the route path,
+ * slowing the process down to better observe what is occurring
+ */
public void setDelayer(String delayer) {
this.delayer = delayer;
}
@@ -601,6 +647,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return handleFault;
}
+ /**
+ * Sets whether fault handling is enabled or not (default is disabled).
+ */
public void setHandleFault(String handleFault) {
this.handleFault = handleFault;
}
@@ -609,6 +658,16 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return autoStartup;
}
+ /**
+ * Sets whether the object should automatically start when Camel starts.
+ * <p/>
+ * <b>Important:</b> Currently only routes can be disabled, as {@link CamelContext}s are always started.
+ * <br/>
+ * <b>Note:</b> When setting auto startup <tt>false</tt> on {@link CamelContext} then that takes precedence
+ * and <i>no</i> routes is started. You would need to start {@link CamelContext} explicit using
+ * the {@link org.apache.camel.CamelContext#start()} method, to start the context, and then
+ * you would need to start the routes manually using {@link CamelContext#startRoute(String)}.
+ */
public void setAutoStartup(String autoStartup) {
this.autoStartup = autoStartup;
}
@@ -617,6 +676,11 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return shutdownEager;
}
+ /**
+ * Whether to shutdown CamelContext eager when Spring is shutting down.
+ * This ensure a cleaner shutdown of Camel, as dependent bean's are not shutdown at this moment.
+ * The bean's will then be shutdown after camelContext.
+ */
public void setShutdownEager(String shutdownEager) {
this.shutdownEager = shutdownEager;
}
@@ -625,6 +689,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return useMDCLogging;
}
+ /**
+ * Set whether <a href="http://www.slf4j.org/api/org/slf4j/MDC.html">MDC</a> is enabled.
+ */
public void setUseMDCLogging(String useMDCLogging) {
this.useMDCLogging = useMDCLogging;
}
@@ -633,6 +700,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return useBreadcrumb;
}
+ /**
+ * Set whether breadcrumb is enabled.
+ */
public void setUseBreadcrumb(String useBreadcrumb) {
this.useBreadcrumb = useBreadcrumb;
}
@@ -641,6 +711,12 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return allowUseOriginalMessage;
}
+ /**
+ * Sets whether to allow access to the original message from Camel's error handler,
+ * or from {@link org.apache.camel.spi.UnitOfWork#getOriginalInMessage()}.
+ * <p/>
+ * Turning this off can optimize performance, as defensive copy of the original message is not needed.
+ */
public void setAllowUseOriginalMessage(String allowUseOriginalMessage) {
this.allowUseOriginalMessage = allowUseOriginalMessage;
}
@@ -649,6 +725,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return runtimeEndpointRegistryEnabled;
}
+ /**
+ * Sets whether {@link org.apache.camel.spi.RuntimeEndpointRegistry} is enabled.
+ */
public void setRuntimeEndpointRegistryEnabled(String runtimeEndpointRegistryEnabled) {
this.runtimeEndpointRegistryEnabled = runtimeEndpointRegistryEnabled;
}
@@ -657,6 +736,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return managementNamePattern;
}
+ /**
+ * The naming pattern for creating the CamelContext management name.
+ */
public void setManagementNamePattern(String managementNamePattern) {
this.managementNamePattern = managementNamePattern;
}
@@ -665,6 +747,16 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return threadNamePattern;
}
+ /**
+ * Sets the thread name pattern used for creating the full thread name.
+ * <p/>
+ * The default pattern is: <tt>Camel (#camelId#) thread ##counter# - #name#</tt>
+ * <p/>
+ * Where <tt>#camelId#</tt> is the name of the {@link org.apache.camel.CamelContext}
+ * <br/>and <tt>#counter#</tt> is a unique incrementing counter.
+ * <br/>and <tt>#name#</tt> is the regular thread name.
+ * <br/>You can also use <tt>#longName#</tt> is the long thread name which can includes endpoint parameters etc.
+ */
public void setThreadNamePattern(String threadNamePattern) {
this.threadNamePattern = threadNamePattern;
}
@@ -674,6 +766,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return lazyLoadTypeConverters;
}
+ /**
+ * Sets whether type converters should be loaded lazy
+ */
@Deprecated
public void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters) {
this.lazyLoadTypeConverters = lazyLoadTypeConverters;
@@ -683,6 +778,16 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return typeConverterStatisticsEnabled;
}
+ /**
+ * Sets whether or not type converter statistics is enabled.
+ * <p/>
+ * By default the type converter utilization statistics is disabled.
+ * <b>Notice:</b> If enabled then there is a slight performance impact under very heavy load.
+ * <p/>
+ * You can enable/disable the statistics at runtime using the
+ * {@link org.apache.camel.spi.TypeConverterRegistry#getStatistics()#setTypeConverterStatisticsEnabled(Boolean)} method,
+ * or from JMX on the {@link org.apache.camel.api.management.mbean.ManagedTypeConverterRegistryMBean} mbean.
+ */
public void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled) {
this.typeConverterStatisticsEnabled = typeConverterStatisticsEnabled;
}
@@ -691,6 +796,11 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return typeConverterExists;
}
+ /**
+ * What should happen when attempting to add a duplicate type converter.
+ * <p/>
+ * The default behavior is to override the existing.
+ */
public void setTypeConverterExists(TypeConverterExists typeConverterExists) {
this.typeConverterExists = typeConverterExists;
}
@@ -699,6 +809,11 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return typeConverterExistsLoggingLevel;
}
+ /**
+ * The logging level to use when logging that a type converter already exists when attempting to add a duplicate type converter.
+ * <p/>
+ * The default logging level is <tt>WARN</tt>
+ */
public void setTypeConverterExistsLoggingLevel(LoggingLevel typeConverterExistsLoggingLevel) {
this.typeConverterExistsLoggingLevel = typeConverterExistsLoggingLevel;
}
@@ -711,6 +826,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return builderRefs;
}
+ /**
+ * Refers to Java {@link RouteBuilder} instances to include as routes in this CamelContext.
+ */
public void setBuilderRefs(List<RouteBuilderDefinition> builderRefs) {
this.builderRefs = builderRefs;
}
@@ -719,6 +837,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return routeRefs;
}
+ /**
+ * Refers to XML routes to include as routes in this CamelContext.
+ */
public void setRouteRefs(List<RouteContextRefDefinition> routeRefs) {
this.routeRefs = routeRefs;
}
@@ -727,6 +848,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return restRefs;
}
+ /**
+ * Refers to XML rest-dsl to include as REST services in this CamelContext.
+ */
public void setRestRefs(List<RestContextRefDefinition> restRefs) {
this.restRefs = restRefs;
}
@@ -737,13 +861,14 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
/**
* Sets the name of the error handler object used to default the error handling strategy
- *
- * @param errorHandlerRef the Spring bean ref of the error handler
*/
public void setErrorHandlerRef(String errorHandlerRef) {
this.errorHandlerRef = errorHandlerRef;
}
+ /**
+ * Configuration of data formats.
+ */
public void setDataFormats(DataFormatsDefinition dataFormats) {
this.dataFormats = dataFormats;
}
@@ -752,6 +877,27 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return dataFormats;
}
+ /**
+ * Configuration of redelivery settings.
+ */
+ public void setRedeliveryPolicies(List<CamelRedeliveryPolicyFactoryBean> redeliveryPolicies) {
+ this.redeliveryPolicies = redeliveryPolicies;
+ }
+
+ public List<?> getBeans() {
+ return beans;
+ }
+
+ /**
+ * Miscellaneous configurations
+ */
+ public void setBeans(List<?> beans) {
+ this.beans = beans;
+ }
+
+ /**
+ * Configuration of error handlers that triggers on exceptions thrown.
+ */
public void setOnExceptions(List<OnExceptionDefinition> onExceptions) {
this.onExceptions = onExceptions;
}
@@ -764,6 +910,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return onCompletions;
}
+ /**
+ * Configuration of sub routes to run at the completion of routing.
+ */
public void setOnCompletions(List<OnCompletionDefinition> onCompletions) {
this.onCompletions = onCompletions;
}
@@ -772,6 +921,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return shutdownRoute;
}
+ /**
+ * Sets the ShutdownRoute option for routes.
+ */
public void setShutdownRoute(ShutdownRoute shutdownRoute) {
this.shutdownRoute = shutdownRoute;
}
@@ -780,6 +932,9 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return shutdownRunningTask;
}
+ /**
+ * Sets the ShutdownRunningTask option to use when shutting down a route.
+ */
public void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask) {
this.shutdownRunningTask = shutdownRunningTask;
}
@@ -788,14 +943,31 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
return threadPoolProfiles;
}
+ /**
+ * Configuration of thread pool profiles.
+ */
public void setThreadPoolProfiles(List<ThreadPoolProfileDefinition> threadPoolProfiles) {
this.threadPoolProfiles = threadPoolProfiles;
}
+ public List<CamelThreadPoolFactoryBean> getThreadPools() {
+ return threadPools;
+ }
+
+ /**
+ * Configuration of thread pool
+ */
+ public void setThreadPools(List<CamelThreadPoolFactoryBean> threadPools) {
+ this.threadPools = threadPools;
+ }
+
public String getDependsOn() {
return dependsOn;
}
+ /**
+ * List of other bean id's this CamelContext depends up. Multiple bean id's can be separated by comma.
+ */
public void setDependsOn(String dependsOn) {
this.dependsOn = dependsOn;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/cb85dc66/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java
index e0c28b9..f468da7 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java
@@ -31,7 +31,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
/**
- * A {@link FactoryBean} which instantiates {@link Endpoint} objects
+ * Camel endpoint configuration
*
* @version
*/
http://git-wip-us.apache.org/repos/asf/camel/blob/cb85dc66/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java
index bf0b3b0..9f10d0f 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/CamelContextAnnotationProcessor.java
@@ -305,6 +305,15 @@ public class CamelContextAnnotationProcessor extends AbstractAnnotationProcessor
boolean deprecated = fieldElement.getAnnotation(Deprecated.class) != null;
+ // special for id as its inherited from camel-core
+ if ("id".equals(name) && isNullOrEmpty(docComment)) {
+ if ("CamelContextFactoryBean".equals(originalClassType.getSimpleName().toString())) {
+ docComment = "Sets the id (name) of this CamelContext";
+ } else {
+ docComment = "Sets the id of this node";
+ }
+ }
+
EipOption ep = new EipOption(name, "attribute", fieldTypeName, required, defaultValue, docComment, deprecated, isEnum, enums, false, null);
eipOptions.add(ep);