You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by js...@apache.org on 2007/10/16 18:17:51 UTC

svn commit: r585186 - /activemq/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java

Author: jstrachan
Date: Tue Oct 16 09:17:41 2007
New Revision: 585186

URL: http://svn.apache.org/viewvc?rev=585186&view=rev
Log:
allow the protocol to be hardwired outside of the URI - see: http://www.nabble.com/My-test-scheme-tf4635115s22882.html#a13236630

Modified:
    activemq/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java

Modified: activemq/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java?rev=585186&r1=585185&r2=585186&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java (original)
+++ activemq/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java Tue Oct 16 09:17:41 2007
@@ -25,7 +25,7 @@
 
 /**
  * Represents the configuration data for communicating over email
- * 
+ *
  * @version $Revision: 532790 $
  */
 public class MailConfiguration implements Cloneable {
@@ -41,6 +41,7 @@
     private String from = "camel@localhost";
     private boolean deleteProcessedMessages = true;
     private String folderName = "INBOX";
+    private boolean ignoreUriScheme;
 
     public MailConfiguration() {
     }
@@ -50,8 +51,9 @@
      */
     public MailConfiguration copy() {
         try {
-            return (MailConfiguration)clone();
-        } catch (CloneNotSupportedException e) {
+            return (MailConfiguration) clone();
+        }
+        catch (CloneNotSupportedException e) {
             throw new RuntimeCamelException(e);
         }
     }
@@ -62,9 +64,11 @@
             setHost(value);
         }
 
-        String scheme = uri.getScheme();
-        if (scheme != null) {
-            setProtocol(scheme);
+        if (getProtocol() != null && isIgnoreUriScheme()) {
+            String scheme = uri.getScheme();
+            if (scheme != null) {
+                setProtocol(scheme);
+            }
         }
         String userInfo = uri.getUserInfo();
         if (userInfo != null) {
@@ -83,7 +87,8 @@
         String fragment = uri.getFragment();
         if (fragment == null || fragment.length() == 0) {
             fragment = userInfo + "@" + host;
-        } else {
+        }
+        else {
             setFolderName(fragment);
         }
         setDestination(fragment);
@@ -216,5 +221,13 @@
 
     public void setFolderName(String folderName) {
         this.folderName = folderName;
+    }
+
+    public boolean isIgnoreUriScheme() {
+        return ignoreUriScheme;
+    }
+
+    public void setIgnoreUriScheme(boolean ignoreUriScheme) {
+        this.ignoreUriScheme = ignoreUriScheme;
     }
 }