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/08/22 08:37:47 UTC
[4/6] git commit: CAMEL-7734: Fixed CS.
CAMEL-7734: Fixed CS.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/86efd450
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/86efd450
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/86efd450
Branch: refs/heads/master
Commit: 86efd450439c347c083b6d06fab7e2b5d670709c
Parents: 24c20ed
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Aug 22 08:28:28 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 22 08:28:28 2014 +0200
----------------------------------------------------------------------
.../camel/component/sjms/BatchMessage.java | 3 +-
.../sjms/MessageConsumerResources.java | 34 ++++----
.../sjms/MessageProducerResources.java | 22 ++++-
.../camel/component/sjms/SjmsComponent.java | 19 ++---
.../camel/component/sjms/SjmsConstants.java | 3 -
.../camel/component/sjms/SjmsConsumer.java | 42 +++++-----
.../camel/component/sjms/SjmsEndpoint.java | 74 ++++++++---------
.../sjms/SjmsExchangeMessageHelper.java | 87 ++++++++++----------
.../camel/component/sjms/SjmsProducer.java | 42 +++++-----
.../sjms/TransactionCommitStrategy.java | 9 +-
.../sjms/consumer/AbstractMessageHandler.java | 11 ++-
.../sjms/consumer/InOnlyMessageHandler.java | 1 -
.../sjms/consumer/InOutMessageHandler.java | 31 ++-----
.../sjms/jms/ConnectionFactoryResource.java | 31 +------
.../component/sjms/jms/ConnectionResource.java | 4 +-
.../sjms/jms/DefaultJmsKeyFormatStrategy.java | 2 -
.../sjms/jms/IllegalHeaderException.java | 2 +-
.../sjms/jms/JmsMessageHeaderType.java | 4 +-
.../component/sjms/jms/JmsMessageHelper.java | 75 +++++++++--------
.../component/sjms/jms/JmsMessageType.java | 6 +-
.../component/sjms/jms/JmsObjectFactory.java | 70 ++++++++--------
.../component/sjms/jms/KeyFormatStrategy.java | 6 +-
.../sjms/jms/SessionAcknowledgementType.java | 13 ++-
.../component/sjms/producer/InOnlyProducer.java | 9 +-
.../component/sjms/producer/InOutProducer.java | 29 ++-----
.../sjms/tx/BatchTransactionCommitStrategy.java | 3 +-
.../tx/DefaultTransactionCommitStrategy.java | 7 +-
.../SessionBatchTransactionSynchronization.java | 3 +-
.../tx/SessionTransactionSynchronization.java | 8 +-
.../sjms/jms/ConnectionFactoryResourceTest.java | 48 ++---------
.../sjms/producer/InOutQueueProducerTest.java | 6 --
.../producer/InOutTempQueueProducerTest.java | 6 --
.../sjms/support/SjmsConnectionTestSupport.java | 42 ----------
33 files changed, 296 insertions(+), 456 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/BatchMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/BatchMessage.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/BatchMessage.java
index e16c7bc..fd9b79e 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/BatchMessage.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/BatchMessage.java
@@ -22,7 +22,6 @@ import java.util.Map;
/**
* A {@link List} of these objects can be used to batch a collection of bodies and
* header pairs in one exchange.
- *
*/
public class BatchMessage<T> {
private T payload;
@@ -70,7 +69,7 @@ public class BatchMessage<T> {
if (!(obj instanceof BatchMessage)) {
return false;
}
- BatchMessage other = (BatchMessage)obj;
+ BatchMessage other = (BatchMessage) obj;
if (headers == null) {
if (other.headers != null) {
return false;
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/MessageConsumerResources.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/MessageConsumerResources.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/MessageConsumerResources.java
index 945b133..6923318 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/MessageConsumerResources.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/MessageConsumerResources.java
@@ -1,3 +1,19 @@
+/**
+ * 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.sjms;
import javax.jms.Destination;
@@ -18,34 +34,16 @@ public class MessageConsumerResources {
this(session, messageConsumer, null);
}
- /**
- * TODO Add Constructor Javadoc
- *
- * @param session
- * @param messageConsumer
- */
public MessageConsumerResources(Session session, MessageConsumer messageConsumer, Destination replyToDestination) {
this.session = session;
this.messageConsumer = messageConsumer;
this.replyToDestination = replyToDestination;
}
- /**
- * Gets the Session value of session for this instance of
- * MessageProducerModel.
- *
- * @return the session
- */
public Session getSession() {
return session;
}
- /**
- * Gets the QueueSender value of queueSender for this instance of
- * MessageProducerModel.
- *
- * @return the queueSender
- */
public MessageConsumer getMessageConsumer() {
return messageConsumer;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/MessageProducerResources.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/MessageProducerResources.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/MessageProducerResources.java
index 3bdad29..e8aae24 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/MessageProducerResources.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/MessageProducerResources.java
@@ -1,3 +1,19 @@
+/**
+ * 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.sjms;
import javax.jms.MessageProducer;
@@ -26,7 +42,7 @@ public class MessageProducerResources {
/**
* Gets the Session value of session for this instance of
* MessageProducerResources.
- *
+ *
* @return the session
*/
public Session getSession() {
@@ -36,7 +52,7 @@ public class MessageProducerResources {
/**
* Gets the QueueSender value of queueSender for this instance of
* MessageProducerResources.
- *
+ *
* @return the queueSender
*/
public MessageProducer getMessageProducer() {
@@ -46,7 +62,7 @@ public class MessageProducerResources {
/**
* Gets the TransactionCommitStrategy value of commitStrategy for this
* instance of SjmsProducer.MessageProducerResources.
- *
+ *
* @return the commitStrategy
*/
public TransactionCommitStrategy getCommitStrategy() {
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsComponent.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsComponent.java
index 03d4506..83eb02f 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsComponent.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsComponent.java
@@ -18,7 +18,6 @@ package org.apache.camel.component.sjms;
import java.util.Map;
import java.util.concurrent.ExecutorService;
-
import javax.jms.ConnectionFactory;
import org.apache.camel.CamelException;
@@ -72,7 +71,7 @@ public class SjmsComponent extends UriEndpointComponent implements HeaderFilterS
/**
* Helper method used to detect the type of endpoint and add the "queue"
* protocol if it is a default endpoint URI.
- *
+ *
* @param uri The value passed into our call to create an endpoint
* @return String
* @throws Exception
@@ -106,18 +105,18 @@ public class SjmsComponent extends UriEndpointComponent implements HeaderFilterS
* are using the InOut MEP. If namedReplyTo is defined and the MEP is InOnly
* the endpoint won't be expecting a reply so throw an error to alert the
* user.
- *
+ *
* @param parameters {@link Endpoint} parameters
* @throws Exception throws a {@link CamelException} when MEP equals InOnly
- * and namedReplyTo is defined.
+ * and namedReplyTo is defined.
*/
private static void validateMepAndReplyTo(Map<String, Object> parameters) throws Exception {
boolean namedReplyToSet = parameters.containsKey("namedReplyTo");
boolean mepSet = parameters.containsKey("exchangePattern");
if (namedReplyToSet && mepSet) {
if (!parameters.get("exchangePattern").equals(ExchangePattern.InOut.toString())) {
- String namedReplyTo = (String)parameters.get("namedReplyTo");
- ExchangePattern mep = ExchangePattern.valueOf((String)parameters.get("exchangePattern"));
+ String namedReplyTo = (String) parameters.get("namedReplyTo");
+ ExchangePattern mep = ExchangePattern.valueOf((String) parameters.get("exchangePattern"));
throw new CamelException("Setting parameter namedReplyTo=" + namedReplyTo + " requires a MEP of type InOut. Parameter exchangePattern is set to " + mep);
}
}
@@ -137,7 +136,7 @@ public class SjmsComponent extends UriEndpointComponent implements HeaderFilterS
connections.fillPool();
setConnectionResource(connections);
} else if (getConnectionResource() instanceof ConnectionFactoryResource) {
- ((ConnectionFactoryResource)getConnectionResource()).fillPool();
+ ((ConnectionFactoryResource) getConnectionResource()).fillPool();
}
}
@@ -149,7 +148,7 @@ public class SjmsComponent extends UriEndpointComponent implements HeaderFilterS
if (getConnectionResource() != null) {
if (getConnectionResource() instanceof ConnectionFactoryResource) {
- ((ConnectionFactoryResource)getConnectionResource()).drainPool();
+ ((ConnectionFactoryResource) getConnectionResource()).drainPool();
}
}
super.doStop();
@@ -184,7 +183,7 @@ public class SjmsComponent extends UriEndpointComponent implements HeaderFilterS
/**
* Gets the ConnectionFactory value of connectionFactory for this instance
* of SjmsComponent.
- *
+ *
* @return the connectionFactory
*/
public ConnectionFactory getConnectionFactory() {
@@ -228,7 +227,7 @@ public class SjmsComponent extends UriEndpointComponent implements HeaderFilterS
/**
* Gets the TransactionCommitStrategy value of transactionCommitStrategy for this
* instance of SjmsComponent.
- *
+ *
* @return the transactionCommitStrategy
*/
public TransactionCommitStrategy getTransactionCommitStrategy() {
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConstants.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConstants.java
index 6f522fb..035c93a 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConstants.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConstants.java
@@ -16,9 +16,6 @@
*/
package org.apache.camel.component.sjms;
-/**
- * TODO Add Class documentation for SjmsConstants
- */
public final class SjmsConstants {
public static final String QUEUE_PREFIX = "queue:";
public static final String TOPIC_PREFIX = "topic:";
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java
index 2e585ee..d93cf82 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java
@@ -18,7 +18,6 @@ package org.apache.camel.component.sjms;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
-
import javax.jms.Connection;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
@@ -45,7 +44,6 @@ import org.apache.commons.pool.impl.GenericObjectPool;
/**
* The SjmsConsumer is the base class for the SJMS MessageListener pool.
- *
*/
public class SjmsConsumer extends DefaultConsumer {
@@ -58,7 +56,7 @@ public class SjmsConsumer extends DefaultConsumer {
*/
protected class MessageConsumerResourcesFactory extends BasePoolableObjectFactory<MessageConsumerResources> {
- /**
+ /**
* Creates a new MessageConsumerResources instance.
*
* @see org.apache.commons.pool.PoolableObjectFactory#makeObject()
@@ -68,7 +66,7 @@ public class SjmsConsumer extends DefaultConsumer {
return createConsumer();
}
- /**
+ /**
* Cleans up the MessageConsumerResources.
*
* @see org.apache.commons.pool.PoolableObjectFactory#destroyObject(java.lang.Object)
@@ -80,7 +78,7 @@ public class SjmsConsumer extends DefaultConsumer {
if (model.getMessageConsumer() != null) {
model.getMessageConsumer().close();
}
-
+
// If the resource has a
if (model.getSession() != null) {
if (model.getSession().getTransacted()) {
@@ -109,11 +107,11 @@ public class SjmsConsumer extends DefaultConsumer {
protected void doStart() throws Exception {
super.doStart();
this.executor = getEndpoint().getCamelContext().getExecutorServiceManager().newDefaultThreadPool(this, "SjmsConsumer");
- if(consumers == null){
+ if (consumers == null) {
consumers = new GenericObjectPool<MessageConsumerResources>(new MessageConsumerResourcesFactory());
consumers.setMaxActive(getConsumerCount());
consumers.setMaxIdle(getConsumerCount());
- if(getEndpoint().isAsyncStartListener()){
+ if (getEndpoint().isAsyncStartListener()) {
asyncStart = getEndpoint().getComponent().getAsyncStartStopExecutorService().submit(new Runnable() {
@Override
public void run() {
@@ -136,7 +134,7 @@ public class SjmsConsumer extends DefaultConsumer {
}
private void fillConsumersPool() throws Exception {
- while(consumers.getNumIdle() < consumers.getMaxIdle()){
+ while (consumers.getNumIdle() < consumers.getMaxIdle()) {
consumers.addObject();
}
}
@@ -144,10 +142,10 @@ public class SjmsConsumer extends DefaultConsumer {
@Override
protected void doStop() throws Exception {
super.doStop();
- if(asyncStart != null && asyncStart.isDone() == false){
+ if (asyncStart != null && !asyncStart.isDone()) {
asyncStart.cancel(true);
}
- if(consumers != null){
+ if (consumers != null) {
if (getEndpoint().isAsyncStopListener()) {
getEndpoint().getComponent().getAsyncStartStopExecutorService().submit(new Runnable() {
@Override
@@ -185,7 +183,7 @@ public class SjmsConsumer extends DefaultConsumer {
Connection conn = null;
try {
conn = getConnectionResource().borrowConnection();
-
+
Session session = null;
MessageConsumer messageConsumer = null;
if (isTransacted()) {
@@ -196,7 +194,7 @@ public class SjmsConsumer extends DefaultConsumer {
messageConsumer = JmsObjectFactory.createMessageConsumer(session, getDestinationName(), getMessageSelector(), isTopic(), getDurableSubscriptionId());
MessageListener handler = createMessageHandler(session);
messageConsumer.setMessageListener(handler);
-
+
if (session == null) {
throw new CamelException("Message Consumer Creation Exception: Session is NULL");
}
@@ -217,7 +215,7 @@ public class SjmsConsumer extends DefaultConsumer {
/**
* Helper factory method used to create a MessageListener based on the MEP
- *
+ *
* @param session a session is only required if we are a transacted consumer
* @return the listener
*/
@@ -272,7 +270,7 @@ public class SjmsConsumer extends DefaultConsumer {
/**
* Use to determine if transactions are enabled or disabled.
- *
+ *
* @return true if transacted, otherwise false
*/
public boolean isTransacted() {
@@ -281,7 +279,7 @@ public class SjmsConsumer extends DefaultConsumer {
/**
* Use to determine whether or not to process exchanges synchronously.
- *
+ *
* @return true if synchronous
*/
public boolean isSynchronous() {
@@ -290,7 +288,7 @@ public class SjmsConsumer extends DefaultConsumer {
/**
* The destination name for this consumer.
- *
+ *
* @return String
*/
public String getDestinationName() {
@@ -299,7 +297,7 @@ public class SjmsConsumer extends DefaultConsumer {
/**
* Returns the number of consumer listeners.
- *
+ *
* @return the consumerCount
*/
public int getConsumerCount() {
@@ -309,7 +307,7 @@ public class SjmsConsumer extends DefaultConsumer {
/**
* Flag set by the endpoint used by consumers and producers to determine if
* the consumer is a JMS Topic.
- *
+ *
* @return the topic true if consumer is a JMS Topic, default is false
*/
public boolean isTopic() {
@@ -325,7 +323,7 @@ public class SjmsConsumer extends DefaultConsumer {
/**
* Gets the durable subscription Id.
- *
+ *
* @return the durableSubscriptionId
*/
public String getDurableSubscriptionId() {
@@ -334,7 +332,7 @@ public class SjmsConsumer extends DefaultConsumer {
/**
* Gets the commit strategy.
- *
+ *
* @return the transactionCommitStrategy
*/
public TransactionCommitStrategy getTransactionCommitStrategy() {
@@ -344,7 +342,7 @@ public class SjmsConsumer extends DefaultConsumer {
/**
* If transacted, returns the nubmer of messages to be processed before
* committing the transaction.
- *
+ *
* @return the transactionBatchCount
*/
public int getTransactionBatchCount() {
@@ -353,7 +351,7 @@ public class SjmsConsumer extends DefaultConsumer {
/**
* Returns the timeout value for batch transactions.
- *
+ *
* @return long
*/
public long getTransactionBatchTimeout() {
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/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 8558a22..d8cd26f 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
@@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory;
public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSupport {
protected final Logger logger = LoggerFactory.getLogger(getClass());
-
+
@UriParam
private boolean synchronous = true;
@UriParam
@@ -155,7 +155,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Use to determine whether or not to process exchanges synchronously.
- *
+ *
* @return true if endoint is synchronous, otherwise false
*/
public boolean isSynchronous() {
@@ -164,7 +164,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Flag can be set to enable/disable synchronous exchange processing.
- *
+ *
* @param synchronous true to process synchronously, default is true
*/
public void setSynchronous(boolean synchronous) {
@@ -173,7 +173,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Returns the configured acknowledgementMode.
- *
+ *
* @return the acknowledgementMode
*/
public SessionAcknowledgementType getAcknowledgementMode() {
@@ -182,9 +182,9 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Sets the acknowledgementMode configured on this endpoint.
- *
+ *
* @param acknowledgementMode default is
- * SessionAcknowledgementType.AUTO_ACKNOWLEDGE
+ * SessionAcknowledgementType.AUTO_ACKNOWLEDGE
*/
public void setAcknowledgementMode(SessionAcknowledgementType acknowledgementMode) {
this.acknowledgementMode = acknowledgementMode;
@@ -193,7 +193,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Flag set by the endpoint used by consumers and producers to determine if
* the endpoint is a JMS Topic.
- *
+ *
* @return the topic true if endpoint is a JMS Topic, default is false
*/
public boolean isTopic() {
@@ -202,7 +202,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Returns the number of Session instances expected on this endpoint.
- *
+ *
* @return the sessionCount
*/
@Deprecated
@@ -214,7 +214,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
* Sets the number of Session instances used for this endpoint. Value is
* ignored for endpoints that require a dedicated session such as a
* transacted or InOut endpoint.
- *
+ *
* @param sessionCount the number of Session instances, default is 1
*/
@Deprecated
@@ -224,7 +224,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Returns the number of consumer listeners for this endpoint.
- *
+ *
* @return the producerCount
*/
public int getProducerCount() {
@@ -233,9 +233,9 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Sets the number of producers used for this endpoint.
- *
+ *
* @param producerCount the number of producers for this endpoint, default
- * is 1
+ * is 1
*/
public void setProducerCount(int producerCount) {
this.producerCount = producerCount;
@@ -243,7 +243,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Returns the number of consumer listeners for this endpoint.
- *
+ *
* @return the consumerCount
*/
public int getConsumerCount() {
@@ -252,9 +252,9 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Sets the number of consumer listeners used for this endpoint.
- *
+ *
* @param consumerCount the number of consumers for this endpoint, default
- * is 1
+ * is 1
*/
public void setConsumerCount(int consumerCount) {
this.consumerCount = consumerCount;
@@ -262,7 +262,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Returns the Time To Live set on this endpoint.
- *
+ *
* @return the ttl
*/
public long getTtl() {
@@ -271,7 +271,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Flag used to adjust the Time To Live value of produced messages.
- *
+ *
* @param ttl a new TTL, default is -1 (disabled)
*/
public void setTtl(long ttl) {
@@ -281,7 +281,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Use to determine if the enpoint has message persistence enabled or
* disabled.
- *
+ *
* @return true if persistent, otherwise false
*/
public boolean isPersistent() {
@@ -290,7 +290,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Flag used to enable/disable message persistence.
- *
+ *
* @param persistent true if persistent, default is true
*/
public void setPersistent(boolean persistent) {
@@ -299,7 +299,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Gets the durable subscription Id.
- *
+ *
* @return the durableSubscriptionId
*/
public String getDurableSubscriptionId() {
@@ -308,7 +308,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Sets the durable subscription Id required for durable topics.
- *
+ *
* @param durableSubscriptionId durable subscription Id or null
*/
public void setDurableSubscriptionId(String durableSubscriptionId) {
@@ -317,7 +317,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Returns the InOut response timeout.
- *
+ *
* @return the responseTimeOut
*/
public long getResponseTimeOut() {
@@ -327,7 +327,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Sets the amount of time we should wait before timing out a InOut
* response.
- *
+ *
* @param responseTimeOut response timeout
*/
public void setResponseTimeOut(long responseTimeOut) {
@@ -337,7 +337,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Returns the JMS Message selector syntax used to refine the messages being
* consumed.
- *
+ *
* @return the messageSelector
*/
public String getMessageSelector() {
@@ -346,7 +346,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Sets the JMS Message selector syntax.
- *
+ *
* @param messageSelector Message selector syntax or null
*/
public void setMessageSelector(String messageSelector) {
@@ -356,7 +356,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* If transacted, returns the nubmer of messages to be processed before
* committing the transaction.
- *
+ *
* @return the transactionBatchCount
*/
public int getTransactionBatchCount() {
@@ -366,9 +366,9 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* If transacted sets the number of messages to process before committing a
* transaction.
- *
+ *
* @param transactionBatchCount number of messages to process before
- * committing, default is 1
+ * committing, default is 1
*/
public void setTransactionBatchCount(int transactionBatchCount) {
this.transactionBatchCount = transactionBatchCount;
@@ -376,7 +376,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Returns the timeout value for batch transactions.
- *
+ *
* @return long
*/
public long getTransactionBatchTimeout() {
@@ -385,7 +385,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Sets timeout value for batch transactions.
- *
+ *
* @param transactionBatchTimeout
*/
public void setTransactionBatchTimeout(long transactionBatchTimeout) {
@@ -396,7 +396,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Gets the commit strategy.
- *
+ *
* @return the transactionCommitStrategy
*/
public TransactionCommitStrategy getTransactionCommitStrategy() {
@@ -405,9 +405,9 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Sets the commit strategy.
- *
+ *
* @param transactionCommitStrategy commit strategy to use when processing
- * transacted messages
+ * transacted messages
*/
public void setTransactionCommitStrategy(TransactionCommitStrategy transactionCommitStrategy) {
this.transactionCommitStrategy = transactionCommitStrategy;
@@ -415,7 +415,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Use to determine if transactions are enabled or disabled.
- *
+ *
* @return true if transacted, otherwise false
*/
public boolean isTransacted() {
@@ -424,7 +424,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Enable/disable flag for transactions
- *
+ *
* @param transacted true if transacted, otherwise false
*/
public void setTransacted(boolean transacted) {
@@ -436,7 +436,7 @@ public class SjmsEndpoint extends DefaultEndpoint implements MultipleConsumersSu
/**
* Returns the reply to destination name used for InOut producer endpoints.
- *
+ *
* @return the namedReplyTo
*/
public String getNamedReplyTo() {
@@ -445,7 +445,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
*/
public void setNamedReplyTo(String namedReplyTo) {
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsExchangeMessageHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsExchangeMessageHelper.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsExchangeMessageHelper.java
index d492183..7d2c8c4 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsExchangeMessageHelper.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsExchangeMessageHelper.java
@@ -23,7 +23,6 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-
import javax.jms.BytesMessage;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
@@ -76,25 +75,25 @@ public final class SjmsExchangeMessageHelper {
DefaultMessage bodyMessage = null;
if (out) {
- bodyMessage = (DefaultMessage)exchange.getOut();
+ bodyMessage = (DefaultMessage) exchange.getOut();
} else {
- bodyMessage = (DefaultMessage)exchange.getIn();
+ bodyMessage = (DefaultMessage) exchange.getIn();
}
switch (JmsMessageHelper.discoverJmsMessageType(message)) {
case Bytes:
- BytesMessage bytesMessage = (BytesMessage)message;
+ BytesMessage bytesMessage = (BytesMessage) message;
if (bytesMessage.getBodyLength() > Integer.MAX_VALUE) {
LOGGER.warn("Length of BytesMessage is too long: {}", bytesMessage.getBodyLength());
return null;
}
- byte[] result = new byte[(int)bytesMessage.getBodyLength()];
+ byte[] result = new byte[(int) bytesMessage.getBodyLength()];
bytesMessage.readBytes(result);
bodyMessage.setHeader(JMS_MESSAGE_TYPE, JmsMessageType.Bytes);
bodyMessage.setBody(result);
break;
case Map:
Map<String, Object> body = new HashMap<String, Object>();
- MapMessage mapMessage = (MapMessage)message;
+ MapMessage mapMessage = (MapMessage) message;
Enumeration<String> names = mapMessage.getMapNames();
while (names.hasMoreElements()) {
String key = names.nextElement();
@@ -105,17 +104,17 @@ public final class SjmsExchangeMessageHelper {
bodyMessage.setBody(body);
break;
case Object:
- ObjectMessage objMsg = (ObjectMessage)message;
+ ObjectMessage objMsg = (ObjectMessage) message;
bodyMessage.setHeader(JMS_MESSAGE_TYPE, JmsMessageType.Object);
bodyMessage.setBody(objMsg.getObject());
break;
case Text:
- TextMessage textMsg = (TextMessage)message;
+ TextMessage textMsg = (TextMessage) message;
bodyMessage.setHeader(JMS_MESSAGE_TYPE, JmsMessageType.Text);
bodyMessage.setBody(textMsg.getText());
break;
case Stream:
- StreamMessage streamMessage = (StreamMessage)message;
+ StreamMessage streamMessage = (StreamMessage) message;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int next = streamMessage.readByte();
while (next > -1) {
@@ -141,9 +140,9 @@ public final class SjmsExchangeMessageHelper {
/**
* Removes the property from the JMS message.
- *
+ *
* @param jmsMessage the JMS message
- * @param name name of the property to remove
+ * @param name name of the property to remove
* @return the old value of the property or <tt>null</tt> if not exists
* @throws JMSException can be thrown
*/
@@ -162,7 +161,7 @@ public final class SjmsExchangeMessageHelper {
Map<String, Object> map = new LinkedHashMap<String, Object>();
Enumeration<?> en = jmsMessage.getPropertyNames();
while (en.hasMoreElements()) {
- String key = (String)en.nextElement();
+ String key = (String) en.nextElement();
if (name.equals(key)) {
answer = key;
} else {
@@ -181,16 +180,16 @@ public final class SjmsExchangeMessageHelper {
/**
* Tests whether a given property with the name exists
- *
+ *
* @param jmsMessage the JMS message
- * @param name name of the property to test if exists
+ * @param name name of the property to test if exists
* @return <tt>true</tt> if the property exists, <tt>false</tt> if not.
* @throws JMSException can be thrown
*/
public static boolean hasProperty(Message jmsMessage, String name) throws JMSException {
Enumeration<?> en = jmsMessage.getPropertyNames();
while (en.hasMoreElements()) {
- String key = (String)en.nextElement();
+ String key = (String) en.nextElement();
if (name.equals(key)) {
return true;
}
@@ -200,10 +199,10 @@ public final class SjmsExchangeMessageHelper {
/**
* Sets the property on the given JMS message.
- *
+ *
* @param jmsMessage the JMS message
- * @param name name of the property to set
- * @param value the value
+ * @param name name of the property to set
+ * @param value the value
* @throws JMSException can be thrown
*/
public static void setProperty(Message jmsMessage, String name, Object value) throws JMSException {
@@ -211,21 +210,21 @@ public final class SjmsExchangeMessageHelper {
return;
}
if (value instanceof Byte) {
- jmsMessage.setByteProperty(name, (Byte)value);
+ jmsMessage.setByteProperty(name, (Byte) value);
} else if (value instanceof Boolean) {
- jmsMessage.setBooleanProperty(name, (Boolean)value);
+ jmsMessage.setBooleanProperty(name, (Boolean) value);
} else if (value instanceof Double) {
- jmsMessage.setDoubleProperty(name, (Double)value);
+ jmsMessage.setDoubleProperty(name, (Double) value);
} else if (value instanceof Float) {
- jmsMessage.setFloatProperty(name, (Float)value);
+ jmsMessage.setFloatProperty(name, (Float) value);
} else if (value instanceof Integer) {
- jmsMessage.setIntProperty(name, (Integer)value);
+ jmsMessage.setIntProperty(name, (Integer) value);
} else if (value instanceof Long) {
- jmsMessage.setLongProperty(name, (Long)value);
+ jmsMessage.setLongProperty(name, (Long) value);
} else if (value instanceof Short) {
- jmsMessage.setShortProperty(name, (Short)value);
+ jmsMessage.setShortProperty(name, (Short) value);
} else if (value instanceof String) {
- jmsMessage.setStringProperty(name, (String)value);
+ jmsMessage.setStringProperty(name, (String) value);
} else {
// fallback to Object
jmsMessage.setObjectProperty(name, value);
@@ -236,8 +235,8 @@ public final class SjmsExchangeMessageHelper {
* Sets the correlation id on the JMS message.
* <p/>
* Will ignore exception thrown
- *
- * @param message the JMS message
+ *
+ * @param message the JMS message
* @param correlationId the correlation id
*/
public static void setCorrelationId(Message message, String correlationId) {
@@ -253,7 +252,7 @@ public final class SjmsExchangeMessageHelper {
/**
* Normalizes the destination name, by removing any leading queue or topic
* prefixes.
- *
+ *
* @param destination the destination
* @return the normalized destination
*/
@@ -272,7 +271,7 @@ public final class SjmsExchangeMessageHelper {
/**
* Sets the JMSReplyTo on the message.
- *
+ *
* @param message the message
* @param replyTo the reply to destination
*/
@@ -286,7 +285,7 @@ public final class SjmsExchangeMessageHelper {
/**
* Gets the JMSReplyTo from the message.
- *
+ *
* @param message the message
* @return the reply to, can be <tt>null</tt>
*/
@@ -302,7 +301,7 @@ public final class SjmsExchangeMessageHelper {
/**
* Gets the JMSType from the message.
- *
+ *
* @param message the message
* @return the type, can be <tt>null</tt>
*/
@@ -318,10 +317,10 @@ public final class SjmsExchangeMessageHelper {
/**
* Gets the JMSRedelivered from the message.
- *
+ *
* @param message the message
* @return <tt>true</tt> if redelivered, <tt>false</tt> if not,
- * <tt>null</tt> if not able to determine
+ * <tt>null</tt> if not able to determine
*/
public static Boolean getJMSRedelivered(Message message) {
try {
@@ -335,18 +334,18 @@ public final class SjmsExchangeMessageHelper {
/**
* Sets the JMSDeliveryMode on the message.
- *
- * @param exchange the exchange
- * @param message the message
+ *
+ * @param exchange the exchange
+ * @param message the message
* @param deliveryMode the delivery mode, either as a String or integer
* @throws javax.jms.JMSException is thrown if error setting the delivery
- * mode
+ * mode
*/
public static void setJMSDeliveryMode(Exchange exchange, Message message, Object deliveryMode) throws JMSException {
Integer mode = null;
if (deliveryMode instanceof String) {
- String s = (String)deliveryMode;
+ String s = (String) deliveryMode;
if ("PERSISTENT".equalsIgnoreCase(s)) {
mode = DeliveryMode.PERSISTENT;
} else if ("NON_PERSISTENT".equalsIgnoreCase(s)) {
@@ -408,7 +407,7 @@ public final class SjmsExchangeMessageHelper {
// log at trace level to not spam log
LOGGER.trace("Ignoring JMS header: {} with value: {}", headerName, headerValue);
if (headerName.equalsIgnoreCase("JMSDestination") || headerName.equalsIgnoreCase("JMSMessageID") || headerName.equalsIgnoreCase("JMSTimestamp")
- || headerName.equalsIgnoreCase("JMSRedelivered")) {
+ || headerName.equalsIgnoreCase("JMSRedelivered")) {
// The following properties are set by the MessageProducer:
// JMSDestination
// The following are set on the underlying JMS provider:
@@ -465,13 +464,13 @@ public final class SjmsExchangeMessageHelper {
}
return exchange;
}
-
+
public static Message createMessage(Exchange exchange, Session session, KeyFormatStrategy keyFormatStrategy) throws Exception {
Message answer = null;
Object body = null;
Map<String, Object> bodyHeaders = null;
-
+
if (exchange.getOut().getBody() != null) {
body = exchange.getOut().getBody();
bodyHeaders = new HashMap<String, Object>(exchange.getOut().getHeaders());
@@ -479,9 +478,9 @@ public final class SjmsExchangeMessageHelper {
body = exchange.getIn().getBody();
bodyHeaders = new HashMap<String, Object>(exchange.getIn().getHeaders());
}
-
+
answer = JmsMessageHelper.createMessage(session, body, bodyHeaders, keyFormatStrategy);
-
+
return answer;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsProducer.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsProducer.java
index 3d2b706..533b2f1 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsProducer.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsProducer.java
@@ -79,11 +79,11 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
protected void doStart() throws Exception {
super.doStart();
this.executor = getEndpoint().getCamelContext().getExecutorServiceManager().newDefaultThreadPool(this, "SjmsProducer");
- if(getProducers() == null){
+ if (getProducers() == null) {
setProducers(new GenericObjectPool<MessageProducerResources>(new MessageProducerResourcesFactory()));
getProducers().setMaxActive(getProducerCount());
getProducers().setMaxIdle(getProducerCount());
- if(getEndpoint().isAsyncStartListener()){
+ if (getEndpoint().isAsyncStartListener()) {
asyncStart = getEndpoint().getComponent().getAsyncStartStopExecutorService().submit(new Runnable() {
@Override
public void run() {
@@ -106,7 +106,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
}
private void fillProducersPool() throws Exception {
- while(producers.getNumIdle() < producers.getMaxIdle()){
+ while (producers.getNumIdle() < producers.getMaxIdle()) {
producers.addObject();
}
}
@@ -114,7 +114,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
@Override
protected void doStop() throws Exception {
super.doStop();
- if(asyncStart != null && asyncStart.isDone() == false){
+ if (asyncStart != null && !asyncStart.isDone()) {
asyncStart.cancel(true);
}
if (getProducers() != null) {
@@ -201,7 +201,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
}
protected SjmsEndpoint getSjmsEndpoint() {
- return (SjmsEndpoint)this.getEndpoint();
+ return (SjmsEndpoint) this.getEndpoint();
}
protected ConnectionResource getConnectionResource() {
@@ -210,7 +210,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
/**
* Gets the acknowledgment mode for this instance of DestinationProducer.
- *
+ *
* @return int
*/
public int getAcknowledgeMode() {
@@ -219,7 +219,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
/**
* Gets the synchronous value for this instance of DestinationProducer.
- *
+ *
* @return true if synchronous, otherwise false
*/
public boolean isSynchronous() {
@@ -228,7 +228,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
/**
* Gets the replyTo for this instance of DestinationProducer.
- *
+ *
* @return String
*/
public String getReplyTo() {
@@ -237,7 +237,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
/**
* Gets the destinationName for this instance of DestinationProducer.
- *
+ *
* @return String
*/
public String getDestinationName() {
@@ -246,7 +246,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
/**
* Sets the producer pool for this instance of SjmsProducer.
- *
+ *
* @param producers A MessageProducerPool
*/
public void setProducers(GenericObjectPool<MessageProducerResources> producers) {
@@ -256,7 +256,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
/**
* Gets the MessageProducerPool value of producers for this instance of
* SjmsProducer.
- *
+ *
* @return the producers
*/
public GenericObjectPool<MessageProducerResources> getProducers() {
@@ -265,7 +265,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
/**
* Test to verify if this endpoint is a JMS Topic or Queue.
- *
+ *
* @return true if it is a Topic, otherwise it is a Queue
*/
public boolean isTopic() {
@@ -274,7 +274,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
/**
* Test to determine if this endpoint should use a JMS Transaction.
- *
+ *
* @return true if transacted, otherwise false
*/
public boolean isEndpointTransacted() {
@@ -283,7 +283,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
/**
* Returns the named reply to value for this producer
- *
+ *
* @return true if it is a Topic, otherwise it is a Queue
*/
public String getNamedReplyTo() {
@@ -292,7 +292,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
/**
* Gets the producerCount for this instance of SjmsProducer.
- *
+ *
* @return int
*/
public int getProducerCount() {
@@ -301,7 +301,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
/**
* Gets consumerCount for this instance of SjmsProducer.
- *
+ *
* @return int
*/
public int getConsumerCount() {
@@ -310,7 +310,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
/**
* Gets the executor for this instance of SjmsProducer.
- *
+ *
* @return ExecutorService
*/
public ExecutorService getExecutor() {
@@ -319,7 +319,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
/**
* Gets the ttl for this instance of SjmsProducer.
- *
+ *
* @return long
*/
public long getTtl() {
@@ -328,7 +328,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
/**
* Gets the boolean value of persistent for this instance of SjmsProducer.
- *
+ *
* @return true if persistent, otherwise false
*/
public boolean isPersistent() {
@@ -337,7 +337,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
/**
* Gets responseTimeOut for this instance of SjmsProducer.
- *
+ *
* @return long
*/
public long getResponseTimeOut() {
@@ -346,7 +346,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
/**
* Gets commitStrategy for this instance of SjmsProducer.
- *
+ *
* @return TransactionCommitStrategy
*/
public TransactionCommitStrategy getCommitStrategy() {
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/TransactionCommitStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/TransactionCommitStrategy.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/TransactionCommitStrategy.java
index cab09b5..e007761 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/TransactionCommitStrategy.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/TransactionCommitStrategy.java
@@ -22,7 +22,6 @@ import org.apache.camel.Exchange;
* Provides a entry point into the transaction
* {@link org.apache.camel.spi.Synchronization} workflow that will allow a user
* to control when the {@link javax.jms.Session} commit operation is executed.
- *
*/
public interface TransactionCommitStrategy {
@@ -30,10 +29,10 @@ public interface TransactionCommitStrategy {
* Should returns true to allow the commit to proceed. If false, the commit
* will be skipped. The default should always be true to avoid messages
* remaining uncommitted.
- *
+ *
* @param exchange {@link org.apache.camel.Exchange}
* @return true if the {@link javax.jms.Session} should be committed,
- * otherwise false
+ * otherwise false
* @throws Exception
*/
boolean commit(Exchange exchange) throws Exception;
@@ -42,10 +41,10 @@ public interface TransactionCommitStrategy {
* Should returns true to allow the commit to proceed. If false, the commit
* will be skipped. The default should always be true to avoid messages
* remaining uncommitted.
- *
+ *
* @param exchange {@link org.apache.camel.Exchange}
* @return true if the {@link javax.jms.Session} should be committed,
- * otherwise false
+ * otherwise false
* @throws Exception
*/
boolean rollback(Exchange exchange) throws Exception;
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/AbstractMessageHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/AbstractMessageHandler.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/AbstractMessageHandler.java
index 38c0860..67ce398 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/AbstractMessageHandler.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/AbstractMessageHandler.java
@@ -17,7 +17,6 @@
package org.apache.camel.component.sjms.consumer;
import java.util.concurrent.ExecutorService;
-
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.Session;
@@ -36,7 +35,7 @@ import org.slf4j.LoggerFactory;
import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
/**
- * Abstract MessageListener
+ * Abstract MessageListener
*/
public abstract class AbstractMessageHandler implements MessageListener {
@@ -73,10 +72,10 @@ public abstract class AbstractMessageHandler implements MessageListener {
public void onMessage(Message message) {
RuntimeCamelException rce = null;
try {
- final DefaultExchange exchange = (DefaultExchange)SjmsExchangeMessageHelper.createExchange(message, getEndpoint());
-
+ final DefaultExchange exchange = (DefaultExchange) SjmsExchangeMessageHelper.createExchange(message, getEndpoint());
+
log.debug("Processing Exchange.id:{}", exchange.getExchangeId());
-
+
if (isTransacted() && synchronization != null) {
exchange.addOnCompletion(synchronization);
}
@@ -123,7 +122,7 @@ public abstract class AbstractMessageHandler implements MessageListener {
public abstract void handleMessage(final Exchange exchange);
/**
- * Method will be called to
+ * Method will be called to
*/
public abstract void close();
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/InOnlyMessageHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/InOnlyMessageHandler.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/InOnlyMessageHandler.java
index 53ca48c..aa21578 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/InOnlyMessageHandler.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/InOnlyMessageHandler.java
@@ -25,7 +25,6 @@ import org.apache.camel.spi.Synchronization;
/**
* An InOnly {@link AbstractMessageHandler}
- *
*/
public class InOnlyMessageHandler extends AbstractMessageHandler {
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/InOutMessageHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/InOutMessageHandler.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/InOutMessageHandler.java
index 26b9a08..a9a6a41 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/InOutMessageHandler.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/InOutMessageHandler.java
@@ -21,7 +21,6 @@ import java.util.TreeMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
-
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
@@ -40,8 +39,6 @@ import org.apache.camel.spi.Synchronization;
import org.apache.camel.util.ObjectHelper;
/**
- * TODO Add Class documentation for AbstractMessageHandler
- * TODO Create a producer
* cache manager to store and purge unused cashed producers or we will have a
* memory leak
*/
@@ -50,29 +47,14 @@ public class InOutMessageHandler extends AbstractMessageHandler {
private Map<String, MessageProducer> producerCache = new TreeMap<String, MessageProducer>();
private ReadWriteLock lock = new ReentrantReadWriteLock();
-
- /**
- *
- * @param endpoint
- * @param executor
- */
public InOutMessageHandler(Endpoint endpoint, ExecutorService executor) {
super(endpoint, executor);
}
-
- /**
- *
- * @param endpoint
- * @param executor
- * @param synchronization
- */
+
public InOutMessageHandler(Endpoint endpoint, ExecutorService executor, Synchronization synchronization) {
super(endpoint, executor, synchronization);
}
- /**
- * @param message
- */
@Override
public void handleMessage(final Exchange exchange) {
try {
@@ -81,9 +63,9 @@ public class InOutMessageHandler extends AbstractMessageHandler {
if (obj != null) {
Destination replyTo = null;
if (isDestination(obj)) {
- replyTo = (Destination)obj;
+ replyTo = (Destination) obj;
} else if (obj instanceof String) {
- replyTo = JmsObjectFactory.createDestination(getSession(), (String)obj, isTopic());
+ replyTo = JmsObjectFactory.createDestination(getSession(), (String) obj, isTopic());
} else {
throw new Exception("The value of JMSReplyTo must be a valid Destination or String. Value provided: " + obj);
}
@@ -158,9 +140,9 @@ public class InOutMessageHandler extends AbstractMessageHandler {
private String getDestinationName(Destination destination) throws Exception {
String answer = null;
if (destination instanceof Queue) {
- answer = ((Queue)destination).getQueueName();
+ answer = ((Queue) destination).getQueueName();
} else if (destination instanceof Topic) {
- answer = ((Topic)destination).getTopicName();
+ answer = ((Topic) destination).getTopicName();
}
return answer;
@@ -178,9 +160,8 @@ public class InOutMessageHandler extends AbstractMessageHandler {
@Override
public void done(boolean sync) {
-
try {
- Message response = SjmsExchangeMessageHelper.createMessage(exchange, getSession(), ((SjmsEndpoint)getEndpoint()).getJmsKeyFormatStrategy());
+ Message response = SjmsExchangeMessageHelper.createMessage(exchange, getSession(), ((SjmsEndpoint) getEndpoint()).getJmsKeyFormatStrategy());
response.setJMSCorrelationID(exchange.getIn().getHeader("JMSCorrelationID", String.class));
localProducer.send(response);
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/ConnectionFactoryResource.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/ConnectionFactoryResource.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/ConnectionFactoryResource.java
index 7246d2f..71d1f1c 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/ConnectionFactoryResource.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/ConnectionFactoryResource.java
@@ -43,45 +43,18 @@ public class ConnectionFactoryResource extends BasePoolableObjectFactory<Connect
this(DEFAULT_POOL_SIZE, null);
}
- /**
- * TODO Add Constructor Javadoc
- *
- * @param poolSize
- * @param connectionFactory
- */
public ConnectionFactoryResource(int poolSize, ConnectionFactory connectionFactory) {
this(poolSize, connectionFactory, null, null);
}
- /**
- * @param poolSize
- * @param connectionFactory
- * @param username
- * @param password
- */
public ConnectionFactoryResource(int poolSize, ConnectionFactory connectionFactory, String username, String password) {
this(poolSize, connectionFactory, username, password, null);
}
- /**
- * @param poolSize
- * @param connectionFactory
- * @param username
- * @param password
- * @param connectionId
- */
public ConnectionFactoryResource(int poolSize, ConnectionFactory connectionFactory, String username, String password, String connectionId) {
this(poolSize, connectionFactory, username, password, null, DEFAULT_WAIT_TIMEOUT);
}
- /**
- * @param poolSize
- * @param connectionFactory
- * @param username
- * @param password
- * @param connectionId
- * @param maxWait
- */
public ConnectionFactoryResource(int poolSize, ConnectionFactory connectionFactory, String username, String password, String connectionId, long maxWait) {
this.connectionFactory = connectionFactory;
this.username = username;
@@ -163,12 +136,12 @@ public class ConnectionFactoryResource extends BasePoolableObjectFactory<Connect
this.clientId = clientId;
}
- public int size(){
+ public int size() {
return connections.getNumActive() + connections.getNumIdle();
}
public void fillPool() throws Exception {
- while(connections.getNumIdle() < connections.getMaxIdle()){
+ while (connections.getNumIdle() < connections.getMaxIdle()) {
connections.addObject();
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/ConnectionResource.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/ConnectionResource.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/ConnectionResource.java
index 4a5dcc2..46677fa 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/ConnectionResource.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/ConnectionResource.java
@@ -37,7 +37,7 @@ public interface ConnectionResource {
/**
* Borrows a {@link Connection} from the connection pool. An exception
* should be thrown if no resource is available.
- *
+ *
* @return {@link Connection}
* @throws Exception when no resource is available
*/
@@ -45,7 +45,7 @@ public interface ConnectionResource {
/**
* Returns the {@link Connection} to the connection pool.
- *
+ *
* @param connection the borrowed {@link Connection}
* @throws Exception
*/
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/DefaultJmsKeyFormatStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/DefaultJmsKeyFormatStrategy.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/DefaultJmsKeyFormatStrategy.java
index 4398878..d95d2b5 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/DefaultJmsKeyFormatStrategy.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/DefaultJmsKeyFormatStrategy.java
@@ -21,8 +21,6 @@ package org.apache.camel.component.sjms.jms;
* <p/>
* This can be used for sending keys contain package names that is common by
* Java frameworks.
- *
- * @version
*/
public class DefaultJmsKeyFormatStrategy implements KeyFormatStrategy {
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/IllegalHeaderException.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/IllegalHeaderException.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/IllegalHeaderException.java
index 327f0a5..5c37631 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/IllegalHeaderException.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/IllegalHeaderException.java
@@ -24,7 +24,7 @@ import org.apache.camel.RuntimeCamelException;
*/
public class IllegalHeaderException extends RuntimeCamelException {
-
+
private static final long serialVersionUID = 3136304415267471091L;
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHeaderType.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHeaderType.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHeaderType.java
index 13ad450..101423b 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHeaderType.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHeaderType.java
@@ -27,10 +27,10 @@ public enum JmsMessageHeaderType {
JMSReplyTo,
JMSType,
JMSRedelivered,
-
+
/*
* Add known custom headers
*/
JMSXGroupID
-
+
}
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHelper.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHelper.java
index 89e7ba5..35b7382 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHelper.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHelper.java
@@ -23,7 +23,6 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-
import javax.jms.BytesMessage;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
@@ -98,12 +97,12 @@ public final class JmsMessageHelper {
switch (messageType) {
case Bytes:
BytesMessage bytesMessage = session.createBytesMessage();
- bytesMessage.writeBytes((byte[])payload);
+ bytesMessage.writeBytes((byte[]) payload);
answer = bytesMessage;
break;
case Map:
MapMessage mapMessage = session.createMapMessage();
- Map<String, Object> objMap = (Map<String, Object>)payload;
+ Map<String, Object> objMap = (Map<String, Object>) payload;
Set<String> keys = objMap.keySet();
for (String key : keys) {
Object value = objMap.get(key);
@@ -113,18 +112,18 @@ public final class JmsMessageHelper {
break;
case Object:
ObjectMessage objectMessage = session.createObjectMessage();
- objectMessage.setObject((Serializable)payload);
+ objectMessage.setObject((Serializable) payload);
answer = objectMessage;
break;
case Text:
TextMessage textMessage = session.createTextMessage();
- textMessage.setText((String)payload);
+ textMessage.setText((String) payload);
answer = textMessage;
break;
case Stream:
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- InputStream is = (InputStream)payload;
- int reads = is.read();
+ InputStream is = (InputStream) payload;
+ int reads = is.read();
while (reads != -1) {
baos.write(reads);
reads = is.read();
@@ -152,12 +151,12 @@ public final class JmsMessageHelper {
/**
* Adds or updates the {@link Message} headers. Header names and values are
* checked for JMS 1.1 compliance.
- *
- * @param jmsMessage the {@link Message} to add or update the headers on
- * @param messageHeaders a {@link Map} of String/Object pairs
+ *
+ * @param jmsMessage the {@link Message} to add or update the headers on
+ * @param messageHeaders a {@link Map} of String/Object pairs
* @param keyFormatStrategy the a {@link KeyFormatStrategy} to used to
- * format keys in a JMS 1.1 compliant manner. If null the
- * {@link DefaultJmsKeyFormatStrategy} will be used.
+ * format keys in a JMS 1.1 compliant manner. If null the
+ * {@link DefaultJmsKeyFormatStrategy} will be used.
* @return {@link Message}
* @throws Exception a
*/
@@ -181,7 +180,7 @@ public final class JmsMessageHelper {
// so pass null to the setter
setCorrelationId(jmsMessage, null);
} else if (headerValue instanceof String) {
- setCorrelationId(jmsMessage, (String)headerValue);
+ setCorrelationId(jmsMessage, (String) headerValue);
} else {
throw new IllegalHeaderException("The " + JMS_CORRELATION_ID + " must either be a String or null. Found: " + headerValue.getClass().getName());
}
@@ -205,14 +204,14 @@ public final class JmsMessageHelper {
setMessageType(jmsMessage, null);
} else if (headerValue instanceof String) {
// Not null but is a String
- setMessageType(jmsMessage, (String)headerValue);
+ setMessageType(jmsMessage, (String) headerValue);
} else {
throw new IllegalHeaderException("The " + JMS_TYPE + " must either be a String or null. Found: " + headerValue.getClass().getName());
}
} else if (headerName.equalsIgnoreCase(JMS_PRIORITY)) {
if (headerValue instanceof Integer) {
try {
- jmsMessage.setJMSPriority((Integer)headerValue);
+ jmsMessage.setJMSPriority((Integer) headerValue);
} catch (JMSException e) {
throw new IllegalHeaderException("Failed to set the " + JMS_PRIORITY + " header. Cause: " + e.getLocalizedMessage(), e);
}
@@ -228,7 +227,7 @@ public final class JmsMessageHelper {
} else if (headerName.equalsIgnoreCase(JMS_EXPIRATION)) {
if (headerValue instanceof Long) {
try {
- jmsMessage.setJMSExpiration((Long)headerValue);
+ jmsMessage.setJMSExpiration((Long) headerValue);
} catch (JMSException e) {
throw new IllegalHeaderException("Failed to set the " + JMS_EXPIRATION + " header. Cause: " + e.getLocalizedMessage(), e);
}
@@ -238,7 +237,7 @@ public final class JmsMessageHelper {
} else {
LOGGER.trace("Ignoring JMS header: {} with value: {}", headerName, headerValue);
if (headerName.equalsIgnoreCase(JMS_DESTINATION) || headerName.equalsIgnoreCase(JMS_MESSAGE_ID) || headerName.equalsIgnoreCase("JMSTimestamp")
- || headerName.equalsIgnoreCase("JMSRedelivered")) {
+ || headerName.equalsIgnoreCase("JMSRedelivered")) {
// The following properties are set by the
// MessageProducer:
// JMSDestination
@@ -264,18 +263,18 @@ public final class JmsMessageHelper {
/**
* Sets the JMSDeliveryMode on the message.
- *
- * @param exchange the exchange
- * @param message the message
+ *
+ * @param exchange the exchange
+ * @param message the message
* @param deliveryMode the delivery mode, either as a String or integer
* @throws javax.jms.JMSException is thrown if error setting the delivery
- * mode
+ * mode
*/
public static void setJMSDeliveryMode(Message message, Object deliveryMode) throws JMSException {
Integer mode = null;
if (deliveryMode instanceof String) {
- String s = (String)deliveryMode;
+ String s = (String) deliveryMode;
if ("PERSISTENT".equalsIgnoreCase(s)) {
mode = DeliveryMode.PERSISTENT;
} else if ("NON_PERSISTENT".equalsIgnoreCase(s)) {
@@ -296,7 +295,7 @@ public final class JmsMessageHelper {
}
} else if (deliveryMode instanceof Integer) {
// fallback and try to convert to a number
- mode = (Integer)deliveryMode;
+ mode = (Integer) deliveryMode;
} else {
throw new IllegalArgumentException("Unable to convert the given delivery mode of type " + deliveryMode.getClass().getName() + " with value: " + deliveryMode);
}
@@ -310,9 +309,9 @@ public final class JmsMessageHelper {
* Sets the correlation id on the JMS message.
* <p/>
* Will ignore exception thrown
- *
+ *
* @param message the JMS message
- * @param type the correlation id
+ * @param type the correlation id
*/
public static void setMessageType(Message message, String type) {
try {
@@ -328,8 +327,8 @@ public final class JmsMessageHelper {
* Sets the correlation id on the JMS message.
* <p/>
* Will ignore exception thrown
- *
- * @param message the JMS message
+ *
+ * @param message the JMS message
* @param correlationId the correlation id
*/
public static void setCorrelationId(Message message, String correlationId) {
@@ -344,10 +343,10 @@ public final class JmsMessageHelper {
/**
* Sets the property on the given JMS message.
- *
+ *
* @param jmsMessage the JMS message
- * @param name name of the property to set
- * @param value the value
+ * @param name name of the property to set
+ * @param value the value
* @throws JMSException can be thrown
*/
public static void setProperty(Message jmsMessage, String name, Object value) throws JMSException {
@@ -355,21 +354,21 @@ public final class JmsMessageHelper {
return;
}
if (value instanceof Byte) {
- jmsMessage.setByteProperty(name, (Byte)value);
+ jmsMessage.setByteProperty(name, (Byte) value);
} else if (value instanceof Boolean) {
- jmsMessage.setBooleanProperty(name, (Boolean)value);
+ jmsMessage.setBooleanProperty(name, (Boolean) value);
} else if (value instanceof Double) {
- jmsMessage.setDoubleProperty(name, (Double)value);
+ jmsMessage.setDoubleProperty(name, (Double) value);
} else if (value instanceof Float) {
- jmsMessage.setFloatProperty(name, (Float)value);
+ jmsMessage.setFloatProperty(name, (Float) value);
} else if (value instanceof Integer) {
- jmsMessage.setIntProperty(name, (Integer)value);
+ jmsMessage.setIntProperty(name, (Integer) value);
} else if (value instanceof Long) {
- jmsMessage.setLongProperty(name, (Long)value);
+ jmsMessage.setLongProperty(name, (Long) value);
} else if (value instanceof Short) {
- jmsMessage.setShortProperty(name, (Short)value);
+ jmsMessage.setShortProperty(name, (Short) value);
} else if (value instanceof String) {
- jmsMessage.setStringProperty(name, (String)value);
+ jmsMessage.setStringProperty(name, (String) value);
} else {
// fallback to Object
jmsMessage.setObjectProperty(name, value);
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageType.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageType.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageType.java
index f45f28b..2438db8 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageType.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageType.java
@@ -18,8 +18,6 @@ package org.apache.camel.component.sjms.jms;
/**
* Enum for different {@link javax.jms.Message} types.
- *
- * @version
*/
public enum JmsMessageType {
@@ -31,12 +29,12 @@ public enum JmsMessageType {
Object,
Stream,
Text,
-
+
/**
* BlobMessage which is not supported by all JMS implementations
*/
Blob,
-
+
/**
* The default type that can be used for empty messages.
*/
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsObjectFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsObjectFactory.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsObjectFactory.java
index 382ed68..1292398 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsObjectFactory.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsObjectFactory.java
@@ -26,17 +26,15 @@ import javax.jms.Topic;
import org.apache.camel.util.ObjectHelper;
/**
- * TODO Add Class documentation for JmsObjectFactory
*
*/
public final class JmsObjectFactory {
-
+
private JmsObjectFactory() {
//Helper class
}
- public static Destination createDestination(Session session, String destinationName, boolean topic)
- throws Exception {
+ public static Destination createDestination(Session session, String destinationName, boolean topic) throws Exception {
if (topic) {
return createTopic(session, destinationName);
} else {
@@ -71,60 +69,60 @@ public final class JmsObjectFactory {
public static MessageConsumer createTopicConsumer(Session session, String destinationName, String messageSelector) throws Exception {
return createMessageConsumer(session, destinationName, messageSelector, true, null);
}
-
+
public static MessageConsumer createTemporaryMessageConsumer(
- Session session,
- String messageSelector,
- boolean topic,
+ Session session,
+ String messageSelector,
+ boolean topic,
String durableSubscriptionId,
boolean noLocal) throws Exception {
Destination destination = createTemporaryDestination(session, topic);
return createMessageConsumer(session, destination, messageSelector, topic, durableSubscriptionId, noLocal);
}
-
+
public static MessageConsumer createMessageConsumer(
- Session session,
- String destinationName,
- String messageSelector,
- boolean topic,
+ Session session,
+ String destinationName,
+ String messageSelector,
+ boolean topic,
String durableSubscriptionId) throws Exception {
// noLocal is default false accordingly to JMS spec
return createMessageConsumer(session, destinationName, messageSelector, topic, durableSubscriptionId, false);
}
-
+
public static MessageConsumer createMessageConsumer(
- Session session,
- String destinationName,
- String messageSelector,
- boolean topic,
+ Session session,
+ String destinationName,
+ String messageSelector,
+ boolean topic,
String durableSubscriptionId,
boolean noLocal) throws Exception {
Destination destination = null;
if (topic) {
destination = session.createTopic(destinationName);
-
+
} else {
destination = session.createQueue(destinationName);
}
return createMessageConsumer(session, destination, messageSelector, topic, durableSubscriptionId, noLocal);
}
-
+
public static MessageConsumer createMessageConsumer(
- Session session,
- Destination destination,
- String messageSelector,
- boolean topic,
+ Session session,
+ Destination destination,
+ String messageSelector,
+ boolean topic,
String durableSubscriptionId,
boolean noLocal) throws Exception {
MessageConsumer messageConsumer = null;
-
+
if (topic) {
if (ObjectHelper.isNotEmpty(durableSubscriptionId)) {
if (ObjectHelper.isNotEmpty(messageSelector)) {
- messageConsumer = session.createDurableSubscriber((Topic)destination, durableSubscriptionId,
- messageSelector, noLocal);
+ messageConsumer = session.createDurableSubscriber((Topic) destination, durableSubscriptionId,
+ messageSelector, noLocal);
} else {
- messageConsumer = session.createDurableSubscriber((Topic)destination, durableSubscriptionId);
+ messageConsumer = session.createDurableSubscriber((Topic) destination, durableSubscriptionId);
}
} else {
if (ObjectHelper.isNotEmpty(messageSelector)) {
@@ -135,29 +133,29 @@ public final class JmsObjectFactory {
}
} else {
if (ObjectHelper.isNotEmpty(messageSelector)) {
- messageConsumer = session.createConsumer(destination, messageSelector);
+ messageConsumer = session.createConsumer(destination, messageSelector);
} else {
messageConsumer = session.createConsumer(destination);
}
}
return messageConsumer;
}
-
+
public static MessageProducer createQueueProducer(
- Session session,
+ Session session,
String destinationName) throws Exception {
return createMessageProducer(session, destinationName, false, true, -1);
}
-
+
public static MessageProducer createTopicProducer(
- Session session,
+ Session session,
String destinationName) throws Exception {
return createMessageProducer(session, destinationName, true, false, -1);
}
-
+
public static MessageProducer createMessageProducer(
- Session session,
- String destinationName,
+ Session session,
+ String destinationName,
boolean topic,
boolean persitent,
long ttl) throws Exception {
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/KeyFormatStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/KeyFormatStrategy.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/KeyFormatStrategy.java
index ffb6536..3b7566f 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/KeyFormatStrategy.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/KeyFormatStrategy.java
@@ -19,14 +19,12 @@ package org.apache.camel.component.sjms.jms;
/**
* Strategy for applying encoding and decoding of JMS headers so they apply to
* the JMS spec.
- *
- * @version
*/
public interface KeyFormatStrategy {
/**
* Encodes the key before its sent as a {@link javax.jms.Message} message.
- *
+ *
* @param key the original key
* @return the encoded key
*/
@@ -35,7 +33,7 @@ public interface KeyFormatStrategy {
/**
* Decodes the key after its received from a {@link javax.jms.Message}
* message.
- *
+ *
* @param key the encoded key
* @return the decoded key as the original key
*/
http://git-wip-us.apache.org/repos/asf/camel/blob/86efd450/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/SessionAcknowledgementType.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/SessionAcknowledgementType.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/SessionAcknowledgementType.java
index 1fb2436..2ca0e79 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/SessionAcknowledgementType.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/SessionAcknowledgementType.java
@@ -20,20 +20,19 @@ import javax.jms.Session;
/**
* Session acknowledge enum keys
- *
*/
public enum SessionAcknowledgementType {
- AUTO_ACKNOWLEDGE(Session.AUTO_ACKNOWLEDGE),
- CLIENT_ACKNOWLEDGE(Session.CLIENT_ACKNOWLEDGE),
- DUPS_OK_ACKNOWLEDGE(Session.DUPS_OK_ACKNOWLEDGE),
+ AUTO_ACKNOWLEDGE(Session.AUTO_ACKNOWLEDGE),
+ CLIENT_ACKNOWLEDGE(Session.CLIENT_ACKNOWLEDGE),
+ DUPS_OK_ACKNOWLEDGE(Session.DUPS_OK_ACKNOWLEDGE),
SESSION_TRANSACTED(Session.SESSION_TRANSACTED);
-
+
private int intValue = -1;
-
+
private SessionAcknowledgementType(int intValue) {
this.intValue = intValue;
}
-
+
public int intValue() {
return intValue;
}