[jboss-cvs] JBossAS SVN: r104307 - in branches/JBPAPP_5_1: connector/src/main/org/jboss/resource/deployers/builder and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Apr 29 08:46:47 EDT 2010


Author: jesper.pedersen
Date: 2010-04-29 08:46:46 -0400 (Thu, 29 Apr 2010)
New Revision: 104307

Added:
   branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/metadata/mcf/RecoverSecurityDomainMetaData.java
   branches/JBPAPP_5_1/connector/src/resources/dtd/jboss-ds_5_1.dtd
Modified:
   branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/ManagedConnectionFactoryDeployment.java
   branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/deployers/builder/ManagedConnectionFactoryBuilder.java
   branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/metadata/mcf/XADataSourceDeploymentMetaData.java
   branches/JBPAPP_5_1/testsuite/imports/config/tests-crash-recovery.xml
Log:
[JBPAPP-3638] XA Resource Recovery (Part 1)

Modified: branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/ManagedConnectionFactoryDeployment.java
===================================================================
--- branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/ManagedConnectionFactoryDeployment.java	2010-04-29 12:23:22 UTC (rev 104306)
+++ branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/ManagedConnectionFactoryDeployment.java	2010-04-29 12:46:46 UTC (rev 104307)
@@ -25,6 +25,9 @@
 import java.beans.PropertyEditorManager;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.Principal;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -47,6 +50,9 @@
 import javax.resource.spi.ManagedConnectionFactory;
 import javax.resource.spi.ResourceAdapter;
 import javax.resource.spi.ResourceAdapterAssociation;
+import javax.resource.spi.security.PasswordCredential;
+import javax.security.auth.Subject;
+import javax.transaction.xa.XAResource;
 
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.logging.Logger;
@@ -57,7 +63,14 @@
 import org.jboss.resource.metadata.DescriptionGroupMetaData;
 import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentMetaData;
 import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryPropertyMetaData;
+import org.jboss.resource.metadata.mcf.SecurityMetaData;
+import org.jboss.resource.metadata.mcf.XAConnectionPropertyMetaData;
+import org.jboss.resource.metadata.mcf.XADataSourceDeploymentMetaData;
+import org.jboss.security.SimplePrincipal;
+import org.jboss.security.SubjectFactory;
 import org.jboss.system.ServiceDynamicMBeanSupport;
+import org.jboss.tm.XAResourceRecovery;
+import org.jboss.tm.XAResourceRecoveryRegistry;
 import org.jboss.util.Classes;
 import org.jboss.util.NestedRuntimeException;
 import org.jboss.util.StringPropertyReplacer;
@@ -72,7 +85,8 @@
  * @author <a href="weston.price at jboss.org">Weston Price</a>
  * @version $Revision$
  */
