[jboss-cvs] JBossAS SVN: r110886 - in projects/jboss-jca/trunk: common/src/main/java/org/jboss/jca/common/api/metadata/ds and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 10 12:02:28 EST 2011


Author: maeste
Date: 2011-03-10 12:02:28 -0500 (Thu, 10 Mar 2011)
New Revision: 110886

Added:
   projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/Recovery.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/connectionmanager/xa/XAResourceRecoveryImpl.java
Removed:
   projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/Recovery.java
Modified:
   projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonXaPool.java
   projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/XaDataSource.java
   projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java
   projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonXaPoolImpl.java
   projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DsParser.java
   projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/XADataSourceImpl.java
   projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ds/DsParserForRecoveryTestCase.java
   projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParserTestCase.java
   projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterParserTestCase.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
Log:
JBJCA-509

Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonXaPool.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonXaPool.java	2011-03-10 16:28:52 UTC (rev 110885)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/CommonXaPool.java	2011-03-10 17:02:28 UTC (rev 110886)
@@ -22,7 +22,6 @@
 package org.jboss.jca.common.api.metadata.common;
 
 
-import org.jboss.jca.common.api.metadata.ds.Recovery;
 
 import java.util.HashMap;
 import java.util.Map;

Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/Recovery.java (from rev 110885, projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/Recovery.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/Recovery.java	                        (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/common/Recovery.java	2011-03-10 17:02:28 UTC (rev 110886)
@@ -0,0 +1,271 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.common.api.metadata.common;
+
+import org.jboss.jca.common.api.metadata.JCAMetadata;
+import org.jboss.jca.common.api.metadata.ValidatableMetadata;
+import org.jboss.jca.common.api.validator.ValidateException;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ *
+ * A Recovery.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public class Recovery implements JCAMetadata, ValidatableMetadata
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = -7425365995463321893L;
+
+   private final Credential credential;
+
+   private final Extension plugin;
+
+   private final Boolean noRecovery;
+
+   /**
+    * Create a new Recovery.
+    *
+    * @param credential credential
+    * @param plugin plugin
+    * @param noRecovery niRecovery
+    * @throws ValidateException in case of not valid metadata creation
+    */
+   public Recovery(Credential credential, Extension plugin, Boolean noRecovery) throws ValidateException
+   {
+      super();
+      this.credential = credential;
+      this.plugin = plugin;
+      this.noRecovery = noRecovery;
+      this.validate();
+   }
+
+   /**
+    * Get the security.
+    *
+    * @return the security.
+    */
+   public final Credential getCredential()
+   {
+      return credential;
+   }
+
+   /**
+    * Get the plugin.
+    *
+    * @return the plugin.
+    */
+   public final Extension getPlugin()
+   {
+      return plugin;
+   }
+
+   /**
+    * Get the noRecovery.
+    *
+    * @return the noRecovery.
+    */
+   public final Boolean getNoRecovery()
+   {
+      return noRecovery;
+   }
+
+   @Override
+   public void validate() throws ValidateException
+   {
+      // the only field not yet validated is a Boolean and all value are fine
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = 1;
+      result = prime * result + ((noRecovery == null) ? 0 : noRecovery.hashCode());
+      result = prime * result + ((plugin == null) ? 0 : plugin.hashCode());
+      result = prime * result + ((credential == null) ? 0 : credential.hashCode());
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (obj == null)
+         return false;
+      if (!(obj instanceof Recovery))
+         return false;
+      Recovery other = (Recovery) obj;
+      if (noRecovery == null)
+      {
+         if (other.noRecovery != null)
+            return false;
+      }
+      else if (!noRecovery.equals(other.noRecovery))
+         return false;
+      if (plugin == null)
+      {
+         if (other.plugin != null)
+            return false;
+      }
+      else if (!plugin.equals(other.plugin))
+         return false;
+      if (credential == null)
+      {
+         if (other.credential != null)
+            return false;
+      }
+      else if (!credential.equals(other.credential))
+         return false;
+      return true;
+   }
+
+   @Override
+   public String toString()
+   {
+      return "Recovery [credential=" + credential + ", plugin=" + plugin + ", noRecovery=" + noRecovery + "]";
+   }
+
+   /**
+   *
+   * A Tag.
+   *
+   * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+   *
+   */
+   public enum Tag
+   {
+      /** always first
+       *
+       */
+      UNKNOWN(null),
+
+      /**
+       * pool tag
+
+      /**
+      * config-property tag
+      */
+      RECOVER_CREDENTIAL("recover-credential"),
+      /** plugin tag */
+
+      PLUGIN("plugin");
+
+      private final String name;
+
+      /**
+       *
+       * Create a new Tag.
+       *
+       * @param name a name
+       */
+      Tag(final String name)
+      {
+         this.name = name;
+      }
+
+      /**
+       * Get the local name of this element.
+       *
+       * @return the local name
+       */
+      public String getLocalName()
+      {
+         return name;
+      }
+
+      private static final Map<String, Tag> MAP;
+
+      static
+      {
+         final Map<String, Tag> map = new HashMap<String, Tag>();
+         for (Tag element : values())
+         {
+            final String name = element.getLocalName();
+            if (name != null)
+               map.put(name, element);
+         }
+         MAP = map;
+      }
+
+      /**
+      *
+      * Static method to get enum instance given localName XsdString
+      *
+      * @param localName a XsdString used as localname (typically tag name as defined in xsd)
+      * @return the enum instance
+      */
+      public static Tag forName(String localName)
+      {
+         final Tag element = MAP.get(localName);
+         return element == null ? UNKNOWN : element;
+      }
+
+   }
+
+   /**
+    *
+    * A Attribute.
+    *
+    * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+    *
+    */
+   public enum Attribute
+   {
+
+      /** class-name attribute
+      *
+      */
+      NO_RECOVERY("no-recovery");
+
+      private final String name;
+
+      /**
+       *
+       * Create a new Tag.
+       *
+       * @param name a name
+       */
+      Attribute(final String name)
+      {
+         this.name = name;
+      }
+
+      /**
+       * Get the local name of this element.
+       *
+       * @return the local name
+       */
+      public String getLocalName()
+      {
+         return name;
+      }
+
+   }
+
+}
+

Deleted: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/Recovery.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/Recovery.java	2011-03-10 16:28:52 UTC (rev 110885)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/Recovery.java	2011-03-10 17:02:28 UTC (rev 110886)
@@ -1,273 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.common.api.metadata.ds;
-
-import org.jboss.jca.common.api.metadata.JCAMetadata;
-import org.jboss.jca.common.api.metadata.ValidatableMetadata;
-import org.jboss.jca.common.api.metadata.common.Credential;
-import org.jboss.jca.common.api.metadata.common.Extension;
-import org.jboss.jca.common.api.validator.ValidateException;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- *
- * A Recovery.
- *
- * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
- *
- */
-public class Recovery implements JCAMetadata, ValidatableMetadata
-{
-   /** The serialVersionUID */
-   private static final long serialVersionUID = -7425365995463321893L;
-
-   private final Credential security;
-
-   private final Extension plugin;
-
-   private final Boolean noRecovery;
-
-   /**
-    * Create a new Recovery.
-    *
-    * @param security security
-    * @param plugin plugin
-    * @param noRecovery niRecovery
-    * @throws ValidateException in case of not valid metadata creation
-    */
-   public Recovery(Credential security, Extension plugin, Boolean noRecovery) throws ValidateException
-   {
-      super();
-      this.security = security;
-      this.plugin = plugin;
-      this.noRecovery = noRecovery;
-      this.validate();
-   }
-
-   /**
-    * Get the security.
-    *
-    * @return the security.
-    */
-   public final Credential getSecurity()
-   {
-      return security;
-   }
-
-   /**
-    * Get the plugin.
-    *
-    * @return the plugin.
-    */
-   public final Extension getPlugin()
-   {
-      return plugin;
-   }
-
-   /**
-    * Get the noRecovery.
-    *
-    * @return the noRecovery.
-    */
-   public final Boolean getNoRecovery()
-   {
-      return noRecovery;
-   }
-
-   @Override
-   public void validate() throws ValidateException
-   {
-      // the only field not yet validated is a Boolean and all value are fine
-   }
-
-   @Override
-   public int hashCode()
-   {
-      final int prime = 31;
-      int result = 1;
-      result = prime * result + ((noRecovery == null) ? 0 : noRecovery.hashCode());
-      result = prime * result + ((plugin == null) ? 0 : plugin.hashCode());
-      result = prime * result + ((security == null) ? 0 : security.hashCode());
-      return result;
-   }
-
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (this == obj)
-         return true;
-      if (obj == null)
-         return false;
-      if (!(obj instanceof Recovery))
-         return false;
-      Recovery other = (Recovery) obj;
-      if (noRecovery == null)
-      {
-         if (other.noRecovery != null)
-            return false;
-      }
-      else if (!noRecovery.equals(other.noRecovery))
-         return false;
-      if (plugin == null)
-      {
-         if (other.plugin != null)
-            return false;
-      }
-      else if (!plugin.equals(other.plugin))
-         return false;
-      if (security == null)
-      {
-         if (other.security != null)
-            return false;
-      }
-      else if (!security.equals(other.security))
-         return false;
-      return true;
-   }
-
-   @Override
-   public String toString()
-   {
-      return "Recovery [security=" + security + ", plugin=" + plugin + ", noRecovery=" + noRecovery + "]";
-   }
-
-   /**
-   *
-   * A Tag.
-   *
-   * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
-   *
-   */
-   public enum Tag
-   {
-      /** always first
-       *
-       */
-      UNKNOWN(null),
-
-      /**
-       * pool tag
-
-      /**
-      * config-property tag
-      */
-      RECOVER_CREDENTIAL("recover-credential"),
-      /** plugin tag */
-
-      PLUGIN("plugin");
-
-      private final String name;
-
-      /**
-       *
-       * Create a new Tag.
-       *
-       * @param name a name
-       */
-      Tag(final String name)
-      {
-         this.name = name;
-      }
-
-      /**
-       * Get the local name of this element.
-       *
-       * @return the local name
-       */
-      public String getLocalName()
-      {
-         return name;
-      }
-
-      private static final Map<String, Tag> MAP;
-
-      static
-      {
-         final Map<String, Tag> map = new HashMap<String, Tag>();
-         for (Tag element : values())
-         {
-            final String name = element.getLocalName();
-            if (name != null)
-               map.put(name, element);
-         }
-         MAP = map;
-      }
-
-      /**
-      *
-      * Static method to get enum instance given localName XsdString
-      *
-      * @param localName a XsdString used as localname (typically tag name as defined in xsd)
-      * @return the enum instance
-      */
-      public static Tag forName(String localName)
-      {
-         final Tag element = MAP.get(localName);
-         return element == null ? UNKNOWN : element;
-      }
-
-   }
-
-   /**
-    *
-    * A Attribute.
-    *
-    * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
-    *
-    */
-   public enum Attribute
-   {
-
-      /** class-name attribute
-      *
-      */
-      NO_RECOVERY("no-recovery");
-
-      private final String name;
-
-      /**
-       *
-       * Create a new Tag.
-       *
-       * @param name a name
-       */
-      Attribute(final String name)
-      {
-         this.name = name;
-      }
-
-      /**
-       * Get the local name of this element.
-       *
-       * @return the local name
-       */
-      public String getLocalName()
-      {
-         return name;
-      }
-
-   }
-
-}
-

Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/XaDataSource.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/XaDataSource.java	2011-03-10 16:28:52 UTC (rev 110885)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/XaDataSource.java	2011-03-10 17:02:28 UTC (rev 110886)
@@ -22,6 +22,7 @@
 package org.jboss.jca.common.api.metadata.ds;
 
 import org.jboss.jca.common.api.metadata.common.CommonXaPool;
