FAQ
Repository: camel
Updated Branches:
   refs/heads/master 3f408a8d8 -> 33cf20844


CAMEL-10044: Add support for defining an option as secret.


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

Branch: refs/heads/master
Commit: e9ae7b3d27fd51d582b54946e7df44358ecece55
Parents: 3f408a8
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sat Jun 11 14:06:12 2016 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sat Jun 11 14:06:12 2016 +0200

----------------------------------------------------------------------
  .../management/mbean/CamelOpenMBeanTypes.java | 25 +++++-----
  .../apache/camel/impl/DefaultCamelContext.java | 51 ++++++++++++++------
  .../management/mbean/ManagedCamelContext.java | 9 +++-
  .../management/mbean/ManagedComponent.java | 5 +-
  .../management/mbean/ManagedDataFormat.java | 5 +-
  .../camel/management/mbean/ManagedEndpoint.java | 5 +-
  .../camel/tools/apt/EipAnnotationProcessor.java | 2 +-
  .../tools/apt/EndpointAnnotationProcessor.java | 16 +++---
  .../tools/apt/helper/JsonSchemaHelper.java | 7 ++-
  .../camel/tools/apt/model/ComponentOption.java | 9 +++-
  .../camel/tools/apt/model/EndpointOption.java | 8 ++-
  .../camel/tools/apt/model/EndpointPath.java | 11 ++++-
  .../tools/apt/EndpointOptionComparatorTest.java | 8 +--
  .../java/org/apache/camel/spi/Metadata.java | 5 ++
  .../java/org/apache/camel/spi/UriParam.java | 5 ++
  15 files changed, 120 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e9ae7b3d/camel-core/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java b/camel-core/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java
