activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r565003 [10/17] - in /activemq/trunk: activemq-fileserver/src/main/java/org/apache/activemq/util/ activemq-fileserver/src/test/java/org/apache/activemq/util/ activemq-jaas/src/main/java/org/apache/activemq/jaas/ activemq-jaas/src/test/java/...
Date Sun, 12 Aug 2007 05:27:34 GMT
Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java (original)
+++ activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java Sat Aug 11 22:27:21 2007
@@ -40,27 +40,23 @@
  * Configures the inbound JMS consumer specification using ActiveMQ
  * 
  * @org.apache.xbean.XBean element="activationSpec"
- * 
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-08-11 17:29:21 -0400 (Sat, 11 Aug
+ *          2007) $
  */
 public class ActiveMQActivationSpec implements MessageActivationSpec, Serializable {
 
-    private static final long serialVersionUID = -7153087544100459975L;
-    
-    /** Auto-acknowledge constant for <code>acknowledgeMode</code> property **/
+    /** Auto-acknowledge constant for <code>acknowledgeMode</code> property * */
     public static final String AUTO_ACKNOWLEDGE_MODE = "Auto-acknowledge";
     /** Dups-ok-acknowledge constant for <code>acknowledgeMode</code> property * */
-    public static final String DUPS_OK_ACKNOWLEDGE_MODE = "Dups-ok-acknowledge";    
+    public static final String DUPS_OK_ACKNOWLEDGE_MODE = "Dups-ok-acknowledge";
     /** Durable constant for <code>subscriptionDurability</code> property * */
     public static final String DURABLE_SUBSCRIPTION = "Durable";
     /** NonDurable constant for <code>subscriptionDurability</code> property * */
     public static final String NON_DURABLE_SUBSCRIPTION = "NonDurable";
-    
-    /**
-     * 
-     */
     public static final int INVALID_ACKNOWLEDGE_MODE = -1;
-    
+
+    private static final long serialVersionUID = -7153087544100459975L;
+
     private transient MessageResourceAdapter resourceAdapter;
     private String destinationType;
     private String messageSelector;
@@ -70,145 +66,156 @@
     private String password;
     private String clientId;
     private String subscriptionName;
-    private String subscriptionDurability = NON_DURABLE_SUBSCRIPTION;    
+    private String subscriptionDurability = NON_DURABLE_SUBSCRIPTION;
     private String noLocal = "false";
     private String useRAManagedTransaction = "false";
-    private String maxSessions="10";
-    private String maxMessagesPerSessions="10";
+    private String maxSessions = "10";
+    private String maxMessagesPerSessions = "10";
     private String enableBatch = "false";
     private String maxMessagesPerBatch = "10";
     private RedeliveryPolicy redeliveryPolicy;
 
-    
     /**
      * @see javax.resource.spi.ActivationSpec#validate()
      */
     public void validate() throws InvalidPropertyException {
-        List errorMessages = new ArrayList();
-        List propsNotSet = new ArrayList();
+        List<String> errorMessages = new ArrayList<String>();
+        List<PropertyDescriptor> propsNotSet = new ArrayList<PropertyDescriptor>();
         try {
-            if (!isValidDestination(errorMessages))
+            if (!isValidDestination(errorMessages)) {
                 propsNotSet.add(new PropertyDescriptor("destination", ActiveMQActivationSpec.class));
-            if (!isValidDestinationType(errorMessages))
+            }
+            if (!isValidDestinationType(errorMessages)) {
                 propsNotSet.add(new PropertyDescriptor("destinationType", ActiveMQActivationSpec.class));
-            if (!isValidAcknowledgeMode(errorMessages))
+            }
+            if (!isValidAcknowledgeMode(errorMessages)) {
                 propsNotSet.add(new PropertyDescriptor("acknowledgeMode", ActiveMQActivationSpec.class));
-            if (!isValidSubscriptionDurability(errorMessages))
+            }
+            if (!isValidSubscriptionDurability(errorMessages)) {
                 propsNotSet.add(new PropertyDescriptor("subscriptionDurability", ActiveMQActivationSpec.class));
-            if (!isValidClientId(errorMessages))
+            }
+            if (!isValidClientId(errorMessages)) {
                 propsNotSet.add(new PropertyDescriptor("clientId", ActiveMQActivationSpec.class));
-            if (!isValidSubscriptionName(errorMessages))
+            }
+            if (!isValidSubscriptionName(errorMessages)) {
                 propsNotSet.add(new PropertyDescriptor("subscriptionName", ActiveMQActivationSpec.class));
-            if (!isValidMaxMessagesPerSessions(errorMessages))
+            }
+            if (!isValidMaxMessagesPerSessions(errorMessages)) {
                 propsNotSet.add(new PropertyDescriptor("maxMessagesPerSessions", ActiveMQActivationSpec.class));
-            if (!isValidMaxSessions(errorMessages))
+            }
+            if (!isValidMaxSessions(errorMessages)) {
                 propsNotSet.add(new PropertyDescriptor("maxSessions", ActiveMQActivationSpec.class));
-            if (!isValidMessageSelector(errorMessages))
+            }
+            if (!isValidMessageSelector(errorMessages)) {
                 propsNotSet.add(new PropertyDescriptor("messageSelector", ActiveMQActivationSpec.class));
-            if (!isValidNoLocal(errorMessages))
+            }
+            if (!isValidNoLocal(errorMessages)) {
                 propsNotSet.add(new PropertyDescriptor("noLocal", ActiveMQActivationSpec.class));
-            if (!isValidUseRAManagedTransaction(errorMessages))
+            }
+            if (!isValidUseRAManagedTransaction(errorMessages)) {
                 propsNotSet.add(new PropertyDescriptor("useRAManagedTransaction", ActiveMQActivationSpec.class));
-            if (!isValidEnableBatch(errorMessages))
+            }
+            if (!isValidEnableBatch(errorMessages)) {
                 propsNotSet.add(new PropertyDescriptor("enableBatch", ActiveMQActivationSpec.class));
-            if (!isValidMaxMessagesPerBatch(errorMessages))
+            }
+            if (!isValidMaxMessagesPerBatch(errorMessages)) {
                 propsNotSet.add(new PropertyDescriptor("maxMessagesPerBatch", ActiveMQActivationSpec.class));
+            }
 
-            
         } catch (IntrospectionException e) {
             e.printStackTrace();
         }
-        
+
         if (propsNotSet.size() > 0) {
             StringBuffer b = new StringBuffer();
             b.append("Invalid settings:");
-            for (Iterator iter = errorMessages.iterator(); iter.hasNext();) {
+            for (Iterator<String> iter = errorMessages.iterator(); iter.hasNext();) {
                 b.append(" ");
                 b.append(iter.next());
             }
             InvalidPropertyException e = new InvalidPropertyException(b.toString());
-            final PropertyDescriptor[] descriptors = (PropertyDescriptor[]) propsNotSet.toArray(new PropertyDescriptor[propsNotSet.size()]);
+            final PropertyDescriptor[] descriptors = propsNotSet.toArray(new PropertyDescriptor[propsNotSet.size()]);
             e.setInvalidPropertyDescriptors(descriptors);
             throw e;
         }
     }
 
-    private boolean isValidUseRAManagedTransaction(List errorMessages) {
+    private boolean isValidUseRAManagedTransaction(List<String> errorMessages) {
         try {
             new Boolean(noLocal);
             return true;
         } catch (Throwable e) {
-        	//
+            //
         }
         errorMessages.add("noLocal must be set to: true or false.");
         return false;
     }
 
-    private boolean isValidNoLocal(List errorMessages) {
+    private boolean isValidNoLocal(List<String> errorMessages) {
         try {
             new Boolean(noLocal);
             return true;
         } catch (Throwable e) {
-        	//
+            //
         }
         errorMessages.add("noLocal must be set to: true or false.");
         return false;
     }
 
-    private boolean isValidMessageSelector(List errorMessages) {
+    private boolean isValidMessageSelector(List<String> errorMessages) {
         try {
-            if( !isEmpty(messageSelector) ) {
+            if (!isEmpty(messageSelector)) {
                 new SelectorParser().parse(messageSelector);
             }
             return true;
         } catch (Throwable e) {
-            errorMessages.add("messageSelector not set to valid message selector: "+e.getMessage());
+            errorMessages.add("messageSelector not set to valid message selector: " + e.getMessage());
             return false;
         }
     }
 
-    private boolean isValidMaxSessions(List errorMessages) {
+    private boolean isValidMaxSessions(List<String> errorMessages) {
         try {
-            if( Integer.parseInt(maxSessions) > 0 ) {
+            if (Integer.parseInt(maxSessions) > 0) {
                 return true;
             }
         } catch (NumberFormatException e) {
-        	//
+            //
         }
         errorMessages.add("maxSessions must be set to number > 0");
         return false;
     }
 
-    private boolean isValidMaxMessagesPerSessions(List errorMessages) {
+    private boolean isValidMaxMessagesPerSessions(List<String> errorMessages) {
         try {
-            if( Integer.parseInt(maxMessagesPerSessions) > 0 ) {
+            if (Integer.parseInt(maxMessagesPerSessions) > 0) {
                 return true;
             }
         } catch (NumberFormatException e) {
-        	//
+            //
         }
         errorMessages.add("maxMessagesPerSessions must be set to number > 0");
         return false;
     }
 
-    private boolean isValidMaxMessagesPerBatch(List errorMessages) {
+    private boolean isValidMaxMessagesPerBatch(List<String> errorMessages) {
         try {
-            if( Integer.parseInt(maxMessagesPerBatch) > 0 ) {
+            if (Integer.parseInt(maxMessagesPerBatch) > 0) {
                 return true;
             }
         } catch (NumberFormatException e) {
-        	//
+            //
         }
         errorMessages.add("maxMessagesPerBatch must be set to number > 0");
         return false;
     }
 
-    private boolean isValidEnableBatch(List errorMessages) {
+    private boolean isValidEnableBatch(List<String> errorMessages) {
         try {
             new Boolean(enableBatch);
             return true;
         } catch (Throwable e) {
-        	//
+            //
         }
         errorMessages.add("enableBatch must be set to: true or false");
         return false;
@@ -225,22 +232,21 @@
      * @see javax.resource.spi.ResourceAdapterAssociation#setResourceAdapter(javax.resource.spi.ResourceAdapter)
      */
     public void setResourceAdapter(ResourceAdapter resourceAdapter) throws ResourceException {
-        //spec section 5.3.3
+        // spec section 5.3.3
         if (this.resourceAdapter != null) {
             throw new ResourceException("ResourceAdapter already set");
         }
         if (!(resourceAdapter instanceof MessageResourceAdapter)) {
             throw new ResourceException("ResourceAdapter is not of type: " + MessageResourceAdapter.class.getName());
         }
-        this.resourceAdapter = (MessageResourceAdapter) resourceAdapter;
+        this.resourceAdapter = (MessageResourceAdapter)resourceAdapter;
     }
 
-
-    /////////////////////////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////////////////////////
     //
     // Java Bean getters and setters for this ActivationSpec class.
     //
-    /////////////////////////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////////////////////////
     /**
      * @return Returns the destinationType.
      */
@@ -257,17 +263,17 @@
     public void setDestinationType(String destinationType) {
         this.destinationType = destinationType;
     }
-    
+
     /**
      * 
      */
     public String getPassword() {
-        if (!isEmpty(password)) {                
+        if (!isEmpty(password)) {
             return password;
         }
         return null;
     }
-    
+
     /**
      * 
      */
@@ -279,19 +285,19 @@
      * 
      */
     public String getUserName() {
-        if (!isEmpty(userName)) {        
+        if (!isEmpty(userName)) {
             return userName;
         }
         return null;
     }
-    
+
     /**
      * 
      */
     public void setUserName(String userName) {
         this.userName = userName;
     }
-    
+
     /**
      * @return Returns the messageSelector.
      */
@@ -320,7 +326,7 @@
      * @param noLocal The noLocal to set.
      */
     public void setNoLocal(String noLocal) {
-        if( noLocal!=null ) {
+        if (noLocal != null) {
             this.noLocal = noLocal;
         }
     }
@@ -341,7 +347,7 @@
     public void setAcknowledgeMode(String acknowledgeMode) {
         this.acknowledgeMode = acknowledgeMode;
     }
-    
+
     /**
      * 
      */
@@ -355,8 +361,8 @@
     /**
      * 
      */
-    public void setClientId(String clientId) {        
-        this.clientId = clientId;            
+    public void setClientId(String clientId) {
+        this.clientId = clientId;
     }
 
     /**
@@ -380,7 +386,7 @@
      * 
      */
     public String getSubscriptionDurability() {
-        if (!isEmpty(subscriptionDurability)) {                
+        if (!isEmpty(subscriptionDurability)) {
             return subscriptionDurability;
         }
         return null;
@@ -409,17 +415,17 @@
     public void setSubscriptionName(String subscriptionName) {
         this.subscriptionName = subscriptionName;
     }
-    
-    private boolean isValidSubscriptionName(List errorMessages) {
-        if( !isDurableSubscription() ? true : subscriptionName != null && subscriptionName.trim().length() > 0 ) {
+
+    private boolean isValidSubscriptionName(List<String> errorMessages) {
+        if (!isDurableSubscription() ? true : subscriptionName != null && subscriptionName.trim().length() > 0) {
             return true;
-        } 
+        }
         errorMessages.add("subscriptionName must be set since durable subscription was requested.");
         return false;
     }
 
-    private boolean isValidClientId(List errorMessages) {
-        if( !isDurableSubscription() ? true : clientId != null && clientId.trim().length() > 0 ) {
+    private boolean isValidClientId(List<String> errorMessages) {
+        if (!isDurableSubscription() ? true : clientId != null && clientId.trim().length() > 0) {
             return true;
         }
         errorMessages.add("clientId must be set since durable subscription was requested.");
@@ -433,41 +439,44 @@
         return DURABLE_SUBSCRIPTION.equals(subscriptionDurability);
     }
 
-    private boolean isValidSubscriptionDurability(List errorMessages) {
+    private boolean isValidSubscriptionDurability(List<String> errorMessages) {
         // subscriptionDurability only applies to Topics
-        if ( DURABLE_SUBSCRIPTION.equals(subscriptionDurability) &&
-             getDestinationType() != null && !Topic.class.getName().equals(getDestinationType())) {
-            errorMessages.add("subscriptionDurability cannot be set to: "+DURABLE_SUBSCRIPTION+" when destinationType is set to "+
-                Queue.class.getName()+" as it is only valid when destinationType is set to "+Topic.class.getName()+".");
+        if (DURABLE_SUBSCRIPTION.equals(subscriptionDurability) && getDestinationType() != null && !Topic.class.getName().equals(getDestinationType())) {
+            errorMessages.add("subscriptionDurability cannot be set to: " + DURABLE_SUBSCRIPTION + " when destinationType is set to " + Queue.class.getName()
+                              + " as it is only valid when destinationType is set to " + Topic.class.getName() + ".");
             return false;
         }
-        if (NON_DURABLE_SUBSCRIPTION.equals(subscriptionDurability) || DURABLE_SUBSCRIPTION.equals(subscriptionDurability))
+        if (NON_DURABLE_SUBSCRIPTION.equals(subscriptionDurability) || DURABLE_SUBSCRIPTION.equals(subscriptionDurability)) {
             return true;
-        errorMessages.add("subscriptionDurability must be set to: "+NON_DURABLE_SUBSCRIPTION+" or "+DURABLE_SUBSCRIPTION+".");
+        }
+        errorMessages.add("subscriptionDurability must be set to: " + NON_DURABLE_SUBSCRIPTION + " or " + DURABLE_SUBSCRIPTION + ".");
         return false;
     }
 
-    private boolean isValidAcknowledgeMode(List errorMessages) {
-        if (AUTO_ACKNOWLEDGE_MODE.equals(acknowledgeMode) || DUPS_OK_ACKNOWLEDGE_MODE.equals(acknowledgeMode))
+    private boolean isValidAcknowledgeMode(List<String> errorMessages) {
+        if (AUTO_ACKNOWLEDGE_MODE.equals(acknowledgeMode) || DUPS_OK_ACKNOWLEDGE_MODE.equals(acknowledgeMode)) {
             return true;
-        errorMessages.add("acknowledgeMode must be set to: "+AUTO_ACKNOWLEDGE_MODE+" or "+DUPS_OK_ACKNOWLEDGE_MODE+".");
+        }
+        errorMessages.add("acknowledgeMode must be set to: " + AUTO_ACKNOWLEDGE_MODE + " or " + DUPS_OK_ACKNOWLEDGE_MODE + ".");
         return false;
     }
 
-    private boolean isValidDestinationType(List errorMessages) {
-        if (Queue.class.getName().equals(destinationType) || Topic.class.getName().equals(destinationType))
+    private boolean isValidDestinationType(List<String> errorMessages) {
+        if (Queue.class.getName().equals(destinationType) || Topic.class.getName().equals(destinationType)) {
             return true;
-        errorMessages.add("destinationType must be set to: "+Queue.class.getName()+" or "+Topic.class.getName()+".");
+        }
+        errorMessages.add("destinationType must be set to: " + Queue.class.getName() + " or " + Topic.class.getName() + ".");
         return false;
     }
 
-    private boolean isValidDestination(List errorMessages) {
-        if(!(destination == null || destination.equals(""))) 
+    private boolean isValidDestination(List<String> errorMessages) {
+        if (!(destination == null || destination.equals(""))) {
             return true;
+        }
         errorMessages.add("destination is a required field and must be set to the destination name.");
         return false;
     }
-     
+
     private boolean isEmpty(String value) {
         return value == null || "".equals(value.trim());
     }
@@ -475,40 +484,33 @@
     /**
      * 
      */
-   @Override
-public String toString() {
-        return "ActiveMQActivationSpec{" +
-                "acknowledgeMode='" + acknowledgeMode + "'" +
-                ", destinationType='" + destinationType + "'" +
-                ", messageSelector='" + messageSelector + "'" +
-                ", destination='" + destination + "'" +
-                ", clientId='" + clientId + "'" +
-                ", subscriptionName='" + subscriptionName + "'" +
-                ", subscriptionDurability='" + subscriptionDurability + "'" +
-                "}";
+    @Override
+    public String toString() {
+        return "ActiveMQActivationSpec{" + "acknowledgeMode='" + acknowledgeMode + "'" + ", destinationType='" + destinationType + "'" + ", messageSelector='" + messageSelector + "'"
+               + ", destination='" + destination + "'" + ", clientId='" + clientId + "'" + ", subscriptionName='" + subscriptionName + "'" + ", subscriptionDurability='" + subscriptionDurability
+               + "'" + "}";
     }
 
-   public int getAcknowledgeModeForSession() {
-        if( AUTO_ACKNOWLEDGE_MODE.equals(acknowledgeMode) ) {
+    public int getAcknowledgeModeForSession() {
+        if (AUTO_ACKNOWLEDGE_MODE.equals(acknowledgeMode)) {
             return Session.AUTO_ACKNOWLEDGE;
-        } else if( DUPS_OK_ACKNOWLEDGE_MODE.equals(acknowledgeMode) ) {
+        } else if (DUPS_OK_ACKNOWLEDGE_MODE.equals(acknowledgeMode)) {
             return Session.DUPS_OK_ACKNOWLEDGE;
         } else {
             return INVALID_ACKNOWLEDGE_MODE;
         }
     }
-    
+
     /**
-     * A helper method mostly for use in Dependency Injection containers
-     * which allows you to customize the destination and destinationType properties
+     * A helper method mostly for use in Dependency Injection containers which
+     * allows you to customize the destination and destinationType properties
      * from a single ActiveMQDestination POJO
      */
     public void setActiveMQDestination(ActiveMQDestination destination) {
         setDestination(destination.getPhysicalName());
         if (destination instanceof Queue) {
             setDestinationType(Queue.class.getName());
-        }
-        else {
+        } else {
             setDestinationType(Topic.class.getName());
         }
     }
@@ -517,9 +519,10 @@
      * 
      */
     public ActiveMQDestination createDestination() {
-        if( isEmpty(destinationType) || isEmpty(destination) )
+        if (isEmpty(destinationType) || isEmpty(destination)) {
             return null;
-        
+        }
+
         ActiveMQDestination dest = null;
         if (Queue.class.getName().equals(destinationType)) {
             dest = new ActiveMQQueue(destination);
@@ -534,15 +537,15 @@
     public String getMaxMessagesPerSessions() {
         return maxMessagesPerSessions;
     }
-    
+
     /**
      * 
      */
     public void setMaxMessagesPerSessions(String maxMessagesPerSessions) {
-        if( maxMessagesPerSessions!=null ) {
+        if (maxMessagesPerSessions != null) {
             this.maxMessagesPerSessions = maxMessagesPerSessions;
         }
-    }    
+    }
 
     /**
      * 
@@ -555,23 +558,23 @@
      * 
      */
     public void setMaxSessions(String maxSessions) {
-        if( maxSessions!=null ) {
+        if (maxSessions != null) {
             this.maxSessions = maxSessions;
         }
     }
-    
+
     /**
      * 
      */
     public String getUseRAManagedTransaction() {
         return useRAManagedTransaction;
     }
-    
+
     /**
      * 
      */
     public void setUseRAManagedTransaction(String useRAManagedTransaction) {
-        if( useRAManagedTransaction!=null ) {
+        if (useRAManagedTransaction != null) {
             this.useRAManagedTransaction = useRAManagedTransaction;
         }
     }
@@ -710,7 +713,7 @@
     public RedeliveryPolicy redeliveryPolicy() {
         return redeliveryPolicy;
     }
-    
+
     protected RedeliveryPolicy lazyCreateRedeliveryPolicy() {
         if (redeliveryPolicy == null) {
             redeliveryPolicy = new RedeliveryPolicy();
@@ -718,4 +721,3 @@
         return redeliveryPolicy;
     }
 }
-

Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionFactory.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionFactory.java (original)
+++ activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionFactory.java Sat Aug 11 22:27:21 2007
@@ -1,4 +1,4 @@
-    /**
+/**
  * 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.
@@ -16,22 +16,22 @@
  */
 package org.apache.activemq.ra;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import java.io.Serializable;
 
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
 import javax.jms.JMSException;
-import javax.jms.QueueConnectionFactory;
 import javax.jms.QueueConnection;
-import javax.jms.TopicConnectionFactory;
+import javax.jms.QueueConnectionFactory;
 import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
 import javax.naming.Reference;
 import javax.resource.Referenceable;
 import javax.resource.ResourceException;
 import javax.resource.spi.ConnectionManager;
-import java.io.Serializable;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * @version $Revision$
@@ -40,13 +40,12 @@
 
     private static final long serialVersionUID = -5754338187296859149L;
 
-    private static final Log log = LogFactory.getLog(ActiveMQConnectionFactory.class);
+    private static final Log LOG = LogFactory.getLog(ActiveMQConnectionFactory.class);
     private ConnectionManager manager;
-    transient private ActiveMQManagedConnectionFactory factory;
+    private transient ActiveMQManagedConnectionFactory factory;
     private Reference reference;
     private final ActiveMQConnectionRequestInfo info;
 
-
     /**
      * @param factory
      * @param manager
@@ -66,7 +65,8 @@
     }
 
     /**
-     * @see javax.jms.ConnectionFactory#createConnection(java.lang.String, java.lang.String)
+     * @see javax.jms.ConnectionFactory#createConnection(java.lang.String,
+     *      java.lang.String)
      */
     public Connection createConnection(String userName, String password) throws JMSException {
         ActiveMQConnectionRequestInfo i = info.copy();
@@ -82,20 +82,19 @@
      */
     private Connection createConnection(ActiveMQConnectionRequestInfo info) throws JMSException {
         try {
-            if( info.isUseInboundSessionEnabled() ) {
+            if (info.isUseInboundSessionEnabled()) {
                 return new InboundConnectionProxy();
             }
             if (manager == null) {
                 throw new JMSException("No JCA ConnectionManager configured! Either enable UseInboundSessionEnabled or get your JCA container to configure one.");
             }
-            return (Connection) manager.allocateConnection(factory, info);
-        }
-        catch (ResourceException e) {
+            return (Connection)manager.allocateConnection(factory, info);
+        } catch (ResourceException e) {
             // Throw the root cause if it was a JMSException..
             if (e.getCause() instanceof JMSException) {
-                throw (JMSException) e.getCause();
+                throw (JMSException)e.getCause();
             }
-            log.debug("Connection could not be created:", e);
+            LOG.debug("Connection could not be created:", e);
             throw new JMSException(e.getMessage());
         }
     }
@@ -115,18 +114,18 @@
     }
 
     public QueueConnection createQueueConnection() throws JMSException {
-        return (QueueConnection) createConnection();
+        return (QueueConnection)createConnection();
     }
 
     public QueueConnection createQueueConnection(String userName, String password) throws JMSException {
-        return (QueueConnection) createConnection(userName, password);
+        return (QueueConnection)createConnection(userName, password);
     }
 
     public TopicConnection createTopicConnection() throws JMSException {
-        return (TopicConnection) createConnection();
+        return (TopicConnection)createConnection();
     }
 
     public TopicConnection createTopicConnection(String userName, String password) throws JMSException {
-        return (TopicConnection) createConnection(userName, password);
+        return (TopicConnection)createConnection(userName, password);
     }
 }

Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionRequestInfo.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionRequestInfo.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionRequestInfo.java (original)
+++ activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionRequestInfo.java Sat Aug 11 22:27:21 2007
@@ -16,17 +16,16 @@
  */
 package org.apache.activemq.ra;
 
-import org.apache.activemq.ActiveMQPrefetchPolicy;
-import org.apache.activemq.RedeliveryPolicy;
-import org.apache.activemq.ActiveMQConnectionFactory;
+import java.io.Serializable;
 
 import javax.resource.spi.ConnectionRequestInfo;
-import java.io.Serializable;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.ActiveMQPrefetchPolicy;
+import org.apache.activemq.RedeliveryPolicy;
 
 /**
- * @version $Revision$
- * 
- * Must override equals and hashCode (JCA spec 16.4)
+ * @version $Revision$ Must override equals and hashCode (JCA spec 16.4)
  */
 public class ActiveMQConnectionRequestInfo implements ConnectionRequestInfo, Serializable, Cloneable {
 
@@ -42,19 +41,19 @@
 
     public ActiveMQConnectionRequestInfo copy() {
         try {
-            ActiveMQConnectionRequestInfo answer = (ActiveMQConnectionRequestInfo) clone();
+            ActiveMQConnectionRequestInfo answer = (ActiveMQConnectionRequestInfo)clone();
             if (redeliveryPolicy != null) {
                 answer.redeliveryPolicy = redeliveryPolicy.copy();
             }
             return answer;
-        }
-        catch (CloneNotSupportedException e) {
+        } catch (CloneNotSupportedException e) {
             throw new RuntimeException("Could not clone: " + e, e);
         }
     }
 
     /**
-     * Returns true if this object will configure an ActiveMQConnectionFactory in any way
+     * Returns true if this object will configure an ActiveMQConnectionFactory
+     * in any way
      */
     public boolean isConnectionFactoryConfigured() {
         return serverUrl != null || clientid != null || redeliveryPolicy != null || prefetchPolicy != null;
@@ -70,14 +69,14 @@
         if (clientid != null) {
             factory.setClientID(clientid);
         }
-        if (redeliveryPolicy != null) { 
+        if (redeliveryPolicy != null) {
             factory.setRedeliveryPolicy(redeliveryPolicy);
         }
         if (prefetchPolicy != null) {
             factory.setPrefetchPolicy(prefetchPolicy);
         }
     }
-    
+
     /**
      * @see javax.resource.spi.ConnectionRequestInfo#hashCode()
      */
@@ -102,7 +101,7 @@
         if (!getClass().equals(o.getClass())) {
             return false;
         }
-        ActiveMQConnectionRequestInfo i = (ActiveMQConnectionRequestInfo) o;
+        ActiveMQConnectionRequestInfo i = (ActiveMQConnectionRequestInfo)o;
         if (notEqual(serverUrl, i.serverUrl)) {
             return false;
         }
@@ -128,8 +127,7 @@
     }
 
     /**
-     * @param url
-     *            The url to set.
+     * @param url The url to set.
      */
     public void setServerUrl(String url) {
         this.serverUrl = url;
@@ -143,8 +141,7 @@
     }
 
     /**
-     * @param password
-     *            The password to set.
+     * @param password The password to set.
      */
     public void setPassword(String password) {
         this.password = password;
@@ -158,8 +155,7 @@
     }
 
     /**
-     * @param userid
-     *            The userid to set.
+     * @param userid The userid to set.
      */
     public void setUserName(String userid) {
         this.userName = userid;
@@ -173,16 +169,15 @@
     }
 
     /**
-     * @param clientid
-     *            The clientid to set.
+     * @param clientid The clientid to set.
      */
     public void setClientid(String clientid) {
         this.clientid = clientid;
     }
 
     public String toString() {
-        return "ActiveMQConnectionRequestInfo{ " + "userName = '" + userName + "' " + ", serverUrl = '" + serverUrl + "' " + ", clientid = '" + clientid + "' "
-                + ", userName = '" + userName + "' " + ", useInboundSession = '" + useInboundSession + "' " + " }";
+        return "ActiveMQConnectionRequestInfo{ " + "userName = '" + userName + "' " + ", serverUrl = '" + serverUrl + "' " + ", clientid = '" + clientid + "' " + ", userName = '" + userName + "' "
+               + ", useInboundSession = '" + useInboundSession + "' " + " }";
     }
 
     public Boolean getUseInboundSession() {
@@ -305,8 +300,8 @@
     }
 
     /**
-     * Returns the prefetch policy; not using bean properties to avoid
-     * breaking compatibility with JCA configuration in J2EE
+     * Returns the prefetch policy; not using bean properties to avoid breaking
+     * compatibility with JCA configuration in J2EE
      */
     public ActiveMQPrefetchPolicy prefetchPolicy() {
         if (prefetchPolicy == null) {

Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointActivationKey.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointActivationKey.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointActivationKey.java (original)
+++ activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointActivationKey.java Sat Aug 11 22:27:21 2007
@@ -20,22 +20,8 @@
 
 
 public class ActiveMQEndpointActivationKey {
-    final private MessageEndpointFactory messageEndpointFactory;
-    final private MessageActivationSpec activationSpec;
-
-    /**
-     * @return Returns the activationSpec.
-     */
-    public MessageActivationSpec getActivationSpec() {
-        return activationSpec;
-    }
-
-    /**
-     * @return Returns the messageEndpointFactory.
-     */
-    public MessageEndpointFactory getMessageEndpointFactory() {
-        return messageEndpointFactory;
-    }
+    private final MessageEndpointFactory messageEndpointFactory;
+    private final MessageActivationSpec activationSpec;
 
     /**
      * For testing
@@ -52,6 +38,21 @@
         this.messageEndpointFactory = messageEndpointFactory;
         this.activationSpec = activationSpec;
     }
+
+    /**
+     * @return Returns the activationSpec.
+     */
+    public MessageActivationSpec getActivationSpec() {
+        return activationSpec;
+    }
+
+    /**
+     * @return Returns the messageEndpointFactory.
+     */
+    public MessageEndpointFactory getMessageEndpointFactory() {
+        return messageEndpointFactory;
+    }
+
 
     /**
      * @see java.lang.Object#hashCode()

Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java (original)
+++ activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java Sat Aug 11 22:27:21 2007
@@ -44,22 +44,19 @@
  */
 public class ActiveMQEndpointWorker {
 
-    private static final Log log = LogFactory.getLog(ActiveMQEndpointWorker.class);
-
-    /**
-     * 
-     */
     public static final Method ON_MESSAGE_METHOD;
+    private static final Log LOG = LogFactory.getLog(ActiveMQEndpointWorker.class);
 
     private static final long INITIAL_RECONNECT_DELAY = 1000; // 1 second.
-    private static final long MAX_RECONNECT_DELAY = 1000*30; // 30 seconds.
-    private static final ThreadLocal<Session> threadLocal = new ThreadLocal<Session>();
-    
+    private static final long MAX_RECONNECT_DELAY = 1000 * 30; // 30 seconds.
+    private static final ThreadLocal<Session> THREAD_LOCAL = new ThreadLocal<Session>();
+
     static {
         try {
-            ON_MESSAGE_METHOD = MessageListener.class.getMethod("onMessage", new Class[]{Message.class});
-        }
-        catch (Exception e) {
+            ON_MESSAGE_METHOD = MessageListener.class.getMethod("onMessage", new Class[] {
+                Message.class
+            });
+        } catch (Exception e) {
             throw new ExceptionInInitializerError(e);
         }
     }
@@ -69,63 +66,16 @@
     protected MessageEndpointFactory endpointFactory;
     protected WorkManager workManager;
     protected boolean transacted;
-    
-    
+    protected ActiveMQConnection connection;
+
     private ConnectionConsumer consumer;
     private ServerSessionPoolImpl serverSessionPool;
     private ActiveMQDestination dest;
     private boolean running;
     private Work connectWork;
-    protected ActiveMQConnection connection;
-    
-    private long reconnectDelay=INITIAL_RECONNECT_DELAY;
-
-
-    /**
-     * @param s
-     */
-    public static void safeClose(Session s) {
-        try {
-            if (s != null) {
-                s.close();
-            }
-        }
-        catch (JMSException e) {
-        	//
-        }
-    }
-
-    /**
-     * @param c
-     */
-    public static void safeClose(Connection c) {
-        try {
-            if (c != null) {
-                c.close();
-            }
-        }
-        catch (JMSException e) {
-        	//
-        }
-    }
 
-    /**
-     * @param cc
-     */
-    public static void safeClose(ConnectionConsumer cc) {
-        try {
-            if (cc != null) {
-                cc.close();
-            }
-        }
-        catch (JMSException e) {
-        	//
-        }
-    }
+    private long reconnectDelay = INITIAL_RECONNECT_DELAY;
 
-    /**
-     * 
-     */
     public ActiveMQEndpointWorker(final MessageResourceAdapter adapter, ActiveMQEndpointActivationKey key) throws ResourceException {
         this.endpointActivationKey = key;
         this.adapter = adapter;
@@ -133,23 +83,24 @@
         this.workManager = adapter.getBootstrapContext().getWorkManager();
         try {
             this.transacted = endpointFactory.isDeliveryTransacted(ON_MESSAGE_METHOD);
-        }
-        catch (NoSuchMethodException e) {
+        } catch (NoSuchMethodException e) {
             throw new ResourceException("Endpoint does not implement the onMessage method.");
         }
-        
+
         connectWork = new Work() {
 
             public void release() {
-            	//
+                //
             }
 
-            synchronized public void run() {
-                if( !isRunning() )
+            public synchronized void run() {
+                if (!isRunning()) {
                     return;
-                if( connection!=null )
+                }
+                if (connection != null) {
                     return;
-                
+                }
+
                 MessageActivationSpec activationSpec = endpointActivationKey.getActivationSpec();
                 try {
                     connection = adapter.makeConnection(activationSpec);
@@ -163,24 +114,15 @@
                     });
 
                     if (activationSpec.isDurableSubscription()) {
-                        consumer = connection.createDurableConnectionConsumer(
-                                (Topic) dest,
-                                activationSpec.getSubscriptionName(), 
-                                emptyToNull(activationSpec.getMessageSelector()),
-                                serverSessionPool, 
-                                activationSpec.getMaxMessagesPerSessionsIntValue(),
-                                activationSpec.getNoLocalBooleanValue());
+                        consumer = connection.createDurableConnectionConsumer((Topic)dest, activationSpec.getSubscriptionName(), emptyToNull(activationSpec.getMessageSelector()), serverSessionPool,
+                                                                              activationSpec.getMaxMessagesPerSessionsIntValue(), activationSpec.getNoLocalBooleanValue());
                     } else {
-                        consumer = connection.createConnectionConsumer(
-                                dest, 
-                                emptyToNull(activationSpec.getMessageSelector()), 
-                                serverSessionPool, 
-                                activationSpec.getMaxMessagesPerSessionsIntValue(),
-                                activationSpec.getNoLocalBooleanValue());
+                        consumer = connection.createConnectionConsumer(dest, emptyToNull(activationSpec.getMessageSelector()), serverSessionPool, activationSpec.getMaxMessagesPerSessionsIntValue(),
+                                                                       activationSpec.getNoLocalBooleanValue());
                     }
 
                 } catch (JMSException error) {
-                    log.debug("Fail to to connect: "+error, error);
+                    LOG.debug("Fail to to connect: " + error, error);
                     reconnect(error);
                 }
             }
@@ -198,89 +140,133 @@
     }
 
     /**
+     * @param s
+     */
+    public static void safeClose(Session s) {
+        try {
+            if (s != null) {
+                s.close();
+            }
+        } catch (JMSException e) {
+            //
+        }
+    }
+
+    /**
+     * @param c
+     */
+    public static void safeClose(Connection c) {
+        try {
+            if (c != null) {
+                c.close();
+            }
+        } catch (JMSException e) {
+            //
+        }
+    }
+
+    /**
+     * @param cc
+     */
+    public static void safeClose(ConnectionConsumer cc) {
+        try {
+            if (cc != null) {
+                cc.close();
+            }
+        } catch (JMSException e) {
+            //
+        }
+    }
+
+    /**
      * 
      */
-    synchronized public void start() throws WorkException, ResourceException {
-        if (running)
+    public synchronized void start() throws WorkException, ResourceException {
+        if (running) {
             return;
+        }
         running = true;
 
-        log.debug("Starting");
+        LOG.debug("Starting");
         serverSessionPool = new ServerSessionPoolImpl(this, endpointActivationKey.getActivationSpec().getMaxSessionsIntValue());
         connect();
-        log.debug("Started");
+        LOG.debug("Started");
     }
 
     /**
      * 
      */
-    synchronized public void stop() throws InterruptedException {
-        if (!running)
+    public synchronized void stop() throws InterruptedException {
+        if (!running) {
             return;
+        }
         running = false;
         serverSessionPool.close();
-        disconnect();        
+        disconnect();
     }
 
     private boolean isRunning() {
         return running;
-    }    
+    }
 
-    synchronized private void connect() {
-        if (!running)
+    private synchronized void connect() {
+        if (!running) {
             return;
+        }
 
         try {
             workManager.scheduleWork(connectWork, WorkManager.INDEFINITE, null, null);
         } catch (WorkException e) {
             running = false;
-            log.error("Work Manager did not accept work: ",e);
+            LOG.error("Work Manager did not accept work: ", e);
         }
     }
 
     /**
      * 
      */
-    synchronized private void disconnect() {
+    private synchronized void disconnect() {
         safeClose(consumer);
-        consumer=null;
+        consumer = null;
         safeClose(connection);
-        connection=null;
+        connection = null;
     }
 
-    private void reconnect(JMSException error){
-        log.debug("Reconnect cause: ",error);
+    private void reconnect(JMSException error) {
+        LOG.debug("Reconnect cause: ", error);
         long reconnectDelay;
-        synchronized(this) {
+        synchronized (this) {
             reconnectDelay = this.reconnectDelay;
-            // Only log errors if the server is really down.. And not a temp failure.
+            // Only log errors if the server is really down.. And not a temp
+            // failure.
             if (reconnectDelay == MAX_RECONNECT_DELAY) {
-                log.error("Endpoint connection to JMS broker failed: " + error.getMessage());
-                log.error("Endpoint will try to reconnect to the JMS broker in "+(MAX_RECONNECT_DELAY/1000)+" seconds");
+                LOG.error("Endpoint connection to JMS broker failed: " + error.getMessage());
+                LOG.error("Endpoint will try to reconnect to the JMS broker in " + (MAX_RECONNECT_DELAY / 1000) + " seconds");
             }
         }
         try {
             disconnect();
             Thread.sleep(reconnectDelay);
-            
-            synchronized(this) {
+
+            synchronized (this) {
                 // Use exponential rollback.
-                this.reconnectDelay*=2;
-                if (this.reconnectDelay > MAX_RECONNECT_DELAY)
-                    this.reconnectDelay=MAX_RECONNECT_DELAY;
+                this.reconnectDelay *= 2;
+                if (this.reconnectDelay > MAX_RECONNECT_DELAY) {
+                    this.reconnectDelay = MAX_RECONNECT_DELAY;
+                }
             }
             connect();
-        } catch(InterruptedException e) {
-        	//
+        } catch (InterruptedException e) {
+            //
         }
     }
 
     protected void registerThreadSession(Session session) {
-        threadLocal.set(session);
+        THREAD_LOCAL.set(session);
     }
 
     protected void unregisterThreadSession(Session session) {
-        threadLocal.set(null);
+        THREAD_LOCAL.set(null);
     }
 
     private String emptyToNull(String value) {

Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnection.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnection.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnection.java (original)
+++ activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnection.java Sat Aug 11 22:27:21 2007
@@ -33,40 +33,40 @@
 import javax.security.auth.Subject;
 import javax.transaction.xa.XAResource;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.activemq.ActiveMQConnection;
 import org.apache.activemq.LocalTransactionEventListener;
 import org.apache.activemq.TransactionContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
- * ActiveMQManagedConnection maps to real physical connection to the
- * server.  Since a ManagedConnection has to provide a transaction
- * managment interface to the physical connection, and sessions
- * are the objects implement transaction managment interfaces in
- * the JMS API, this object also maps to a singe physical JMS session.
- * <p/>
- * The side-effect is that JMS connection the application gets
- * will allways create the same session object.  This is good if
- * running in an app server since the sessions are elisted in the
- * context transaction.  This is bad if used outside of an app
- * server since the user may be trying to create 2 different
- * sessions to coordinate 2 different uow.
- *
+ * ActiveMQManagedConnection maps to real physical connection to the server.
+ * Since a ManagedConnection has to provide a transaction managment interface to
+ * the physical connection, and sessions are the objects implement transaction
+ * managment interfaces in the JMS API, this object also maps to a singe
+ * physical JMS session. <p/> The side-effect is that JMS connection the
+ * application gets will allways create the same session object. This is good if
+ * running in an app server since the sessions are elisted in the context
+ * transaction. This is bad if used outside of an app server since the user may
+ * be trying to create 2 different sessions to coordinate 2 different uow.
+ * 
  * @version $Revision$
  */
-public class ActiveMQManagedConnection implements ManagedConnection, ExceptionListener { // TODO: , DissociatableManagedConnection {
+public class ActiveMQManagedConnection implements ManagedConnection, ExceptionListener { // TODO:
+                                                                                            // ,
+                                                                                            // DissociatableManagedConnection
+                                                                                            // {
 
-    private static final Log log = LogFactory.getLog(ActiveMQManagedConnection.class);
+    private static final Log LOG = LogFactory.getLog(ActiveMQManagedConnection.class);
 
     private PrintWriter logWriter;
 
     private final ActiveMQConnection physicalConnection;
     private final TransactionContext transactionContext;
-    private final ArrayList proxyConnections = new ArrayList();
-    private final ArrayList listeners = new ArrayList();
+    private final ArrayList<ManagedConnectionProxy> proxyConnections = new ArrayList<ManagedConnectionProxy>();
+    private final ArrayList<ConnectionEventListener> listeners = new ArrayList<ConnectionEventListener>();
     private final LocalAndXATransaction localAndXATransaction;
-    
+
     private Subject subject;
     private ActiveMQConnectionRequestInfo info;
     private boolean destoryed;
@@ -77,41 +77,43 @@
             this.info = info;
             this.physicalConnection = physicalConnection;
             this.transactionContext = new TransactionContext(physicalConnection);
-            
+
             this.localAndXATransaction = new LocalAndXATransaction(transactionContext) {
                 public void setInManagedTx(boolean inManagedTx) throws JMSException {
-                    super.setInManagedTx(inManagedTx);                    
-                    Iterator iterator = proxyConnections.iterator();
+                    super.setInManagedTx(inManagedTx);
+                    Iterator<ManagedConnectionProxy> iterator = proxyConnections.iterator();
                     while (iterator.hasNext()) {
-                        ManagedConnectionProxy proxy = (ManagedConnectionProxy) iterator.next();
+                        ManagedConnectionProxy proxy = iterator.next();
                         proxy.setUseSharedTxContext(inManagedTx);
-                    }                    
+                    }
                 }
             };
-            
-            this.transactionContext.setLocalTransactionEventListener( new LocalTransactionEventListener() {
+
+            this.transactionContext.setLocalTransactionEventListener(new LocalTransactionEventListener() {
                 public void beginEvent() {
                     fireBeginEvent();
                 }
+
                 public void commitEvent() {
                     fireCommitEvent();
                 }
+
                 public void rollbackEvent() {
                     fireRollbackEvent();
                 }
             });
-                        
+
             physicalConnection.setExceptionListener(this);
-		} catch (JMSException e) {
-            throw new ResourceException("Could not create a new connection: "+e.getMessage(), e);
-        }    			
+        } catch (JMSException e) {
+            throw new ResourceException("Could not create a new connection: " + e.getMessage(), e);
+        }
     }
-    
+
     public boolean isInManagedTx() {
         return localAndXATransaction.isInManagedTx();
     }
-    
-    static public boolean matches(Object x, Object y) {
+
+    public static boolean matches(Object x, Object y) {
         if (x == null ^ y == null) {
             return false;
         }
@@ -124,13 +126,14 @@
     public void associate(Subject subject, ActiveMQConnectionRequestInfo info) throws JMSException {
 
         // Do we need to change the associated userid/password
-        if( !matches(info.getUserName(), this.info.getUserName()) || !matches(info.getPassword(), this.info.getPassword()) ) {
+        if (!matches(info.getUserName(), this.info.getUserName()) || !matches(info.getPassword(), this.info.getPassword())) {
             ((ActiveMQConnection)physicalConnection).changeUserInfo(info.getUserName(), info.getPassword());
         }
-        
+
         // Do we need to set the clientId?
-        if( info.getClientid()!=null && info.getClientid().length()>0 ) 
+        if (info.getClientid() != null && info.getClientid().length() > 0) {
             physicalConnection.setClientID(info.getClientid());
+        }
 
         this.subject = subject;
         this.info = info;
@@ -139,55 +142,50 @@
     public Connection getPhysicalConnection() {
         return physicalConnection;
     }
-    
+
     private void fireBeginEvent() {
-        ConnectionEvent event = new ConnectionEvent(ActiveMQManagedConnection.this,
-                ConnectionEvent.LOCAL_TRANSACTION_STARTED);
-        Iterator iterator = listeners.iterator();
+        ConnectionEvent event = new ConnectionEvent(ActiveMQManagedConnection.this, ConnectionEvent.LOCAL_TRANSACTION_STARTED);
+        Iterator<ConnectionEventListener> iterator = listeners.iterator();
         while (iterator.hasNext()) {
-            ConnectionEventListener l = (ConnectionEventListener) iterator.next();
+            ConnectionEventListener l = iterator.next();
             l.localTransactionStarted(event);
         }
     }
 
     private void fireCommitEvent() {
-        ConnectionEvent event = new ConnectionEvent(ActiveMQManagedConnection.this,
-                ConnectionEvent.LOCAL_TRANSACTION_COMMITTED);
-        Iterator iterator = listeners.iterator();
+        ConnectionEvent event = new ConnectionEvent(ActiveMQManagedConnection.this, ConnectionEvent.LOCAL_TRANSACTION_COMMITTED);
+        Iterator<ConnectionEventListener> iterator = listeners.iterator();
         while (iterator.hasNext()) {
-            ConnectionEventListener l = (ConnectionEventListener) iterator.next();
+            ConnectionEventListener l = iterator.next();
             l.localTransactionCommitted(event);
         }
     }
 
     private void fireRollbackEvent() {
-        ConnectionEvent event = new ConnectionEvent(ActiveMQManagedConnection.this,
-                ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK);
-        Iterator iterator = listeners.iterator();
+        ConnectionEvent event = new ConnectionEvent(ActiveMQManagedConnection.this, ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK);
+        Iterator<ConnectionEventListener> iterator = listeners.iterator();
         while (iterator.hasNext()) {
-            ConnectionEventListener l = (ConnectionEventListener) iterator.next();
+            ConnectionEventListener l = iterator.next();
             l.localTransactionRolledback(event);
         }
     }
 
     private void fireCloseEvent(ManagedConnectionProxy proxy) {
-        ConnectionEvent event = new ConnectionEvent(ActiveMQManagedConnection.this,
-                ConnectionEvent.CONNECTION_CLOSED);
+        ConnectionEvent event = new ConnectionEvent(ActiveMQManagedConnection.this, ConnectionEvent.CONNECTION_CLOSED);
         event.setConnectionHandle(proxy);
-        
-        Iterator iterator = listeners.iterator();
+
+        Iterator<ConnectionEventListener> iterator = listeners.iterator();
         while (iterator.hasNext()) {
-            ConnectionEventListener l = (ConnectionEventListener) iterator.next();
+            ConnectionEventListener l = iterator.next();
             l.connectionClosed(event);
         }
     }
 
     private void fireErrorOccurredEvent(Exception error) {
-        ConnectionEvent event = new ConnectionEvent(ActiveMQManagedConnection.this,
-                ConnectionEvent.CONNECTION_ERROR_OCCURRED, error);
-        Iterator iterator = listeners.iterator();
+        ConnectionEvent event = new ConnectionEvent(ActiveMQManagedConnection.this, ConnectionEvent.CONNECTION_ERROR_OCCURRED, error);
+        Iterator<ConnectionEventListener> iterator = listeners.iterator();
         while (iterator.hasNext()) {
-            ConnectionEventListener l = (ConnectionEventListener) iterator.next();
+            ConnectionEventListener l = iterator.next();
             l.connectionErrorOccurred(event);
         }
     }
@@ -196,8 +194,7 @@
      * @see javax.resource.spi.ManagedConnection#getConnection(javax.security.auth.Subject,
      *      javax.resource.spi.ConnectionRequestInfo)
      */
-    public Object getConnection(Subject subject, ConnectionRequestInfo info)
-            throws ResourceException {
+    public Object getConnection(Subject subject, ConnectionRequestInfo info) throws ResourceException {
         ManagedConnectionProxy proxy = new ManagedConnectionProxy(this);
         proxyConnections.add(proxy);
         return proxy;
@@ -206,10 +203,10 @@
     private boolean isDestroyed() {
         return destoryed;
     }
-    
+
     /**
      * Close down the physical connection to the server.
-     *
+     * 
      * @see javax.resource.spi.ManagedConnection#destroy()
      */
     public void destroy() throws ResourceException {
@@ -224,7 +221,7 @@
             physicalConnection.close();
             destoryed = true;
         } catch (JMSException e) {
-            log.info("Error occured during close of a JMS connection.", e);
+            LOG.info("Error occured during close of a JMS connection.", e);
         }
     }
 
@@ -235,26 +232,26 @@
      * @see javax.resource.spi.ManagedConnection#cleanup()
      */
     public void cleanup() throws ResourceException {
-    	
+
         // Have we allready been destroyed??
         if (isDestroyed()) {
             return;
         }
 
-        Iterator iterator = proxyConnections.iterator();
+        Iterator<ManagedConnectionProxy> iterator = proxyConnections.iterator();
         while (iterator.hasNext()) {
-            ManagedConnectionProxy proxy = (ManagedConnectionProxy) iterator.next();
+            ManagedConnectionProxy proxy = iterator.next();
             proxy.cleanup();
         }
         proxyConnections.clear();
         localAndXATransaction.cleanup();
-        
+
         try {
             ((ActiveMQConnection)physicalConnection).cleanup();
         } catch (JMSException e) {
-            throw new ResourceException("Could cleanup the ActiveMQ connection: "+e, e);
+            throw new ResourceException("Could cleanup the ActiveMQ connection: " + e, e);
         }
-            
+
     }
 
     /**
@@ -262,10 +259,9 @@
      */
     public void associateConnection(Object connection) throws ResourceException {
         if (connection instanceof ManagedConnectionProxy) {
-            ManagedConnectionProxy proxy = (ManagedConnectionProxy) connection;
+            ManagedConnectionProxy proxy = (ManagedConnectionProxy)connection;
             proxyConnections.add(proxy);
-        }
-        else {
+        } else {
             throw new ResourceException("Not supported : associating connection instance of " + connection.getClass().getName());
         }
     }
@@ -310,8 +306,7 @@
                 }
                 try {
                     return physicalConnection.getMetaData().getJMSProviderName();
-                }
-                catch (JMSException e) {
+                } catch (JMSException e) {
                     throw new ResourceException("Error accessing provider.", e);
                 }
             }
@@ -322,8 +317,7 @@
                 }
                 try {
                     return physicalConnection.getMetaData().getProviderVersion();
-                }
-                catch (JMSException e) {
+                } catch (JMSException e) {
                     throw new ResourceException("Error accessing provider.", e);
                 }
             }
@@ -341,8 +335,7 @@
                 }
                 try {
                     return physicalConnection.getClientID();
-                }
-                catch (JMSException e) {
+                } catch (JMSException e) {
                     throw new ResourceException("Error accessing provider.", e);
                 }
             }
@@ -393,7 +386,7 @@
     /**
      * When a proxy is closed this cleans up the proxy and notifys the
      * ConnectionEventListeners that a connection closed.
-     *
+     * 
      * @param proxy
      */
     public void proxyClosedEvent(ManagedConnectionProxy proxy) {
@@ -403,12 +396,12 @@
     }
 
     public void onException(JMSException e) {
-        log.warn("Connection failed: "+e);
-        log.debug("Cause: ", e);
-        
+        LOG.warn("Connection failed: " + e);
+        LOG.debug("Cause: ", e);
+
         // Let any active proxy connections know that exception occured.
-        for (Iterator iter = proxyConnections.iterator(); iter.hasNext();) {
-            ManagedConnectionProxy proxy = (ManagedConnectionProxy) iter.next();
+        for (Iterator<ManagedConnectionProxy> iter = proxyConnections.iterator(); iter.hasNext();) {
+            ManagedConnectionProxy proxy = iter.next();
             proxy.onException(e);
         }
         // Let the container know that the error occured.

Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnectionFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnectionFactory.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnectionFactory.java (original)
+++ activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnectionFactory.java Sat Aug 11 22:27:21 2007
@@ -31,11 +31,8 @@
 import javax.security.auth.Subject;
 
 /**
- * @version $Revisio n$
- * 
- * TODO: Must override equals and hashCode (JCA spec 16.4)
- * 
- * @org.apache.xbean.XBean element="managedConnectionFactory"  
+ * @version $Revisio n$ TODO: Must override equals and hashCode (JCA spec 16.4)
+ * @org.apache.xbean.XBean element="managedConnectionFactory"
  */
 public class ActiveMQManagedConnectionFactory implements ManagedConnectionFactory, ResourceAdapterAssociation {
 
@@ -52,31 +49,36 @@
         if (!(adapter instanceof MessageResourceAdapter)) {
             throw new ResourceException("ResourceAdapter is not of type: " + MessageResourceAdapter.class.getName());
         }
-        this.adapter = (MessageResourceAdapter) adapter;
+        this.adapter = (MessageResourceAdapter)adapter;
         ActiveMQConnectionRequestInfo baseInfo = this.adapter.getInfo().copy();
-        if (info.getClientid() == null)
+        if (info.getClientid() == null) {
             info.setClientid(baseInfo.getClientid());
-        if (info.getPassword() == null)
+        }
+        if (info.getPassword() == null) {
             info.setPassword(baseInfo.getPassword());
-        if (info.getServerUrl() == null)
+        }
+        if (info.getServerUrl() == null) {
             info.setServerUrl(baseInfo.getServerUrl());
-        if (info.getUseInboundSession() == null)
+        }
+        if (info.getUseInboundSession() == null) {
             info.setUseInboundSession(baseInfo.getUseInboundSession());
-        if (info.getUserName() == null)
+        }
+        if (info.getUserName() == null) {
             info.setUserName(baseInfo.getUserName());
+        }
     }
-    
+
     /**
      * @see java.lang.Object#equals(java.lang.Object)
      */
     @Override
     public boolean equals(Object object) {
-        if( object == null || object.getClass()!=ActiveMQManagedConnectionFactory.class ) {
+        if (object == null || object.getClass() != ActiveMQManagedConnectionFactory.class) {
             return false;
         }
         return ((ActiveMQManagedConnectionFactory)object).info.equals(info);
     }
-    
+
     /**
      * @see java.lang.Object#hashCode()
      */
@@ -84,7 +86,6 @@
     public int hashCode() {
         return info.hashCode();
     }
-    
 
     /**
      * @see javax.resource.spi.ResourceAdapterAssociation#getResourceAdapter()
@@ -118,13 +119,12 @@
      */
     public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo info) throws ResourceException {
         try {
-            if( info == null ) {
+            if (info == null) {
                 info = this.info;
             }
-            ActiveMQConnectionRequestInfo amqInfo = (ActiveMQConnectionRequestInfo) info;
+            ActiveMQConnectionRequestInfo amqInfo = (ActiveMQConnectionRequestInfo)info;
             return new ActiveMQManagedConnection(subject, adapter.makeConnection(amqInfo), amqInfo);
-        }
-        catch (JMSException e) {
+        } catch (JMSException e) {
             throw new ResourceException("Could not create connection.", e);
         }
     }
@@ -137,13 +137,12 @@
     public ManagedConnection matchManagedConnections(Set connections, Subject subject, ConnectionRequestInfo info) throws ResourceException {
         Iterator iterator = connections.iterator();
         while (iterator.hasNext()) {
-            ActiveMQManagedConnection c = (ActiveMQManagedConnection) iterator.next();
+            ActiveMQManagedConnection c = (ActiveMQManagedConnection)iterator.next();
             if (c.matches(subject, info)) {
                 try {
-                    c.associate(subject, (ActiveMQConnectionRequestInfo) info);
+                    c.associate(subject, (ActiveMQConnectionRequestInfo)info);
                     return c;
-                }
-                catch (JMSException e) {
+                } catch (JMSException e) {
                     throw new ResourceException(e);
                 }
             }
@@ -293,7 +292,6 @@
     public void setRedeliveryUseExponentialBackOff(Boolean value) {
         info.setRedeliveryUseExponentialBackOff(value);
     }
-
 
     // Prefetch policy configuration
     /**

Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java (original)
+++ activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java Sat Aug 11 22:27:21 2007
@@ -44,20 +44,19 @@
 
 /**
  * Knows how to connect to one ActiveMQ server. It can then activate endpoints
- * and deliver messages to those end points using the connection configure in the
- * resource adapter. <p/>Must override equals and hashCode (JCA spec 16.4)
- *
+ * and deliver messages to those end points using the connection configure in
+ * the resource adapter. <p/>Must override equals and hashCode (JCA spec 16.4)
+ * 
  * @org.apache.xbean.XBean element="resourceAdapter" rootElement="true"
- * description="The JCA Resource Adaptor for ActiveMQ"
- *
+ *                         description="The JCA Resource Adaptor for ActiveMQ"
  * @version $Revision$
  */
 public class ActiveMQResourceAdapter implements MessageResourceAdapter, Serializable {
 
     private static final long serialVersionUID = -5417363537865649130L;
-    private static final Log log = LogFactory.getLog(ActiveMQResourceAdapter.class);
-    
-    private final HashMap endpointWorkers = new HashMap();
+    private static final Log LOG = LogFactory.getLog(ActiveMQResourceAdapter.class);
+
+    private final HashMap<ActiveMQEndpointActivationKey, ActiveMQEndpointWorker> endpointWorkers = new HashMap<ActiveMQEndpointActivationKey, ActiveMQEndpointWorker>();
     private final ActiveMQConnectionRequestInfo info = new ActiveMQConnectionRequestInfo();
 
     private BootstrapContext bootstrapContext;
@@ -69,7 +68,7 @@
      * 
      */
     public ActiveMQResourceAdapter() {
-    	super();
+        super();
     }
 
     /**
@@ -77,12 +76,12 @@
      */
     public void start(BootstrapContext bootstrapContext) throws ResourceAdapterInternalException {
         this.bootstrapContext = bootstrapContext;
-        if (brokerXmlConfig!=null && brokerXmlConfig.trim().length()>0 ) {
+        if (brokerXmlConfig != null && brokerXmlConfig.trim().length() > 0) {
             try {
                 broker = BrokerFactory.createBroker(new URI(brokerXmlConfig));
                 broker.start();
             } catch (Throwable e) {
-                throw new ResourceAdapterInternalException("Failed to startup an embedded broker: "+brokerXmlConfig+", due to: "+e, e);
+                throw new ResourceAdapterInternalException("Failed to startup an embedded broker: " + brokerXmlConfig + ", due to: " + e, e);
             }
         }
     }
@@ -106,12 +105,13 @@
     }
 
     /**
-     * @see org.apache.activemq.ra.MessageResourceAdapter#makeConnection(org.apache.activemq.ra.ActiveMQConnectionRequestInfo, org.apache.activemq.ActiveMQConnectionFactory)
+     * @see org.apache.activemq.ra.MessageResourceAdapter#makeConnection(org.apache.activemq.ra.ActiveMQConnectionRequestInfo,
+     *      org.apache.activemq.ActiveMQConnectionFactory)
      */
     public ActiveMQConnection makeConnection(ActiveMQConnectionRequestInfo info, ActiveMQConnectionFactory connectionFactory) throws JMSException {
         String userName = info.getUserName();
         String password = info.getPassword();
-        ActiveMQConnection physicalConnection = (ActiveMQConnection) connectionFactory.createConnection(userName, password);
+        ActiveMQConnection physicalConnection = (ActiveMQConnection)connectionFactory.createConnection(userName, password);
 
         String clientId = info.getClientid();
         if (clientId != null && clientId.length() > 0) {
@@ -130,13 +130,12 @@
         String clientId = activationSpec.getClientId();
         if (clientId != null) {
             connectionFactory.setClientID(clientId);
-        }
-        else {
+        } else {
             if (activationSpec.isDurableSubscription()) {
-                log.warn("No clientID specified for durable subscription: " + activationSpec);
+                LOG.warn("No clientID specified for durable subscription: " + activationSpec);
             }
         }
-        ActiveMQConnection physicalConnection = (ActiveMQConnection) connectionFactory.createConnection(userName, password);
+        ActiveMQConnection physicalConnection = (ActiveMQConnection)connectionFactory.createConnection(userName, password);
 
         // have we configured a redelivery policy
         RedeliveryPolicy redeliveryPolicy = activationSpec.redeliveryPolicy();
@@ -151,12 +150,11 @@
      * @throws JMSException
      * @throws URISyntaxException
      */
-    synchronized private ActiveMQConnectionFactory createConnectionFactory(ActiveMQConnectionRequestInfo info) throws JMSException {
+    private synchronized ActiveMQConnectionFactory createConnectionFactory(ActiveMQConnectionRequestInfo info) throws JMSException {
         ActiveMQConnectionFactory factory = connectionFactory;
         if (factory != null && info.isConnectionFactoryConfigured()) {
             factory = factory.copy();
-        }
-        else if (factory == null) {
+        } else if (factory == null) {
             factory = new ActiveMQConnectionFactory();
         }
         info.configure(factory);
@@ -164,8 +162,9 @@
     }
 
     private String defaultValue(String value, String defaultValue) {
-        if (value != null)
+        if (value != null) {
             return value;
+        }
         return defaultValue;
     }
 
@@ -174,7 +173,7 @@
      */
     public void stop() {
         while (endpointWorkers.size() > 0) {
-            ActiveMQEndpointActivationKey key = (ActiveMQEndpointActivationKey) endpointWorkers.keySet().iterator().next();
+            ActiveMQEndpointActivationKey key = endpointWorkers.keySet().iterator().next();
             endpointDeactivation(key.getMessageEndpointFactory(), key.getActivationSpec());
         }
         if (broker != null) {
@@ -195,8 +194,7 @@
      * @see javax.resource.spi.ResourceAdapter#endpointActivation(javax.resource.spi.endpoint.MessageEndpointFactory,
      *      javax.resource.spi.ActivationSpec)
      */
-    public void endpointActivation(MessageEndpointFactory endpointFactory, ActivationSpec activationSpec)
-            throws ResourceException {
+    public void endpointActivation(MessageEndpointFactory endpointFactory, ActivationSpec activationSpec) throws ResourceException {
 
         // spec section 5.3.3
         if (!equals(activationSpec.getResourceAdapter())) {
@@ -207,8 +205,7 @@
             throw new NotSupportedException("That type of ActicationSpec not supported: " + activationSpec.getClass());
         }
 
-        ActiveMQEndpointActivationKey key = new ActiveMQEndpointActivationKey(endpointFactory,
-                (MessageActivationSpec) activationSpec);
+        ActiveMQEndpointActivationKey key = new ActiveMQEndpointActivationKey(endpointFactory, (MessageActivationSpec)activationSpec);
         // This is weird.. the same endpoint activated twice.. must be a
         // container error.
         if (endpointWorkers.containsKey(key)) {
@@ -228,8 +225,8 @@
     public void endpointDeactivation(MessageEndpointFactory endpointFactory, ActivationSpec activationSpec) {
 
         if (activationSpec instanceof MessageActivationSpec) {
-            ActiveMQEndpointActivationKey key = new ActiveMQEndpointActivationKey(endpointFactory, (MessageActivationSpec) activationSpec);
-            ActiveMQEndpointWorker worker = (ActiveMQEndpointWorker) endpointWorkers.remove(key);
+            ActiveMQEndpointActivationKey key = new ActiveMQEndpointActivationKey(endpointFactory, (MessageActivationSpec)activationSpec);
+            ActiveMQEndpointWorker worker = endpointWorkers.remove(key);
             if (worker == null) {
                 // This is weird.. that endpoint was not activated.. oh well..
                 // this method
@@ -253,7 +250,7 @@
     /**
      * We only connect to one resource manager per ResourceAdapter instance, so
      * any ActivationSpec will return the same XAResource.
-     *
+     * 
      * @see javax.resource.spi.ResourceAdapter#getXAResources(javax.resource.spi.ActivationSpec[])
      */
     public XAResource[] getXAResources(ActivationSpec[] activationSpecs) throws ResourceException {
@@ -261,9 +258,11 @@
         try {
             connection = makeConnection();
             if (connection instanceof XAConnection) {
-                XASession session = ((XAConnection) connection).createXASession();
+                XASession session = ((XAConnection)connection).createXASession();
                 XAResource xaResource = session.getXAResource();
-                return new XAResource[] { xaResource };
+                return new XAResource[] {
+                    xaResource
+                };
             }
             return new XAResource[] {};
         } catch (JMSException e) {
@@ -272,7 +271,7 @@
             try {
                 connection.close();
             } catch (Throwable ignore) {
-            	//
+                //
             }
         }
     }
@@ -350,16 +349,15 @@
      * Sets the <a href="http://activemq.org/Xml+Configuration">XML
      * configuration file </a> used to configure the ActiveMQ broker via Spring
      * if using embedded mode.
-     *
-     * @param brokerXmlConfig
-     *            is the filename which is assumed to be on the classpath unless
-     *            a URL is specified. So a value of <code>foo/bar.xml</code>
-     *            would be assumed to be on the classpath whereas
-     *            <code>file:dir/file.xml</code> would use the file system.
-     *            Any valid URL string is supported.
+     * 
+     * @param brokerXmlConfig is the filename which is assumed to be on the
+     *                classpath unless a URL is specified. So a value of
+     *                <code>foo/bar.xml</code> would be assumed to be on the
+     *                classpath whereas <code>file:dir/file.xml</code> would
+     *                use the file system. Any valid URL string is supported.
      */
     public void setBrokerXmlConfig(String brokerXmlConfig) {
-        this.brokerXmlConfig=brokerXmlConfig;
+        this.brokerXmlConfig = brokerXmlConfig;
     }
 
     /**
@@ -521,12 +519,12 @@
             return false;
         }
 
-        final MessageResourceAdapter activeMQResourceAdapter = (MessageResourceAdapter) o;
+        final MessageResourceAdapter activeMQResourceAdapter = (MessageResourceAdapter)o;
 
         if (!info.equals(activeMQResourceAdapter.getInfo())) {
             return false;
         }
-        if ( notEqual(brokerXmlConfig, activeMQResourceAdapter.getBrokerXmlConfig()) ) {
+        if (notEqual(brokerXmlConfig, activeMQResourceAdapter.getBrokerXmlConfig())) {
             return false;
         }
 
@@ -537,7 +535,6 @@
         return (o1 == null ^ o2 == null) || (o1 != null && !o1.equals(o2));
     }
 
-
     /**
      * @see java.lang.Object#hashCode()
      */
@@ -545,7 +542,7 @@
     public int hashCode() {
         int result;
         result = info.hashCode();
-        if( brokerXmlConfig !=null ) {
+        if (brokerXmlConfig != null) {
             result ^= brokerXmlConfig.hashCode();
         }
         return result;
@@ -580,13 +577,14 @@
     }
 
     /**
-     * This allows a connection factory to be configured and shared between a ResourceAdaptor and outbound messaging.
-     * Note that setting the connectionFactory will overload many of the properties on this POJO such as the redelivery
-     * and prefetch policies; the properties on the connectionFactory will be used instead.
+     * This allows a connection factory to be configured and shared between a
+     * ResourceAdaptor and outbound messaging. Note that setting the
+     * connectionFactory will overload many of the properties on this POJO such
+     * as the redelivery and prefetch policies; the properties on the
+     * connectionFactory will be used instead.
      */
     public void setConnectionFactory(ActiveMQConnectionFactory connectionFactory) {
         this.connectionFactory = connectionFactory;
     }
-
 
 }

Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/InboundConnectionProxy.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/InboundConnectionProxy.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/InboundConnectionProxy.java (original)
+++ activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/InboundConnectionProxy.java Sat Aug 11 22:27:21 2007
@@ -16,7 +16,20 @@
  */
 package org.apache.activemq.ra;
 
-import javax.jms.*;
+import javax.jms.Connection;
+import javax.jms.ConnectionConsumer;
+import javax.jms.ConnectionMetaData;
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueSession;
+import javax.jms.ServerSessionPool;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicSession;
 
 import org.apache.activemq.ActiveMQConnectionMetaData;
 

Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/InboundContext.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/InboundContext.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/InboundContext.java (original)
+++ activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/InboundContext.java Sat Aug 11 22:27:21 2007
@@ -33,7 +33,7 @@
     /**
      * Returns the current session being used to process a JMS message in the current thread.
      */
-    public Session getSession() throws JMSException;
+    Session getSession() throws JMSException;
 
     /**
      * Lazily creates a message producer that can be used to send messages using the
@@ -45,5 +45,5 @@
      *         destination so the destination must be specified on a send() method.
      * @throws javax.jms.JMSException
      */
-    public MessageProducer getMessageProducer() throws JMSException;
+    MessageProducer getMessageProducer() throws JMSException;
 }

Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/InboundContextSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/InboundContextSupport.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/InboundContextSupport.java (original)
+++ activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/InboundContextSupport.java Sat Aug 11 22:27:21 2007
@@ -18,46 +18,50 @@
 
 /**
  * A helper class used to provide access to the current active
- * {@link InboundContext} instance being used to process a message
- * in the current thread so that messages can be produced using the same
- * session.
- *
+ * {@link InboundContext} instance being used to process a message in the
+ * current thread so that messages can be produced using the same session.
+ * 
  * @version $Revision$
  */
-public class InboundContextSupport {
-    private static final ThreadLocal<InboundContext> threadLocal = new ThreadLocal<InboundContext>();
+public final class InboundContextSupport {
+
+    private static final ThreadLocal<InboundContext> THREAD_LOCAL = new ThreadLocal<InboundContext>();
+
+    private InboundContextSupport() {
+    }
 
     /**
-     * Returns the current {@link InboundContext} used by the current thread which is processing a message.
-     * This allows us to access the current Session to send a message using the same underlying
-     * session to avoid unnecessary XA or to use regular JMS transactions while using message driven POJOs.
-     *
+     * Returns the current {@link InboundContext} used by the current thread
+     * which is processing a message. This allows us to access the current
+     * Session to send a message using the same underlying session to avoid
+     * unnecessary XA or to use regular JMS transactions while using message
+     * driven POJOs.
+     * 
      * @return
      */
     public static InboundContext getActiveSessionAndProducer() {
-        return threadLocal.get();
+        return THREAD_LOCAL.get();
     }
 
-
     /**
      * Registers the session and producer which should be called before the
      * {@link javax.resource.spi.endpoint.MessageEndpoint#beforeDelivery(java.lang.reflect.Method)}
      * method is called.
-     *
+     * 
      * @param sessionAndProducer
      */
     public static void register(InboundContext sessionAndProducer) {
-        threadLocal.set(sessionAndProducer);
+        THREAD_LOCAL.set(sessionAndProducer);
     }
 
     /**
      * Unregisters the session and producer which should be called after the
      * {@link javax.resource.spi.endpoint.MessageEndpoint#afterDelivery()}
      * method is called.
-     *
+     * 
      * @param sessionAndProducer
      */
     public static void unregister(InboundContext sessionAndProducer) {
-        threadLocal.set(null);
+        THREAD_LOCAL.set(null);
     }
 }

Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/InboundSessionProxy.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/InboundSessionProxy.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/InboundSessionProxy.java (original)
+++ activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/InboundSessionProxy.java Sat Aug 11 22:27:21 2007
@@ -16,16 +16,37 @@
  */
 package org.apache.activemq.ra;
 
-
-import javax.jms.*;
-
 import java.io.Serializable;
 
+import javax.jms.BytesMessage;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.StreamMessage;
+import javax.jms.TemporaryQueue;
+import javax.jms.TemporaryTopic;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+
 /**
  * A {@link Session} implementation which can be used with the ActiveMQ JCA
- * Resource Adapter to publish messages using the same JMS session that is used to dispatch
- * messages.
- *
+ * Resource Adapter to publish messages using the same JMS session that is used
+ * to dispatch messages.
+ * 
  * @version $Revision$
  */
 public class InboundSessionProxy implements Session, QueueSession, TopicSession {
@@ -39,9 +60,8 @@
     public QueueSession getQueueSession() throws JMSException {
         Session session = getSession();
         if (session instanceof QueueSession) {
-            return (QueueSession) session;
-        }
-        else {
+            return (QueueSession)session;
+        } else {
             throw new JMSException("The underlying JMS Session does not support QueueSession semantics: " + session);
         }
     }
@@ -49,15 +69,14 @@
     public TopicSession getTopicSession() throws JMSException {
         Session session = getSession();
         if (session instanceof TopicSession) {
-            return (TopicSession) session;
-        }
-        else {
+            return (TopicSession)session;
+        } else {
             throw new JMSException("The underlying JMS Session does not support TopicSession semantics: " + session);
         }
     }
 
     public InboundContext getSessionAndProducer() throws JMSException {
-        if( sessionAndProducer==null ) {
+        if (sessionAndProducer == null) {
             sessionAndProducer = InboundContextSupport.getActiveSessionAndProducer();
             if (sessionAndProducer == null) {
                 throw new JMSException("No currently active Session. This JMS provider cannot be used outside a MessageListener.onMessage() invocation");
@@ -90,14 +109,13 @@
     public void run() {
         try {
             getSession().run();
-        }
-        catch (JMSException e) {
+        } catch (JMSException e) {
             throw new RuntimeException("Failed to run() on session due to: " + e, e);
         }
     }
 
     // Straightforward delegation methods
-    //-------------------------------------------------------------------------
+    // -------------------------------------------------------------------------
 
     public QueueBrowser createBrowser(Queue queue) throws JMSException {
         return getSession().createBrowser(queue);
@@ -218,10 +236,10 @@
     public TopicPublisher createPublisher(Topic topic) throws JMSException {
         return getTopicSession().createPublisher(topic);
     }
-    
+
     public String toString() {
         try {
-            return "InboundSessionProxy { "+getSession()+" }";
+            return "InboundSessionProxy { " + getSession() + " }";
         } catch (JMSException e) {
             return "InboundSessionProxy { null }";
         }



Mime
View raw message