+import org.jboss.jca.common.api.metadata.common.Recovery;
 
 import java.util.HashMap;
 import java.util.Map;

Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java	2011-03-10 16:28:52 UTC (rev 110885)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java	2011-03-10 17:02:28 UTC (rev 110886)
@@ -26,8 +26,8 @@
 import org.jboss.jca.common.api.metadata.common.CommonXaPool;
 import org.jboss.jca.common.api.metadata.common.Credential;
 import org.jboss.jca.common.api.metadata.common.Extension;
+import org.jboss.jca.common.api.metadata.common.Recovery;
 import org.jboss.jca.common.api.metadata.ds.DataSource;
-import org.jboss.jca.common.api.metadata.ds.Recovery;
 import org.jboss.jca.common.api.metadata.ds.Validation;
 import org.jboss.jca.common.api.metadata.ds.XaDataSource;
 import org.jboss.jca.common.api.validator.ValidateException;

Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonXaPoolImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonXaPoolImpl.java	2011-03-10 16:28:52 UTC (rev 110885)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/common/CommonXaPoolImpl.java	2011-03-10 17:02:28 UTC (rev 110886)
@@ -22,7 +22,7 @@
 package org.jboss.jca.common.metadata.common;
 
 import org.jboss.jca.common.api.metadata.common.CommonXaPool;