index 596b2d4..cb39d62 100644
--- a/camel-core/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java
+++ b/camel-core/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java
@@ -83,9 +83,9 @@ public final class CamelOpenMBeanTypes {
      }

      public static CompositeType explainComponentCompositeType() throws OpenDataException {
- return new CompositeType("components", "Components", new String[]{"option", "kind", "group", "label", "type", "java type", "deprecated", "value", "default value", "description"},
- new String[]{"Option", "Kind", "Group", "Label", "Type", "Java Type", "Deprecated", "Value", "Default Value", "Description"},
- new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
+ return new CompositeType("components", "Components", new String[]{"option", "kind", "group", "label", "type", "java type", "deprecated", "secret", "value", "default value", "description"},
+ new String[]{"Option", "Kind", "Group", "Label", "Type", "Java Type", "Deprecated", "Secret", "Value", "Default Value", "Description"},
+ new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
                                 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
      }

@@ -95,10 +95,10 @@ public final class CamelOpenMBeanTypes {
      }

      public static CompositeType explainDataFormatsCompositeType() throws OpenDataException {
- return new CompositeType("dataformats", "DataFormats", new String[]{"option", "kind", "label", "type", "java type", "deprecated", "value", "default value", "description"},
- new String[]{"Option", "Kind", "Label", "Type", "Java Type", "Deprecated", "Value", "Default Value", "Description"},
+ return new CompositeType("dataformats", "DataFormats", new String[]{"option", "kind", "label", "type", "java type", "deprecated", "secret", "value", "default value", "description"},
+ new String[]{"Option", "Kind", "Label", "Type", "Java Type", "Deprecated", "Secret", "Value", "Default Value", "Description"},
                  new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
- SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
+ SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
      }


@@ -108,9 +108,9 @@ public final class CamelOpenMBeanTypes {
      }

      public static CompositeType explainEndpointsCompositeType() throws OpenDataException {
- return new CompositeType("endpoints", "Endpoints", new String[]{"option", "kind", "group", "label", "type", "java type", "deprecated", "value", "default value", "description"},
- new String[]{"Option", "Kind", "Group", "Label", "Type", "Java Type", "Deprecated", "Value", "Default Value", "Description"},
- new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
+ return new CompositeType("endpoints", "Endpoints", new String[]{"option", "kind", "group", "label", "type", "java type", "deprecated", "secret", "value", "default value", "description"},
+ new String[]{"Option", "Kind", "Group", "Label", "Type", "Java Type", "Deprecated", "Secret", "Value", "Default Value", "Description"},
+ new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
                                 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
      }

@@ -132,10 +132,11 @@ public final class CamelOpenMBeanTypes {
      }

      public static CompositeType listComponentsCompositeType() throws OpenDataException {
- return new CompositeType("components", "Components", new String[]{"name", "title", "syntax", "description", "label", "deprecated", "status", "type", "groupId", "artifactId", "version"},
- new String[]{"Name", "Title", "Syntax", "Description", "Label", "Deprecated", "Status", "Type", "GroupId", "ArtifactId", "Version"},
+ return new CompositeType("components", "Components", new String[]{"name", "title", "syntax", "description", "label", "deprecated",
+ "secret", "status", "type", "groupId", "artifactId", "version"},
+ new String[]{"Name", "Title", "Syntax", "Description", "Label", "Deprecated", "Secret", "Status", "Type", "GroupId", "ArtifactId", "Version"},
                  new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
- SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
+ SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
      }

      public static TabularType listAwaitThreadsTabularType() throws OpenDataException {

http://git-wip-us.apache.org/repos/asf/camel/blob/e9ae7b3d/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index 38ee073..f3fc577 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -1745,6 +1745,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                  String required = null;
                  String javaType = null;
                  String deprecated = null;
+ String secret = null;
                  String defaultValue = null;
                  String description = null;
                  for (Map<String, String> row : rows) {
@@ -1755,6 +1756,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                          required = row.get("required");
                          javaType = row.get("javaType");
                          deprecated = row.get("deprecated");
+ secret = row.get("secret");
                          defaultValue = row.get("defaultValue");
                          description = row.get("description");
                          break;
@@ -1762,7 +1764,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                  }

                  // remember this option from the uri
- dataFormatOptions.put(name, new String[]{name, kind, label, required, type, javaType, deprecated, value, defaultValue, description});
+ dataFormatOptions.put(name, new String[]{name, kind, label, required, type, javaType, deprecated, secret, value, defaultValue, description});
              }

              // include other rows
@@ -1776,6 +1778,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                  String type = row.get("type");
                  String javaType = row.get("javaType");
                  String deprecated = row.get("deprecated");
+ String secret = row.get("secret");
                  value = URISupport.sanitizePath(value);
                  String description = row.get("description");

@@ -1788,7 +1791,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                          if (isDataFormatOption) {
                              selected.put(name, dataFormatOptions.get(name));
                          } else {
- selected.put(name, new String[]{name, kind, label, required, type, javaType, deprecated, value, defaultValue, description});
+ selected.put(name, new String[]{name, kind, label, required, type, javaType, deprecated, secret, value, defaultValue, description});
                          }
                      }
                  }
@@ -1814,9 +1817,10 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                  String type = row[4];
                  String javaType = row[5];
                  String deprecated = row[6];
- String value = row[7];
- String defaultValue = row[8];
- String description = row[9];
+ String secret = row[7];
+ String value = row[8];
+ String defaultValue = row[9];
+ String description = row[10];

                  // add json of the option
                  buffer.append(StringQuoteHelper.doubleQuote(name)).append(": { ");
@@ -1839,6 +1843,9 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                  if (deprecated != null) {
                      csb.append("\"deprecated\": \"" + deprecated + "\"");
                  }
+ if (secret != null) {
+ csb.append("\"secret\": \"" + secret + "\"");
+ }
                  if (value != null) {
                      csb.append("\"value\": \"" + value + "\"");
                  }
@@ -1905,6 +1912,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                  String required = null;
                  String javaType = null;
                  String deprecated = null;
+ String secret = null;
                  String defaultValue = null;
                  String description = null;
                  for (Map<String, String> row : rows) {
@@ -1916,6 +1924,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                          required = row.get("required");
                          javaType = row.get("javaType");
                          deprecated = row.get("deprecated");
+ secret = row.get("secret");
                          defaultValue = row.get("defaultValue");
                          description = row.get("description");
                          break;
@@ -1923,7 +1932,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                  }

                  // add as selected row
- selected.put(name, new String[]{name, kind, group, label, required, type, javaType, deprecated, value, defaultValue, description});
+ selected.put(name, new String[]{name, kind, group, label, required, type, javaType, deprecated, secret, value, defaultValue, description});
              }

              // include other rows
@@ -1938,6 +1947,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                  String type = row.get("type");
                  String javaType = row.get("javaType");
                  String deprecated = row.get("deprecated");
+ String secret = row.get("secret");
                  value = URISupport.sanitizePath(value);
                  String description = row.get("description");

@@ -1945,7 +1955,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                  if (includeAllOptions) {
                      // add as selected row
                      if (!selected.containsKey(name)) {
- selected.put(name, new String[]{name, kind, group, label, required, type, javaType, deprecated, value, defaultValue, description});
+ selected.put(name, new String[]{name, kind, group, label, required, type, javaType, deprecated, secret, value, defaultValue, description});
                      }
                  }
              }
@@ -1971,9 +1981,10 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                  String type = row[5];
                  String javaType = row[6];
                  String deprecated = row[7];
- String value = row[8];
- String defaultValue = row[9];
- String description = row[10];
+ String secret = row[8];
+ String value = row[9];
+ String defaultValue = row[10];
+ String description = row[11];

                  // add json of the option
                  buffer.append(StringQuoteHelper.doubleQuote(name)).append(": { ");
@@ -1999,6 +2010,9 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                  if (deprecated != null) {
                      csb.append("\"deprecated\": \"" + deprecated + "\"");
                  }
+ if (secret != null) {
+ csb.append("\"secret\": \"" + secret + "\"");
+ }
                  if (value != null) {
                      csb.append("\"value\": \"" + value + "\"");
                  }
@@ -2065,6 +2079,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                  String required = null;
                  String javaType = null;
                  String deprecated = null;
+ String secret = null;
                  String defaultValue = null;
                  String description = null;
                  for (Map<String, String> row : rows) {
@@ -2076,6 +2091,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                          required = row.get("required");
                          javaType = row.get("javaType");
                          deprecated = row.get("deprecated");
+ secret = row.get("secret");
                          defaultValue = row.get("defaultValue");
                          description = row.get("description");
                          break;
@@ -2083,7 +2099,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                  }

                  // remember this option from the uri
- uriOptions.put(name, new String[]{name, kind, group, label, required, type, javaType, deprecated, value, defaultValue, description});
+ uriOptions.put(name, new String[]{name, kind, group, label, required, type, javaType, deprecated, secret, value, defaultValue, description});
              }

              // include other rows
@@ -2098,6 +2114,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                  String type = row.get("type");
                  String javaType = row.get("javaType");
                  String deprecated = row.get("deprecated");
+ String secret = row.get("secret");
                  value = URISupport.sanitizePath(value);
                  String description = row.get("description");

@@ -2110,7 +2127,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                          if (isUriOption) {
                              selected.put(name, uriOptions.get(name));
                          } else {
- selected.put(name, new String[]{name, kind, group, label, required, type, javaType, deprecated, value, defaultValue, description});
+ selected.put(name, new String[]{name, kind, group, label, required, type, javaType, deprecated, secret, value, defaultValue, description});
                          }
                      }
                  }
@@ -2139,9 +2156,10 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                  String type = row[5];
                  String javaType = row[6];
                  String deprecated = row[7];
- String value = row[8];
- String defaultValue = row[9];
- String description = row[10];
+ String secret = row[8];
+ String value = row[9];
+ String defaultValue = row[10];
+ String description = row[11];

                  // add json of the option
                  buffer.append(StringQuoteHelper.doubleQuote(name)).append(": { ");
@@ -2167,6 +2185,9 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                  if (deprecated != null) {
                      csb.append("\"deprecated\": \"" + deprecated + "\"");
                  }
+ if (secret != null) {
+ csb.append("\"secret\": \"" + secret + "\"");
+ }
                  if (value != null) {
                      csb.append("\"value\": \"" + value + "\"");
                  }

http://git-wip-us.apache.org/repos/asf/camel/blob/e9ae7b3d/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java
index 2c23bae..f4ea29b 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java
@@ -663,6 +663,7 @@ public class ManagedCamelContext extends ManagedPerformanceCounter implements Ti
                  String description = null;
                  String label = null;
                  String deprecated = null;
+ String secret = null;
                  String status = context.hasComponent(name) != null ? "in use" : "on classpath";
                  String type = (String) entry.getValue().get("class");
                  String groupId = null;
@@ -688,6 +689,8 @@ public class ManagedCamelContext extends ManagedPerformanceCounter implements Ti
                          label = row.get("label");
                      } else if (row.containsKey("deprecated")) {
                          deprecated = row.get("deprecated");
+ } else if (row.containsKey("secret")) {
+ secret = row.get("secret");
                      } else if (row.containsKey("javaType")) {
                          type = row.get("javaType");
                      } else if (row.containsKey("groupId")) {
@@ -700,8 +703,10 @@ public class ManagedCamelContext extends ManagedPerformanceCounter implements Ti
                  }

                  CompositeType ct = CamelOpenMBeanTypes.listComponentsCompositeType();
