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 2014/11/24 09:46:56 UTC
[1/2] camel git commit: CAMEL-8038: Fixed @UriPath
Repository: camel
Updated Branches:
refs/heads/master 4cd41261a -> ad38d52b7
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/6426a3b4
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6426a3b4
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6426a3b4
Branch: refs/heads/master
Commit: 6426a3b4937594bb1402bf949e9e6c697ddc0724
Parents: 4cd4126
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Nov 24 07:52:05 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Nov 24 07:52:05 2014 +0100
----------------------------------------------------------------------
.../camel/component/mybatis/MyBatisEndpoint.java | 17 ++++++++++++++++-
...ComponentConfigurationAndDocumentationTest.java | 2 +-
2 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/6426a3b4/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
index 013123d..50a6eb1 100644
--- a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
+++ b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
@@ -25,6 +25,7 @@ import org.apache.camel.Producer;
import org.apache.camel.impl.DefaultPollingEndpoint;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
import org.apache.camel.util.ObjectHelper;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSessionFactory;
@@ -37,7 +38,7 @@ public class MyBatisEndpoint extends DefaultPollingEndpoint {
private MyBatisProcessingStrategy processingStrategy = new DefaultMyBatisProcessingStrategy();
private ExecutorType executorType;
- @UriParam
+ @UriPath
private String statement;
@UriParam
private StatementType statementType;
@@ -83,6 +84,9 @@ public class MyBatisEndpoint extends DefaultPollingEndpoint {
return statement;
}
+ /**
+ * The statement name in the MyBatis XML mapping file which maps to the query, insert, update or delete operation you wish to evaluate.
+ */
public void setStatement(String statement) {
this.statement = statement;
}
@@ -91,6 +95,9 @@ public class MyBatisEndpoint extends DefaultPollingEndpoint {
return statementType;
}
+ /**
+ * Mandatory to specify for the producer to control which kind of operation to invoke.
+ */
public void setStatementType(StatementType statementType) {
this.statementType = statementType;
}
@@ -99,6 +106,14 @@ public class MyBatisEndpoint extends DefaultPollingEndpoint {
return executorType;
}
+ /**
+ * The executor type to be used while executing statements.
+ * <ul>
+ * <li>simple - executor does nothing special.</li>
+ * <li>reuse - executor reuses prepared statements.</li>
+ * <li>batch - executor reuses statements and batches updates.</li>
+ * </ul>
+ */
public void setExecutorType(ExecutorType executorType) {
this.executorType = executorType;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/6426a3b4/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisComponentConfigurationAndDocumentationTest.java b/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisComponentConfigurationAndDocumentationTest.java
index 2f5a854..359f926 100644
--- a/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisComponentConfigurationAndDocumentationTest.java
+++ b/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisComponentConfigurationAndDocumentationTest.java
@@ -44,7 +44,7 @@ public class MyBatisComponentConfigurationAndDocumentationTest extends CamelTest
assertNotNull(json);
assertTrue(json.contains("\"maxMessagesPerPoll\": { \"kind\": \"parameter\", \"type\": \"integer\""));
- assertTrue(json.contains("\"statement\": { \"kind\": \"parameter\", \"type\": \"string\""));
+ assertTrue(json.contains("\"statement\": { \"kind\": \"path\", \"type\": \"string\""));
}
@Test
[2/2] camel git commit: CAMEL-8038: Fixed @UriPath
Posted by da...@apache.org.
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/ad38d52b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ad38d52b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ad38d52b
Branch: refs/heads/master
Commit: ad38d52b77338c4968c50c49372f54b8e543af86
Parents: 6426a3b
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Nov 24 08:10:37 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Nov 24 08:10:37 2014 +0100
----------------------------------------------------------------------
.../camel/component/sjms/SjmsEndpoint.java | 57 ++++++++++++--------
.../sjms/jms/DestinationCreationStrategy.java | 2 +
.../camel/component/event/EventComponent.java | 2 +-
.../camel/component/event/EventEndpoint.java | 15 +++++-
.../camel/component/vertx/VertxEndpoint.java | 5 +-
5 files changed, 54 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ad38d52b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java
index b015e39..6284c13 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java
@@ -33,6 +33,7 @@ import org.apache.camel.impl.DefaultEndpoint;
import org.apache.camel.spi.HeaderFilterStrategy;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,43 +44,46 @@ import org.slf4j.LoggerFactory;
public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSupport {
protected final Logger logger = LoggerFactory.getLogger(getClass());
-
- @UriParam
+ @UriPath
+ private String destinationName;
+ @UriParam(defaultValue = "true")
private boolean synchronous = true;
- @UriParam
+ @UriParam(defaultValue = "false")
private boolean transacted;
@UriParam
private String namedReplyTo;
+ @UriParam(defaultValue = "AUTO_ACKNOWLEDGE")
private SessionAcknowledgementType acknowledgementMode = SessionAcknowledgementType.AUTO_ACKNOWLEDGE;
private boolean topic;
- @UriParam
+ @UriParam(defaultValue = "1")
private int sessionCount = 1;
- @UriParam
+ @UriParam(defaultValue = "1")
private int producerCount = 1;
- @UriParam
+ @UriParam(defaultValue = "1")
private int consumerCount = 1;
- @UriParam
+ @UriParam(defaultValue = "-1")
private long ttl = -1;
- @UriParam
+ @UriParam(defaultValue = "true")
private boolean persistent = true;
@UriParam
private String durableSubscriptionId;
- @UriParam
+ @UriParam(defaultValue = "5000")
private long responseTimeOut = 5000;
@UriParam
private String messageSelector;
- @UriParam
+ @UriParam(defaultValue = "-1")
private int transactionBatchCount = -1;
- @UriParam
+ @UriParam(defaultValue = "5000")
private long transactionBatchTimeout = 5000;
- @UriParam
+ @UriParam(defaultValue = "false")
private boolean asyncStartListener;
- @UriParam
+ @UriParam(defaultValue = "false")
private boolean asyncStopListener;
- @UriParam
+ @UriParam(defaultValue = "true")
private boolean prefillPool = true;
+ @UriParam
private TransactionCommitStrategy transactionCommitStrategy;
-// @UriParam
+ @UriParam
private DestinationCreationStrategy destinationCreationStrategy = new DefaultDestinationCreationStrategy();
public SjmsEndpoint() {
@@ -87,13 +91,17 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
public SjmsEndpoint(String uri, Component component) {
super(uri, component);
- if (getEndpointUri().indexOf("://queue:") > -1) {
+ if (getEndpointUri().contains("://queue:")) {
topic = false;
- } else if (getEndpointUri().indexOf("://topic:") > -1) {
+ } else if (getEndpointUri().contains("://topic:")) {
topic = true;
} else {
throw new IllegalArgumentException("Endpoint URI unsupported: " + uri);
}
+ destinationName = getEndpointUri().substring(getEndpointUri().lastIndexOf(":") + 1);
+ if (destinationName.contains("?")) {
+ destinationName = destinationName.substring(0, destinationName.lastIndexOf("?"));
+ }
}
@Override
@@ -139,12 +147,15 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
return true;
}
+ /**
+ * DestinationName is a JMS queue or topic name. By default, the destinationName is interpreted as a queue name.
+ */
+ public void setDestinationName(String destinationName) {
+ this.destinationName = destinationName;
+ }
+
public String getDestinationName() {
- String answer = getEndpointUri().substring(getEndpointUri().lastIndexOf(":") + 1);
- if (answer.indexOf("?") > -1) {
- answer = answer.substring(0, answer.lastIndexOf("?"));
- }
- return answer;
+ return destinationName;
}
public ConnectionResource getConnectionResource() {
@@ -452,7 +463,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Sets the reply to destination name used for InOut producer endpoints.
*
- * @param the namedReplyTo the JMS reply to destination name
+ * @param namedReplyTo the JMS reply to destination name
*/
public void setNamedReplyTo(String namedReplyTo) {
this.namedReplyTo = namedReplyTo;
http://git-wip-us.apache.org/repos/asf/camel/blob/ad38d52b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/DestinationCreationStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/DestinationCreationStrategy.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/DestinationCreationStrategy.java
index 0797f72..b78a548 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/DestinationCreationStrategy.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/DestinationCreationStrategy.java
@@ -24,6 +24,8 @@ import javax.jms.Session;
* Strategy for creating Destination's
*/
public interface DestinationCreationStrategy {
+
Destination createDestination(Session session, String name, boolean topic) throws JMSException;
+
Destination createTemporaryDestination(Session session, boolean topic) throws JMSException;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ad38d52b/components/camel-spring/src/main/java/org/apache/camel/component/event/EventComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/component/event/EventComponent.java b/components/camel-spring/src/main/java/org/apache/camel/component/event/EventComponent.java
index acb49fb..bdff49a 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/component/event/EventComponent.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/component/event/EventComponent.java
@@ -68,7 +68,7 @@ public class EventComponent extends UriEndpointComponent implements ApplicationC
}
protected EventEndpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
- EventEndpoint answer = new EventEndpoint(uri, this);
+ EventEndpoint answer = new EventEndpoint(uri, this, remaining);
setProperties(answer, parameters);
return answer;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ad38d52b/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java b/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java
index 483bd5f..395ffd8 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java
@@ -24,6 +24,7 @@ import org.apache.camel.impl.DefaultProducer;
import org.apache.camel.processor.loadbalancer.LoadBalancer;
import org.apache.camel.processor.loadbalancer.TopicLoadBalancer;
import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriPath;
import org.apache.camel.util.ObjectHelper;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
@@ -43,9 +44,13 @@ public class EventEndpoint extends DefaultEndpoint implements ApplicationContext
private LoadBalancer loadBalancer;
private ApplicationContext applicationContext;
- public EventEndpoint(String endpointUri, EventComponent component) {
+ @UriPath(description = "Name of endpoint")
+ private String name;
+
+ public EventEndpoint(String endpointUri, EventComponent component, String name) {
super(endpointUri, component);
this.applicationContext = component.getApplicationContext();
+ this.name = name;
}
/**
@@ -66,6 +71,14 @@ public class EventEndpoint extends DefaultEndpoint implements ApplicationContext
return applicationContext;
}
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
public boolean isSingleton() {
return true;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ad38d52b/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxEndpoint.java b/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxEndpoint.java
index 4cac188..69388c5 100644
--- a/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxEndpoint.java
+++ b/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxEndpoint.java
@@ -22,6 +22,7 @@ import org.apache.camel.Producer;
import org.apache.camel.impl.DefaultEndpoint;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
import org.vertx.java.core.Vertx;
import org.vertx.java.core.eventbus.EventBus;
@@ -31,9 +32,9 @@ import org.vertx.java.core.eventbus.EventBus;
@UriEndpoint(scheme = "vertx", consumerClass = VertxConsumer.class)
public class VertxEndpoint extends DefaultEndpoint {
- @UriParam
+ @UriPath
private String address;
- @UriParam
+ @UriParam(defaultValue = "false")
private Boolean pubSub;
public VertxEndpoint(String uri, VertxComponent component, String address) {