-import org.jboss.jca.common.api.metadata.ds.Recovery;
+import org.jboss.jca.common.api.metadata.common.Recovery;
 import org.jboss.jca.common.api.validator.ValidateException;
 
 /**

Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DsParser.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DsParser.java	2011-03-10 16:28:52 UTC (rev 110885)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DsParser.java	2011-03-10 17:02:28 UTC (rev 110886)
@@ -25,9 +25,9 @@
 import org.jboss.jca.common.api.metadata.common.CommonXaPool;
 import org.jboss.jca.common.api.metadata.common.Credential;
 import org.jboss.jca.common.api.metadata.common.Extension;
+import org.jboss.jca.common.api.metadata.common.Recovery;
 import org.jboss.jca.common.api.metadata.ds.DataSource;
 import org.jboss.jca.common.api.metadata.ds.DataSources;
-import org.jboss.jca.common.api.metadata.ds.Recovery;
 import org.jboss.jca.common.api.metadata.ds.Statement;
 import org.jboss.jca.common.api.metadata.ds.Statement.TrackStatementsEnum;
 import org.jboss.jca.common.api.metadata.ds.TimeOut;

Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/XADataSourceImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/XADataSourceImpl.java	2011-03-10 16:28:52 UTC (rev 110885)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/XADataSourceImpl.java	2011-03-10 17:02:28 UTC (rev 110886)
@@ -23,7 +23,7 @@
 
 import org.jboss.jca.common.api.metadata.common.CommonXaPool;
 import org.jboss.jca.common.api.metadata.common.Credential;
-import org.jboss.jca.common.api.metadata.ds.Recovery;
+import org.jboss.jca.common.api.metadata.common.Recovery;
 import org.jboss.jca.common.api.metadata.ds.Statement;
 import org.jboss.jca.common.api.metadata.ds.TimeOut;
 import org.jboss.jca.common.api.metadata.ds.TransactionIsolation;

Modified: projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ds/DsParserForRecoveryTestCase.java
===================================================================
--- projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ds/DsParserForRecoveryTestCase.java	2011-03-10 16:28:52 UTC (rev 110885)
+++ projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ds/DsParserForRecoveryTestCase.java	2011-03-10 17:02:28 UTC (rev 110886)
@@ -23,8 +23,8 @@
 
 import org.jboss.jca.common.api.metadata.common.Credential;
 import org.jboss.jca.common.api.metadata.common.Extension;
+import org.jboss.jca.common.api.metadata.common.Recovery;
 import org.jboss.jca.common.api.metadata.ds.DataSources;
-import org.jboss.jca.common.api.metadata.ds.Recovery;
 import org.jboss.jca.common.api.metadata.ds.XaDataSource;
 import org.jboss.jca.common.api.validator.ValidateException;
 
@@ -89,7 +89,7 @@
       Recovery recovery = ds.getRecovery();
       assertThat(recovery, not(isNull()));
       assertThat(recovery.getNoRecovery(), is(false));
-      Credential security = recovery.getSecurity();
+      Credential security = recovery.getCredential();
       Extension plugin = recovery.getPlugin();
       assertThat(security.getUserName(), is("myUserName"));
       assertThat(security.getPassword(), is("myPassword"));

Modified: projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParserTestCase.java
===================================================================
--- projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParserTestCase.java	2011-03-10 16:28:52 UTC (rev 110885)
+++ projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParserTestCase.java	2011-03-10 17:02:28 UTC (rev 110886)
@@ -29,8 +29,8 @@
 import org.jboss.jca.common.api.metadata.common.CommonXaPool;
 import org.jboss.jca.common.api.metadata.common.Credential;
 import org.jboss.jca.common.api.metadata.common.Extension;
+import org.jboss.jca.common.api.metadata.common.Recovery;
 import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
-import org.jboss.jca.common.api.metadata.ds.Recovery;
 import org.jboss.jca.common.api.metadata.ironjacamar.IronJacamar;
 import org.jboss.jca.common.metadata.ParserException;
 
@@ -609,7 +609,7 @@
             Recovery recovery = xaPool.getRecovery();
             assertThat(recovery, not(isNull()));
             assertThat(recovery.getNoRecovery(), is(false));
-            Credential security = recovery.getSecurity();
+            Credential security = recovery.getCredential();
             Extension plugin = recovery.getPlugin();
             assertThat(security.getUserName(), is("myUserName"));
             assertThat(security.getPassword(), is("myPassword"));

Modified: projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterParserTestCase.java
===================================================================
--- projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterParserTestCase.java	2011-03-10 16:28:52 UTC (rev 110885)
+++ projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/resourceadapter/ResourceAdapterParserTestCase.java	2011-03-10 17:02:28 UTC (rev 110886)
@@ -26,8 +26,8 @@
 import org.jboss.jca.common.api.metadata.common.CommonXaPool;
 import org.jboss.jca.common.api.metadata.common.Credential;
 import org.jboss.jca.common.api.metadata.common.Extension;
+import org.jboss.jca.common.api.metadata.common.Recovery;
 import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
-import org.jboss.jca.common.api.metadata.ds.Recovery;
 import org.jboss.jca.common.api.metadata.resourceadapter.ResourceAdapter;
 import org.jboss.jca.common.api.metadata.resourceadapter.ResourceAdapters;
 
@@ -156,7 +156,7 @@
          Recovery recovery = xaPool.getRecovery();
          assertThat(recovery, not(isNull()));
          assertThat(recovery.getNoRecovery(), is(false));
-         Credential security = recovery.getSecurity();
+         Credential security = recovery.getCredential();
          Extension plugin = recovery.getPlugin();
          assertThat(security.getUserName(), is("myUserName"));
          assertThat(security.getPassword(), is("myPassword"));

Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/connectionmanager/xa/XAResourceRecoveryImpl.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/connectionmanager/xa/XAResourceRecoveryImpl.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/connectionmanager/xa/XAResourceRecoveryImpl.java	2011-03-10 17:02:28 UTC (rev 110886)
@@ -0,0 +1,479 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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 org.jboss.jca.core.connectionmanager.xa.XAResourceWrapperImpl;
+
+import java.security.AccessController;
+import java.security.Principal;
+import java.security.PrivilegedAction;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.security.PasswordCredential;
+import javax.security.auth.Subject;
+import javax.transaction.xa.XAResource;
+
+import org.jboss.logging.Logger;
+import org.jboss.security.SecurityContext;
+import org.jboss.security.SecurityContextAssociation;
+import org.jboss.security.SecurityContextFactory;
+import org.jboss.security.SimplePrincipal;
+import org.jboss.security.SubjectFactory;
+import org.jboss.tm.XAResourceRecovery;
+import org.jboss.tm.XAResourceRecoveryRegistry;
+
+/**
+ *
+ * A XAResourceRecoveryImpl.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public class XAResourceRecoveryImpl implements XAResourceRecovery
+{
+
+   private final ManagedConnectionFactory mcf;
+
+   private final Boolean padXid;
+
+   private final Boolean isSameRMOverrideValue;
+
+   private final Boolean wrapXAResource;
+
+   private String jndiName;
+
+   private final String recoverUserName;
+
+   private final String recoverPassword;
+
+   private final String recoverSecurityDomain;
+
+   private final SubjectFactory subjectFactory;
+
+   private ManagedConnection recoverMC;
+
+   /** Log instance */
+   private static Logger log = Logger.getLogger(XAResourceRecoveryImpl.class);
+
+   /**
+    * Create a new XAResourceRecoveryImpl.
+    *
+    * @param mcf mcf
+    * @param padXid padXid
+    * @param isSameRMOverrideValue isSameRMOverrideValue
+    * @param wrapXAResource wrapXAResource
+    * @param recoverUserName recoverUserName
+    * @param recoverPassword recoverPassword
+    * @param recoverSecurityDomain recoverSecurityDomain
+    * @param subjectFactory subjectFactory
+    */
+   public XAResourceRecoveryImpl(ManagedConnectionFactory mcf, Boolean padXid, Boolean isSameRMOverrideValue,
+      Boolean wrapXAResource, String recoverUserName,
+      String recoverPassword, String recoverSecurityDomain, SubjectFactory subjectFactory)
+   {
+      super();
+      this.mcf = mcf;
+      this.padXid = padXid;
+      this.isSameRMOverrideValue = isSameRMOverrideValue;
+      this.wrapXAResource = wrapXAResource;
+      this.recoverUserName = recoverUserName;
+      this.recoverPassword = recoverPassword;
+      this.recoverSecurityDomain = recoverSecurityDomain;
+      this.subjectFactory = subjectFactory;
+
+   }
+
+   /**
+    * Provides XAResource(s) to the transaction system for recovery purposes.
+    *
+    * @return An array of XAResource objects for use in transaction recovery
+    * In most cases the implementation will need to return only a single XAResource in the array.
+    * For more sophisticated cases, such as where multiple different connection types are supported,
+    * it may be necessary to return more than one.
+    *
+    * The Resource should be instantiated in such a way as to carry the necessary permissions to
+    * allow transaction recovery. For some deployments it may therefore be necessary or desirable to
+    * provide resource(s) based on e.g. database connection parameters such as username other than those
+    * used for the regular application connections to the same resource manager.
+    */
+   @Override
+   public XAResource[] getXAResources()
+   {
+
+      try
+      {
+         Subject subject = getSubject();
+
+         // Check if we got a valid Subject instance; requirement for recovery
+         if (subject != null)
+         {
+            ManagedConnection mc = open(subject);
+            XAResource xaResource = null;
+
+            try
+            {
+               xaResource = mc.getXAResource();
+            }
+            catch (ResourceException reconnect)
+            {
+               close(mc);
+               mc = open(subject);
+               xaResource = mc.getXAResource();
+            }
+
+            String eisProductName = null;
+            String eisProductVersion = null;
+
+            try
+            {
+               if (mc.getMetaData() != null)
+               {
+                  eisProductName = mc.getMetaData().getEISProductName();
+                  eisProductVersion = mc.getMetaData().getEISProductVersion();
+               }
+            }
+            catch (ResourceException re)
+            {
+               // Ignore
+            }
+
+            if (eisProductName == null)
+               eisProductName = getJndiName();
+
+            if (eisProductVersion == null)
+               eisProductVersion = getJndiName();
+
+            try
+            {
+               if (wrapXAResource)
+               {
+
+                  xaResource = new XAResourceWrapperImpl(xaResource,
+                                                            padXid,
+                                                            isSameRMOverrideValue,
+                                                            eisProductName,
+                                                            eisProductVersion,
+                                                            jndiName);
+               }
+            }
+            catch (Throwable t)
+            {
+               // Ignore
+            }
+
+            if (log.isDebugEnabled())
+               log.debug("Recovery XAResource=" + xaResource + " for " + jndiName);
+
+            return new XAResource[]{xaResource};
+         }
+         else
+         {
+            if (log.isDebugEnabled())
+               log.debug("Subject for recovery was null");
+         }
+      }
+      catch (ResourceException re)
+      {
+         if (log.isDebugEnabled())
+            log.debug("Error during recovery", re);
+      }
+
+      return new XAResource[0];
+   }
+
+   /**
+    * This method provide the Subject used for the XA Resource Recovery
+    * integration with the XAResourceRecoveryRegistry.
+    *
+    * This isn't done through the SecurityAssociation functionality of JBossSX
+    * as the Subject returned here should only be used for recovery.
+    *
+    * @return The recovery subject; <code>null</code> if no Subject could be created
+    */
+   private Subject getSubject()
+   {
+      return AccessController.doPrivileged(new PrivilegedAction<Subject>()
+      {
+         /**
+          * run method
+          */
+         public Subject run()
+         {
+            if (recoverUserName != null && recoverPassword != null)
+            {
+               // User name and password use-case
+               Subject subject = new Subject();
+
+               // Principals
+               Principal p = new SimplePrincipal(recoverUserName);
+               subject.getPrincipals().add(p);
+
+               // PrivateCredentials
+               PasswordCredential pc = new PasswordCredential(recoverUserName, recoverPassword.toCharArray());
+               pc.setManagedConnectionFactory(mcf);
+               subject.getPrivateCredentials().add(pc);
+
+               // PublicCredentials
+               // None
+
+               if (log.isDebugEnabled())
+                  log.debug("Recovery Subject=" + subject);
+
+               return subject;
+            }
+            else
+            {
+               // Security-domain use-case
+               try
+               {
+                  // Create a security context on the association
+                  SecurityContext securityContext = SecurityContextFactory
+                     .createSecurityContext(recoverSecurityDomain);
+                  SecurityContextAssociation.setSecurityContext(securityContext);
+
+                  // Unauthenticated
+                  Subject unauthenticated = new Subject();
+
+                  // Leave the subject empty as we don't have any information to do the
+                  // authentication with - and we only need it to be able to get the
+                  // real subject from the SubjectFactory
+
+                  // Set the authenticated subject
+                  securityContext.getSubjectInfo().setAuthenticatedSubject(unauthenticated);
+
+                  // Select the domain
+                  String domain = recoverSecurityDomain;
+
+                  if (domain != null)
+                  {
+                     // Use the unauthenticated subject to get the real recovery subject instance
+                     Subject subject = subjectFactory.createSubject(domain);
+
+                     if (log.isDebugEnabled())
+                        log.debug("Recovery Subject=" + subject);
+
+                     return subject;
+                  }
+                  else
+                  {
+                     if (log.isDebugEnabled())
+                        log.debug("RecoverySecurityDomain was empty");
+                  }
+               }
+               catch (Throwable t)
+               {
+                  log.debug("Exception during getSubject()" + t.getMessage(), t);
+               }
+
+               return null;
+            }
+         }
+      });
+   }
+
+   /**
+    *
+    * registeer this impl to passed XAResourceRecoveryRegistry
+    *
+    * @param registry the registry
+    * @param cfJndiName the connection factory jndi name
+    */
+   public void registerXaRecovery(XAResourceRecoveryRegistry registry, String cfJndiName)
+   {
+      this.jndiName = cfJndiName;
+      registry.addXAResourceRecovery(this);
+
+   }
+
+   /**
+    * Open a managed connection
+    * @param s The subject
+    * @return The managed connection
+    * @exception ResourceException Thrown in case of an error
+    */
+   private ManagedConnection open(Subject s) throws ResourceException
+   {
+      if (recoverMC == null)
+      {
+         recoverMC = mcf.createManagedConnection(s, null);
+      }
+
+      return recoverMC;
+   }
+
+   /**
+   * Close a managed connection
+   * @param mc The managed connection
+   */
+   private void close(ManagedConnection mc)
+   {
+      if (mc != null)
+      {
+         try
+         {
+            mc.cleanup();
+         }
+         catch (ResourceException ire)
+         {
+            if (log.isDebugEnabled())
+               log.debug("Error during recovery cleanup", ire);
+         }
+      }
+
+      if (mc != null)
+      {
+         try
+         {
+            mc.destroy();
+         }
+         catch (ResourceException ire)
+         {
+            if (log.isDebugEnabled())
+               log.debug("Error during recovery destroy", ire);
+         }
+      }
+
+      mc = null;
+   }
+
+   /**
+    * Get the recoverMC.
+    *
+    * @return the recoverMC.
+    */
+   public final ManagedConnection getRecoverMC()
+   {
+      return recoverMC;
+   }
+
+   /**
+    * Set the recoverMC.
+    *
+    * @param recoverMC The recoverMC to set.
+    */
+   public final void setRecoverMC(ManagedConnection recoverMC)
+   {
+      this.recoverMC = recoverMC;
+   }
+
+   /**
+    * Get the mcf.
+    *
+    * @return the mcf.
+    */
+   public final ManagedConnectionFactory getMcf()
+   {
+      return mcf;
+   }
+
+   /**
+    * Get the padXid.
+    *
+    * @return the padXid.
+    */
+   public final Boolean isPadXid()
+   {
+      return padXid;
+   }
+
+   /**
+    * Get the isSameRMOverrideValue.
+    *
+    * @return the isSameRMOverrideValue.
+    */
+   public final Boolean isSameRMOverrideValue()
+   {
+      return isSameRMOverrideValue;
+   }
+
+   /**
+    * Get the wrapXAResource.
+    *
+    * @return the wrapXAResource.
+    */
+   public final Boolean isWrapXAResource()
+   {
+      return wrapXAResource;
+   }
+
+   /**
+    * Get the jndiName.
+    *
+    * @return the jndiName.
+    */
+   public final String getJndiName()
+   {
+      return jndiName;
+   }
+
+   /**
+    * Get the recoverUserName.
+    *
+    * @return the recoverUserName.
+    */
+   public final String getRecoverUserName()
+   {
+      return recoverUserName;
+   }
+
+   /**
+    * Get the recoverPassword.
+    *
+    * @return the recoverPassword.
+    */
+   public final String getRecoverPassword()
+   {
+      return recoverPassword;
+   }
+
+   /**
+    * Get the recoverSecurityDomain.
+    *
+    * @return the recoverSecurityDomain.
+    */
+   public final String getRecoverSecurityDomain()
+   {
+      return recoverSecurityDomain;
+   }
+
+   /**
+    * Get the subjectFactory.
+    *
+    * @return the subjectFactory.
+    */
+   public final SubjectFactory getSubjectFactory()
+   {
+      return subjectFactory;
+   }
+
+   /**
+    * Set the jndiName.
+    *
+    * @param jndiName The jndiName to set.
+    */
+   public final void setJndiName(String jndiName)
+   {
+      this.jndiName = jndiName;
+   }
+}

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java	2011-03-10 16:28:52 UTC (rev 110885)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java	2011-03-10 17:02:28 UTC (rev 110886)
@@ -24,6 +24,8 @@
 import org.jboss.jca.common.api.metadata.common.CommonPool;
 import org.jboss.jca.common.api.metadata.common.CommonTimeOut;
 import org.jboss.jca.common.api.metadata.common.CommonValidation;