- CompositeData data = new CompositeDataSupport(ct, new String[]{"name", "title", "syntax", "description", "label", "deprecated", "status", "type", "groupId", "artifactId", "version"},
- new Object[]{name, title, syntax, description, label, deprecated, status, type, groupId, artifactId, version});
+ CompositeData data = new CompositeDataSupport(ct, new String[]{"name", "title", "syntax", "description", "label", "deprecated", "secret",
+ "status", "type", "groupId", "artifactId", "version"},
+ new Object[]{name, title, syntax, description, label, deprecated, secret,
+ status, type, groupId, artifactId, version});
                  answer.put(data);
              }
              return answer;

http://git-wip-us.apache.org/repos/asf/camel/blob/e9ae7b3d/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedComponent.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedComponent.java
index a93841b..4ca9df9 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedComponent.java
@@ -117,14 +117,15 @@ public class ManagedComponent implements ManagedInstance, ManagedComponentMBean
                  String type = row.get("type");
                  String javaType = row.get("javaType");
                  String deprecated = row.get("deprecated") != null ? row.get("deprecated") : "";
+ String secret = row.get("secret") != null ? row.get("secret") : "";
                  String value = row.get("value") != null ? row.get("value") : "";
                  String defaultValue = row.get("defaultValue") != null ? row.get("defaultValue") : "";
                  String description = row.get("description") != null ? row.get("description") : "";

                  CompositeType ct = CamelOpenMBeanTypes.explainComponentCompositeType();
                  CompositeData data = new CompositeDataSupport(ct,
- new String[]{"option", "kind", "group", "label", "type", "java type", "deprecated", "value", "default value", "description"},
- new Object[]{name, kind, group, label, type, javaType, deprecated, value, defaultValue, description});
+ new String[]{"option", "kind", "group", "label", "type", "java type", "deprecated", "secret", "value", "default value", "description"},
+ new Object[]{name, kind, group, label, type, javaType, deprecated, secret, value, defaultValue, description});
                  answer.put(data);
              }


