camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: CAMEL-10592: Component title for secured alternative should indicate that in the title.
Date Mon, 19 Dec 2016 09:40:24 GMT
CAMEL-10592: Component title for secured alternative should indicate that in the title.


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

Branch: refs/heads/camel-2.18.x
Commit: 7b4b77a11ecfff1f507843e576624f0b97d65fd9
Parents: 74fd151
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Mon Dec 19 10:39:43 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Dec 19 10:40:15 2016 +0100

----------------------------------------------------------------------
 .../tools/apt/EndpointAnnotationProcessor.java  | 22 +++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7b4b77a1/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 0b60421..446aa61 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
@@ -112,7 +112,14 @@ public class EndpointAnnotationProcessor extends AbstractProcessor {
                 for (int i = 0; i < schemes.length; i++) {
                     final String alias = schemes[i];
                     final String extendsAlias = extendsSchemes != null ? (i < extendsSchemes.length
? extendsSchemes[i] : extendsSchemes[0]) : null;
-                    final String aliasTitle = i < titles.length ? titles[i] : titles[0];
+                    String aTitle = i < titles.length ? titles[i] : titles[0];
+
+                    // some components offer a secure alternative which we need to amend
the title accordingly
+                    if (secureAlias(schemes[0], alias)) {
+                        aTitle += " (Secure)";
+                    }
+                    final String aliasTitle = aTitle;
+
                     // write html documentation
                     String name = canonicalClassName(classElement.getQualifiedName().toString());
                     String packageName = name.substring(0, name.lastIndexOf("."));
@@ -866,6 +873,19 @@ public class EndpointAnnotationProcessor extends AbstractProcessor {
         return answer;
     }
 
+    private static boolean secureAlias(String scheme, String alias) {
+        if (scheme.equals(alias)) {
+            return false;
+        }
+
+        // if alias is like scheme but with ending s its secured
+        if ((scheme + "s").equals(alias)) {
+            return true;
+        }
+
+        return false;
+    }
+
     // CHECKSTYLE:ON
 
 }


Mime
View raw message