+import org.jboss.jca.common.api.metadata.common.Credential;
+import org.jboss.jca.common.api.metadata.common.Recovery;
 import org.jboss.jca.common.api.metadata.ds.DataSource;
 import org.jboss.jca.common.api.metadata.ds.DataSources;
 import org.jboss.jca.common.api.metadata.ds.XaDataSource;
@@ -38,6 +40,7 @@
 import org.jboss.jca.core.connectionmanager.pool.api.Pool;
 import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
 import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
+import org.jboss.jca.core.spi.connectionmanager.xa.XAResourceRecoveryImpl;
 import org.jboss.jca.core.spi.mdr.MetadataRepository;
 
 import java.lang.reflect.Method;
@@ -51,6 +54,7 @@
 
 import org.jboss.logging.Logger;
 import org.jboss.security.SubjectFactory;
+import org.jboss.tm.XAResourceRecoveryRegistry;
 
 /**
  * An abstract deployer implementation for datasources
@@ -69,6 +73,9 @@
    /** Metadata repository */
    protected MetadataRepository mdr;
 
+   /** xaResourceRecoveryRegistry */
+   protected XAResourceRecoveryRegistry xaResourceRecoveryRegistry;
+
    /**
     * Create a new AbstractDsDeployer.
     * @param log The logger
@@ -289,7 +296,7 @@
       // Select the correct connection manager
       TransactionSupportLevel tsl = TransactionSupportLevel.LocalTransaction;
       ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-      ConnectionManager cm = 
+      ConnectionManager cm =
          cmf.createTransactional(tsl, pool, getSubjectFactory(securityDomain), securityDomain,
                                  allocationRetry, allocationRetryWaitMillis,
                                  getTransactionManager(), null, null, null, null, null);
@@ -327,7 +334,8 @@
     * @return The connection factory
     * @exception Throwable Thrown if an error occurs during deployment
     */
