CAMEL-8038: Fixed @UriPath

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

Branch: refs/heads/master
Commit: 3c7289e91c4d681d1b46e64dc5549fc02d7a2127
Parents: 1fbe140
Author: Claus Ibsen <davscl...@apache.org>
Authored: Wed Nov 26 11:04:28 2014 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Wed Nov 26 11:04:28 2014 +0100

----------------------------------------------------------------------
 .../camel/component/github/GitHubComponent.java | 14 +++-
 .../camel/component/github/GitHubEndpoint.java  | 86 ++++++++------------
 .../camel/component/github/GitHubType.java      | 23 ++++++
 .../github/consumer/CommitConsumer.java         |  2 +-
 .../component/github/consumer/ConsumerType.java | 31 -------
 .../component/github/producer/ProducerType.java | 31 -------
 .../camel/component/jira/JIRAComponent.java     |  7 +-
 .../camel/component/jira/JIRAEndpoint.java      | 62 +++++---------
 .../apache/camel/component/jira/JIRAType.java   | 22 +++++
 .../component/jira/consumer/ConsumerType.java   | 31 -------
 .../jira/consumer/NewCommentConsumer.java       |  1 -
 .../jira/consumer/NewIssueConsumer.java         |  1 -
 .../jira/producer/NewIssueProducer.java         |  2 +
 .../component/jira/producer/ProducerType.java   | 31 -------
 .../component/jira/CommentConsumerTest.java     |  9 +-
 .../camel/component/jira/IssueConsumerTest.java |  7 +-
 .../optaplanner/OptaPlannerEndpoint.java        |  2 +-
 .../camel/component/ssh/SshConfiguration.java   | 13 +--
 .../apache/camel/component/ssh/SshEndpoint.java |  2 +-
 19 files changed, 131 insertions(+), 246 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubComponent.java
----------------------------------------------------------------------
diff --git 
a/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubComponent.java
 
