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/01/07 21:02:51 UTC

[1/4] camel git commit: Component docs

Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x cf474047d -> e8b1ba6e0
  refs/heads/master eef022e26 -> 6e0550c78


Component docs


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

Branch: refs/heads/master
Commit: a580d3a0de2941d860bcda76a5c90b1147250951
Parents: eef022e
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jan 7 20:38:42 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 7 20:38:42 2016 +0100

----------------------------------------------------------------------
 .../org/apache/camel/component/docker/DockerConfiguration.java  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a580d3a0/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerConfiguration.java b/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerConfiguration.java
index 442bc83..2a9ec62 100644
--- a/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerConfiguration.java
+++ b/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerConfiguration.java
@@ -28,7 +28,10 @@ import org.apache.camel.spi.UriPath;
 @UriParams
 public class DockerConfiguration implements Cloneable {
 
-    @UriPath @Metadata(required = "true")
+    @UriPath(enums = "events,stats,auth,info,ping,version,imagebuild,imagecreate,imageinspect,imagelist,imagepull,imagepush"
+            + "imageremove,imagesearch,imagetag,containerattach,containercommit,containercopyfile,containercreate,containerdiff"
+            + "inspectcontainer,containerkill,containerlist,containerlog,containerpause,containerrestart,containerremove,containerstart"
+            + "containerstop,containertop,containerunpause,containerwait,execcreate,execstart") @Metadata(required = "true")
     private DockerOperation operation;
     @UriParam(defaultValue = "localhost") @Metadata(required = "true")
     private String host = "localhost";


[2/4] camel git commit: Camel catalog - Fixed validator/endpoint parser when uris have authority and port number is a placeholder and not a number.

Posted by da...@apache.org.
Camel catalog - Fixed validator/endpoint parser when uris have authority and port number is a placeholder and not a number.


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

Branch: refs/heads/master
Commit: 6e0550c78674866d1a68665e60f62f8db32c472f
Parents: a580d3a
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jan 7 21:02:16 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 7 21:02:16 2016 +0100

----------------------------------------------------------------------
 .../camel/catalog/DefaultCamelCatalog.java      | 75 +++++++++++---------
 .../apache/camel/catalog/CamelCatalogTest.java  |  7 ++
 2 files changed, 47 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6e0550c7/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
index 028a43b..24baa69 100644
--- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
+++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
@@ -942,24 +942,6 @@ public class DefaultCamelCatalog implements CamelCatalog {
             throw new IllegalArgumentException("Cannot find endpoint with scheme " + scheme);
         }
 
-        Map<String, String> userInfoOptions = new LinkedHashMap<String, String>();
-
-        // do we have user info in authority?
-        boolean userInfo = false;
-        String username = null;
-        String password = null;
-        if (u.getUserInfo() != null) {
-            userInfo = true;
-            String[] parts = u.getUserInfo().split(":");
-            if (parts.length == 2) {
-                username = parts[0];
-                password = parts[1];
-            } else {
-                // only username
-                username = u.getUserInfo();
-            }
-        }
-
         // grab the syntax
         String syntax = null;
         String alternativeSyntax = null;
@@ -976,31 +958,54 @@ public class DefaultCamelCatalog implements CamelCatalog {
             throw new IllegalArgumentException("Endpoint with scheme " + scheme + " has no syntax defined in the json schema");
         }
 
-        // clip the scheme from the syntax
-        syntax = after(syntax, ":");
-        if (alternativeSyntax != null) {
-            alternativeSyntax = after(alternativeSyntax, ":");
-        }
-
-        // clip the scheme from the uri
-        uri = after(uri, ":");
-        String uriPath = stripQuery(uri);
-
-        // do the component support userinfo?
+        // only if we support alternative syntax, and the uri contains the username and password in the authority
+        // part of the uri, then we would need some special logic to capture that information and strip those
+        // details from the uri, so we can continue parsing the uri using the normal syntax
+        Map<String, String> userInfoOptions = new LinkedHashMap<String, String>();
         if (alternativeSyntax != null && alternativeSyntax.contains("@")) {
+            // clip the scheme from the syntax
+            alternativeSyntax = after(alternativeSyntax, ":");
+            // trim so only userinfo
             int idx = alternativeSyntax.indexOf("@");
             String fields = alternativeSyntax.substring(0, idx);
             String[] names = fields.split(":");
-            if (userInfo && names.length == 2) {
-                userInfoOptions.put(names[0], username);
-                if (password != null) {
-                    // password is optional
-                    userInfoOptions.put(names[1], password);
+
+            // grab authority part and grab username and/or password
+            String authority = u.getAuthority();
+            if (authority != null && authority.contains("@")) {
+                String username = null;
+                String password = null;
+
+                // grab unserinfo part before @
+                String userInfo = authority.substring(0, authority.indexOf("@"));
+                String[] parts = userInfo.split(":");
+                if (parts.length == 2) {
+                    username = parts[0];
+                    password = parts[1];
+                } else {
+                    // only username
+                    username = userInfo;
+                }
+
+                // remember the username and/or password which we add later to the options
+                if (names.length == 2) {
+                    userInfoOptions.put(names[0], username);
+                    if (password != null) {
+                        // password is optional
+                        userInfoOptions.put(names[1], password);
+                    }
                 }
             }
         }
+
+        // clip the scheme from the syntax
+        syntax = after(syntax, ":");
+        // clip the scheme from the uri
+        uri = after(uri, ":");
+        String uriPath = stripQuery(uri);
+
         // strip user info from uri path
-        if (userInfo) {
+        if (!userInfoOptions.isEmpty()) {
             int idx = uriPath.indexOf('@');
             if (idx > -1) {
                 uriPath = uriPath.substring(idx + 1);

http://git-wip-us.apache.org/repos/asf/camel/blob/6e0550c7/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java b/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
index ded4da0..b764e1b 100644
--- a/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
+++ b/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
@@ -533,6 +533,13 @@ public class CamelCatalogTest {
         result = catalog.validateEndpointProperties("ssh://scott@localhost:8101?certResource=classpath:test_rsa&useFixedDelay=true&delay=5000&pollCommand=features:list%0A");
         assertTrue(result.isSuccess());
 
+        // userinfo with both user and password and placeholder
+        result = catalog.validateEndpointProperties("ssh://smx:smx@localhost:8181?timeout=3000");
+        assertTrue(result.isSuccess());
+        // and should also work when port is using a placeholder
+        result = catalog.validateEndpointProperties("ssh://smx:smx@localhost:{{port}}?timeout=3000");
+        assertTrue(result.isSuccess());
+
         // placeholder for a bunch of optional options
         result = catalog.validateEndpointProperties("aws-swf://activity?{{options}}");
         assertTrue(result.isSuccess());


[3/4] camel git commit: Component docs

Posted by da...@apache.org.
Component docs


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

Branch: refs/heads/camel-2.16.x
Commit: bf0e1d5c41799511d41e01abcf23d0aaef23b889
Parents: cf47404
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jan 7 20:38:42 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 7 21:02:34 2016 +0100

----------------------------------------------------------------------
 .../org/apache/camel/component/docker/DockerConfiguration.java  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/bf0e1d5c/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerConfiguration.java b/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerConfiguration.java
index 442bc83..2a9ec62 100644
--- a/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerConfiguration.java
+++ b/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerConfiguration.java
@@ -28,7 +28,10 @@ import org.apache.camel.spi.UriPath;
 @UriParams
 public class DockerConfiguration implements Cloneable {
 
-    @UriPath @Metadata(required = "true")
+    @UriPath(enums = "events,stats,auth,info,ping,version,imagebuild,imagecreate,imageinspect,imagelist,imagepull,imagepush"
+            + "imageremove,imagesearch,imagetag,containerattach,containercommit,containercopyfile,containercreate,containerdiff"
+            + "inspectcontainer,containerkill,containerlist,containerlog,containerpause,containerrestart,containerremove,containerstart"
+            + "containerstop,containertop,containerunpause,containerwait,execcreate,execstart") @Metadata(required = "true")
     private DockerOperation operation;
     @UriParam(defaultValue = "localhost") @Metadata(required = "true")
     private String host = "localhost";


[4/4] camel git commit: Camel catalog - Fixed validator/endpoint parser when uris have authority and port number is a placeholder and not a number.

Posted by da...@apache.org.
Camel catalog - Fixed validator/endpoint parser when uris have authority and port number is a placeholder and not a number.


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

Branch: refs/heads/camel-2.16.x
Commit: e8b1ba6e035a6250eaddcb1e297e319f885d73d3
Parents: bf0e1d5
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jan 7 21:02:16 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 7 21:02:43 2016 +0100

----------------------------------------------------------------------
 .../camel/catalog/DefaultCamelCatalog.java      | 75 +++++++++++---------
 .../apache/camel/catalog/CamelCatalogTest.java  |  7 ++
 2 files changed, 47 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e8b1ba6e/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
index 028a43b..24baa69 100644
--- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
+++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
@@ -942,24 +942,6 @@ public class DefaultCamelCatalog implements CamelCatalog {
             throw new IllegalArgumentException("Cannot find endpoint with scheme " + scheme);
         }
 
-        Map<String, String> userInfoOptions = new LinkedHashMap<String, String>();
-
-        // do we have user info in authority?
-        boolean userInfo = false;
-        String username = null;
-        String password = null;
-        if (u.getUserInfo() != null) {
-            userInfo = true;
-            String[] parts = u.getUserInfo().split(":");
-            if (parts.length == 2) {
-                username = parts[0];
-                password = parts[1];
-            } else {
-                // only username
-                username = u.getUserInfo();
-            }
-        }
-
         // grab the syntax
         String syntax = null;
         String alternativeSyntax = null;
@@ -976,31 +958,54 @@ public class DefaultCamelCatalog implements CamelCatalog {
             throw new IllegalArgumentException("Endpoint with scheme " + scheme + " has no syntax defined in the json schema");
         }
 
-        // clip the scheme from the syntax
-        syntax = after(syntax, ":");
-        if (alternativeSyntax != null) {
-            alternativeSyntax = after(alternativeSyntax, ":");
-        }
-
-        // clip the scheme from the uri
-        uri = after(uri, ":");
-        String uriPath = stripQuery(uri);
-
-        // do the component support userinfo?
+        // only if we support alternative syntax, and the uri contains the username and password in the authority
+        // part of the uri, then we would need some special logic to capture that information and strip those
+        // details from the uri, so we can continue parsing the uri using the normal syntax
+        Map<String, String> userInfoOptions = new LinkedHashMap<String, String>();
         if (alternativeSyntax != null && alternativeSyntax.contains("@")) {
+            // clip the scheme from the syntax
+            alternativeSyntax = after(alternativeSyntax, ":");
+            // trim so only userinfo
             int idx = alternativeSyntax.indexOf("@");
             String fields = alternativeSyntax.substring(0, idx);
             String[] names = fields.split(":");
-            if (userInfo && names.length == 2) {
-                userInfoOptions.put(names[0], username);
-                if (password != null) {
-                    // password is optional
-                    userInfoOptions.put(names[1], password);
+
+            // grab authority part and grab username and/or password
+            String authority = u.getAuthority();
+            if (authority != null && authority.contains("@")) {
+                String username = null;
+                String password = null;
+
+                // grab unserinfo part before @
+                String userInfo = authority.substring(0, authority.indexOf("@"));
+                String[] parts = userInfo.split(":");
+                if (parts.length == 2) {
+                    username = parts[0];
+                    password = parts[1];
+                } else {
+                    // only username
+                    username = userInfo;
+                }
+
+                // remember the username and/or password which we add later to the options
+                if (names.length == 2) {
+                    userInfoOptions.put(names[0], username);
+                    if (password != null) {
+                        // password is optional
+                        userInfoOptions.put(names[1], password);
+                    }
                 }
             }
         }
+
+        // clip the scheme from the syntax
+        syntax = after(syntax, ":");
+        // clip the scheme from the uri
+        uri = after(uri, ":");
+        String uriPath = stripQuery(uri);
+
         // strip user info from uri path
-        if (userInfo) {
+        if (!userInfoOptions.isEmpty()) {
             int idx = uriPath.indexOf('@');
             if (idx > -1) {
                 uriPath = uriPath.substring(idx + 1);

http://git-wip-us.apache.org/repos/asf/camel/blob/e8b1ba6e/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java b/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
index ded4da0..b764e1b 100644
--- a/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
+++ b/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
@@ -533,6 +533,13 @@ public class CamelCatalogTest {
         result = catalog.validateEndpointProperties("ssh://scott@localhost:8101?certResource=classpath:test_rsa&useFixedDelay=true&delay=5000&pollCommand=features:list%0A");
         assertTrue(result.isSuccess());
 
+        // userinfo with both user and password and placeholder
+        result = catalog.validateEndpointProperties("ssh://smx:smx@localhost:8181?timeout=3000");
+        assertTrue(result.isSuccess());
+        // and should also work when port is using a placeholder
+        result = catalog.validateEndpointProperties("ssh://smx:smx@localhost:{{port}}?timeout=3000");
+        assertTrue(result.isSuccess());
+
         // placeholder for a bunch of optional options
         result = catalog.validateEndpointProperties("aws-swf://activity?{{options}}");
         assertTrue(result.isSuccess());