-   private Object deployXADataSource(XaDataSource ds, String jndiName, String uniqueId, ClassLoader cl) throws Throwable
+   private Object deployXADataSource(XaDataSource ds, String jndiName, String uniqueId, ClassLoader cl)
+      throws Throwable
    {
       log.debug("XaDataSource=" + ds);
 
@@ -398,7 +406,7 @@
       ConnectionManager cm =
          cmf.createTransactional(tsl, pool, getSubjectFactory(securityDomain), securityDomain,
                                  allocationRetry, allocationRetryWaitMillis,
-                                 getTransactionManager(), interleaving, 
+                                 getTransactionManager(), interleaving,
                                  xaResourceTimeout, isSameRMOverride, wrapXAResource, padXid);
 
       cm.setJndiName(jndiName);
@@ -420,7 +428,66 @@
          injectValue(mcf, "setSpy", Boolean.TRUE);
          injectValue(mcf, "setJndiName", jndiName);
       }
+      Recovery recoveryMD = ds.getRecovery();
+      String defaultSecurityDomain = null;
+      String defaultUserName = null;
+      String defaultPassword = null;
 
+      if (ds.getSecurity() != null)
+      {
+         defaultSecurityDomain = ds.getSecurity().getSecurityDomain();
+         defaultUserName = ds.getSecurity().getUserName();
+         defaultPassword = ds.getSecurity().getPassword();
+      }
+      String recoverSecurityDomain = defaultSecurityDomain;
+      String recoverUser = defaultUserName;
+      String recoverPassword = defaultPassword;
+      XAResourceRecoveryImpl resourceRecovery = null;
+      if (recoveryMD == null || !recoveryMD.getNoRecovery())
+      {
+         // If we have an XAResourceRecoveryRegistry and the deployment is XA
+         // lets register it for XA Resource Recovery using the "recover" definitions
+         // from the -ds.xml file. Fallback to the standard definitions for
+         // user name, password. Keep a seperate reference to the security-domain
+
+         Credential credential = recoveryMD != null ? recoveryMD.getCredential() : null;
+         if (credential != null)
+         {
+            recoverSecurityDomain = credential.getSecurityDomain();
+
+            recoverUser = credential.getUserName();
+            recoverPassword = credential.getPassword();
+         }
+
+         if (log.isDebugEnabled())
+         {
+            if (recoverUser != null)
+            {
+               log.debug("RecoverUser=" + recoverUser);
+            }
+            else if (recoverSecurityDomain != null)
+            {
+               log.debug("RecoverSecurityDomain=" + recoverSecurityDomain);
+            }
+
+         }
+         resourceRecovery = new XAResourceRecoveryImpl(
+                                                       mcf,
+                                                       padXid,
+                                                       isSameRMOverride,
+                                                       wrapXAResource,
+                                                       recoverUser,
+                                                       recoverPassword,
+                                                       recoverSecurityDomain,
+                                                       null);
+
+      }
+
+      if (getXAResourceRecoveryRegistry() != null && resourceRecovery != null)
+      {
+         resourceRecovery.registerXaRecovery(getXAResourceRecoveryRegistry(),
+            cm.getJndiName());
+      }
       // ConnectionFactory
       return mcf.createConnectionFactory(cm);
    }