http://git-wip-us.apache.org/repos/asf/camel/blob/e9ae7b3d/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedDataFormat.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedDataFormat.java
index dd4f7b9..e4de40a 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedDataFormat.java
@@ -116,14 +116,15 @@ public class ManagedDataFormat implements ManagedInstance, ManagedDataFormatMBea
                      String type = row.get("type");
                      String javaType = row.get("javaType");
                      String deprecated = row.get("deprecated") != null ? row.get("deprecated") : "";
+ String secret = row.get("secret") != null ? row.get("secret") : "";
                      String value = row.get("value") != null ? row.get("value") : "";
                      String defaultValue = row.get("defaultValue") != null ? row.get("defaultValue") : "";
                      String description = row.get("description") != null ? row.get("description") : "";

                      CompositeType ct = CamelOpenMBeanTypes.explainDataFormatsCompositeType();
                      CompositeData data = new CompositeDataSupport(ct,
- new String[]{"option", "kind", "label", "type", "java type", "deprecated", "value", "default value", "description"},
- new Object[]{name, kind, label, type, javaType, deprecated, value, defaultValue, description});
+ new String[]{"option", "kind", "label", "type", "java type", "deprecated", "secret", "value", "default value", "description"},
+ new Object[]{name, kind, label, type, javaType, deprecated, secret, value, defaultValue, description});
                      answer.put(data);
                  }