b/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubComponent.java
index aa3d038..37a022a 100644
--- 
a/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubComponent.java
+++ 
b/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubComponent.java
@@ -27,8 +27,20 @@ import org.apache.camel.impl.DefaultComponent;
 public class GitHubComponent extends DefaultComponent {
 
     protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
-        Endpoint endpoint = new GitHubEndpoint(uri, this);
+        GitHubEndpoint endpoint = new GitHubEndpoint(uri, this);
         setProperties(endpoint, parameters);
+
+        String[] parts = remaining.split("/");
+        if (parts.length >= 1) {
+            String s = parts[0];
+            GitHubType type = 
getCamelContext().getTypeConverter().convertTo(GitHubType.class, s);
+            endpoint.setType(type);
+            if (parts.length > 1) {
+                s = parts[1];
+                endpoint.setBranchName(s);
+            }
+        }
+
         return endpoint;
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubEndpoint.java
 
b/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubEndpoint.java
index d8ecd7d..92a49a3 100644
--- 
a/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubEndpoint.java
+++ 
b/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubEndpoint.java
@@ -16,23 +16,20 @@
  */
 package org.apache.camel.component.github;
 
-import java.util.regex.Pattern;
-
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.component.github.consumer.CommitConsumer;
-import org.apache.camel.component.github.consumer.ConsumerType;
 import org.apache.camel.component.github.consumer.PullRequestCommentConsumer;
 import org.apache.camel.component.github.consumer.PullRequestConsumer;
 import org.apache.camel.component.github.consumer.TagConsumer;
 import org.apache.camel.component.github.producer.ClosePullRequestProducer;
-import org.apache.camel.component.github.producer.ProducerType;
 import org.apache.camel.component.github.producer.PullRequestCommentProducer;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
-import org.apache.camel.spi.UriParams;
+import org.apache.camel.spi.UriPath;
+import org.apache.camel.util.ObjectHelper;
 
 /**
  * The endpoint encapsulates portions of the GitHub API, relying on the 
org.eclipse.egit.github.core Java SDK.
@@ -55,9 +52,13 @@ import org.apache.camel.spi.UriParams;
  * - the types of payloads we're polling aren't typically large (plus, paging 
is available in the API)
  * - need to support apps running somewhere not publicly accessible where a 
webhook would fail
  */
-@UriEndpoint(scheme = "github")
-@UriParams
+@UriEndpoint(scheme = "github", label = "api,file")
 public class GitHubEndpoint extends DefaultEndpoint {
+
+    @UriPath
+    private GitHubType type;
+    @UriPath
+    private String branchName;
     @UriParam
     private String username;
     @UriParam
@@ -74,63 +75,46 @@ public class GitHubEndpoint extends DefaultEndpoint {
     }
 
     public Producer createProducer() throws Exception {
-        String uri = getEndpointUri();
-        String[] uriSplit = splitUri(getEndpointUri());
-        
-        if (uriSplit.length > 0) {
-            switch (ProducerType.fromUri(uriSplit[0])) {
-            case CLOSEPULLREQUEST:
-                return new ClosePullRequestProducer(this);
-            case PULLREQUESTCOMMENT:
-                return new PullRequestCommentProducer(this);
-            default:
-                break;
-            }
+        if (type == GitHubType.CLOSEPULLREQUEST) {
+            return new ClosePullRequestProducer(this);
+        } else if (type == GitHubType.PULLREQUESTCOMMENT) {
+            return new PullRequestCommentProducer(this);
         }
-
-        throw new IllegalArgumentException("Cannot create any producer with 
uri " + uri
-                + ". A producer type was not provided (or an incorrect pairing 
was used).");
+        throw new IllegalArgumentException("Cannot create producer with type " 
+ type);
     }
     
     public Consumer createConsumer(Processor processor) throws Exception {
-        String uri = getEndpointUri();
-        String[] uriSplit = splitUri(getEndpointUri());
-        
-        if (uriSplit.length > 0) {
-            switch (ConsumerType.fromUri(uriSplit[0])) {
-            case COMMIT:
-                if (uriSplit.length >= 2 && uriSplit[1].length() > 1) {
-                    return new CommitConsumer(uriSplit[1], this, processor);
-                } else {
-                    throw new IllegalArgumentException("Must provide a branch 
name when using the COMMIT consumer.  github://commit/[branch name]?[options]");
-                }
-            case PULLREQUEST:
-                return new PullRequestConsumer(this, processor);
-            case PULLREQUESTCOMMENT:
-                return new PullRequestCommentConsumer(this, processor);
-            case TAG:
-                return new TagConsumer(this, processor);
-            default:
-                break;
-            }
+        if (type == GitHubType.COMMIT) {
+            ObjectHelper.notEmpty(branchName, "branchName", this);
+            return new CommitConsumer(this, processor, branchName);
+        } else if (type == GitHubType.PULLREQUEST) {
+            return new PullRequestConsumer(this, processor);
+        } else if (type == GitHubType.PULLREQUESTCOMMENT) {
+            return new PullRequestCommentConsumer(this, processor);
+        } else if (type == GitHubType.TAG) {
+            return new TagConsumer(this, processor);
         }
-
-        throw new IllegalArgumentException("Cannot create any consumer with 
uri " + uri
-                + ". A consumer type was not provided (or an incorrect pairing 
was used).");
+        throw new IllegalArgumentException("Cannot create consumer with type " 
+ type);
     }
 
     public boolean isSingleton() {
         return true;
     }
 
-    private static String[] splitUri(String uri) {
-        Pattern p1 = Pattern.compile("github:(//)*");
-        Pattern p2 = Pattern.compile("\\?.*");
+    public GitHubType getType() {
+        return type;
+    }
+
+    public void setType(GitHubType type) {
+        this.type = type;
+    }
 
-        uri = p1.matcher(uri).replaceAll("");
-        uri = p2.matcher(uri).replaceAll("");
+    public String getBranchName() {
+        return branchName;
+    }
 
-        return uri.split("/");
+    public void setBranchName(String branchName) {
+        this.branchName = branchName;
     }
 
     public String getUsername() {

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubType.java
----------------------------------------------------------------------
diff --git 
a/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubType.java
 
b/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubType.java
new file mode 100644
index 0000000..c6e07de
--- /dev/null
+++ 
b/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubType.java
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.github;
+
+public enum GitHubType {
+
+    CLOSEPULLREQUEST, PULLREQUESTCOMMENT, COMMIT, PULLREQUEST, TAG
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/CommitConsumer.java
----------------------------------------------------------------------
diff --git 
a/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/CommitConsumer.java
 
b/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/CommitConsumer.java
index 3cee731..5d4bdc0 100644
--- 
a/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/CommitConsumer.java
+++ 
b/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/CommitConsumer.java
@@ -36,7 +36,7 @@ public class CommitConsumer extends AbstractGitHubConsumer {
     
     private List<String> commitHashes = new ArrayList<String>();
     
-    public CommitConsumer(String branchName, GitHubEndpoint endpoint, 
Processor processor) throws Exception {
+    public CommitConsumer(GitHubEndpoint endpoint, Processor processor, String 
branchName) throws Exception {
         super(endpoint, processor);
 
         Registry registry = endpoint.getCamelContext().getRegistry();

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/ConsumerType.java
----------------------------------------------------------------------
diff --git 
a/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/ConsumerType.java
 
b/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/ConsumerType.java
deleted file mode 100644
index 5c7251f..0000000
--- 
a/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/ConsumerType.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.github.consumer;
-
-public enum ConsumerType {
-
-    COMMIT, PULLREQUEST, PULLREQUESTCOMMENT, TAG, UNKNOWN;
-
-    public static ConsumerType fromUri(String uri) {
-        for (ConsumerType consumerType : ConsumerType.values()) {
-            if (consumerType.name().equalsIgnoreCase(uri)) {
-                return consumerType;
-            }
-        }
-        return ConsumerType.UNKNOWN;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-github/src/main/java/org/apache/camel/component/github/producer/ProducerType.java
----------------------------------------------------------------------
diff --git 
a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/ProducerType.java
 
b/components/camel-github/src/main/java/org/apache/camel/component/github/producer/ProducerType.java
deleted file mode 100644
index 04c59a5..0000000
--- 
a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/ProducerType.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.github.producer;
-
-public enum ProducerType {
-
-    CLOSEPULLREQUEST, PULLREQUESTCOMMENT, UNKNOWN;
-
-    public static ProducerType fromUri(String uri) {
-        for (ProducerType producerType : ProducerType.values()) {
-            if (producerType.name().equalsIgnoreCase(uri)) {
-                return producerType;
-            }
-        }
-        return ProducerType.UNKNOWN;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-jira/src/main/java/org/apache/camel/component/jira/JIRAComponent.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jira/src/main/java/org/apache/camel/component/jira/JIRAComponent.java
 
b/components/camel-jira/src/main/java/org/apache/camel/component/jira/JIRAComponent.java
index d0430ec..eed1d08 100644
--- 
a/components/camel-jira/src/main/java/org/apache/camel/component/jira/JIRAComponent.java
+++ 
b/components/camel-jira/src/main/java/org/apache/camel/component/jira/JIRAComponent.java
@@ -26,11 +26,10 @@ import org.apache.camel.impl.DefaultComponent;
  */
 public class JIRAComponent extends DefaultComponent {
 
-    protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters)
-        throws Exception {
-        
-        Endpoint endpoint = new JIRAEndpoint(uri, this);
+    protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
+        JIRAEndpoint endpoint = new JIRAEndpoint(uri, this);
         setProperties(endpoint, parameters);
+        
endpoint.setType(getCamelContext().getTypeConverter().convertTo(JIRAType.class, 
remaining));
         return endpoint;
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-jira/src/main/java/org/apache/camel/component/jira/JIRAEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jira/src/main/java/org/apache/camel/component/jira/JIRAEndpoint.java
 
b/components/camel-jira/src/main/java/org/apache/camel/component/jira/JIRAEndpoint.java
index 3ea31c8..cfbd5a4 100644
--- 
a/components/camel-jira/src/main/java/org/apache/camel/component/jira/JIRAEndpoint.java
+++ 
b/components/camel-jira/src/main/java/org/apache/camel/component/jira/JIRAEndpoint.java
@@ -16,20 +16,16 @@
  */
 package org.apache.camel.component.jira;
 
-import java.util.regex.Pattern;
-
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
-import org.apache.camel.component.jira.consumer.ConsumerType;
 import org.apache.camel.component.jira.consumer.NewCommentConsumer;
 import org.apache.camel.component.jira.consumer.NewIssueConsumer;
 import org.apache.camel.component.jira.producer.NewIssueProducer;
-import org.apache.camel.component.jira.producer.ProducerType;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
-import org.apache.camel.spi.UriParams;
+import org.apache.camel.spi.UriPath;
 
 /**
  * The endpoint encapsulates portions of the JIRA API, relying on the 
jira-rest-java-client SDK.
@@ -46,9 +42,11 @@ import org.apache.camel.spi.UriParams;
  * - the types of payloads we're polling aren't typically large (plus, paging 
is available in the API)
  * - need to support apps running somewhere not publicly accessible where a 
webhook would fail
  */
-@UriParams
-@UriEndpoint(scheme = "jira")
+@UriEndpoint(scheme = "jira", label = "api,reporting")
 public class JIRAEndpoint extends DefaultEndpoint {
+
+    @UriPath
+    private JIRAType type;
     @UriParam
     private String serverUrl;
     @UriParam
@@ -57,7 +55,7 @@ public class JIRAEndpoint extends DefaultEndpoint {
     private String password;
     @UriParam
     private String jql;
-    @UriParam
+    @UriParam(defaultValue = "6000")
     private int delay = 6000;
 
     public JIRAEndpoint(String uri, JIRAComponent component) {
@@ -65,53 +63,31 @@ public class JIRAEndpoint extends DefaultEndpoint {
     }
 
     public Producer createProducer() throws Exception {
-        String uri = getEndpointUri();
-        String[] uriSplit = splitUri(getEndpointUri());
-        
-        if (uriSplit.length > 0) {
-            switch (ProducerType.fromUri(uriSplit[0])) {
-            case NEWISSUE:
-                return new NewIssueProducer(this);
-            default:
-                break;
-            }
+        if (type == JIRAType.NEWISSUE) {
+            return new NewIssueProducer(this);
         }
-
-        throw new IllegalArgumentException("Cannot create any producer with 
uri " + uri
-                + ". A producer type was not provided (or an incorrect pairing 
was used).");
+        throw new IllegalArgumentException("Producer does not support type: " 
+ type);
     }
     
     public Consumer createConsumer(Processor processor) throws Exception {
-        String uri = getEndpointUri();
-        String[] uriSplit = splitUri(getEndpointUri());
-        
-        if (uriSplit.length > 0) {
-            switch (ConsumerType.fromUri(uriSplit[0])) {
-            case NEWCOMMENT:
-                return new NewCommentConsumer(this, processor);
-            case NEWISSUE:
-                return new NewIssueConsumer(this, processor);
-            default:
-                break;
-            }
+        if (type == JIRAType.NEWCOMMENT) {
+            return new NewCommentConsumer(this, processor);
+        } else if (type == JIRAType.NEWISSUE) {
+            return new NewIssueConsumer(this, processor);
         }
-
-        throw new IllegalArgumentException("Cannot create any consumer with 
uri " + uri
-                + ". A consumer type was not provided (or an incorrect pairing 
was used).");
+        throw new IllegalArgumentException("Consumer does not support type: " 
+ type);
     }
 
     public boolean isSingleton() {
         return true;
     }
 
-    private static String[] splitUri(String uri) {
-        Pattern p1 = Pattern.compile("jira:(//)*");
-        Pattern p2 = Pattern.compile("\\?.*");
-
-        uri = p1.matcher(uri).replaceAll("");
-        uri = p2.matcher(uri).replaceAll("");
+    public JIRAType getType() {
+        return type;
+    }
 
-        return uri.split("/");
+    public void setType(JIRAType type) {
+        this.type = type;
     }
 
     public String getServerUrl() {

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-jira/src/main/java/org/apache/camel/component/jira/JIRAType.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jira/src/main/java/org/apache/camel/component/jira/JIRAType.java
 
b/components/camel-jira/src/main/java/org/apache/camel/component/jira/JIRAType.java
new file mode 100644
index 0000000..e2e14d3
--- /dev/null
+++ 
b/components/camel-jira/src/main/java/org/apache/camel/component/jira/JIRAType.java
@@ -0,0 +1,22 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jira;
+
+public enum JIRAType {
+
+    NEWISSUE, NEWCOMMENT
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-jira/src/main/java/org/apache/camel/component/jira/consumer/ConsumerType.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jira/src/main/java/org/apache/camel/component/jira/consumer/ConsumerType.java
 
b/components/camel-jira/src/main/java/org/apache/camel/component/jira/consumer/ConsumerType.java
deleted file mode 100644
index db71d05..0000000
--- 
a/components/camel-jira/src/main/java/org/apache/camel/component/jira/consumer/ConsumerType.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jira.consumer;
-
-public enum ConsumerType {
-
-    NEWCOMMENT, NEWISSUE, UNKNOWN;
-
-    public static ConsumerType fromUri(String uri) {
-        for (ConsumerType consumerType : ConsumerType.values()) {
-            if (consumerType.name().equalsIgnoreCase(uri)) {
-                return consumerType;
-            }
-        }
-        return ConsumerType.UNKNOWN;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-jira/src/main/java/org/apache/camel/component/jira/consumer/NewCommentConsumer.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jira/src/main/java/org/apache/camel/component/jira/consumer/NewCommentConsumer.java
 
b/components/camel-jira/src/main/java/org/apache/camel/component/jira/consumer/NewCommentConsumer.java
index 04c2314..cd869b7 100644
--- 
a/components/camel-jira/src/main/java/org/apache/camel/component/jira/consumer/NewCommentConsumer.java
+++ 
b/components/camel-jira/src/main/java/org/apache/camel/component/jira/consumer/NewCommentConsumer.java
@@ -30,7 +30,6 @@ import org.apache.camel.component.jira.JIRAEndpoint;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 /**
  * Consumes new comments on JIRA issues.
  * 

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-jira/src/main/java/org/apache/camel/component/jira/consumer/NewIssueConsumer.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jira/src/main/java/org/apache/camel/component/jira/consumer/NewIssueConsumer.java
 
b/components/camel-jira/src/main/java/org/apache/camel/component/jira/consumer/NewIssueConsumer.java
index 237a9a2..563db31 100644
--- 
a/components/camel-jira/src/main/java/org/apache/camel/component/jira/consumer/NewIssueConsumer.java
+++ 
b/components/camel-jira/src/main/java/org/apache/camel/component/jira/consumer/NewIssueConsumer.java
@@ -25,7 +25,6 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.component.jira.JIRAEndpoint;
 
-
 /**
  * Consumes new JIRA issues.
  * 

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-jira/src/main/java/org/apache/camel/component/jira/producer/NewIssueProducer.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jira/src/main/java/org/apache/camel/component/jira/producer/NewIssueProducer.java
 
b/components/camel-jira/src/main/java/org/apache/camel/component/jira/producer/NewIssueProducer.java
index be54c70..f05e6cf 100644
--- 
a/components/camel-jira/src/main/java/org/apache/camel/component/jira/producer/NewIssueProducer.java
+++ 
b/components/camel-jira/src/main/java/org/apache/camel/component/jira/producer/NewIssueProducer.java
@@ -42,6 +42,8 @@ public class NewIssueProducer extends AbstractJIRAProducer {
             // copy the header of in message to the out message
             exchange.getOut().copyFrom(exchange.getIn());
             exchange.getOut().setBody(issue);
+        } else {
+            exchange.getIn().setBody(issue);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-jira/src/main/java/org/apache/camel/component/jira/producer/ProducerType.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jira/src/main/java/org/apache/camel/component/jira/producer/ProducerType.java
 
b/components/camel-jira/src/main/java/org/apache/camel/component/jira/producer/ProducerType.java
deleted file mode 100644
index 037ec1a..0000000
--- 
a/components/camel-jira/src/main/java/org/apache/camel/component/jira/producer/ProducerType.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.jira.producer;
-
-public enum ProducerType {
-
-    NEWISSUE, UNKNOWN;
-
-    public static ProducerType fromUri(String uri) {
-        for (ProducerType producerType : ProducerType.values()) {
-            if (producerType.name().equalsIgnoreCase(uri)) {
-                return producerType;
-            }
-        }
-        return ProducerType.UNKNOWN;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-jira/src/test/java/org/apache/camel/component/jira/CommentConsumerTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jira/src/test/java/org/apache/camel/component/jira/CommentConsumerTest.java
 
b/components/camel-jira/src/test/java/org/apache/camel/component/jira/CommentConsumerTest.java
index e852ae3..df09d3f 100644
--- 
a/components/camel-jira/src/test/java/org/apache/camel/component/jira/CommentConsumerTest.java
+++ 
b/components/camel-jira/src/test/java/org/apache/camel/component/jira/CommentConsumerTest.java
@@ -35,15 +35,14 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class CommentConsumerTest extends CamelTestSupport {
+
     public static final Logger LOG = 
LoggerFactory.getLogger(CommentConsumerTest.class);
+
     private static final String URL = "https://somerepo.atlassian.net";;
     private static final String USERNAME = "someguy";
     private static final String PASSWORD = "xU3xjhay9yjEaZq";
     private static final String JIRA_CREDENTIALS = URL + "&username=" + 
USERNAME + "&password=" + PASSWORD;
     protected MockJerseyJiraRestClientFactory factory;
-   
-    
-
 
     @Override
     protected JndiRegistry createRegistry() throws Exception {
@@ -54,7 +53,6 @@ public class CommentConsumerTest extends CamelTestSupport {
         return registry;
     }
 
-
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
@@ -77,7 +75,6 @@ public class CommentConsumerTest extends CamelTestSupport {
         mockResultEndpoint.assertIsSatisfied();
     }
 
-
     @Test
     public void singleIssueTest() throws Exception {
         MockEndpoint mockResultEndpoint = getMockEndpoint("mock:result");
@@ -89,12 +86,10 @@ public class CommentConsumerTest extends CamelTestSupport {
         Comment comment1 = searchRestClient.addCommentToIssue(issue1, 
commentText);
 
         mockResultEndpoint.expectedBodiesReceived(comment1);
-        
 
         mockResultEndpoint.assertIsSatisfied();
     }
 
-
     @Test
     public void multiIssueTest() throws Exception {
         MockEndpoint mockResultEndpoint = getMockEndpoint("mock:result");

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-jira/src/test/java/org/apache/camel/component/jira/IssueConsumerTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jira/src/test/java/org/apache/camel/component/jira/IssueConsumerTest.java
 
b/components/camel-jira/src/test/java/org/apache/camel/component/jira/IssueConsumerTest.java
index e2195c5..579f426 100644
--- 
a/components/camel-jira/src/test/java/org/apache/camel/component/jira/IssueConsumerTest.java
+++ 
b/components/camel-jira/src/test/java/org/apache/camel/component/jira/IssueConsumerTest.java
@@ -32,7 +32,9 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class IssueConsumerTest extends CamelTestSupport {
+
     public static final Logger LOG = 
LoggerFactory.getLogger(IssueConsumerTest.class);
+
     private static final String URL = "https://somerepo.atlassian.net";;
     private static final String USERNAME = "someguy";
     private static final String PASSWORD = "xU3xjhay9yjEaZq";
@@ -40,7 +42,6 @@ public class IssueConsumerTest extends CamelTestSupport {
     private static final String PROJECT = "camel-jira-component";
     protected MockJerseyJiraRestClientFactory factory;
 
-
     @Override
     protected JndiRegistry createRegistry() throws Exception {
         JndiRegistry registry = super.createRegistry();
@@ -50,7 +51,6 @@ public class IssueConsumerTest extends CamelTestSupport {
         return registry;
     }
 
-
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
@@ -73,7 +73,6 @@ public class IssueConsumerTest extends CamelTestSupport {
         mockResultEndpoint.assertIsSatisfied();
     }
 
-
     @Test
     public void singleIssueTest() throws Exception {
         MockEndpoint mockResultEndpoint = getMockEndpoint("mock:result");
@@ -87,7 +86,6 @@ public class IssueConsumerTest extends CamelTestSupport {
         mockResultEndpoint.assertIsSatisfied();
     }
 
-
     @Test
     public void multipleIssuesTest() throws Exception {
         MockEndpoint mockResultEndpoint = getMockEndpoint("mock:result");
@@ -103,7 +101,6 @@ public class IssueConsumerTest extends CamelTestSupport {
         mockResultEndpoint.assertIsSatisfied();
     }
 
-
     /**
      * Log new issues.  Not really needed for this test, but useful for 
debugging.
      */

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerEndpoint.java
 
b/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerEndpoint.java
index 9cc96aa..6468c37 100644
--- 
a/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerEndpoint.java
+++ 
b/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerEndpoint.java
@@ -29,7 +29,7 @@ import org.optaplanner.core.api.solver.SolverFactory;
 /**
  * OptaPlanner endpoint for Camel
  */
-@UriEndpoint(scheme = "optaplanner")
+@UriEndpoint(scheme = "optaplanner", label = "engine,planning")
 public class OptaPlannerEndpoint extends ResourceEndpoint {
 
     private SolverFactory solverFactory;

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java
----------------------------------------------------------------------
diff --git 
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java
 
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java
index d969322..13fce73 100644
--- 
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java
+++ 
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java
@@ -21,6 +21,7 @@ import java.net.URI;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
+import org.apache.camel.spi.UriPath;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.sshd.common.KeyPairProvider;
 
@@ -28,22 +29,22 @@ import org.apache.sshd.common.KeyPairProvider;
 public class SshConfiguration implements Cloneable {
     public static final int DEFAULT_SSH_PORT = 22;
 
-    @UriParam
-    private String username;
-    @UriParam
+    @UriPath
     private String host;
-    @UriParam
+    @UriPath
     private int port = DEFAULT_SSH_PORT;
     @UriParam
+    private String username;
+    @UriParam
     private String password;
     @UriParam
     private String pollCommand;
     private KeyPairProvider keyPairProvider;
-    @UriParam
+    @UriParam(defaultValue = KeyPairProvider.SSH_RSA)
     private String keyType = KeyPairProvider.SSH_RSA;
     @UriParam
     private String certResource;
-    @UriParam
+    @UriParam(defaultValue = "30000")
     private long timeout = 30000;
 
     public SshConfiguration() {

http://git-wip-us.apache.org/repos/asf/camel/blob/3c7289e9/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java
 
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java
index 7303aad..af001a6 100644
--- 
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java
+++ 
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
 /**
  * Represents an SSH endpoint.
  */
-@UriEndpoint(scheme = "ssh", consumerClass = SshConsumer.class)
+@UriEndpoint(scheme = "ssh", consumerClass = SshConsumer.class, label = "file")
 public class SshEndpoint extends ScheduledPollEndpoint {
     protected final Logger log = LoggerFactory.getLogger(getClass());
 

Reply via email to