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/12/22 17:51:28 UTC

[3/5] camel git commit: Component docs with enum should not only be assumed as string type

Component docs with enum should not only be assumed as string type


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

Branch: refs/heads/master
Commit: a39bdf6a3c6f0dda871e2dd12004adf63cdaab5f
Parents: 4724f36
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Dec 22 16:52:54 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Dec 22 18:13:37 2016 +0100

----------------------------------------------------------------------
 .../springboot/JmsComponentConfiguration.java    |  2 +-
 .../camel-amqp/src/main/docs/amqp-component.adoc |  8 ++++----
 .../src/main/docs/flatpack-component.adoc        |  2 +-
 .../apache/camel/component/jms/JmsComponent.java |  1 -
 .../camel/tools/apt/helper/JsonSchemaHelper.java |  3 ++-
 .../maven/packaging/ReadmeComponentMojo.java     |  3 +++
 .../SpringBootAutoConfigurationMojo.java         |  6 +++---
 .../packaging/model/ComponentOptionModel.java    | 19 ++++++++++++++-----
 .../packaging/model/EndpointOptionModel.java     |  9 +++++++++
 9 files changed, 37 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a39bdf6a/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java b/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java
index 65b1c6c..3fd040a 100644
--- a/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java
+++ b/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java
@@ -294,7 +294,7 @@ public class JmsComponentConfiguration {
      * is the lowest priority and 9 is the highest). The explicitQosEnabled
      * option must also be enabled in order for this option to have any effect.
      */
