activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r521238 - in /activemq/camel/trunk/camel-jms: ./ src/main/java/org/apache/camel/component/jms/ src/test/java/org/apache/camel/component/jms/
Date Thu, 22 Mar 2007 12:22:42 GMT
Author: jstrachan
Date: Thu Mar 22 05:22:41 2007
New Revision: 521238

URL: http://svn.apache.org/viewvc?view=rev&rev=521238
Log:
tidied up the code

Modified:
    activemq/camel/trunk/camel-jms/pom.xml
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpointResolver.java
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsExchange.java
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessage.java
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/MessageListenerProcessor.java
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/MessagePropertyAcessException.java
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/MessagePropertyNamesAcessException.java
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/RuntimeJmsException.java
    activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java

Modified: activemq/camel/trunk/camel-jms/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/pom.xml?view=diff&rev=521238&r1=521237&r2=521238
==============================================================================
--- activemq/camel/trunk/camel-jms/pom.xml (original)
+++ activemq/camel/trunk/camel-jms/pom.xml Thu Mar 22 05:22:41 2007
@@ -18,7 +18,7 @@
 -->
 
 <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
 
   <modelVersion>4.0.0</modelVersion>
 

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java?view=diff&rev=521238&r1=521237&r2=521238
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java
(original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java
Thu Mar 22 05:22:41 2007
@@ -17,18 +17,18 @@
  */
 package org.apache.camel.component.jms;
 
-import javax.jms.Message;
-import javax.jms.ObjectMessage;
-import javax.jms.TextMessage;
-import javax.jms.MapMessage;
 import javax.jms.BytesMessage;
-import javax.jms.StreamMessage;
 import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
 import javax.jms.Session;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Enumeration;
+import javax.jms.StreamMessage;
+import javax.jms.TextMessage;
 import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * A Strategy used to convert between a Camel {@JmsExchange} and {@JmsMessage} to and from
a
@@ -37,7 +37,6 @@
  * @version $Revision$
  */
 public class JmsBinding {
-
     /**
      * Creates a JMS message from the Camel exchange and message
      *
@@ -89,7 +88,6 @@
             throw new RuntimeJmsException("Failed to extract body due to: " + e + ". Message:
" + message, e);
         }
     }
-
 
     /**
      * Extracts a {@link Map} from a {@link MapMessage}

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java?view=diff&rev=521238&r1=521237&r2=521238
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
(original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
Thu Mar 22 05:22:41 2007
@@ -19,7 +19,6 @@
 
 import com.sun.jndi.toolkit.url.Uri;
 import org.apache.camel.CamelContext;
-import org.apache.camel.Component;
 import org.apache.camel.Processor;
 import org.apache.camel.impl.DefaultComponent;
 import org.apache.camel.util.ObjectHelper;
@@ -36,7 +35,6 @@
 public class JmsComponent extends DefaultComponent<JmsExchange> {
     public static final String QUEUE_PREFIX = "queue/";
     public static final String TOPIC_PREFIX = "topic/";
-
     private JmsTemplate template;
 
     /**
@@ -70,7 +68,6 @@
         return jmsComponent(template);
     }
 
-
     protected JmsComponent() {
         this.template = new JmsTemplate();
     }
@@ -134,7 +131,6 @@
     public void setTemplate(JmsTemplate template) {
         this.template = template;
     }
-
 
     protected AbstractMessageListenerContainer createMessageListenerContainer(JmsTemplate
template) {
         // TODO use an enum to auto-switch container types?

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpointResolver.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpointResolver.java?view=diff&rev=521238&r1=521237&r2=521238
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpointResolver.java
(original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpointResolver.java
Thu Mar 22 05:22:41 2007
@@ -21,7 +21,6 @@
 import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
 import org.apache.camel.EndpointResolver;
-import org.apache.camel.component.queue.QueueComponent;
 import org.apache.camel.util.ObjectHelper;
 
 import java.util.concurrent.Callable;
@@ -29,9 +28,9 @@
 /**
  * An implementation of {@link EndpointResolver} that creates
  * {@link JMSEndpoint} objects.
- *
+ * <p/>
  * The syntax for a JMS URI looks like:
- *
+ * <p/>
  * <pre><code>jms:[component:]destination</code></pre>
  * the component is optional, and if it is not specified, the default component name
  * is assumed.
@@ -39,51 +38,52 @@
  * @version $Revision:520964 $
  */
 public class JmsEndpointResolver implements EndpointResolver<JmsExchange> {
+    public static final String DEFAULT_COMPONENT_NAME = JmsEndpointResolver.class.getName();
 
-	public static final String DEFAULT_COMPONENT_NAME = JmsEndpointResolver.class.getName();
+    /**
+     * Finds the {@see JmsComponent} specified by the uri.  If the {@see JmsComponent}
+     * object do not exist, it will be created.
+     */
+    public Component resolveComponent(CamelContext container, String uri) {
+        String id[] = getEndpointId(uri);
+        return resolveJmsComponent(container, id[0]);
+    }
 
-	/**
-	 * Finds the {@see JmsComponent} specified by the uri.  If the {@see JmsComponent}
-	 * object do not exist, it will be created.
-	 */
-	public Component resolveComponent(CamelContext container, String uri) {
-		String id[] = getEndpointId(uri);        
-		return resolveJmsComponent(container, id[0]);
-	}
-
-	/**
-	 * Finds the {@see QueueEndpoint} specified by the uri.  If the {@see QueueEndpoint} or
it's associated
-	 * {@see QueueComponent} object do not exist, they will be created.
-	 */
-	public JmsEndpoint resolveEndpoint(CamelContext container, String uri) {
-		String id[] = getEndpointId(uri);        
-    	JmsComponent component = resolveJmsComponent(container, id[0]);
+    /**
+     * Finds the {@see QueueEndpoint} specified by the uri.  If the {@see QueueEndpoint}
or it's associated
+     * {@see QueueComponent} object do not exist, they will be created.
+     */
+    public JmsEndpoint resolveEndpoint(CamelContext container, String uri) {
+        String id[] = getEndpointId(uri);
+        JmsComponent component = resolveJmsComponent(container, id[0]);
         return component.createEndpoint(uri, id[1]);
     }
 
-	/**
-	 * @return an array that looks like: [componentName,endpointName] 
-	 */
-	private String[] getEndpointId(String uri) {
-		String rc [] = {DEFAULT_COMPONENT_NAME, null};
-		String splitURI[] = ObjectHelper.splitOnCharacter(uri, ":", 3);        
-    	if( splitURI[2] != null ) {
-    		rc[0] =  splitURI[1];
-    		rc[1] =  splitURI[2];
-    	} else {
-    		rc[1] =  splitURI[1];
-    	}
-		return rc;
-	}
-	
-	@SuppressWarnings("unchecked")
-	private JmsComponent resolveJmsComponent(final CamelContext container, final String componentName)
{
-    	Component rc = container.getOrCreateComponent(componentName, new Callable(){
-			public JmsComponent call() throws Exception {
+    /**
+     * @return an array that looks like: [componentName,endpointName]
+     */
+    private String[] getEndpointId(String uri) {
+        String rc[] = {DEFAULT_COMPONENT_NAME, null};
+        String splitURI[] = ObjectHelper.splitOnCharacter(uri, ":", 3);
+        if (splitURI[2] != null) {
+            rc[0] = splitURI[1];
+            rc[1] = splitURI[2];
+        }
+        else {
+            rc[1] = splitURI[1];
+        }
+        return rc;
+    }
+
+    @SuppressWarnings("unchecked")
+    private JmsComponent resolveJmsComponent(final CamelContext container, final String componentName)
{
+        Component rc = container.getOrCreateComponent(componentName, new Callable() {
+            public JmsComponent call() throws Exception {
                 return new JmsComponent(container);
-			}});
-    	return (JmsComponent) rc;
-	}
+            }
+        });
+        return (JmsComponent) rc;
+    }
 
 
 }

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsExchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsExchange.java?view=diff&rev=521238&r1=521237&r2=521238
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsExchange.java
(original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsExchange.java
Thu Mar 22 05:22:41 2007
@@ -20,17 +20,14 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.impl.DefaultExchange;
 
-import javax.jms.JMSException;
 import javax.jms.Message;
-import javax.jms.Session;
 
 /**
  * Represents an {@ilnk Exchange} for working with JMS
- * 
+ *
  * @version $Revision:520964 $
  */
 public class JmsExchange extends DefaultExchange {
-
     private JmsBinding binding;
 
     public JmsExchange(CamelContext context, JmsBinding binding) {
@@ -66,7 +63,6 @@
     public Exchange newInstance() {
         return new JmsExchange(getContext(), binding);
     }
-
 
     @Override
     protected org.apache.camel.Message createInMessage() {

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessage.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessage.java?view=diff&rev=521238&r1=521237&r2=521238
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessage.java
(original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessage.java
Thu Mar 22 05:22:41 2007
@@ -18,18 +18,10 @@
 package org.apache.camel.component.jms;
 
 import org.apache.camel.InvalidHeaderTypeException;
-import org.apache.camel.Exchange;
 import org.apache.camel.impl.MessageSupport;
 
-import javax.jms.BytesMessage;
 import javax.jms.JMSException;
-import javax.jms.MapMessage;
 import javax.jms.Message;
-import javax.jms.ObjectMessage;
-import javax.jms.Session;
-import javax.jms.StreamMessage;
-import javax.jms.TextMessage;
-import java.io.Serializable;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
@@ -50,7 +42,6 @@
         this.jmsMessage = jmsMessage;
     }
 
-
     @Override
     public Object getBody() {
         Object answer = super.getBody();
@@ -140,9 +131,5 @@
     public JmsMessage newInstance() {
         return new JmsMessage();
     }
-
-
-
-
 }
 

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/MessageListenerProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/MessageListenerProcessor.java?view=diff&rev=521238&r1=521237&r2=521238
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/MessageListenerProcessor.java
(original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/MessageListenerProcessor.java
Thu Mar 22 05:22:41 2007
@@ -20,19 +20,19 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 
-import javax.jms.MessageListener;
 import javax.jms.Message;
+import javax.jms.MessageListener;
 
 /**
  * Represents a JMS {@link MessageListener} which can be used directly with any JMS client
  * or derived from to create an MDB for processing messages using a {@link Processor}
- *  
- * @version $Revision$
+ *
+ * @version $Revision:520964 $
  */
 public class MessageListenerProcessor implements MessageListener {
     private final JmsEndpoint endpoint;
     private final Processor<Exchange> processor;
-    
+
     public MessageListenerProcessor(JmsEndpoint endpoint, Processor<Exchange> processor)
{
         this.endpoint = endpoint;
         this.processor = processor;

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/MessagePropertyAcessException.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/MessagePropertyAcessException.java?view=diff&rev=521238&r1=521237&r2=521238
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/MessagePropertyAcessException.java
(original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/MessagePropertyAcessException.java
Thu Mar 22 05:22:41 2007
@@ -19,11 +19,11 @@
 import javax.jms.JMSException;
 
 /**
- * @version $Revision$
+ * @version $Revision:520964 $
  */
 public class MessagePropertyAcessException extends RuntimeJmsException {
-	private static final long serialVersionUID = -3996286386119163309L;
-	private String propertyName;
+    private static final long serialVersionUID = -3996286386119163309L;
+    private String propertyName;
 
     public MessagePropertyAcessException(String propertyName, JMSException e) {
         super("Error accessing header: " + propertyName, e);

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/MessagePropertyNamesAcessException.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/MessagePropertyNamesAcessException.java?view=diff&rev=521238&r1=521237&r2=521238
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/MessagePropertyNamesAcessException.java
(original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/MessagePropertyNamesAcessException.java
Thu Mar 22 05:22:41 2007
@@ -19,13 +19,12 @@
 import javax.jms.JMSException;
 
 /**
- * @version $Revision$
+ * @version $Revision:520964 $
  */
 public class MessagePropertyNamesAcessException extends RuntimeJmsException {
+    private static final long serialVersionUID = -6744171518099741324L;
 
-	private static final long serialVersionUID = -6744171518099741324L;
-
-	public MessagePropertyNamesAcessException(JMSException e) {
+    public MessagePropertyNamesAcessException(JMSException e) {
         super("Failed to acess the JMS message property names", e);
     }
 }

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/RuntimeJmsException.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/RuntimeJmsException.java?view=diff&rev=521238&r1=521237&r2=521238
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/RuntimeJmsException.java
(original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/RuntimeJmsException.java
Thu Mar 22 05:22:41 2007
@@ -19,13 +19,12 @@
 import javax.jms.JMSException;
 
 /**
- * @version $Revision$
+ * @version $Revision:520964 $
  */
 public class RuntimeJmsException extends RuntimeException {
+    private static final long serialVersionUID = -2141493732308871761L;
 
-	private static final long serialVersionUID = -2141493732308871761L;
-
-	public RuntimeJmsException(String message, JMSException cause) {
+    public RuntimeJmsException(String message, JMSException cause) {
         super(message, cause);
     }
 }

Modified: activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java?view=diff&rev=521238&r1=521237&r2=521238
==============================================================================
--- activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java
(original)
+++ activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java
Thu Mar 22 05:22:41 2007
@@ -30,8 +30,8 @@
 
 import javax.jms.ConnectionFactory;
 import javax.jms.Message;
-import javax.jms.TextMessage;
 import javax.jms.ObjectMessage;
+import javax.jms.TextMessage;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -40,7 +40,6 @@
  */
 public class JmsRouteTest extends TestCase {
     private static final transient Log log = LogFactory.getLog(JmsRouteTest.class);
-    
     protected JmsExchange receivedExchange;
     protected CamelContext container = new DefaultCamelContext();
     protected CountDownLatch latch = new CountDownLatch(1);



Mime
View raw message