[jboss-cvs] JBossAS SVN: r110841 - in projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core: connectionmanager/xa and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Mar 4 16:21:55 EST 2011


Author: jesper.pedersen
Date: 2011-03-04 16:21:54 -0500 (Fri, 04 Mar 2011)
New Revision: 110841

Added:
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/connectionmanager/xa/
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/connectionmanager/xa/XAResourceWrapper.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/connectionmanager/xa/XidWrapper.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/connectionmanager/xa/package.html
Removed:
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/xa/api/
Modified:
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerImpl.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/xa/XAResourceWrapperImpl.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/xa/XidWrapperImpl.java
Log:
[JBJCA-508] Expose JNDI name in XA SPI

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerImpl.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerImpl.java	2011-03-04 18:45:19 UTC (rev 110840)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerImpl.java	2011-03-04 21:21:54 UTC (rev 110841)
@@ -516,7 +516,9 @@
                getLog().trace("Generating XAResourceWrapper for TxConnectionManager" + this);
 
             xaResource = new XAResourceWrapperImpl(mc.getXAResource(), padXid, 
-                                                   isSameRMOverride, eisProductName, eisProductVersion);
+                                                   isSameRMOverride, 
+                                                   eisProductName, eisProductVersion,
+                                                   getJndiName());
          }
          else
          {

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/xa/XAResourceWrapperImpl.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/xa/XAResourceWrapperImpl.java	2011-03-04 18:45:19 UTC (rev 110840)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/xa/XAResourceWrapperImpl.java	2011-03-04 21:21:54 UTC (rev 110841)
@@ -20,14 +20,15 @@
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 package org.jboss.jca.core.connectionmanager.xa;
-import org.jboss.jca.core.connectionmanager.xa.api.XidWrapper;
 
+import org.jboss.jca.core.spi.connectionmanager.xa.XAResourceWrapper;
+import org.jboss.jca.core.spi.connectionmanager.xa.XidWrapper;
+
 import javax.transaction.xa.XAException;
 import javax.transaction.xa.XAResource;
 import javax.transaction.xa.Xid;
 
 import org.jboss.logging.Logger;
-import org.jboss.tm.XAResourceWrapper;
 
 /**
  * A XAResourceWrapper.
@@ -38,74 +39,49 @@
  */
 public class XAResourceWrapperImpl implements XAResourceWrapper
 {
-   /**Serial version UID*/
-   private static final long serialVersionUID = -7463658256795280905L;
+   /** Serial version UID */
+   private static final long serialVersionUID = 2147435420748633848L;
 
-   /**Log instance*/
+   /** Log instance */
    private static Logger log = Logger.getLogger(XAResourceWrapperImpl.class);
    
-   /** The xaResource */
+   /** The XA resource */
    private XAResource xaResource;
    
-   /**Pad*/
+   /** Pad */
    private boolean pad;
 
-   /**Override Rm Value*/
+   /** Override Rm Value */
    private Boolean overrideRmValue;
 
-   /**Product name*/
+   /** Product name */
    private String productName;
 
-   /**Product version*/
+   /** Product version */
    private String productVersion;
    
+   /** Product version */
+   private String jndiName;
+   
    /**
     * Creates a new wrapper instance.
     * @param resource xaresource
-    */
-   public XAResourceWrapperImpl(XAResource resource)
-   {
-      this(resource, false, Boolean.FALSE, null, null);
-   }
-
-   /**
-    * Creates a new wrapper instance.
-    * @param resource xaresource
     * @param pad pad
-    */   
-   public XAResourceWrapperImpl(XAResource resource, boolean pad)
-   {
-      this(resource, pad, Boolean.FALSE, null, null);
-   }
-
-   /**
-    * Creates a new wrapper instance.
-    * @param resource xaresource
-    * @param pad pad
     * @param override override
-    */   
-   public XAResourceWrapperImpl(XAResource resource, boolean pad, Boolean override)
-   {
-      this(resource, pad, override, null, null);
-   }
-
-
-   /**
-    * Creates a new wrapper instance.
-    * @param resource xaresource
-    * @param pad pad
-    * @param override override
     * @param productName product name
     * @param productVersion product version
+    * @param jndiName jndi name
     */   
    public XAResourceWrapperImpl(XAResource resource, boolean pad, Boolean override, 
-         String productName, String productVersion)
+                                String productName, String productVersion,
+                                String jndiName)
    {
       this.overrideRmValue = override;
       this.pad = pad;
       this.xaResource = resource;
       this.productName = productName;
       this.productVersion = productVersion;
+      this.jndiName = jndiName;
    }
 
    /**
@@ -242,6 +218,14 @@
    }
 
    /**
+    * {@inheritDoc}
+    */
+   public String getJndiName()
+   {
+      return jndiName;
+   }
+   
+   /**
     * Return wrapper for given xid.
     * @param xid xid
     * @return return wrapper
@@ -251,7 +235,7 @@
       if (xid instanceof XidWrapper)
          return xid;
       else
-         return new XidWrapperImpl(xid, pad);
+         return new XidWrapperImpl(xid, pad, jndiName);
    }
 
    /**
@@ -259,6 +243,15 @@
     */
    public String toString()
    {
-      return super.toString();
+      StringBuilder sb = new StringBuilder();
+      sb.append("XAResourceWrapperImpl@").append(Integer.toHexString(System.identityHashCode(this)));
+      sb.append("[xaResource=").append(xaResource);
+      sb.append(" pad=").append(pad);
+      sb.append(" overrideRmValue=").append(overrideRmValue);
+      sb.append(" productName=").append(productName);
+      sb.append(" productVersion=").append(productVersion);
+      sb.append(" jndiName=").append(jndiName);
+      sb.append("]");
+      return sb.toString();
    }
 }

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/xa/XidWrapperImpl.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/xa/XidWrapperImpl.java	2011-03-04 18:45:19 UTC (rev 110840)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/xa/XidWrapperImpl.java	2011-03-04 21:21:54 UTC (rev 110841)
@@ -1,6 +1,6 @@
 /*
  * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
  * as indicated by the @author tags. See the copyright.txt file in the
  * distribution for a full listing of individual contributors.
  *
@@ -21,7 +21,7 @@
  */
 package org.jboss.jca.core.connectionmanager.xa;
 