-    private Integer priority = Integer;
+    private Integer priority = 4;
     /**
      * Specifies whether to inhibit the delivery of messages published by its
      * own connection.

http://git-wip-us.apache.org/repos/asf/camel/blob/a39bdf6a/components/camel-amqp/src/main/docs/amqp-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-amqp/src/main/docs/amqp-component.adoc b/components/camel-amqp/src/main/docs/amqp-component.adoc
index 28330ac..f582d83 100644
--- a/components/camel-amqp/src/main/docs/amqp-component.adoc
+++ b/components/camel-amqp/src/main/docs/amqp-component.adoc
@@ -71,8 +71,8 @@ The AMQP component supports 74 options which are listed below.
 | durableSubscriptionName | common |  | String | The durable subscriber name for specifying durable topic subscriptions. The clientId option must be configured as well.
 | exceptionListener | advanced |  | ExceptionListener | Specifies the JMS Exception Listener that is to be notified of any underlying JMS exceptions.
 | errorHandler | advanced |  | ErrorHandler | Specifies a org.springframework.util.ErrorHandler to be invoked in case of any uncaught exceptions thrown while processing a Message. By default these exceptions will be logged at the WARN level if no errorHandler has been configured. You can configure logging level and whether stack traces should be logged using errorHandlerLoggingLevel and errorHandlerLogStackTrace options. This makes it much easier to configure than having to code a custom errorHandler.
-| errorHandlerLoggingLevel | advanced | WARN | LoggingLevel | Allows to configure the default errorHandler logging level for logging uncaught exceptions.
-| errorHandlerLogStackTrace | advanced | true | boolean | Allows to control whether stacktraces should be logged or not by the default errorHandler.
+| errorHandlerLoggingLevel | logging | WARN | LoggingLevel | Allows to configure the default errorHandler logging level for logging uncaught exceptions.
+| errorHandlerLogStackTrace | logging | true | boolean | Allows to control whether stacktraces should be logged or not by the default errorHandler.
 | explicitQosEnabled | producer | false | boolean | Set if the deliveryMode priority or timeToLive qualities of service should be used when sending messages. This option is based on Spring's JmsTemplate. The deliveryMode priority and timeToLive options are applied to the current endpoint. This contrasts with the preserveMessageQos option which operates at message granularity reading QoS properties exclusively from the Camel In message headers.
 | exposeListenerSession | consumer (advanced) | false | boolean | Specifies whether the listener session should be exposed when consuming messages.
 | idleTaskExecutionLimit | advanced | 1 | int | Specifies the limit for idle executions of a receive task not having received any message within its execution. If this limit is reached the task will shut down and leave receiving to other executing tasks (in the case of dynamic scheduling; see the maxConcurrentConsumers setting). There is additional doc available from Spring.
@@ -193,8 +193,6 @@ The AMQP component supports 85 endpoint options which are listed below:
 | asyncStopListener | advanced | false | boolean | Whether to stop the JmsConsumer message listener asynchronously when stopping a route.
 | destinationResolver | advanced |  | DestinationResolver | A pluggable org.springframework.jms.support.destination.DestinationResolver that allows you to use your own resolver (for example to lookup the real destination in a JNDI registry).
 | errorHandler | advanced |  | ErrorHandler | Specifies a org.springframework.util.ErrorHandler to be invoked in case of any uncaught exceptions thrown while processing a Message. By default these exceptions will be logged at the WARN level if no errorHandler has been configured. You can configure logging level and whether stack traces should be logged using errorHandlerLoggingLevel and errorHandlerLogStackTrace options. This makes it much easier to configure than having to code a custom errorHandler.
-| errorHandlerLoggingLevel | advanced | WARN | LoggingLevel | Allows to configure the default errorHandler logging level for logging uncaught exceptions.
-| errorHandlerLogStackTrace | advanced | true | boolean | Allows to control whether stacktraces should be logged or not by the default errorHandler.
 | exceptionListener | advanced |  | ExceptionListener | Specifies the JMS Exception Listener that is to be notified of any underlying JMS exceptions.
 | headerFilterStrategy | advanced |  | HeaderFilterStrategy | To use a custom HeaderFilterStrategy to filter header to and from Camel message.
 | idleConsumerLimit | advanced | 1 | int | Specify the limit for the number of consumers that are allowed to be idle at any given time.
@@ -219,6 +217,8 @@ The AMQP component supports 85 endpoint options which are listed below:
 | useMessageIDAsCorrelationID | advanced | false | boolean | Specifies whether JMSMessageID should always be used as JMSCorrelationID for InOut messages.
 | waitForProvisionCorrelationToBeUpdatedCounter | advanced | 50 | int | Number of times to wait for provisional correlation id to be updated to the actual correlation id when doing request/reply over JMS and when the option useMessageIDAsCorrelationID is enabled.
 | waitForProvisionCorrelationToBeUpdatedThreadSleepingTime | advanced | 100 | long | Interval in millis to sleep each time while waiting for provisional correlation id to be updated.
+| errorHandlerLoggingLevel | logging | WARN | LoggingLevel | Allows to configure the default errorHandler logging level for logging uncaught exceptions.
+| errorHandlerLogStackTrace | logging | true | boolean | Allows to control whether stacktraces should be logged or not by the default errorHandler.
 | password | security |  | String | Password to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory.
 | username | security |  | String | Username to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory.
 | transacted | transaction | false | boolean | Specifies whether to use transacted mode

http://git-wip-us.apache.org/repos/asf/camel/blob/a39bdf6a/components/camel-flatpack/src/main/docs/flatpack-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-flatpack/src/main/docs/flatpack-component.adoc b/components/camel-flatpack/src/main/docs/flatpack-component.adoc
index 8183df5..1095a7f 100644
--- a/components/camel-flatpack/src/main/docs/flatpack-component.adoc
+++ b/components/camel-flatpack/src/main/docs/flatpack-component.adoc
@@ -55,7 +55,7 @@ The Flatpack component supports 27 endpoint options which are listed below:
 [width="100%",cols="2,1,1m,1m,5",options="header"]
 |=======================================================================
 | Name | Group | Default | Java Type | Description
-| type | common |  | FlatpackType | Whether to use fixed or delimiter
+| type | common | delim | FlatpackType | Whether to use fixed or delimiter
 | resourceUri | common |  | String | *Required* URL for loading the flatpack mapping file from classpath or file system
 | allowShortLines | common | false | boolean | Allows for lines to be shorter than expected and ignores the extra characters
 | delimiter | common | , | char | The default character delimiter for delimited files.

http://git-wip-us.apache.org/repos/asf/camel/blob/a39bdf6a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
index a996f65..67c15e0 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
@@ -28,7 +28,6 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.LoggingLevel;
 import org.apache.camel.impl.HeaderFilterStrategyComponent;
 import org.apache.camel.spi.Metadata;
-import org.apache.camel.spi.UriParam;
 import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/camel/blob/a39bdf6a/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java
index b535814..228d3d3 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java
@@ -69,7 +69,8 @@ public final class JsonSchemaHelper {
 
         sb.append(", \"type\": ");
         if ("enum".equals(typeName)) {
-            sb.append(Strings.doubleQuote("string"));
+            String actualType = JsonSchemaHelper.getType(type, false);
+            sb.append(Strings.doubleQuote(actualType));
             sb.append(", \"javaType\": \"" + type + "\"");
             CollectionStringBuffer enumValues = new CollectionStringBuffer();
             for (Object value : enums) {

http://git-wip-us.apache.org/repos/asf/camel/blob/a39bdf6a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
index 434e6e6..74c790c 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
@@ -500,7 +500,9 @@ public class ReadmeComponentMojo extends AbstractMojo {
             option.setRequired(getSafeValue("required", row));
             option.setType(getSafeValue("type", row));
             option.setJavaType(getSafeValue("javaType", row));
+            option.setEnums(getSafeValue("enum", row));
             option.setDeprecated(getSafeValue("deprecated", row));
+            option.setSecret(getSafeValue("secret", row));
             option.setDefaultValue(getSafeValue("defaultValue", row));
             option.setDescription(getSafeValue("description", row));
             // lets put required in the description
@@ -524,6 +526,7 @@ public class ReadmeComponentMojo extends AbstractMojo {
             option.setPrefix(getSafeValue("prefix", row));
             option.setMultiValue(getSafeValue("multiValue", row));
             option.setDeprecated(getSafeValue("deprecated", row));
+            option.setSecret(getSafeValue("secret", row));
             option.setDefaultValue(getSafeValue("defaultValue", row));
             option.setDescription(getSafeValue("description", row));
             // lets put required in the description

http://git-wip-us.apache.org/repos/asf/camel/blob/a39bdf6a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
index 410c8d1..81ff6a6 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
@@ -368,7 +368,7 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
             if (!type.endsWith(INNER_TYPE_SUFFIX)
                 && type.indexOf('[') == -1
                 && !EXCLUDE_INNER_PATTERN.matcher(type).matches()
-                && Strings.isBlank(option.getEnumValues())
+                && Strings.isBlank(option.getEnums())
                 && (javaClassSource == null || (javaClassSource.isClass() && !javaClassSource.isAbstract()))) {
                 // add nested configuration annotation for complex properties
                 prop.getField().addAnnotation(NestedConfigurationProperty.class);
@@ -392,7 +392,7 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
                     prop.getField().setLiteralInitializer(value);
                 } else if ("integer".equals(option.getType()) || "boolean".equals(option.getType())) {
                     prop.getField().setLiteralInitializer(option.getDefaultValue());
-                } else if (!Strings.isBlank(option.getEnumValues())) {
+                } else if (!Strings.isBlank(option.getEnums())) {
                     String enumShortName = type.substring(type.lastIndexOf(".") + 1);
                     prop.getField().setLiteralInitializer(enumShortName + "." + option.getDefaultValue());
                     javaClass.addImport(model.getJavaType());
@@ -1230,7 +1230,7 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
             option.setDeprecated(getSafeValue("deprecated", row));
             option.setDescription(getSafeValue("description", row));
             option.setDefaultValue(getSafeValue("defaultValue", row));
-            option.setEnumValues(getSafeValue("enum", row));
+            option.setEnums(getSafeValue("enum", row));
             component.addComponentOption(option);
         }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/a39bdf6a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/ComponentOptionModel.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/ComponentOptionModel.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/ComponentOptionModel.java
index c94e0dd..64142e4 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/ComponentOptionModel.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/ComponentOptionModel.java
@@ -25,9 +25,10 @@ public class ComponentOptionModel {
     private String type;
     private String javaType;
     private String deprecated;
+    private String secret;
     private String description;
     private String defaultValue;
-    private String enumValues;
+    private String enums;
 
     public String getName() {
         return name;
@@ -85,6 +86,14 @@ public class ComponentOptionModel {
         this.deprecated = deprecated;
     }
 
+    public String getSecret() {
+        return secret;
+    }
+
+    public void setSecret(String secret) {
+        this.secret = secret;
+    }
+
     public String getDescription() {
         return description;
     }
@@ -101,12 +110,12 @@ public class ComponentOptionModel {
         this.defaultValue = defaultValue;
     }
 
-    public String getEnumValues() {
-        return enumValues;
+    public String getEnums() {
+        return enums;
     }
 
-    public void setEnumValues(String enumValues) {
-        this.enumValues = enumValues;
+    public void setEnums(String enums) {
+        this.enums = enums;
     }
 
     public String getShortJavaType() {

http://git-wip-us.apache.org/repos/asf/camel/blob/a39bdf6a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/EndpointOptionModel.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/EndpointOptionModel.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/EndpointOptionModel.java
index 5013795..8155166 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/EndpointOptionModel.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/EndpointOptionModel.java
@@ -28,6 +28,7 @@ public class EndpointOptionModel {
     private String prefix;
     private String multiValue;
     private String deprecated;
+    private String secret;
     private String defaultValue;
     private String description;
     private String enumValues;
@@ -112,6 +113,14 @@ public class EndpointOptionModel {
         this.deprecated = deprecated;
     }
 
+    public String getSecret() {
+        return secret;
+    }
+
+    public void setSecret(String secret) {
+        this.secret = secret;
+    }
+
     public String getDefaultValue() {
         return defaultValue;
     }