@@ -537,4 +604,23 @@
     * @exception DeployException Thrown if the security domain can't be resolved
     */
    protected abstract SubjectFactory getSubjectFactory(String securityDomain) throws DeployException;
+
+   /** Get the xAResourceRecoveryRegistry.
+    *
+    * @return the xAResourceRecoveryRegistry.
+    */
+   public final XAResourceRecoveryRegistry getXAResourceRecoveryRegistry()
+   {
+      return xaResourceRecoveryRegistry;
+   }
+
+   /**
+    * Set the xAResourceRecoveryRegistry.
+    *
+    * @param xAResourceRecoveryRegistry The xAResourceRecoveryRegistry to set.
+    */
+   public final void setXAResourceRecoveryRegistry(XAResourceRecoveryRegistry xAResourceRecoveryRegistry)
+   {
+      xaResourceRecoveryRegistry = xAResourceRecoveryRegistry;
+   }
 }

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java	2011-03-10 16:28:52 UTC (rev 110885)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java	2011-03-10 17:02:28 UTC (rev 110886)
@@ -29,6 +29,8 @@
 import org.jboss.jca.common.api.metadata.common.CommonTimeOut;
 import org.jboss.jca.common.api.metadata.common.CommonValidation;
 import org.jboss.jca.common.api.metadata.common.CommonXaPool;
