camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [05/10] camel git commit: CAMEL-9486: Add support for alternative syntax in Camel @UriEndpoint so we are aware of this.
Date Wed, 06 Jan 2016 16:46:11 GMT
CAMEL-9486: Add support for alternative syntax in Camel @UriEndpoint so we are aware of this.


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

Branch: refs/heads/master
Commit: e5a094d327defe96a54263d70173faa0bd39b044
Parents: 1a16407
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Jan 6 16:58:18 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Jan 6 16:58:18 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/component/irc/IrcEndpoint.java     | 3 ++-
 .../java/org/apache/camel/component/jcr/JcrEndpoint.java     | 3 ++-
 .../org/apache/camel/component/mail/MailConfiguration.java   | 8 +++++++-
 .../java/org/apache/camel/component/mail/MailEndpoint.java   | 4 +++-
 .../java/org/apache/camel/component/xmpp/XmppComponent.java  | 8 +++++++-
 .../java/org/apache/camel/component/xmpp/XmppEndpoint.java   | 3 ++-
 6 files changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e5a094d3/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java
b/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java
index fc16738..97012ae 100644
--- a/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java
+++ b/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java
@@ -34,7 +34,8 @@ import org.slf4j.LoggerFactory;
 /**
  * For IRC chat communication.
  */
-@UriEndpoint(scheme = "irc", title = "IRC", syntax = "irc:hostname:port", consumerClass =
IrcConsumer.class, label = "chat")
+@UriEndpoint(scheme = "irc", title = "IRC", syntax = "irc:hostname:port", alternativeSyntax
= "irc:username:password@hostname:port",
+        consumerClass = IrcConsumer.class, label = "chat")
 public class IrcEndpoint extends DefaultEndpoint {
     private static final Logger LOG = LoggerFactory.getLogger(IrcEndpoint.class);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/e5a094d3/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrEndpoint.java
b/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrEndpoint.java
index 961c8f3..c452717 100644
--- a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrEndpoint.java
+++ b/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrEndpoint.java
@@ -36,7 +36,8 @@ import org.apache.camel.util.ObjectHelper;
 /**
  * The jcr component allows you to add/read nodes to/from a JCR compliant content repository.
  */
-@UriEndpoint(scheme = "jcr", title = "JCR", syntax = "jcr:host/base", consumerClass = JcrConsumer.class,
label = "cms,database")
+@UriEndpoint(scheme = "jcr", title = "JCR", syntax = "jcr:host/base", alternativeSyntax =
"jcr:username:password@host/base",
+        consumerClass = JcrConsumer.class, label = "cms,database")
 public class JcrEndpoint extends DefaultEndpoint {
 
     private Credentials credentials;

http://git-wip-us.apache.org/repos/asf/camel/blob/e5a094d3/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
index 6f37baa..e6c1d9b 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
@@ -149,7 +149,13 @@ public class MailConfiguration implements Cloneable {
 
         String userInfo = uri.getUserInfo();
         if (userInfo != null) {
-            setUsername(userInfo);
+            String[] parts = uri.getUserInfo().split(":");
+            if (parts.length == 2) {
+                setUsername(parts[0]);
+                setPassword(parts[1]);
+            } else {
+                setUsername(userInfo);
+            }
         }
 
         int port = uri.getPort();

http://git-wip-us.apache.org/repos/asf/camel/blob/e5a094d3/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
index f7c8e78..4b3ca8c 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
@@ -32,7 +32,9 @@ import org.apache.camel.spi.UriParam;
 /**
  * To send or receive emails using imap/pop3 or stmp protocols.
  */
-@UriEndpoint(scheme = "imap,imaps,pop3,pop3s,smtp,smtps", title = "IMAP,IMAPS,POP3,POP3S,SMTP,SMTPS",
syntax = "imap:host:port", consumerClass = MailConsumer.class, label = "mail")
+@UriEndpoint(scheme = "imap,imaps,pop3,pop3s,smtp,smtps", title = "IMAP,IMAPS,POP3,POP3S,SMTP,SMTPS",
+        syntax = "imap:host:port", alternativeSyntax = "imap:username:password@host:port",
+        consumerClass = MailConsumer.class, label = "mail")
 public class MailEndpoint extends ScheduledPollEndpoint {
     @UriParam(defaultValue = "" + MailConsumer.DEFAULT_CONSUMER_DELAY, label = "consumer",
description = "Milliseconds before the next poll.")
     private long delay = MailConsumer.DEFAULT_CONSUMER_DELAY;

http://git-wip-us.apache.org/repos/asf/camel/blob/e5a094d3/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppComponent.java
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppComponent.java
index 312684d..889e6c1 100644
--- a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppComponent.java
+++ b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppComponent.java
@@ -56,7 +56,13 @@ public class XmppComponent extends UriEndpointComponent {
         endpoint.setHost(u.getHost());
         endpoint.setPort(u.getPort());
         if (u.getUserInfo() != null) {
-            endpoint.setUser(u.getUserInfo());
+            String[] parts = u.getUserInfo().split(":");
+            if (parts.length == 2) {
+                endpoint.setUser(parts[0]);
+                endpoint.setPassword(parts[1]);
+            } else {
+                endpoint.setUser(u.getUserInfo());
+            }
         }
         String remainingPath = u.getPath();
         if (remainingPath != null) {

http://git-wip-us.apache.org/repos/asf/camel/blob/e5a094d3/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
index 97c022d..d0609b5 100644
--- a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
+++ b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
@@ -49,7 +49,8 @@ import org.slf4j.LoggerFactory;
 /**
  * To send and receive messages from a XMPP (chat) server.
  */
-@UriEndpoint(scheme = "xmpp", title = "XMPP", syntax = "xmpp:host:port/participant", consumerClass
= XmppConsumer.class, label = "chat,messaging")
+@UriEndpoint(scheme = "xmpp", title = "XMPP", syntax = "xmpp:host:port/participant", alternativeSyntax
= "xmpp:user:password@host:port/participant",
+        consumerClass = XmppConsumer.class, label = "chat,messaging")
 public class XmppEndpoint extends DefaultEndpoint implements HeaderFilterStrategyAware {
     private static final Logger LOG = LoggerFactory.getLogger(XmppEndpoint.class);
 


Mime
View raw message