http://git-wip-us.apache.org/repos/asf/camel/blob/e9ae7b3d/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEndpoint.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEndpoint.java
index 0e2f8ca..58390f9 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEndpoint.java
@@ -104,14 +104,15 @@ public class ManagedEndpoint implements ManagedInstance, ManagedEndpointMBean {
                  String type = row.get("type");
                  String javaType = row.get("javaType");
                  String deprecated = row.get("deprecated") != null ? row.get("deprecated") : "";
+ String secret = row.get("secret") != null ? row.get("secret") : "";
                  String value = row.get("value") != null ? row.get("value") : "";
                  String defaultValue = row.get("defaultValue") != null ? row.get("defaultValue") : "";
                  String description = row.get("description") != null ? row.get("description") : "";

                  CompositeType ct = CamelOpenMBeanTypes.explainEndpointsCompositeType();
                  CompositeData data = new CompositeDataSupport(ct,
- new String[]{"option", "kind", "group", "label", "type", "java type", "deprecated", "value", "default value", "description"},
- new Object[]{name, kind, group, label, type, javaType, deprecated, value, defaultValue, description});
+ new String[]{"option", "kind", "group", "label", "type", "java type", "deprecated", "secret", "value", "default value", "description"},
+ new Object[]{name, kind, group, label, type, javaType, deprecated, secret, value, defaultValue, description});
                  answer.put(data);
              }


http://git-wip-us.apache.org/repos/asf/camel/blob/e9ae7b3d/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java
index 325f4d2..c5000a5 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java
@@ -207,7 +207,7 @@ public class EipAnnotationProcessor extends AbstractAnnotationProcessor {
              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(), null, null, entry.isEnumType(), entry.getEnums(), entry.isOneOf(), entry.getOneOfTypes(), null, null, false));
+ entry.isDeprecated(), false, null, null, entry.isEnumType(), entry.getEnums(), entry.isOneOf(), entry.getOneOfTypes(), null, null, false));
          }
          buffer.append("\n }");


http://git-wip-us.apache.org/repos/asf/camel/blob/e9ae7b3d/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
index a703a68..9f93844 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
@@ -275,7 +275,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
              boolean multiValue = false;

              buffer.append(JsonSchemaHelper.toJson(entry.getName(), "property", required, entry.getType(), defaultValue, doc,
- entry.isDeprecated(), entry.getGroup(), entry.getLabel(), entry.isEnumType(), entry.getEnums(), false, null,
+ entry.isDeprecated(), entry.isSecret(), entry.getGroup(), entry.getLabel(), entry.isEnumType(), entry.getEnums(), false, null,
                      optionalPrefix, prefix, multiValue));
          }
          buffer.append("\n },");
@@ -326,7 +326,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
              boolean multiValue = false;

              buffer.append(JsonSchemaHelper.toJson(entry.getName(), "path", required, entry.getType(), defaultValue, doc,
- entry.isDeprecated(), entry.getGroup(), entry.getLabel(), entry.isEnumType(), entry.getEnums(), false, null,
+ entry.isDeprecated(), entry.isSecret(), entry.getGroup(), entry.getLabel(), entry.isEnumType(), entry.getEnums(), false, null,
                      optionalPrefix, prefix, multiValue));
          }

@@ -371,7 +371,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
              boolean multiValue = entry.isMultiValue();

              buffer.append(JsonSchemaHelper.toJson(entry.getName(), "parameter", required, entry.getType(), defaultValue,
- doc, entry.isDeprecated(), entry.getGroup(), entry.getLabel(), entry.isEnumType(), entry.getEnums(), false, null,
+ doc, entry.isDeprecated(), entry.isSecret(), entry.getGroup(), entry.getLabel(), entry.isEnumType(), entry.getEnums(), false, null,
                      optionalPrefix, prefix, multiValue));
          }
          buffer.append("\n }");