+import org.jboss.jca.common.api.metadata.common.Credential;
+import org.jboss.jca.common.api.metadata.common.Recovery;
 import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
 import org.jboss.jca.common.api.metadata.ironjacamar.IronJacamar;
 import org.jboss.jca.common.api.metadata.ra.AdminObject;
@@ -46,6 +48,7 @@
 import org.jboss.jca.core.connectionmanager.pool.api.Pool;
 import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
 import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
+import org.jboss.jca.core.spi.connectionmanager.xa.XAResourceRecoveryImpl;
 import org.jboss.jca.validator.Failure;
 import org.jboss.jca.validator.FailureHelper;
 import org.jboss.jca.validator.Key;
@@ -84,6 +87,7 @@
 
 import org.jboss.logging.Logger;
 import org.jboss.security.SubjectFactory;
+import org.jboss.tm.XAResourceRecoveryRegistry;
 
 /**
  * An abstract resource adapter deployer which contains common functionality
@@ -105,6 +109,9 @@
    /** The configuration */
    private Configuration configuration = null;
 
+   /** xaResourceRecoveryRegistry */
+   protected org.jboss.tm.XAResourceRecoveryRegistry xaResourceRecoveryRegistry;
+
    /**
     * Create a new AbstractResourceAdapterDeployer.
     *
@@ -746,7 +753,8 @@
     */
    protected CommonDeployment createObjectsAndInjectValue(URL url, String deploymentName, File root, ClassLoader cl,
       Connector cmd, IronJacamar ijmd, org.jboss.jca.common.api.metadata.resourceadapter.ResourceAdapter raxml)
-      throws DeployException, ResourceException, ValidatorException, org.jboss.jca.core.spi.mdr.AlreadyExistsException,
+      throws DeployException, ResourceException, ValidatorException,
+      org.jboss.jca.core.spi.mdr.AlreadyExistsException,
              ClassNotFoundException, Throwable
    {
       Set<Failure> failures = null;
@@ -989,7 +997,7 @@
                      // Select the correct connection manager
                      if (tsl == TransactionSupportLevel.NoTransaction)
                      {
-                        cm = cmf.createNonTransactional(tsl, pool, 
+                        cm = cmf.createNonTransactional(tsl, pool,
                                                         getSubjectFactory(securityDomain), securityDomain,
                                                         allocationRetry, allocationRetryWaitMillis);
                      }
@@ -1030,10 +1038,10 @@
                            }
                         }
 
-                        cm = cmf.createTransactional(tsl, pool, 
+                        cm = cmf.createTransactional(tsl, pool,
                                                      getSubjectFactory(securityDomain), securityDomain,
                                                      allocationRetry, allocationRetryWaitMillis,
-                                                     getTransactionManager(), interleaving, 
+                                                     getTransactionManager(), interleaving,
                                                      xaResourceTimeout, isSameRMOverride,
                                                      wrapXAResource, padXid);
                      }
@@ -1328,12 +1336,13 @@
                                     if (allocationRetryWaitMillis == null)
                                        allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
                                  }