-import org.jboss.jca.core.connectionmanager.xa.api.XidWrapper;
+import org.jboss.jca.core.spi.connectionmanager.xa.XidWrapper;
 
 import java.util.Arrays;
 
@@ -36,7 +36,7 @@
 public class XidWrapperImpl implements XidWrapper
 {
    /** The serialVersionUID */
-   private static final long serialVersionUID = 396520266833097662L;
+   private static final long serialVersionUID = 3223859423961011795L;
 
    /** The formatId */
    private int formatId;
@@ -46,6 +46,9 @@
    
    /** The branchQualifier */
    private byte[] branchQualifier;
+
+   /** The jndi name */
+   private String jndiName;
    
    /** Cached toString() */
    private transient String cachedToString;
@@ -55,25 +58,18 @@
    
    /**
     * Creates a new XidWrapperImpl instance.
-    * @param xid xid
-    */
-   public XidWrapperImpl(Xid xid)
-   {
-      this(xid, false);
-   }
-   
-   /**
-    * Creates a new XidWrapperImpl instance.
     * @param xid The Xid instances
     * @param pad Should the branch qualifier be padded
+    * @param jndiName The JNDI name
     */
-   public XidWrapperImpl(Xid xid, boolean pad)
+   public XidWrapperImpl(Xid xid, boolean pad, String jndiName)
    {
       this.branchQualifier = pad ? new byte[Xid.MAXBQUALSIZE] : new byte[xid.getBranchQualifier().length];      
       System.arraycopy(xid.getBranchQualifier(), 0, branchQualifier, 0, xid.getBranchQualifier().length);      
 
       this.globalTransactionId = xid.getGlobalTransactionId();
       this.formatId = xid.getFormatId();
+      this.jndiName = jndiName;
    }
 
    /**
@@ -103,6 +99,14 @@
    /**
     * {@inheritDoc}
     */
+   public String getJndiName()
+   {
+      return jndiName;
+   }
+   
+   /**
+    * {@inheritDoc}
+    */
    public boolean equals(Object object)
    {
       if (object == this)
@@ -141,14 +145,16 @@
    {
       if (cachedToString == null)
       {
-         StringBuffer buffer = new StringBuffer();
-         buffer.append("XidWrapper[FormatId=").append(getFormatId());
-         buffer.append(" GlobalId=").append(new String(getGlobalTransactionId()).trim());
-         buffer.append(" BranchQual=");
-         buffer.append(new String(getBranchQualifier()).trim());
-         buffer.append(']');
-         cachedToString = buffer.toString();
+         StringBuilder sb = new StringBuilder();
+         sb.append("XidWrapperImpl@").append(Integer.toHexString(System.identityHashCode(this)));
+         sb.append("[formatId=").append(getFormatId());
+         sb.append(" globalTransactionId=").append(new String(getGlobalTransactionId()).trim());
+         sb.append(" branchQualifier=").append(new String(getBranchQualifier()).trim());
+         sb.append(" jndiName=").append(jndiName);
+         sb.append("]");
+         cachedToString = sb.toString();
       }
+
       return cachedToString;
    }
 }

Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/connectionmanager/xa/XAResourceWrapper.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/connectionmanager/xa/XAResourceWrapper.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/connectionmanager/xa/XAResourceWrapper.java	2011-03-04 21:21:54 UTC (rev 110841)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.core.spi.connectionmanager.xa;
+
+/**
+ * An XAResource wrapper.
+ * 
+ * @author <a href="jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @version $Revision: 85945 $
+ */
+public interface XAResourceWrapper extends org.jboss.tm.XAResourceWrapper
+{
+   /**
+    * Get the JNDI name
+    * @return The value
+    */
+   public String getJndiName();
+}

Copied: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/connectionmanager/xa/XidWrapper.java (from rev 110840, projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/xa/api/XidWrapper.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/connectionmanager/xa/XidWrapper.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/connectionmanager/xa/XidWrapper.java	2011-03-04 21:21:54 UTC (rev 110841)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.core.spi.connectionmanager.xa;
+
+import java.io.Serializable;
+
+import javax.transaction.xa.Xid;
+
+/**
+ * A XidWrapper.
+ * 
+ * @author <a href="jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @version $Revision: 85945 $
+ */
+public interface XidWrapper extends Serializable, Xid
+{
+   /**
+    * Get the JNDI name
+    * @return The value
+    */
+   public String getJndiName();
+}

Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/connectionmanager/xa/package.html
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/connectionmanager/xa/package.html	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/connectionmanager/xa/package.html	2011-03-04 21:21:54 UTC (rev 110841)
@@ -0,0 +1,3 @@
+<body>
+This package contains the XA extension for the connection manager.
+</body>



More information about the jboss-cvs-commits mailing list