@@ -562,6 +562,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {

                  String required = metadata != null ? metadata.required() : null;
                  String label = metadata != null ? metadata.label() : null;
+ boolean secret = metadata != null ? metadata.secret() : false;

                  // we do not yet have default values / notes / as no annotation support yet
                  // String defaultValueNote = param.defaultValueNote();
@@ -605,7 +606,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {

                  String group = EndpointHelper.labelAsGroupName(label, componentModel.isConsumerOnly(), componentModel.isProducerOnly());
                  ComponentOption option = new ComponentOption(name, fieldTypeName, required, defaultValue, defaultValueNote,
- docComment.trim(), deprecated, group, label, isEnum, enums);
+ docComment.trim(), deprecated, secret, group, label, isEnum, enums);
                  componentOptions.add(option);
              }

@@ -634,6 +635,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {

                  Metadata metadata = fieldElement.getAnnotation(Metadata.class);
                  boolean deprecated = fieldElement.getAnnotation(Deprecated.class) != null;
+ Boolean secret = metadata != null ? metadata.secret() : null;

                  UriPath path = fieldElement.getAnnotation(UriPath.class);
                  String fieldName = fieldElement.getSimpleName().toString();
@@ -700,7 +702,8 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
                      }

                      String group = EndpointHelper.labelAsGroupName(label, componentModel.isConsumerOnly(), componentModel.isProducerOnly());
- EndpointPath ep = new EndpointPath(name, fieldTypeName, required, defaultValue, docComment, deprecated, group, label, isEnum, enums);
+ boolean isSecret = secret != null ? secret : false;
+ EndpointPath ep = new EndpointPath(name, fieldTypeName, required, defaultValue, docComment, deprecated, isSecret, group, label, isEnum, enums);
                      endpointPaths.add(ep);
                  }

@@ -783,9 +786,10 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
                              fieldTypeName = param.javaType();
                          }

+ boolean isSecret = secret != null ? secret : param.secret();
                          String group = EndpointHelper.labelAsGroupName(label, componentModel.isConsumerOnly(), componentModel.isProducerOnly());
                          EndpointOption option = new EndpointOption(name, fieldTypeName, required, defaultValue, defaultValueNote,
- docComment.trim(), paramOptionalPrefix, paramPrefix, multiValue, deprecated, group, label, isEnum, enums);
+ docComment.trim(), paramOptionalPrefix, paramPrefix, multiValue, deprecated, isSecret, group, label, isEnum, enums);
                          endpointOptions.add(option);
                      }
                  }