-public class ManagedConnectionFactoryDeployment extends ServiceDynamicMBeanSupport implements ManagedConnectionFactory
+public class ManagedConnectionFactoryDeployment extends ServiceDynamicMBeanSupport 
+   implements ManagedConnectionFactory, XAResourceRecovery
 {
 
    /** The serialVersionUID */
@@ -126,6 +140,13 @@
    private ManagedConnectionFactoryDeploymentMetaData dmd;
    
    private ConnectorMetaData cmd;
+
+   private boolean recoveryRegistered = false;
+   private XAResourceRecoveryRegistry xrrr = null;
+   private SubjectFactory subjectFactory = null;
+   private String recoverSecurityDomain = null;
+   private String recoverUserName = null;
+   private String recoverPassword = null;
    
    /**
     * Default managed constructor for RARDeployment mbeans.
@@ -314,7 +335,27 @@
    {
       return mcf;
    }
-   
+
+   public XAResourceRecoveryRegistry getXAResourceRecoveryRegistry()
+   {
+      return xrrr;
+   }
+
+   public void setXAResourceRecoveryRegistry(XAResourceRecoveryRegistry xrrr)
+   {
+      this.xrrr = xrrr;
+   }
+
+   public SubjectFactory getSubjectFactory()
+   {
+      return subjectFactory;
+   }
+
+   public void setSubjectFactory(SubjectFactory sf)
+   {
+      this.subjectFactory = sf;
+   }
+
    protected void startService() throws Exception
    {
       if (mcf != null)
@@ -375,14 +416,226 @@
          ResourceAdapterAssociation raa = (ResourceAdapterAssociation) mcf;
          raa.setResourceAdapter(resourceAdapter);
       }
+
+      if (dmd instanceof XADataSourceDeploymentMetaData)
+      {
+         XADataSourceDeploymentMetaData xdsdm = (XADataSourceDeploymentMetaData)dmd;
+         XAResourceRecoveryRegistry xrrr = getXAResourceRecoveryRegistry();
+
+         if (xrrr != null && !xdsdm.isNoRecover())
+         {
+            // 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 and security-domain
+
+            SecurityMetaData recoverSecurityDomainMD = xdsdm.getRecoverSecurityMetaData();
+            if (recoverSecurityDomainMD == null)
+               recoverSecurityDomainMD = xdsdm.getSecurityMetaData();
+
+            if (recoverSecurityDomainMD != null)
+               recoverSecurityDomain = recoverSecurityDomainMD.getDomain();
+
+            recoverUserName = xdsdm.getRecoverUserName();
+            recoverPassword = xdsdm.getRecoverPassWord();
+
+            if (recoverUserName == null)
+            {
+               for (XAConnectionPropertyMetaData xcpmd : xdsdm.getXADataSourceProperties())
+               {
+                  if (xcpmd.getName().equals("RecoverUser"))
+                     recoverUserName = xcpmd.getValue();
+               }
+            }
+
+            if (recoverUserName == null)
+            {
+               for (XAConnectionPropertyMetaData xcpmd : xdsdm.getXADataSourceProperties())
+               {
+                  if (xcpmd.getName().equals("User"))
+                     recoverUserName = xcpmd.getValue();
+               }
+            }
+
+            if (recoverPassword == null)
+            {
+               for (XAConnectionPropertyMetaData xcpmd : xdsdm.getXADataSourceProperties())
+               {
+                  if (xcpmd.getName().equals("RecoverPassword"))
+                     recoverPassword = xcpmd.getValue();
+               }
+            }
+
+            if (recoverPassword == null)
+            {
+               for (XAConnectionPropertyMetaData xcpmd : xdsdm.getXADataSourceProperties())
+               {
+                  if (xcpmd.getName().equals("Password"))
+                     recoverPassword = xcpmd.getValue();
+               }
+            }
+
+            if (recoverUserName == null)
+               recoverUserName = xdsdm.getUserName();
+
+            if (recoverPassword == null)
+               recoverPassword = xdsdm.getPassWord();
+
+            if (log.isDebugEnabled())
+               log.debug("Registered for XA Resource Recovery: " + xdsdm.getJndiName());
+
+            if (log.isDebugEnabled())
+               log.debug("RecoverUserName=" + recoverUserName);
+
+            if (log.isDebugEnabled())
+               log.debug("RecoverSecurityDomain=" + recoverSecurityDomain);
+
+            xrrr.addXAResourceRecovery(this);
+            recoveryRegistered = true;
+         }
+      }
    }
 
    protected void stopService()
    {
+      if (recoveryRegistered)
+      {
+         XAResourceRecoveryRegistry xrrr = getXAResourceRecoveryRegistry();
+
+         if (xrrr != null)
+         {
+            xrrr.removeXAResourceRecovery(this);
+            recoveryRegistered = false;
+
+            if (log.isDebugEnabled())
+               log.debug("Unregistered for XA Resource Recovery: " + dmd.getJndiName());
+         }
+      }
+
       mcf = null;
       mcfClass = null;
    }
 
+   /**
+    * 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. 
+    */
+   public XAResource[] getXAResources()
+   {
+      if (recoveryRegistered)
+      {
+         try
+         {
+            Subject subject = getSubject();
+
+            // Check if we got a valid Subject instance; requirement for recovery
+            if (subject != null)
+            {
+               ManagedConnection mc = createManagedConnection(subject, null);
+
+               XAResource xaResource = mc.getXAResource();
+
+               // TODO: EISName, ...
+
+               if (log.isDebugEnabled())
+                  log.debug("Recovery XAResource=" + xaResource + " for " + dmd.getJndiName());
+            
+               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);
+         }
+      }
+
+      if (log.isDebugEnabled())
+         log.debug("Recovery not registered for " + dmd.getJndiName());
+
+      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>() 
+      {
+         public Subject run()
+         {
+            if (recoverUserName != null && recoverPassword != null && recoverSecurityDomain == 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
+               Subject subject = subjectFactory.createSubject(recoverSecurityDomain);
+
+               if (recoverUserName != null && recoverPassword != null)
+               {
+                  // 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;
+            }
+         }
+      });
+   }
+   
    public void setManagedConnectionFactoryAttribute(String name, Class clazz, Object value)
    {
       setManagedConnectionFactoryAttribute(name, clazz, value, false);
@@ -590,7 +843,7 @@
       return mcf.createConnectionFactory(cxManager);
    }
 
-   public ManagedConnection createManagedConnection(javax.security.auth.Subject subject,
+   public ManagedConnection createManagedConnection(Subject subject,
          ConnectionRequestInfo cxRequestInfo) throws ResourceException
    {
       return mcf.createManagedConnection(subject, cxRequestInfo);
@@ -620,7 +873,7 @@
       return mcf.hashCode();
    }
 
-   public ManagedConnection matchManagedConnections(java.util.Set connectionSet, javax.security.auth.Subject subject,
+   public ManagedConnection matchManagedConnections(java.util.Set connectionSet, Subject subject,
          ConnectionRequestInfo cxRequestInfo) throws ResourceException
    {
       return mcf.matchManagedConnections(connectionSet, subject, cxRequestInfo);
@@ -651,6 +904,8 @@
       attributes.add(new MBeanAttributeInfo("CredentialInterface", String.class.getName(), "The Credential Interface", true, false, false));
       attributes.add(new MBeanAttributeInfo("ReauthenticationSupport", Boolean.class.getName(), "The Reauthentication Support", true, false, true));
       attributes.add(new MBeanAttributeInfo("McfInstance", "javax.resource.spi.ManagedConnectionFactory", "The ManagedConnectionFactory instance", true, false, false));
+      attributes.add(new MBeanAttributeInfo("XAResourceRecoveryRegistry", XAResourceRecoveryRegistry.class.getName(), "The XAResource Recovery Registry", true, false, false));
+      attributes.add(new MBeanAttributeInfo("SubjectFactory", SubjectFactory.class.getName(), "The subject factory used for recovery", true, false, false));
       
 //      ConnectionDefinitionMetaData cdmd = cmd.getConnectionDefinition(this.connectionDefinition);
       
@@ -672,8 +927,15 @@
       if("OldRarDeployment".equals(attribute.getName()))
       {
          this.oldRarDeployment = (ObjectName)attribute.getValue();
-         
       }
+      else if("XAResourceRecoveryRegistry".equals(attribute.getName()))
+      {
+         this.xrrr = (XAResourceRecoveryRegistry)attribute.getValue();
+      }
+      else if("SubjectFactory".equals(attribute.getName()))
+      {
+         this.subjectFactory = (SubjectFactory)attribute.getValue();
+      }
    }
 
    @Override
@@ -778,6 +1040,14 @@
       {
          result = mcf;               
       }
+      else if("XAResourceRecoveryRegistry".equals(attribute))
+      {
+         result = xrrr;               
+      }
+      else if("SubjectFactory".equals(attribute))
+      {
+         result = subjectFactory;               
+      }
       
       if(result == null)
       {

Modified: branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/deployers/builder/ManagedConnectionFactoryBuilder.java
===================================================================
--- branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/deployers/builder/ManagedConnectionFactoryBuilder.java	2010-04-29 12:23:22 UTC (rev 104306)
+++ branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/deployers/builder/ManagedConnectionFactoryBuilder.java	2010-04-29 12:46:46 UTC (rev 104307)
@@ -33,6 +33,7 @@
 import org.jboss.system.metadata.ServiceAttributeMetaData;
 import org.jboss.system.metadata.ServiceConstructorMetaData;
 import org.jboss.system.metadata.ServiceDependencyMetaData;
+import org.jboss.system.metadata.ServiceInjectionValueMetaData;
 
 /**
  * A ManagedConnectionFactoryBuilder.
@@ -46,6 +47,8 @@
    private static final String MCF = "org.jboss.resource.connectionmanager.ManagedConnectionFactoryDeployment";
    private static final String RAR_JMX = "jboss.jca:service=RARDeployment,name='";
    private static final String MCF_JMX = "jboss.jca:service=ManagedConnectionFactory,name=";
+   private static final String SUBJECT_FACTORY = "JBossSecuritySubjectFactory";
+   private static final String TRANSACTION_MANAGER_SERVICE = "jboss:service=TransactionManager";
 
    private DefaultJCAMetaDataRepository repository;
    
@@ -67,9 +70,25 @@
    @Override
    public List<ServiceAttributeMetaData> buildAttributes(ManagedConnectionFactoryDeploymentMetaData deployment)
    {
+      // This code uses the MC/JMX bridge to inject MC beans into JMX components
+
       List<ServiceAttributeMetaData> attributes = new ArrayList<ServiceAttributeMetaData>();
+
       ServiceAttributeMetaData attribute = buildDependencyAttribute("OldRarDeployment", RAR_JMX + deployment.getRarName() + "'");      
       attributes.add(attribute);            
+
+      attribute = new ServiceAttributeMetaData();
+      attribute.setName("SubjectFactory");
+      ServiceInjectionValueMetaData sf = new ServiceInjectionValueMetaData(SUBJECT_FACTORY);
+      attribute.setValue(sf);      
+      attributes.add(attribute);
+
+      attribute = new ServiceAttributeMetaData();
+      attribute.setName("XAResourceRecoveryRegistry");
+      ServiceInjectionValueMetaData xrrr = new ServiceInjectionValueMetaData(TRANSACTION_MANAGER_SERVICE);
+      attribute.setValue(xrrr);      
+      attributes.add(attribute);
+
       return attributes;
    }
    
@@ -97,9 +116,8 @@
          ServiceDependencyMetaData depends = buildDependency(string);
          dependencies.add(depends);         
       }
-    
+
       return dependencies;
-  
    }
    
    @Override   

Added: branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/metadata/mcf/RecoverSecurityDomainMetaData.java
===================================================================
--- branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/metadata/mcf/RecoverSecurityDomainMetaData.java	                        (rev 0)
+++ branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/metadata/mcf/RecoverSecurityDomainMetaData.java	2010-04-29 12:46:46 UTC (rev 104307)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.resource.metadata.mcf;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * A RecoverSecurityDomainMetaData.
+ * 
+ * @author <a href="jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @version $Revision: 85945 $
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name="recover-security-domain")
+public class RecoverSecurityDomainMetaData extends SecurityDomainMetaData
+{   
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 1L;
+   
+   public RecoverSecurityDomainMetaData()
+   {
+      type = SecurityDeploymentType.DOMAIN;
+   }
+}

Modified: branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/metadata/mcf/XADataSourceDeploymentMetaData.java
===================================================================
--- branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/metadata/mcf/XADataSourceDeploymentMetaData.java	2010-04-29 12:23:22 UTC (rev 104306)
+++ branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/metadata/mcf/XADataSourceDeploymentMetaData.java	2010-04-29 12:46:46 UTC (rev 104307)
@@ -70,6 +70,21 @@
    @XmlElement(name="xa-resource-timeout")
    private int xaResourceTimeout;
 
+   @XmlElement(name="recover-user-name")
+   @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+   private String recoverUserName;
+   
+   @XmlElement(name="recover-password")
+   @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+   private String recoverPassWord;
+
+   @XmlElement(name="no-recover")
+   private Boolean noRecover = Boolean.FALSE;
+
+   /** The recoverSecurityMetaData */
+   @XmlElement(name="recover-security-domain", type=RecoverSecurityDomainMetaData.class)
+   private SecurityMetaData recoverSecurityMetaData;
+
    public XADataSourceDeploymentMetaData()
    {
       setRarName(RAR_NAME);
@@ -183,4 +198,62 @@
 
       return properties;
    }
+
+   @ManagementProperty(name="recover-password", description="The DataSource password for recovery",
+         includeInTemplate=true)
+   public String getRecoverPassWord()
+   {
+      return recoverPassWord;
+   }
+
+   public void setRecoverPassWord(String passWord)
+   {
+      this.recoverPassWord = passWord;
+   }
+
+   @ManagementProperty(name="recover-user-name", description="The DataSource username for recovery",
+         includeInTemplate=true)
+   public String getRecoverUserName()
+   {
+      return recoverUserName;
+   }
+
+   public void setRecoverUserName(String userName)
+   {
+      this.recoverUserName = userName;
+   }
+
+   /**
+    * Get the recoverSecurityMetaData.
+    * 
+    * @return the securityMetaData.
+    */
+   @ManagementProperty(name="recover-security-domain",
+         description="The security-domain used for recovery connections",
+         includeInTemplate=true)
+   public SecurityMetaData getRecoverSecurityMetaData()
+   {
+      return recoverSecurityMetaData;
+   }
+
+   /**
+    * Set the recoverSecurityMetaData.
+    * 
+    * @param securityMetaData The securityMetaData to set.
+    */
+   public void setRecoverSecurityMetaData(SecurityMetaData securityMetaData)
+   {
+      this.recoverSecurityMetaData = securityMetaData;
+   }
+
+   // <no-recover/> element - currently not exposed in the DTD
+   public Boolean isNoRecover()
+   {
+      return noRecover;
+   }
+
+   public void setNoRecover(Boolean nr)
+   {
+      this.noRecover = nr;
+   }
 }

Added: branches/JBPAPP_5_1/connector/src/resources/dtd/jboss-ds_5_1.dtd
===================================================================
--- branches/JBPAPP_5_1/connector/src/resources/dtd/jboss-ds_5_1.dtd	                        (rev 0)
+++ branches/JBPAPP_5_1/connector/src/resources/dtd/jboss-ds_5_1.dtd	2010-04-29 12:46:46 UTC (rev 104307)
@@ -0,0 +1,540 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+
+<!-- DTD for the JCA 1.5 datasources and connection factory configurations (*-ds.xml) in JBoss-5.1.x,
+     transformed by ConnectionFactoryTemplate.xsl
+
+DOCTYPE datasources
+    PUBLIC "-//JBoss//DTD JBOSS JCA Config 5.1//EN"
+    "http://www.jboss.org/j2ee/dtd/jboss-ds_5_1.dtd"
+
+DOCTYPE connection-factories
+    PUBLIC "-//JBoss//DTD JBOSS JCA Config 5.1//EN"
+    "http://www.jboss.org/j2ee/dtd/jboss-ds_5_1.dtd"
+
+$Id: jboss-ds_5_1.dtd 85945 2009-03-16 19:45:12Z dimitris at jboss.org $
+-->
+
+<!--
+The datasources element is the root of the jdbc datasource configuration
+-->
+<!ELEMENT datasources (loader-repository? , (mbean | local-tx-datasource | xa-datasource | no-tx-datasource |
+ ha-local-tx-datasource | ha-xa-datasource)*)>
+
+<!-- Specify a jca-jdbc non-XADatasource (local) wrapper, using no transactions
+-->
+<!ELEMENT no-tx-datasource (jndi-name , use-java-context?, connection-url , 
+url-delimiter?, url-selector-strategy-class-name?, 
+driver-class , connection-property* , user-name? , password? ,
+(application-managed-security | security-domain | security-domain-and-application)? ,
+min-pool-size? , max-pool-size? , blocking-timeout-millis? , background-validation?, background-validation-minutes? , idle-timeout-minutes?,
+allocation-retry?, allocation-retry-wait-millis?, validate-on-match?, new-connection-sql?, check-valid-connection-sql?, valid-connection-checker-class-name?,
+exception-sorter-class-name?, stale-connection-checker-class-name?, track-statements?, 
+prefill?, use-fast-fail?,
+prepared-statement-cache-size?, share-prepared-statements? , set-tx-query-timeout?, query-timeout?, use-try-lock?,
+metadata?, type-mapping?, depends*)>
+
+<!-- Specify a jca-jdbc non-XADatasource (local) wrapper, using local
+transactions
+-->
+<!ELEMENT local-tx-datasource (jndi-name , use-java-context?, connection-url ,
+url-delimiter?, url-selector-strategy-class-name?, 
+driver-class, transaction-isolation? , connection-property* , user-name? , password? ,
+(application-managed-security | security-domain | security-domain-and-application)? ,
+min-pool-size? , max-pool-size? , blocking-timeout-millis? , background-validation?, background-validation-minutes?, 
+validate-on-match?, idle-timeout-minutes? , allocation-retry?, allocation-retry-wait-millis?, 
+no-tx-separate-pools? , new-connection-sql? , check-valid-connection-sql? ,
+valid-connection-checker-class-name? , exception-sorter-class-name? , stale-connection-checker-class-name?, track-statements? ,
+prefill?, use-fast-fail?,
+prepared-statement-cache-size?, share-prepared-statements? , set-tx-query-timeout?, query-timeout?, use-try-lock?,
+metadata?, type-mapping?, depends*)>
+
+<!-- Specify a jca-jdbc XADatasource wrapper
+-->
+<!ELEMENT xa-datasource (jndi-name , use-java-context?, track-connection-by-tx?, interleaving?, xa-datasource-class,
+xa-datasource-property* , url-property?, url-delimiter?, url-selector-strategy-class-name?,
+isSameRM-override-value? , transaction-isolation? , user-name? , password? , recover-user-name? , recover-password? , no-recover?,
+(application-managed-security | security-domain | security-domain-and-application)? , recover-security-domain?,
+min-pool-size? , max-pool-size? , blocking-timeout-millis? , background-validation?, background-validation-minutes? , idle-timeout-minutes? ,
+allocation-retry?, allocation-retry-wait-millis?, validate-on-match?, no-tx-separate-pools? , xa-resource-timeout?, new-connection-sql? , check-valid-connection-sql? ,
+valid-connection-checker-class-name? , exception-sorter-class-name? , stale-connection-checker-class-name?, track-statements? ,
+prefill?, use-fast-fail?,
+prepared-statement-cache-size?, share-prepared-statements? , set-tx-query-timeout?, query-timeout?, use-try-lock?,
+metadata?, type-mapping?, depends*)>
+
+<!-- The JNDI name under which the DataSource wrapper will be bound. Note that
+this name is relative to the "java:/" prefix unless use-java-context is false.
+Ex:
+<jndi-name>DefaultDS</jndi-name>
+-->
+<!ELEMENT jndi-name (#PCDATA)>
+
+<!-- Setting this to false will bind the DataSource into global jndi
+Ex:
+<use-java-context>false</use-java-context>
+-->
+<!ELEMENT use-java-context (#PCDATA)>
+
+<!-- The JDBC driver connection URL string
+Ex:
+<connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>
+-->
+<!ELEMENT connection-url (#PCDATA)>
+
+<!-- The fully qualifed name of the JDBC driver class
+   Ex:
+   <driver-class>org.hsqldb.jdbcDriver</driver-class>
+-->
+<!ELEMENT driver-class (#PCDATA)>
+
+<!-- Set java.sql.Connection transaction isolation level to use.
+The constants defined in the interface Connection are the possible transaction
+isolation levels and include:
+   TRANSACTION_READ_UNCOMMITTED
+   TRANSACTION_READ_COMMITTED
+   TRANSACTION_REPEATABLE_READ
+   TRANSACTION_SERIALIZABLE
+   TRANSACTION_NONE
+
+   Ex:
+   <transaction-isolation>TRANSACTION_SERIALIZABLE</transaction-isoation>
+-->
+<!ELEMENT transaction-isolation (#PCDATA)>
+
+<!-- Specify the default username used when creating a new connection.
+   Ex:
+   <user-name>sa</user-name>
+-->
+<!ELEMENT user-name (#PCDATA)>
+
+<!-- Specify the default password used when creating a new connection.
+   Ex:
+   <password>sa-pass</password>
+-->
+<!ELEMENT password (#PCDATA)>
+
+<!-- Specify the username used when creating a connection during recovery.
+   Ex:
+   <recover-user-name>sa</recover-user-name>
+-->
+<!ELEMENT recover-user-name (#PCDATA)>
+
+<!-- Specify the password used when creating a connection during recovery.
+   Ex:
+   <recover-password>sa-pass</recover-password>
+-->
+<!ELEMENT recover-password (#PCDATA)>
+
+<!-- Specify if the xa-datasource should be excluded from recovery.
+     Default: false
+   Ex:
+   <no-recover>true</no-recover>
+-->
+<!ELEMENT no-recover (#PCDATA)>
+
+<!-- Indicates that app supplied parameters (such as from getConnection(user, pw))
+are used to distinguish connections in the pool.
+   Ex:
+   <application-managed-security/>
+-->
+<!ELEMENT application-managed-security EMPTY>
+
+<!-- Indicates Subject (from security domain) are used to distinguish connections in the pool. 
+The content of the security-domain is the name of the JAAS security manager that will handle
+authentication. This name correlates to the JAAS login-config.xml descriptor
+application-policy/name attribute.
+
+   Ex:
+   <security-domain>HsqlDbRealm</security-domain>
+-->
+<!ELEMENT security-domain (#PCDATA)>
+
+<!-- Indicates that either app supplied parameters (such as from
+getConnection(user, pw)) or Subject (from security domain) are used to
+distinguish connections in the pool. The content of the
+security-domain is the name of the JAAS security manager that will handle
+authentication. This name correlates to the JAAS login-config.xml descriptor
+application-policy/name attribute.
+
+   Ex:
+   <security-domain-and-application>HsqlDbRealm</security-domain-and-application>
+-->
+<!ELEMENT security-domain-and-application (#PCDATA)>
+
+<!-- Indicates the Subject (from security domain) that are used to distinguish connection used for recovery. 
+The content of the recover-security-domain is the name of the JAAS security manager that will handle
+authentication. This name correlates to the JAAS login-config.xml descriptor
+application-policy/name attribute.
+
+   Ex:
+   <recover-security-domain>OracleDbRealm</recover-security-domain>
+-->
+<!ELEMENT recover-security-domain (#PCDATA)>
+
+<!-- Whether to use separete pools for connection retrieved in a transaction
+     and those retieved outside a transaction
+e.g.
+     <no-tx-separate-pools/>
+-->
+<!ELEMENT no-tx-separate-pools EMPTY>
+
+<!-- The min-pool-size element indicates the minimum number of connections a
+pool should hold. These are not created until a Subject is known from a
+request for a connection. This default to 0.
+
+   Ex:
+   <min-pool-size>1</min-pool-size>
+-->
+<!ELEMENT min-pool-size (#PCDATA)>
+
+<!-- The max-pool-size element indicates the maximum number of connections for a
+pool. No more than MaxSize connections will be created in each sub-pool. This
+defaults to 20.
+-->
+<!ELEMENT max-pool-size (#PCDATA)>
+
+<!-- The blocking-timeout-millis element indicates the maximum time in
+milliseconds to block while waiting for a connection before throwing an
+exception. Note that this blocks only while waiting for a permit for a
+connection, and will never throw an exception if creating a new connection
+takes an inordinately long time. The default is 30000 (30 seconds).
+-->
+<!ELEMENT blocking-timeout-millis (#PCDATA)>
+
+<!-- The idle-timeout-minutes elements indicates the maximum time in
+minutes a connection may be idle before being closed.  The actual maximum time
+depends also on the IdleRemover scan time, which is 1/2 the smallest
+idle-timeout-minutes of any pool.
+-->
+<!ELEMENT idle-timeout-minutes (#PCDATA)>
+
+<!-- The allocation retry element indicates the number of times that allocating
+a connection should be tried before throwing an exception. The default is 0.
+-->
+<!ELEMENT allocation-retry (#PCDATA)>
+
+<!-- The allocation retry wait millis element indicates the time in
+milliseconds to wait between retrying to allocate a connection. 
+The default is 5000 (5 seconds).
+-->
+<!ELEMENT allocation-retry-wait-millis (#PCDATA)>
+
+<!-- The validate-on-match element indicates whether or not connection level validation should be done when a connection factory attempts to
+match a managed connection for a given set. This is typically exclusive to the use of background validation -->
+
+<!ELEMENT validate-on-match (#PCDATA)>
+
+<!-- An element to specify that connections should be validated on a background thread versus being validated
+     prior to use-->
+<!ELEMENT background-validation (#PCDATA)>
+
+<!-- The background-validation-minutes element specifies the amount of time, in minutes, that background validation
+     will run. -->
+<!ELEMENT background-validation-minutes (#PCDATA)>
+
+<!-- An element to specify that all intermediate end(suspend) and
+start(resume) calls.  Also, all work on one tx will go through one
+connection.
+A side effect of this (currently at least) is that a connection will only
+be usable by one tx until the tx commits.
+   Ex:
+   <track-connection-by-tx/>
+DEPRECATED: this element is now deprecated (it is assumed to present by default, also see <interleaving/>)
+-->
+<!ELEMENT track-connection-by-tx EMPTY>
+
+<!-- An element to enable interleaving for XA connection factories
+   Ex:
+   <interleaving/>
+-->
+<!ELEMENT interleaving EMPTY>
+
+<!-- The fully qualifed name of the javax.sql.XADataSource implementation class.
+   Ex:
+   <xa-datasource-class>com.informix.jdbcx.IfxXADataSource</xa-datasource-class>
+-->
+<!ELEMENT xa-datasource-class (#PCDATA)>
+
+<!-- Specify a property to assign to the XADataSource implementation class.
+Each property is identified by the name attribute and the property value is
+given by the xa-datasource-property element content. The property is mapped
+onto the XADataSource implementation by looking for a JavaBeans style
+getter method for the property name. If found, the value of the property is
+set using the JavaBeans setter with the element text translated to the true
+property type using the java.beans.PropertyEditor for the type.
+
+   Ex:
+    <xa-datasource-property name="IfxWAITTIME">10</xa-datasource-property>
+    <xa-datasource-property name="IfxIFXHOST">myhost.mydomain.com</xa-datasource-property>
+    <xa-datasource-property name="PortNumber">1557</xa-datasource-property>
+    <xa-datasource-property name="DatabaseName">mydb</xa-datasource-property>
+    <xa-datasource-property name="ServerName">myserver</xa-datasource-property>
+-->
+<!ELEMENT xa-datasource-property (#PCDATA)>
+
+<!-- The xa-datasource-property name attribute specifies the name of the
+XADataSource attribute the xa-datasource-property element content provides
+the value of.
+-->
+<!ATTLIST xa-datasource-property name CDATA  #REQUIRED>
+
+<!-- The isSameRM-override-value element allows one to unconditionally set
+whether the javax.transaction.xa.XAResource.isSameRM(XAResource) returns
+true or false.
+
+Ex:
+<isSameRM-override-value>true</isSameRM-override-value>
+-->
+<!ELEMENT isSameRM-override-value (#PCDATA)>
+
+<!-- The connection-property element allows you to pass in arbitrary connection
+properties to the Driver.connect(url, props) method. Each connection-property
+specifies a string name/value pair with the property name coming from the
+name attribute and the value coming from the element content.
+
+   Ex:
+   <connection-property name="char.encoding">UTF-8</connection-property>
+-->
+<!ELEMENT connection-property (#PCDATA)>
+
+<!-- The connection-property name attribute gives the name of the connection
+property.
+-->
+<!ATTLIST connection-property name CDATA  #REQUIRED>
+
+<!-- Specify an SQL statement to execute whenever a connection is added to
+the connection pool.
+-->
+<!ELEMENT new-connection-sql (#PCDATA)>
+
+<!-- Specify an SQL statement to check validity of a pool connection. This
+may be called when managed connection is taken from pool for use.
+-->
+<!ELEMENT check-valid-connection-sql (#PCDATA)>
+
+<!-- An org.jboss.resource.adapter.jdbc.ValidConnectionChecker that provides
+a SQLException isValidConnection(Connection e) method to validate is a connection
+is valid. An exception means the connection is destroyed.
+This overrides the check-valid-connection-sql when present.
+
+Ex:
+<exception-sorter-class-name>
+   org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker
+</exception-sorter-class-name>
+-->
+<!ELEMENT valid-connection-checker-class-name (#PCDATA)>
+
+<!-- An org.jboss.resource.adapter.jdbc.ExceptionSorter that provides
+a boolean isExceptionFatal(SQLException e) method to validate is an exception
+should be broadcast to all javax.resource.spi.ConnectionEventListener as
+a connectionErrorOccurred message.
+
+Ex:
+<exception-sorter-class-name>
+   org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
+</exception-sorter-class-name>
+<exception-sorter-class-name>
+   org.jboss.resource.adapter.jdbc.vendor.SybaseExceptionSorter
+</exception-sorter-class-name>
+-->
+<!ELEMENT exception-sorter-class-name (#PCDATA)>
+
+<!-- An org.jboss.resource.adapter.jdbc.StaleConnectionChecker that provides
+a boolean isStaleConnection(SQLException e) method which if it it returns
+true will wrap the exception in an
+org.jboss.resource.adapter.jdbc.StaleConnectionException
+which is a subclass of SQLException.
+
+Ex:
+<stale-connection-checker-class-name>
+   org.jboss.resource.adapter.jdbc.vendor.OracleStaleConnectionChecker
+</stale-connection-checker-class-name>
+-->
+<!ELEMENT stale-connection-checker-class-name (#PCDATA)>
+
+<!-- Whether to check for unclosed statements when a
+     connection is returned to the pool and result sets are
+     closed when a statement is closed/return to the prepared
+     statement cache.
+     valid values are:
+     false - do not track statements and results
+     true - track statements and result sets and warn when they are not closed
+     nowarn - track statements but do no warn about them being unclosed (the default)
+     e.g.
+     <track-statements>nowarn</track-statements>
+-->
+<!ELEMENT track-statements EMPTY>
+
+<!-- Whether to attempt to prefill the connection pool. Empty element denotes a false value.
+   e.g.
+    <prefill>true</prefill>
+    -->
+<!ELEMENT  prefill (#PCDATA) >
+
+<!-- Whether fail a connection allocation on the first connection if it is invalid (true)
+     or keep trying until the pool is exhausted of all potential connections (false)
+     
+     default false.
+   e.g.
+    <use-fast-fail>true</use-fast-fail>
+    -->
+<!ELEMENT use-fast-fail (#PCDATA) >
+
+<!-- The number of prepared statements per connection in an LRU cache
+-->
+<!ELEMENT prepared-statement-cache-size (#PCDATA)>
+
+<!-- whether to share prepare statements, i.e. whether asking for same
+     statement twice without closing uses the same underlying prepared statement.
+
+     The default is false.
+     e.g.
+     <share-prepared-statements/>
+-->
+<!ELEMENT share-prepared-statements EMPTY>
+
+<!-- whether to set the query timeout based on the time remaining until transaction timeout,
+     any configured query timeout will be used if there is no transaction.
+
+     The default is false.
+     e.g.
+     <set-tx-query-timeout/>
+-->
+<!ELEMENT set-tx-query-timeout EMPTY>
+
+<!-- Any configured query timeout in seconds
+
+     The default is no timeout
+     e.g. 5 minutes
+     <query-timeout>300</query-timeout>
+-->
+<!ELEMENT query-timeout (#PCDATA)>
+
+<!-- Any configured timeout for internal locks on the resource adapter objects in milli-seconds
+
+     The default is a 60 second timeout
+     e.g. 5 minutes
+     <use-try-lock>300000</use-try-lock>
+-->
+<!ELEMENT use-try-lock (#PCDATA)>
+
+<!-- The depends element specifies the JMX ObjectName string of a service
+that the connection manager services depend on.
+
+   Ex:
+   <depends>jboss:service=Hypersonic</depends>
+-->
+<!ELEMENT depends (#PCDATA)>
+
+<!-- The connection-factories element is the root of the generic jca adaptor section
+-->
+<!ELEMENT connection-factories (loader-repository? , (mbean | tx-connection-factory | no-tx-connection-factory)*)>
+
+<!-- The loader repository -->
+<!ELEMENT loader-repository ANY>
+
+<!-- Any embedded mbean -->
+<!ELEMENT mbean ANY>
+
+<!-- The tx-connection-factory element is used to configure generic resource
+adapters supporting transactions
+-->
+<!ELEMENT tx-connection-factory (jndi-name , (local-transaction | xa-transaction) ,
+track-connection-by-tx? , rar-name?, connection-definition?, config-property* ,
+(application-managed-security | security-domain | security-domain-and-application)? ,
+min-pool-size? , max-pool-size? , blocking-timeout-millis? , background-validation?, background-validation-minutes? , idle-timeout-minutes? ,
+allocation-retry?, allocation-retry-wait-millis?, no-tx-separate-pools?, prefill?, use-fast-fail?, xa-resource-timeout?,
+metadata?, type-mapping?, depends*)>
+
+<!-- The no-tx-connection-factory element is used to configure generic resource
+adapters that do not support transactions
+-->
+<!ELEMENT no-tx-connection-factory (jndi-name , rar-name?, connection-definition? , config-property* ,
+(application-managed-security | security-domain | security-domain-and-application)? ,
+min-pool-size? , max-pool-size? , blocking-timeout-millis? , background-validation?, background-validation-minutes? , idle-timeout-minutes? ,
+allocation-retry?, allocation-retry-wait-millis?, prefill?, use-fast-fail?, metadata?, type-mapping?, depends*)>
+
+<!-- The rar deployment to associate with the connection manager mbean.
+e.g. jms-ra.rar or myapplication.ear#my.rar for nested rars
+-->
+<!ELEMENT rar-name (#PCDATA)>
+
+<!-- The connection definition inside the rar deployment uniquely identified by the
+connection factory interface, e.g. javax.sql.DataSource
+-->
+<!ELEMENT connection-definition (#PCDATA)>
+
+<!-- Passed to XAResource.setTransactionTimeout()
+
+     Default is zero which does not invoke the setter
+     e.g. 5 minutes
+     <xa-resource-timeout>300</xa-resource-timeout>
+-->
+<!ELEMENT xa-resource-timeout (#PCDATA)>
+
+<!-- The xa-transaction element is used to mark that the tx-connection-factory
+supports XA transactions.
+-->
+<!ELEMENT xa-transaction EMPTY>
+
+<!-- The local-transaction element is used to mark that the tx-connection-factory
+supports local transactions.
+-->
+<!ELEMENT local-transaction EMPTY>
+
+<!-- The config-property specifies a mannaged connection factory property.
+-->
+<!ELEMENT config-property (#PCDATA)>
+
+<!-- The config-property name attribute gives the name of the connection
+factory property.
+-->
+<!ATTLIST config-property name CDATA  #REQUIRED>
+
+<!-- The config-property type attribute gives the name of the connection
+factory property.
+-->
+<!ATTLIST config-property type CDATA  #REQUIRED>
+
+<!-- The type mapping from conf/standardjboss.xml -->
+<!ELEMENT type-mapping (#PCDATA)>
+
+<!-- For backwards compatibility use type-mapping -->
+<!ELEMENT metadata (type-mapping)>
+
+<!--
+Use local-tx-datasource
+-->
+<!ELEMENT ha-local-tx-datasource (jndi-name, use-java-context?, connection-url, url-delimiter,
+driver-class, transaction-isolation? , connection-property* , user-name? , password?,
+(application-managed-security | security-domain | security-domain-and-application)? ,
+min-pool-size? , max-pool-size? , blocking-timeout-millis? , idle-timeout-minutes? ,
+allocation-retry?, allocation-retry-wait-millis?, no-tx-separate-pools? , new-connection-sql? , check-valid-connection-sql? ,
+valid-connection-checker-class-name? , exception-sorter-class-name? , track-statements? ,
+prepared-statement-cache-size?, share-prepared-statements? , set-tx-query-timeout?, query-timeout?, use-try-lock?,
+metadata?, type-mapping?, depends*)>
+
+<!--
+Use xa-datasource
+-->
+<!ELEMENT ha-xa-datasource (jndi-name , use-java-context?, track-connection-by-tx , xa-datasource-class ,
+xa-datasource-property* , url-property, url-delimiter, isSameRM-override-value? , transaction-isolation? ,
+user-name? , password? ,
+(application-managed-security | security-domain | security-domain-and-application)? ,
+min-pool-size? , max-pool-size? , blocking-timeout-millis? , idle-timeout-minutes? ,
+allocation-retry?, allocation-retry-wait-millis?, no-tx-separate-pools? , xa-resource-timeout? ,
+new-connection-sql? , check-valid-connection-sql? ,
+valid-connection-checker-class-name? , exception-sorter-class-name? , track-statements? ,
+prepared-statement-cache-size?, share-prepared-statements? , set-tx-query-timeout?, query-timeout?, use-try-lock?,
+type-mapping?, depends*)>
+
+<!-- Specifies the delimeter for URLs in connection-url for ha datasources
+-->
+<!ELEMENT url-delimiter (#PCDATA)>
+
+<!-- A class that implements org.jboss.resource.adapter.jdbc.URLSelectorStrategy
+-->
+<!ELEMENT url-selector-strategy-class-name (#PCDATA)>
+
+<!-- For HA XA datasource specifies the name of an xa-datasource-property that contains a list of URLs
+-->
+<!ELEMENT url-property (#PCDATA)>

Modified: branches/JBPAPP_5_1/testsuite/imports/config/tests-crash-recovery.xml
===================================================================
--- branches/JBPAPP_5_1/testsuite/imports/config/tests-crash-recovery.xml	2010-04-29 12:23:22 UTC (rev 104306)
+++ branches/JBPAPP_5_1/testsuite/imports/config/tests-crash-recovery.xml	2010-04-29 12:46:46 UTC (rev 104307)
@@ -135,7 +135,6 @@
       	    <replacetoken><![CDATA[</transaction-service>]]></replacetoken>
       	    <replacevalue><![CDATA[   
     <properties depends="arjuna" name="jta">
-       <property name="com.arjuna.ats.jta.recovery.XAResourceRecovery1" value= "com.arjuna.ats.internal.jbossatx.jta.AppServerJDBCXARecovery;jndiname=CrashRecoveryDS"/>
        <!-- xaRecoveryNode should match value in nodeIdentifier or be * -->
        <property name="com.arjuna.ats.jta.xaRecoveryNode" value="1"/>
     </properties>




More information about the jboss-cvs-commits mailing list