-
+                                 XAResourceRecoveryImpl resourceRecovery = null;
                                  // Select the correct connection manager
                                  if (tsl == TransactionSupportLevel.NoTransaction)
                                  {
-                                    cm = cmf.createNonTransactional(tsl, pool, 
-                                                                    getSubjectFactory(securityDomain), securityDomain,
+                                    cm = cmf.createNonTransactional(tsl, pool,
+                                                                    getSubjectFactory(securityDomain),
+                                       securityDomain,
                                                                     allocationRetry, allocationRetryWaitMillis);
                                  }
                                  else
@@ -1343,14 +1352,16 @@
                                     Boolean isSameRMOverride = null;
                                     Boolean wrapXAResource = null;
                                     Boolean padXid = null;
+                                    Recovery recoveryMD = null;
                                     if (cdRaXml != null && cdRaXml.isXa())
                                     {
-                                       CommonXaPool ijXaPool = (CommonXaPool) cdRaXml.getPool();
+                                       CommonXaPool cdRaXmlXaPool = (CommonXaPool) cdRaXml.getPool();
 
-                                       interleaving = ijXaPool.isInterleaving();
-                                       isSameRMOverride = ijXaPool.isSameRmOverride();
-                                       wrapXAResource = ijXaPool.isWrapXaDataSource();
-                                       padXid = ijXaPool.isPadXid();
+                                       interleaving = cdRaXmlXaPool.isInterleaving();
+                                       isSameRMOverride = cdRaXmlXaPool.isSameRmOverride();
+                                       wrapXAResource = cdRaXmlXaPool.isWrapXaDataSource();
+                                       padXid = cdRaXmlXaPool.isPadXid();
+                                       recoveryMD = cdRaXmlXaPool.getRecovery();
                                     }
 
                                     if (ijCD != null && ijCD.isXa())
@@ -1368,14 +1379,59 @@
 
                                        if (padXid == null)
                                           padXid = ijXaPool.isPadXid();
+                                       if (recoveryMD == null)
+                                          recoveryMD = ijXaPool.getRecovery();
                                     }
 
-                                    cm = cmf.createTransactional(tsl, pool, 
+                                    cm = cmf.createTransactional(tsl, pool,
                                                                  getSubjectFactory(securityDomain), securityDomain,
                                                                  allocationRetry, allocationRetryWaitMillis,
                                                                  getTransactionManager(), interleaving,
-                                                                 xaResourceTimeout, isSameRMOverride, 
+                                                                 xaResourceTimeout, isSameRMOverride,
                                                                  wrapXAResource, padXid);
+                                    String recoverSecurityDomain = securityDomain;
+                                    String recoverUser = null;
+                                    String recoverPassword = null;
+                                    if (recoveryMD == null || !recoveryMD.getNoRecovery())
+                                    {
+                                       // If we have an XAResourceRecoveryRegistry and the deployment is XA
+                                       // lets register it for XA Resource Recovery using the "recover" definitions
+                                       // from the -ds.xml file. Fallback to the standard definitions for
+                                       // user name, password. Keep a seperate reference to the security-domain
+
+                                       Credential credential = recoveryMD != null ? recoveryMD.getCredential() : null;
+                                       if (credential != null)
+                                       {
+                                          recoverSecurityDomain = credential.getSecurityDomain();
+
+                                          recoverUser = credential.getUserName();
+                                          recoverPassword = credential.getPassword();
+                                       }
+
+                                       if (log.isDebugEnabled())
+                                       {
+                                          if (recoverUser != null)
+                                          {
+                                             log.debug("RecoverUser=" + recoverUser);
+                                          }
+                                          else if (recoverSecurityDomain != null)
+                                          {
+                                             log.debug("RecoverSecurityDomain=" + recoverSecurityDomain);
+                                          }
+
+                                       }
+                                       resourceRecovery = new XAResourceRecoveryImpl(
+                                                                                     mcf,
+                                                                                     padXid,
+                                                                                     isSameRMOverride,
+                                                                                     wrapXAResource,
+                                                                                     recoverUser,
+                                                                                     recoverPassword,
+                                                                                     recoverSecurityDomain,
+                                                                                     getSubjectFactory(
+                                                                                        recoverSecurityDomain));
+
+                                    }
                                  }
 
                                  // ConnectionFactory
@@ -1468,12 +1524,16 @@
 
                                        pool.setName(poolName);
                                     }
-
+                                    if (getXAResourceRecoveryRegistry() != null && resourceRecovery != null)
+                                    {
+                                       resourceRecovery.registerXaRecovery(getXAResourceRecoveryRegistry(),
+                                          cm.getJndiName());
+                                    }
                                     if (activateDeployment)
                                     {
                                        org.jboss.jca.core.api.management.ManagedConnectionFactory mgtMcf =
                                           new org.jboss.jca.core.api.management.ManagedConnectionFactory(mcf);
-                                       
+
                                        mgtMcf.getConfigProperties().
                                           addAll(createManagementView(cdMeta.getConfigProperties()));
                                        mgtMcf.setPoolConfiguration(pc);
@@ -1495,7 +1555,7 @@
 
             failures = initAdminObject(cmd, cl, archiveValidationObjects, beanValidationObjects, failures, url,
                deploymentName, activateDeployment, raxml != null ? raxml.getAdminObjects() : null, ijmd != null
-               ? ijmd.getAdminObjects() : null, aos, aoJndiNames, activateDeployment ? mgtConnector : null);
+                  ? ijmd.getAdminObjects() : null, aos, aoJndiNames, activateDeployment ? mgtConnector : null);
          }
 
          // Archive validation
@@ -1785,4 +1845,24 @@
    protected abstract Object initAndInject(String value, List<? extends ConfigProperty> cpm, ClassLoader cl)
       throws DeployException;
 
+   /**
+    * Get the xAResourceRecoveryRegistry.
+    *
+    * @return the xAResourceRecoveryRegistry.
+    */
+   public final org.jboss.tm.XAResourceRecoveryRegistry getXAResourceRecoveryRegistry()
+   {
+      return xaResourceRecoveryRegistry;
+   }
+
+   /**
+    * Set the xAResourceRecoveryRegistry.
+    *
+    * @param xAResourceRecoveryRegistry The xAResourceRecoveryRegistry to set.
+    */
+   public final void setXAResourceRecoveryRegistry(XAResourceRecoveryRegistry xAResourceRecoveryRegistry)
+   {
+      xaResourceRecoveryRegistry = xAResourceRecoveryRegistry;
+   }
+
 }



More information about the jboss-cvs-commits mailing list