http://git-wip-us.apache.org/repos/asf/camel/blob/e9ae7b3d/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 21ba792..b535814 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
@@ -41,7 +41,7 @@ public final class JsonSchemaHelper {
      }

      public static String toJson(String name, String kind, Boolean required, String type, String defaultValue, String description,
- Boolean deprecated, String group, String label, boolean enumType, Set<String> enums,
+ Boolean deprecated, Boolean secret, String group, String label, boolean enumType, Set<String> enums,
                                  boolean oneOfType, Set<String> oneOffTypes, String optionalPrefix, String prefix, boolean multiValue) {
          String typeName = JsonSchemaHelper.getType(type, enumType);

@@ -117,6 +117,11 @@ public final class JsonSchemaHelper {
              sb.append(Strings.doubleQuote(deprecated.toString()));
          }

+ if (secret != null) {
+ sb.append(", \"secret\": ");
+ sb.append(Strings.doubleQuote(secret.toString()));
+ }
+
          if (!Strings.isNullOrEmpty(defaultValue)) {
              sb.append(", \"defaultValue\": ");
              String text = safeDefaultValue(defaultValue);

http://git-wip-us.apache.org/repos/asf/camel/blob/e9ae7b3d/tooling/apt/src/main/java/org/apache/camel/tools/apt/model/ComponentOption.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/model/ComponentOption.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/model/ComponentOption.java
index fd8562b..4474339 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/model/ComponentOption.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/model/ComponentOption.java
@@ -31,13 +31,15 @@ public final class ComponentOption {
      private String defaultValueNote;
      private String documentation;
      private boolean deprecated;
+ private boolean secret;
      private String group;
      private String label;
      private boolean enumType;
      private Set<String> enums;

      public ComponentOption(String name, String type, String required, String defaultValue, String defaultValueNote,
- String documentation, boolean deprecated, String group, String label, boolean enumType, Set<String> enums) {
+ String documentation, boolean deprecated, boolean secret, String group, String label,
+ boolean enumType, Set<String> enums) {
          this.name = name;
          this.type = type;
          this.required = required;
@@ -45,6 +47,7 @@ public final class ComponentOption {
          this.defaultValueNote = defaultValueNote;
          this.documentation = documentation;
          this.deprecated = deprecated;
+ this.secret = secret;
          this.label = group;
          this.label = label;
          this.enumType = enumType;
@@ -75,6 +78,10 @@ public final class ComponentOption {
          return deprecated;
      }

+ public boolean isSecret() {
+ return secret;
+ }
+
      public String getEnumValuesAsHtml() {
          CollectionStringBuffer csb = new CollectionStringBuffer("<br/>");
          if (enums != null && enums.size() > 0) {

http://git-wip-us.apache.org/repos/asf/camel/blob/e9ae7b3d/tooling/apt/src/main/java/org/apache/camel/tools/apt/model/EndpointOption.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/model/EndpointOption.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/model/EndpointOption.java
index 7a45547..af4f4a8 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/model/EndpointOption.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/model/EndpointOption.java
@@ -34,6 +34,7 @@ public final class EndpointOption {
      private String prefix;
      private boolean multiValue;
      private boolean deprecated;
+ private boolean secret;
      private String group;
      private String label;
      private boolean enumType;
@@ -41,7 +42,7 @@ public final class EndpointOption {

      public EndpointOption(String name, String type, String required, String defaultValue, String defaultValueNote,
                            String documentation, String optionalPrefix, String prefix, boolean multiValue,
- boolean deprecated, String group, String label,
+ boolean deprecated, boolean secret, String group, String label,
                            boolean enumType, Set<String> enums) {
          this.name = name;
          this.type = type;
@@ -53,6 +54,7 @@ public final class EndpointOption {
          this.prefix = prefix;
          this.multiValue = multiValue;
          this.deprecated = deprecated;
+ this.secret = secret;
          this.group = group;
          this.label = label;
          this.enumType = enumType;
@@ -95,6 +97,10 @@ public final class EndpointOption {
          return deprecated;
      }

+ public boolean isSecret() {
+ return secret;
+ }
+
      public String getEnumValuesAsHtml() {
          CollectionStringBuffer csb = new CollectionStringBuffer("<br/>");
          if (enums != null && enums.size() > 0) {

http://git-wip-us.apache.org/repos/asf/camel/blob/e9ae7b3d/tooling/apt/src/main/java/org/apache/camel/tools/apt/model/EndpointPath.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/model/EndpointPath.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/model/EndpointPath.java
index 5088814..dc7ddc0 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/model/EndpointPath.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/model/EndpointPath.java
@@ -28,19 +28,22 @@ public final class EndpointPath {
      private String defaultValue;
      private String documentation;
      private boolean deprecated;
+ private boolean secret;
      private String group;
      private String label;
      private boolean enumType;
      private Set<String> enums;

- public EndpointPath(String name, String type, String required, String defaultValue, String documentation, boolean deprecated,
- String group, String label, boolean enumType, Set<String> enums) {
+ public EndpointPath(String name, String type, String required, String defaultValue, String documentation,
+ boolean deprecated, boolean secret, String group, String label,
+ boolean enumType, Set<String> enums) {
          this.name = name;
          this.type = type;
          this.required = required;
          this.defaultValue = defaultValue;
          this.documentation = documentation;
          this.deprecated = deprecated;
+ this.secret = secret;
          this.group = group;
          this.label = label;
          this.enumType = enumType;
@@ -71,6 +74,10 @@ public final class EndpointPath {
          return deprecated;
      }

+ public boolean isSecret() {
+ return secret;
+ }
+
      public String getEnumValuesAsHtml() {
          CollectionStringBuffer csb = new CollectionStringBuffer("<br/>");
          if (enums != null && enums.size() > 0) {

http://git-wip-us.apache.org/repos/asf/camel/blob/e9ae7b3d/tooling/apt/src/test/java/org/apache/camel/tools/apt/EndpointOptionComparatorTest.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/test/java/org/apache/camel/tools/apt/EndpointOptionComparatorTest.java b/tooling/apt/src/test/java/org/apache/camel/tools/apt/EndpointOptionComparatorTest.java
index 660dc56..0fea0a3 100644
--- a/tooling/apt/src/test/java/org/apache/camel/tools/apt/EndpointOptionComparatorTest.java
+++ b/tooling/apt/src/test/java/org/apache/camel/tools/apt/EndpointOptionComparatorTest.java
@@ -39,10 +39,10 @@ public class EndpointOptionComparatorTest {
          String group3 = EndpointHelper.labelAsGroupName(label3, false, false);
          String group4 = EndpointHelper.labelAsGroupName(label4, false, false);

- EndpointOption op1 = new EndpointOption("first", "string", "true", "", "", "blah", null, null, false, false, group1, label1, false, null);
- EndpointOption op2 = new EndpointOption("synchronous", "string", "true", "", "", "blah", null, null, false, false, group2, label2, false, null);
- EndpointOption op3 = new EndpointOption("second", "string", "true", "", "", "blah", null, null, false, false, group3, label3, false, null);
- EndpointOption op4 = new EndpointOption("country", "string", "true", "", "", "blah", null, null, false, false, group4, label4, false, null);
+ EndpointOption op1 = new EndpointOption("first", "string", "true", "", "", "blah", null, null, false, false, false, group1, label1, false, null);
+ EndpointOption op2 = new EndpointOption("synchronous", "string", "true", "", "", "blah", null, null, false, false, false, group2, label2, false, null);
+ EndpointOption op3 = new EndpointOption("second", "string", "true", "", "", "blah", null, null, false, false, false, group3, label3, false, null);
+ EndpointOption op4 = new EndpointOption("country", "string", "true", "", "", "blah", null, null, false, false, false, group4, label4, false, null);

          List<EndpointOption> list = new ArrayList<EndpointOption>();
          list.add(op1);

http://git-wip-us.apache.org/repos/asf/camel/blob/e9ae7b3d/tooling/spi-annotations/src/main/java/org/apache/camel/spi/Metadata.java
----------------------------------------------------------------------
diff --git a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/Metadata.java b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/Metadata.java
index 825c8b3..5adebc1 100644
--- a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/Metadata.java
+++ b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/Metadata.java
@@ -61,4 +61,9 @@ public @interface Metadata {
       */
      String description() default "";

+ /**
+ * Whether the option is secret/sensitive information such as a password.
+ */
+ boolean secret() default false;
+
  }

http://git-wip-us.apache.org/repos/asf/camel/blob/e9ae7b3d/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriParam.java
----------------------------------------------------------------------
diff --git a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriParam.java b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriParam.java
index 51760c3..dc9a544 100644
--- a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriParam.java
+++ b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriParam.java
@@ -78,6 +78,11 @@ public @interface UriParam {
      String label() default "";

      /**
+ * Whether the option is secret/sensitive information such as a password.
+ */
+ boolean secret() default false;
+
+ /**
       * To re-associate the preferred Java type of this parameter.
       * <p/>
       * This is used for parameters which are of a specialized type but can be configured by another Java type, such as from a String.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 3 | next ›
Discussion Overview
groupcommits @
categoriescamel
postedJun 11, '16 at 2:27p
activeJun 11, '16 at 2:27p
posts3
users1
websitecamel.apache.org

1 user in discussion

Davsclaus: 3 posts

People

Translate

site design / logo © 2017 Grokbase