[jboss-cvs] JBossAS SVN: r107739 - in projects/jboss-jca/trunk: adapters and 28 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Aug 23 12:51:51 EDT 2010


Author: jesper.pedersen
Date: 2010-08-23 12:51:50 -0400 (Mon, 23 Aug 2010)
New Revision: 107739

Added:
   projects/jboss-jca/trunk/adapters/src/test/
   projects/jboss-jca/trunk/adapters/src/test/java/
   projects/jboss-jca/trunk/adapters/src/test/java/org/
   projects/jboss-jca/trunk/adapters/src/test/java/org/jboss/
   projects/jboss-jca/trunk/adapters/src/test/java/org/jboss/jca/
   projects/jboss-jca/trunk/adapters/src/test/java/org/jboss/jca/adapters/
   projects/jboss-jca/trunk/adapters/src/test/java/org/jboss/jca/adapters/jdbc/
   projects/jboss-jca/trunk/adapters/src/test/java/org/jboss/jca/adapters/jdbc/unit/
   projects/jboss-jca/trunk/adapters/src/test/java/org/jboss/jca/adapters/jdbc/unit/H2TestCase.java
   projects/jboss-jca/trunk/adapters/src/test/java/org/jboss/jca/adapters/jdbc/unit/package.html
   projects/jboss-jca/trunk/adapters/src/test/resources/
   projects/jboss-jca/trunk/adapters/src/test/resources/h2-ds.xml
   projects/jboss-jca/trunk/adapters/src/test/resources/jndi.properties
   projects/jboss-jca/trunk/adapters/src/test/resources/logging.properties
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/mdr/
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/mdr/SimpleMetadataRepository.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/mdr/package.html
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/ExplicitJndiStrategy.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/AlreadyExistsException.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/MetadataRepository.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/MetadataRepositoryException.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/NotFoundException.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/package.html
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractResourceAdapterDeployer.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployment.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAConfiguration.java
   projects/jboss-jca/trunk/embedded/src/main/resources/ds.xml
   projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/ds.xml
Removed:
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/
Modified:
   projects/jboss-jca/trunk/adapters/build.xml
   projects/jboss-jca/trunk/build.xml
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/NoopJndiStrategy.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/SimpleJndiStrategy.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/naming/JndiStrategy.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployment.java
   projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/deployers/fungal/RADeployerTestCase.java
   projects/jboss-jca/trunk/doc/developerguide/en/modules/deployers.xml
   projects/jboss-jca/trunk/doc/developerguide/en/modules/metadata.xml
   projects/jboss-jca/trunk/doc/userguide/en/modules/configuration.xml
   projects/jboss-jca/trunk/doc/userguide/en/modules/deployment.xml
   projects/jboss-jca/trunk/doc/userguide/en/modules/schemas.xml
   projects/jboss-jca/trunk/embedded/src/main/java/org/jboss/jca/embedded/EmbeddedJCA.java
   projects/jboss-jca/trunk/embedded/src/main/resources/jca.xml
   projects/jboss-jca/trunk/ivy.xml
   projects/jboss-jca/trunk/sjc/build.xml
   projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/Main.java
   projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap.xml
   projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/jca.xml
   projects/jboss-jca/trunk/tools/findbugs/filter.xml
Log:
[JBJCA-404] [JBJCA-405] Metadata repository and datasource deployer (Part 1)

Modified: projects/jboss-jca/trunk/adapters/build.xml
===================================================================
--- projects/jboss-jca/trunk/adapters/build.xml	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/adapters/build.xml	2010-08-23 16:51:50 UTC (rev 107739)
@@ -105,19 +105,120 @@
        Target: test
        ================================= -->
   <target name="test" depends="jars, prepare-test">
+    <mkdir dir="${reports.dir}"/>
+    <mkdir dir="${reports.dir}/adapters"/>
+
+    <junit dir="src/test"
+           printsummary="${junit.printsummary}"
+           haltonerror="${junit.haltonerror}"
+           haltonfailure="${junit.haltonfailure}"
+           fork="${junit.fork}"
+           timeout="${junit.timeout}">
+      
+      <jvmarg line="${junit.jvm.options}"/>
+      <sysproperty key="archives.dir" value="${build.adapters.dir}"/>
+      <sysproperty key="java.util.logging.manager" value="org.jboss.logmanager.LogManager"/>
+      <sysproperty key="log4j.defaultInitOverride" value="true"/>
+      <sysproperty key="org.jboss.logging.Logger.pluginClass" value="org.jboss.logging.logmanager.LoggerPluginImpl"/>
+      <sysproperty key="test.dir" value="${test.dir}"/>
+      <sysproperty key="xb.builder.useUnorderedSequence" value="true"/>
+      <sysproperty key="javax.xml.stream.XMLInputFactory" value="com.sun.xml.internal.stream.XMLInputFactoryImpl"/>
+      
+      <classpath>
+        <pathelement location="${build.adapters.dir}/test"/>
+        <fileset dir="${target.dir}" includes="*.jar"/>
+        <fileset dir="${lib.dir}/common" includes="*.jar" />
+        <fileset dir="${lib.dir}/embedded" includes="*.jar" />
+        <fileset dir="${lib.dir}/arquillian" includes="*.jar" />
+        <fileset dir="${lib.dir}/sjc" includes="*.jar" />
+        <fileset dir="${lib.dir}/test" includes="*.jar" />
+      </classpath>
+      
+      <formatter type="plain"/>
+      <formatter type="xml"/>
+      
+      <batchtest todir="${reports.dir}/adapters"
+                 haltonerror="${junit.batchtest.haltonerror}"
+                 haltonfailure="${junit.batchtest.haltonfailure}"
+                 fork="${junit.batchtest.fork}">
+        
+        <fileset dir="${build.adapters.dir}/test">
+          <include name="**/*TestCase.class"/>
+        </fileset>
+      </batchtest>
+
+    </junit>
   </target>
 
-
   <!-- ================================= 
        Target: one-test
        ================================= -->
   <target name="one-test" depends="jars, prepare-test">
+    <mkdir dir="${reports.dir}"/>
+    <mkdir dir="${reports.dir}/adapters"/>
+
+    <junit dir="src/test"
+           printsummary="${junit.printsummary}"
+           haltonerror="${junit.haltonerror}"
+           haltonfailure="${junit.haltonfailure}"
+           fork="${junit.fork}"
+           timeout="${junit.timeout}">
+      
+      <jvmarg line="${junit.jvm.options}"/>
+      <sysproperty key="archives.dir" value="${build.adapters.dir}"/>
+      <sysproperty key="java.util.logging.manager" value="org.jboss.logmanager.LogManager"/>
+      <sysproperty key="log4j.defaultInitOverride" value="true"/>
+      <sysproperty key="org.jboss.logging.Logger.pluginClass" value="org.jboss.logging.logmanager.LoggerPluginImpl"/>
+      <sysproperty key="test.dir" value="${test.dir}"/>
+      <sysproperty key="xb.builder.useUnorderedSequence" value="true"/>
+      <sysproperty key="javax.xml.stream.XMLInputFactory" value="com.sun.xml.internal.stream.XMLInputFactoryImpl"/>
+      
+      <classpath>
+        <pathelement location="${build.adapters.dir}/test"/>
+        <fileset dir="${target.dir}" includes="*.jar"/>
+        <fileset dir="${lib.dir}/common" includes="*.jar" />
+        <fileset dir="${lib.dir}/embedded" includes="*.jar" />
+        <fileset dir="${lib.dir}/arquillian" includes="*.jar" />
+        <fileset dir="${lib.dir}/sjc" includes="*.jar" />
+        <fileset dir="${lib.dir}/test" includes="*.jar" />
+      </classpath>
+      
+      <formatter type="plain"/>
+      <formatter type="xml"/>
+      
+      <test todir="${reports.dir}/adapters" name="${test}"
+                 haltonerror="${junit.batchtest.haltonerror}"
+                 haltonfailure="${junit.batchtest.haltonfailure}"
+                 fork="${junit.batchtest.fork}"/>
+    </junit>
   </target>
 
   <!-- ================================= 
        Target: prepare-test
        ================================= -->
   <target name="prepare-test">
+    <mkdir dir="${build.adapters.dir}" />
+    <mkdir dir="${build.adapters.dir}/test" />
+
+    <javac srcdir="src/test"
+           destdir="${build.adapters.dir}/test"
+           classpathref="test.lib.path.id"
+           debug="${javac.debug}"
+           deprecation="${javac.deprecation}"
+           optimize="${javac.optimize}">
+      <compilerarg value="-Xlint"/>
+    </javac> 
+
+    <copy todir="${build.adapters.dir}/test">
+      <fileset dir="src/test/resources"/>
+    </copy>
+
+    <copy todir="${build.adapters.dir}/">
+      <fileset dir="${target.dir}">
+        <include name="jdbc-local.rar"/>
+        <include name="jdbc-xa.rar"/>
+      </fileset>
+    </copy>
   </target>
 
   <!-- ================================= 

Added: projects/jboss-jca/trunk/adapters/src/test/java/org/jboss/jca/adapters/jdbc/unit/H2TestCase.java
===================================================================
--- projects/jboss-jca/trunk/adapters/src/test/java/org/jboss/jca/adapters/jdbc/unit/H2TestCase.java	                        (rev 0)
+++ projects/jboss-jca/trunk/adapters/src/test/java/org/jboss/jca/adapters/jdbc/unit/H2TestCase.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,168 @@
+/*
+ * 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.jca.adapters.jdbc.unit;
+
+import org.jboss.jca.embedded.EmbeddedJCA;
+
+import java.io.File;
+import java.net.URL;
+import java.sql.Connection;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+import org.jboss.logging.Logger;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * Test cases for getting a connection from the H2 database
+ * 
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @version $Revision: $
+ */
+public class H2TestCase
+{
+
+   // --------------------------------------------------------------------------------||
+   // Class Members ------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   private static Logger log = Logger.getLogger(H2TestCase.class);
+
+   private static final String JNDI_NAME = "java:/H2DS";
+
+   /*
+    * Embedded
+    */
+   private static EmbeddedJCA embedded;
+
+   // --------------------------------------------------------------------------------||
+   // Tests --------------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Get a connection from the database
+    * @exception Throwable Thrown if case of an error
+    */
+   @Test
+   public void testConnection() throws Throwable
+   {
+      Context context = null;
+
+      try
+      {
+         context = new InitialContext();
+         
+         DataSource ds = (DataSource)context.lookup(JNDI_NAME);
+         assertNotNull(ds);
+
+         Connection c = ds.getConnection();
+         assertNotNull(c);
+      }
+      catch (Throwable t)
+      {
+         log.error(t.getMessage(), t);
+         fail(t.getMessage());
+      }
+      finally
+      {
+         if (context != null)
+         {
+            try
+            {
+               context.close();
+            }
+            catch (NamingException ne)
+            {
+               // Ignore
+            }
+         }
+      }
+   }
+
+   // --------------------------------------------------------------------------------||
+   // Helper Methods -----------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Get the URL for a test archive
+    * @param archive The name of the test archive
+    * @return The URL to the archive
+    * @throws Throwable throwable exception
+    */
+   private static URL getURL(String archive) throws Throwable
+   {
+      File f = new File(System.getProperty("archives.dir") + File.separator + archive);
+      return f.toURI().toURL();
+   }
+
+   // --------------------------------------------------------------------------------||
+   // Lifecycle Methods --------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Lifecycle start, before the suite is executed
+    * @throws Throwable throwable exception 
+    */
+   @BeforeClass
+   public static void beforeClass() throws Throwable
+   {
+      // Create and set an embedded JCA instance
+      embedded = new EmbeddedJCA();
+
+      // Startup
+      embedded.startup();
+
+      // Deploy jdbc-local.rar
+      embedded.deploy(getURL("jdbc-local.rar"));
+
+      // Deploy H2 datasource
+      embedded.deploy(getURL("test/h2-ds.xml"));
+   }
+
+   /**
+    * Lifecycle stop, after the suite is executed
+    * @throws Throwable throwable exception 
+    */
+   @AfterClass
+   public static void afterClass() throws Throwable
+   {
+      // Undeploy H2 datasource
+      embedded.undeploy(getURL("test/h2-ds.xml"));
+
+      // Undeploy jdbc-local.rar
+      embedded.undeploy(getURL("jdbc-local.rar"));
+
+      // Shutdown embedded
+      embedded.shutdown();
+
+      // Set embedded to null
+      embedded = null;
+   }
+}

Added: projects/jboss-jca/trunk/adapters/src/test/java/org/jboss/jca/adapters/jdbc/unit/package.html
===================================================================
--- projects/jboss-jca/trunk/adapters/src/test/java/org/jboss/jca/adapters/jdbc/unit/package.html	                        (rev 0)
+++ projects/jboss-jca/trunk/adapters/src/test/java/org/jboss/jca/adapters/jdbc/unit/package.html	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,3 @@
+<body>
+Test cases for IronJacamar Embedded
+</body>

Added: projects/jboss-jca/trunk/adapters/src/test/resources/h2-ds.xml
===================================================================
--- projects/jboss-jca/trunk/adapters/src/test/resources/h2-ds.xml	                        (rev 0)
+++ projects/jboss-jca/trunk/adapters/src/test/resources/h2-ds.xml	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:noNamespaceSchemaLocation="http://www.jboss.org/jee/schema/ironjacamar/datasources_1_0.xsd">
+  <datasource jndi-name="java:/H2DS" pool-name="H2DS">
+    <user-name>sa</user-name>
+    <password>sa</password>
+    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
+    <driver-class>org.h2.Driver</driver-class>
+  </datasource>
+
+</datasources>

Added: projects/jboss-jca/trunk/adapters/src/test/resources/jndi.properties
===================================================================
--- projects/jboss-jca/trunk/adapters/src/test/resources/jndi.properties	                        (rev 0)
+++ projects/jboss-jca/trunk/adapters/src/test/resources/jndi.properties	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,2 @@
+java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Added: projects/jboss-jca/trunk/adapters/src/test/resources/logging.properties
===================================================================
--- projects/jboss-jca/trunk/adapters/src/test/resources/logging.properties	                        (rev 0)
+++ projects/jboss-jca/trunk/adapters/src/test/resources/logging.properties	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,62 @@
+#
+# JBoss, Home of Professional Open Source.
+# Copyright 2009, 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.
+#
+
+### $Id: $ ###
+
+# Additional logger names to configure (root logger is always configured)
+loggers=org.jboss.jca,org.jboss,org.jnp,com.arjuna
+
+# Root logger level
+logger.level=${iron.jacamar.log.level:INFO}
+logger.handlers=CONSOLE, FILE
+
+# org.jboss.jca
+logger.org.jboss.jca.level=DEBUG
+
+# org.jboss
+logger.org.jboss.level=INFO
+
+# org.jnp
+logger.org.jnp.level=INFO
+
+# com.arjuna
+logger.com.arjuna.level=INFO
+
+# Console handler configuration
+handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
+handler.CONSOLE.properties=autoFlush
+handler.CONSOLE.level=${iron.jacamar.log.console.level:INFO}
+handler.CONSOLE.autoFlush=true
+handler.CONSOLE.formatter=PATTERN
+
+# File handler configuration
+handler.FILE=org.jboss.logmanager.handlers.FileHandler
+handler.FILE.level=${iron.jacamar.log.file.level:DEBUG}
+handler.FILE.properties=autoFlush,fileName
+handler.FILE.autoFlush=true
+handler.FILE.fileName=${test.dir}/adapters/test.log
+handler.FILE.formatter=PATTERN
+
+# Formatter pattern configuration
+formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
+formatter.PATTERN.properties=pattern
+formatter.PATTERN.pattern=%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n

Modified: projects/jboss-jca/trunk/build.xml
===================================================================
--- projects/jboss-jca/trunk/build.xml	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/build.xml	2010-08-23 16:51:50 UTC (rev 107739)
@@ -96,7 +96,8 @@
   <property name="version.dom4j" value="1.6.1"/>
   <property name="version.mockito" value="1.8.5"/>
   <property name="version.eclipse.ecj" value="3.5.1"/>
-  <property name="version.fungal" value="0.8.0.Beta6"/>
+  <property name="version.fungal" value="0.8.0.RC2"/>
+  <property name="version.h2" value="1.2.141"/>
   <property name="version.hibernate-validator" value="4.0.2.GA"/>
   <property name="version.javassist" value="3.12.0.GA"/>
   <property name="version.jaxb.api" value="2.1"/>

Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/mdr/SimpleMetadataRepository.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/mdr/SimpleMetadataRepository.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/mdr/SimpleMetadataRepository.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,109 @@
+/*
+ * 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.jca.core.mdr;
+
+import org.jboss.jca.common.api.metadata.ra.Connector;
+import org.jboss.jca.core.spi.mdr.AlreadyExistsException;
+import org.jboss.jca.core.spi.mdr.MetadataRepository;
+import org.jboss.jca.core.spi.mdr.NotFoundException;
+
+import java.net.URL;
+import java.util.Collections;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * A simple implementation of the metadata repository
+ * 
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class SimpleMetadataRepository implements MetadataRepository
+{
+   /** Resource adapter templates */
+   private ConcurrentMap<URL, Connector> raTemplates;
+
+   /**
+    * Constructor
+    */
+   public SimpleMetadataRepository()
+   {
+      this.raTemplates = new ConcurrentHashMap<URL, Connector>();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void registerResourceAdapter(URL deployment, Connector md) throws AlreadyExistsException
+   {
+      if (deployment == null)
+         throw new IllegalArgumentException("Deployment is null");
+
+      if (md == null)
+         throw new IllegalArgumentException("Metadata is null");
+
+      if (raTemplates.containsKey(deployment))
+         throw new AlreadyExistsException(deployment + " already registered");
+
+      raTemplates.put(deployment, md);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void unregisterResourceAdapter(URL deployment) throws NotFoundException
+   {
+      if (deployment == null)
+         throw new IllegalArgumentException("Deployment is null");
+
+      if (!raTemplates.containsKey(deployment))
+         throw new NotFoundException(deployment + " isn't registered");
+
+      raTemplates.remove(deployment);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Connector getResourceAdapter(URL deployment) throws NotFoundException
+   {
+      if (deployment == null)
+         throw new IllegalArgumentException("Deployment is null");
+
+      if (!raTemplates.containsKey(deployment))
+         throw new NotFoundException(deployment + " isn't registered");
+
+      Connector md = raTemplates.get(deployment);
+
+      // Always return a copy as the caller may make changes to it
+      return (Connector)md.copy();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Set<URL> getResourceAdapters()
+   {
+      return Collections.unmodifiableSet(raTemplates.keySet());
+   }
+}

Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/mdr/package.html
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/mdr/package.html	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/mdr/package.html	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,3 @@
+<body>
+This package contains the metadata repository implementation.
+</body>

Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/ExplicitJndiStrategy.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/ExplicitJndiStrategy.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/ExplicitJndiStrategy.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,235 @@
+/*
+ * 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.jca.core.naming;
+
+import org.jboss.jca.core.spi.naming.JndiStrategy;
+
+import java.util.Hashtable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.naming.StringRefAddr;
+import javax.resource.Referenceable;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.naming.Util;
+
+/**
+ * An explicit JNDI strategy that requires a JNDI for each connection factory
+ * 
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class ExplicitJndiStrategy implements JndiStrategy
+{
+   private static Logger log = Logger.getLogger(ExplicitJndiStrategy.class);
+
+   private static ConcurrentMap<String, Object> connectionFactories = new ConcurrentHashMap<String, Object>();
+
+   /**
+    * Constructor
+    */
+   public ExplicitJndiStrategy()
+   {
+   }
+
+   /**
+    * Obtain the connection factory
+    * {@inheritDoc}
+    */
+   public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment)
+      throws Exception
+   {
+      Reference ref = (Reference)obj;
+      String className = (String)ref.get("class").getContent();
+      String cfname = (String)ref.get("name").getContent();
+
+      return connectionFactories.get(qualifiedName(cfname, className));
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public String[] bindConnectionFactories(String deployment, Object[] cfs) throws Throwable
+   {
+      throw new IllegalStateException("JNDI names are required");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public String[] bindConnectionFactories(String deployment, Object[] cfs, String[] jndis) throws Throwable
+   {
+      if (deployment == null)
+         throw new IllegalArgumentException("Deployment is null");
+
+      if (deployment.trim().equals(""))
+         throw new IllegalArgumentException("Deployment is empty");
+
+      if (cfs == null)
+         throw new IllegalArgumentException("CFS is null");
+
+      if (cfs.length == 0)
+         throw new IllegalArgumentException("CFS is empty");
+
+      if (jndis == null)
+         throw new IllegalArgumentException("JNDIs is null");
+
+      if (jndis.length == 0)
+         throw new IllegalArgumentException("JNDIs is empty");
+
+      if (cfs.length != jndis.length)
+         throw new IllegalArgumentException("Number of connection factories doesn't match number of JNDI names");
+
+      Context context = new InitialContext();
+      try
+      {
+         for (int i = 0; i < cfs.length; i++)
+         {
+            String jndiName = jndis[i];
+            Object cf = cfs[i];
+
+            String className = cf.getClass().getName();
+            Reference ref = new Reference(className,
+                                          new StringRefAddr("class", className),
+                                          ExplicitJndiStrategy.class.getName(),
+                                          null);
+            ref.add(new StringRefAddr("name", jndiName));
+
+            if (connectionFactories.putIfAbsent(qualifiedName(jndiName, className), cf) != null)
+               throw new Exception("Deployment " + className + " failed, " + jndiName + " is already deployed");
+
+            Referenceable referenceable = (Referenceable)cf;
+            referenceable.setReference(ref);
+            
+            Util.bind(context, jndiName, cf);
+
+            if (log.isDebugEnabled())
+               log.debug("Bound " + cf.getClass().getName() + " under " + jndiName);
+         }
+      }
+      finally
+      {
+         if (context != null)
+         {
+            try
+            {
+               context.close();
+            }
+            catch (NamingException ne)
+            {
+               // Ignore
+            }
+         }
+      }
+
+      return jndis;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void unbindConnectionFactories(String deployment, Object[] cfs) throws Throwable
+   {
+      throw new IllegalStateException("JNDI names are required");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void unbindConnectionFactories(String deployment, Object[] cfs, String[] jndis) throws Throwable
+   {
+      if (cfs == null)
+         throw new IllegalArgumentException("CFS is null");
+
+      if (cfs.length == 0)
+         throw new IllegalArgumentException("CFS is empty");
+
+      if (jndis == null)
+         throw new IllegalArgumentException("JNDIs is null");
+
+      if (jndis.length == 0)
+         throw new IllegalArgumentException("JNDIs is empty");
+
+      if (cfs.length != jndis.length)
+         throw new IllegalArgumentException("Number of connection factories doesn't match number of JNDI names");
+
+      Context context = null;
+      try
+      {
+         context = new InitialContext();
+
+         for (int i = 0; i < cfs.length; i++)
+         {
+            String jndiName = jndis[i];
+            Object cf = cfs[i];
+            String className = cf.getClass().getName();
+
+            Util.unbind(context, jndiName);
+
+            connectionFactories.remove(qualifiedName(jndiName, className));
+
+            if (log.isDebugEnabled())
+               log.debug("Unbound " + className + " under " + jndiName);
+         }
+      }
+      catch (Throwable t)
+      {
+         log.warn("Exception during unbind", t);
+      }
+      finally
+      {
+         if (context != null)
+         {
+            try
+            {
+               context.close();
+            }
+            catch (NamingException ne)
+            {
+               // Ignore
+            }
+         }
+      }
+   }
+
+   /**
+    * Clone the JNDI strategy implementation
+    * @return A copy of the implementation
+    * @exception CloneNotSupportedException Thrown if the copy operation isn't supported
+    *  
+    */
+   public JndiStrategy clone() throws CloneNotSupportedException
+   {
+      return (JndiStrategy)super.clone();
+   }
+
+   private static String qualifiedName(String name, String className)
+   {
+      return className + "#" + name;
+   }
+}

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/NoopJndiStrategy.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/NoopJndiStrategy.java	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/NoopJndiStrategy.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -58,11 +58,7 @@
    }
 
    /**
-    * Bind connection factories for a deployment
-    * @param deployment The deployment name
-    * @param cfs The connection factories
-    * @return The JNDI names for the connection factories
-    * @exception Throwable Thrown if an error occurs
+    * {@inheritDoc}
     */
    public String[] bindConnectionFactories(String deployment, Object[] cfs) throws Throwable
    {
@@ -70,16 +66,28 @@
    }
 
    /**
-    * Unbind connection factories for a deployment
-    * @param deployment The deployment name
-    * @param cfs The connection factories
-    * @exception Throwable Thrown if an error occurs
+    * {@inheritDoc}
     */
+   public String[] bindConnectionFactories(String deployment, Object[] cfs, String[] jndis) throws Throwable
+   {
+      return new String[0];
+   }
+
+   /**
+    * {@inheritDoc}
+    */
    public void unbindConnectionFactories(String deployment, Object[] cfs) throws Throwable
    {
    }
 
    /**
+    * {@inheritDoc}
+    */
+   public void unbindConnectionFactories(String deployment, Object[] cfs, String[] jndis) throws Throwable
+   {
+   }
+
+   /**
     * Clone the JNDI strategy implementation
     * @return A copy of the implementation
     * @exception CloneNotSupportedException Thrown if the copy operation isn't supported

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/SimpleJndiStrategy.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/SimpleJndiStrategy.java	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/naming/SimpleJndiStrategy.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -41,7 +41,7 @@
 
 /**
  * A simple JNDI strategy that bind a single connection factory under the
- * name of "java:/eis/&lt;deployment&gt;"
+ * name of "java:/eis/&lt;deployment&gt;" by default
  * 
  * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
  */
@@ -76,14 +76,20 @@
    }
 
    /**
-    * Bind connection factories for a deployment
-    * @param deployment The deployment name
-    * @param cfs The connection factories
-    * @return The JNDI names for the connection factories
-    * @exception Throwable Thrown if an error occurs
+    * {@inheritDoc}
     */
    public String[] bindConnectionFactories(String deployment, Object[] cfs) throws Throwable
    {
+      String jndiName = JNDI_PREFIX + deployment;
+
+      return bindConnectionFactories(deployment, cfs, new String[] {jndiName});
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public String[] bindConnectionFactories(String deployment, Object[] cfs, String[] jndis) throws Throwable
+   {
       if (deployment == null)
          throw new IllegalArgumentException("Deployment is null");
 
@@ -99,9 +105,17 @@
       if (cfs.length > 1)
          throw new IllegalArgumentException("SimpleJndiStrategy only support " + 
                                             "a single connection factory per deployment");
+      if (jndis == null)
+         throw new IllegalArgumentException("JNDIs is null");
 
-      String jndiName = JNDI_PREFIX + deployment;
+      if (jndis.length == 0)
+         throw new IllegalArgumentException("JNDIs is empty");
 
+      if (jndis.length > 1)
+         throw new IllegalArgumentException("SimpleJndiStrategy only support " + 
+                                            "a single JNDI name per deployment");
+
+      String jndiName = jndis[0];
       Object cf = cfs[0];
 
       Context context = new InitialContext();
@@ -127,20 +141,37 @@
       }
       finally
       {
-         context.close();
+         if (context != null)
+         {
+            try
+            {
+               context.close();
+            }
+            catch (NamingException ne)
+            {
+               // Ignore
+            }
+         }
       }
 
       return new String[] {jndiName};
    }
 
    /**
-    * Unbind connection factories for a deployment
-    * @param deployment The deployment name
-    * @param cfs The connection factories
-    * @exception Throwable Thrown if an error occurs
+    * {@inheritDoc}
     */
    public void unbindConnectionFactories(String deployment, Object[] cfs) throws Throwable
    {
+      String jndiName = JNDI_PREFIX + deployment;
+
+      unbindConnectionFactories(deployment, cfs, new String[] {jndiName});
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void unbindConnectionFactories(String deployment, Object[] cfs, String[] jndis) throws Throwable
+   {
       if (cfs == null)
          throw new IllegalArgumentException("CFS is null");
 
@@ -151,8 +182,17 @@
          throw new IllegalArgumentException("SimpleJndiStrategy only support " + 
                                             "a single connection factory per deployment");
 
-      String jndiName = JNDI_PREFIX + deployment;
+      if (jndis == null)
+         throw new IllegalArgumentException("JNDIs is null");
 
+      if (jndis.length == 0)
+         throw new IllegalArgumentException("JNDIs is empty");
+
+      if (jndis.length > 1)
+         throw new IllegalArgumentException("SimpleJndiStrategy only support " + 
+                                            "a single JNDI name per deployment");
+
+      String jndiName = jndis[0];
       Object cf = cfs[0];
       String className = cf.getClass().getName();
 

Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/AlreadyExistsException.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/AlreadyExistsException.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/AlreadyExistsException.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,70 @@
+/*
+ * 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.jca.core.spi.mdr;
+
+/**
+ * AlreadyExistsException is thrown in case a metadata entry already is registered
+ * 
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class AlreadyExistsException extends MetadataRepositoryException
+{
+   /** Serial version UID */
+   private static final long serialVersionUID = 1L;
+
+   /**
+    * Constructor
+    */
+   public AlreadyExistsException()
+   {
+      super();
+   }
+
+   /**
+    * Constructor
+    * @param message The exception message
+    */
+   public AlreadyExistsException(String message)
+   {
+      super(message);
+   }
+
+   /**
+    * Constructor
+    * @param message The exception message
+    * @param cause The cause of the exception
+    */
+   public AlreadyExistsException(String message, Throwable cause)
+   {
+      super(message, cause);
+   }
+
+   /**
+    * Constructor
+    * @param cause The cause of the exception
+    */
+   public AlreadyExistsException(Throwable cause)
+   {
+      super(cause);
+   }
+}

Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/MetadataRepository.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/MetadataRepository.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/MetadataRepository.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,65 @@
+/*
+ * 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.jca.core.spi.mdr;
+
+import org.jboss.jca.common.api.metadata.ra.Connector;
+
+import java.net.URL;
+import java.util.Set;
+
+/**
+ * The SPI for the metadata repository
+ * 
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public interface MetadataRepository
+{
+   /**
+    * Register a resource adapter template
+    * @param deployment The deployment
+    * @param md The metadata
+    * @exception AlreadyExistsException Thrown if the deployment is already registered
+    */
+   public void registerResourceAdapter(URL deployment, Connector md) throws AlreadyExistsException;
+
+   /**
+    * Unregister a resource adapter template
+    * @param deployment The deployment
+    * @exception NotFoundException Thrown if the deployment isn't registered
+    */
+   public void unregisterResourceAdapter(URL deployment) throws NotFoundException;
+
+   /**
+    * Get the metadata for a resource adapter
+    * @param deployment The deployment
+    * @return The metadata
+    * @exception NotFoundException Thrown if the deployment isn't registered
+    */
+   public Connector getResourceAdapter(URL deployment) throws NotFoundException;
+
+   /**
+    * Get the resource adapters deployments registered
+    * @return The names of the deployments
+    */
+   public Set<URL> getResourceAdapters();
+}

Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/MetadataRepositoryException.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/MetadataRepositoryException.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/MetadataRepositoryException.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,70 @@
+/*
+ * 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.jca.core.spi.mdr;
+
+/**
+ * Top level exception for the metadata repository
+ * 
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class MetadataRepositoryException extends Exception
+{
+   /** Serial version UID */
+   private static final long serialVersionUID = 1L;
+
+   /**
+    * Constructor
+    */
+   public MetadataRepositoryException()
+   {
+      super();
+   }
+
+   /**
+    * Constructor
+    * @param message The exception message
+    */
+   public MetadataRepositoryException(String message)
+   {
+      super(message);
+   }
+
+   /**
+    * Constructor
+    * @param message The exception message
+    * @param cause The cause of the exception
+    */
+   public MetadataRepositoryException(String message, Throwable cause)
+   {
+      super(message, cause);
+   }
+
+   /**
+    * Constructor
+    * @param cause The cause of the exception
+    */
+   public MetadataRepositoryException(Throwable cause)
+   {
+      super(cause);
+   }
+}

Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/NotFoundException.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/NotFoundException.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/NotFoundException.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,70 @@
+/*
+ * 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.jca.core.spi.mdr;
+
+/**
+ * NotFoundExcepion is thrown in case a metadata entry isn't found in the repository
+ * 
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class NotFoundException extends MetadataRepositoryException
+{
+   /** Serial version UID */
+   private static final long serialVersionUID = 1L;
+
+   /**
+    * Constructor
+    */
+   public NotFoundException()
+   {
+      super();
+   }
+
+   /**
+    * Constructor
+    * @param message The exception message
+    */
+   public NotFoundException(String message)
+   {
+      super(message);
+   }
+
+   /**
+    * Constructor
+    * @param message The exception message
+    * @param cause The cause of the exception
+    */
+   public NotFoundException(String message, Throwable cause)
+   {
+      super(message, cause);
+   }
+
+   /**
+    * Constructor
+    * @param cause The cause of the exception
+    */
+   public NotFoundException(Throwable cause)
+   {
+      super(cause);
+   }
+}

Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/package.html
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/package.html	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/mdr/package.html	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,3 @@
+<body>
+This package contains the metadata repository SPI.
+</body>

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/naming/JndiStrategy.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/naming/JndiStrategy.java	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/naming/JndiStrategy.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -31,7 +31,7 @@
  */
 public interface JndiStrategy extends Cloneable, ObjectFactory
 {
-   /**
+    /**
     * Bind connection factories for a deployment
     * @param deployment The deployment name
     * @param cfs The connection factories
@@ -40,6 +40,16 @@
     */
    public String[] bindConnectionFactories(String deployment, Object[] cfs) throws Throwable;
 
+    /**
+    * Bind connection factories for a deployment
+    * @param deployment The deployment name
+    * @param cfs The connection factories
+    * @param jndis The JNDI names for the connection factories
+    * @return The JNDI names for the connection factories
+    * @exception Throwable Thrown if an error occurs
+    */
+   public String[] bindConnectionFactories(String deployment, Object[] cfs, String[] jndis) throws Throwable;
+
    /**
     * Unbind connection factories for a deployment
     * @param deployment The deployment name
@@ -49,6 +59,15 @@
    public void unbindConnectionFactories(String deployment, Object[] cfs) throws Throwable;
 
    /**
+    * Unbind connection factories for a deployment
+    * @param deployment The deployment name
+    * @param cfs The connection factories
+    * @param jndis The JNDI names for the connection factories
+    * @exception Throwable Thrown if an error occurs
+    */
+   public void unbindConnectionFactories(String deployment, Object[] cfs, String[] jndis) throws Throwable;
+
+   /**
     * Clone the JNDI strategy implementation
     * @return A copy of the implementation
     * @exception CloneNotSupportedException Thrown if the copy operation isn't supported

Added: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractResourceAdapterDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractResourceAdapterDeployer.java	                        (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractResourceAdapterDeployer.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,390 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-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.jca.deployers.fungal;
+
+import org.jboss.jca.common.api.metadata.ra.ConfigProperty;
+import org.jboss.jca.core.api.bootstrap.CloneableBootstrapContext;
+import org.jboss.jca.core.spi.naming.JndiStrategy;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.FailureHelper;
+import org.jboss.jca.validator.Validate;
+import org.jboss.jca.validator.Validator;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterAssociation;
+
+import org.jboss.logging.Logger;
+
+import com.github.fungal.api.util.Injection;
+import com.github.fungal.api.util.JarFilter;
+import com.github.fungal.spi.deployers.DeployException;
+
+/**
+ * An abstract resource adapter deployer which contains common functionality
+ * for all resource adapter archive based deployers.
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public abstract class AbstractResourceAdapterDeployer
+{
+   private static Logger log = Logger.getLogger(AbstractResourceAdapterDeployer.class);
+
+   private static boolean trace = log.isTraceEnabled();
+
+   /** The configuration */
+   private RAConfiguration raConfiguration = null;
+
+   /**
+    * Constructor
+    */
+   AbstractResourceAdapterDeployer()
+   {
+   }
+
+   /**
+    * Set the configuration
+    * @param value The value
+    */
+   public void setConfiguration(RAConfiguration value)
+   {
+      raConfiguration = value;
+   }
+
+   /**
+    * Get the configuration
+    * @return The value
+    */
+   public RAConfiguration getConfiguration()
+   {
+      return raConfiguration;
+   }
+
+   /**
+    * validate archive
+    *
+    * @param url of the archive
+    * @param archiveValidation classes and/or to validate.
+    * @return The list of failures gotten. Null in case of no failures or if validation is not run according to
+    *   {@link #getArchiveValidation()} Settin
+    */
+   //IT IS PACKAGE PROTECTED ONLY FOR TESTS ACCESSIBILITY
+   List<Failure> validateArchive(URL url, List<Validate> archiveValidation)
+   {
+      // Archive validation
+      if (!getConfiguration().getArchiveValidation())
+      {
+         return null;
+      }
+      Validator validator = new Validator();
+      List<Failure> failures = validator.validate(archiveValidation);
+
+      return failures;
+   }
+
+   /**
+    * print Failures into Log files.
+    *
+    * @param urlFileName filename Of deployed rar
+    * @param validator validator instance used to run validation rules
+    * @param failures the list of Failures to be printed
+    * @param reportDirectory where to put various logs
+    * @param fhInput optional parameter. Normally used only for test or in case of
+    *   FailureHelper already present in context
+    * @return the error Text
+    *
+    */
+   //IT IS PACKAGE PROTECTED ONLY FOR TESTS ACCESSIBILITY
+   String printFailuresLog(String urlFileName, Validator validator, Collection<Failure> failures,
+         File reportDirectory, FailureHelper... fhInput)
+   {
+      String errorText = "";
+      FailureHelper fh = null;
+      if (fhInput.length == 0)
+         fh = new FailureHelper(failures);
+      else
+         fh = fhInput[0];
+
+      if (failures != null && failures.size() > 0)
+      {
+         if (reportDirectory == null)
+         {
+            reportDirectory = new File(SecurityActions.getSystemProperty("iron.jacamar.home"), "/log/");
+         }
+         if (reportDirectory.exists())
+         {
+            int lastSlashIndex = urlFileName.lastIndexOf("/");
+            int lastSepaIndex = urlFileName.lastIndexOf(File.separator);
+
+            int lastIndex = lastSlashIndex > lastSepaIndex ? lastSlashIndex : lastSepaIndex;
+            if (lastIndex != -1)
+               urlFileName = urlFileName.substring(lastIndex + 1);
+            urlFileName += ".log";
+
+            File report = new File(reportDirectory, urlFileName);
+            FileWriter fw = null;
+            BufferedWriter bw = null;
+            try
+            {
+               fw = new FileWriter(report);
+               bw = new BufferedWriter(fw, 8192);
+               bw.write(fh.asText(validator.getResourceBundle()));
+               bw.flush();
+
+               errorText = "Validation failures - see: " + report.getAbsolutePath();
+            }
+            catch (IOException ioe)
+            {
+               log.warn(ioe.getMessage(), ioe);
+            }
+            finally
+            {
+               if (bw != null)
+               {
+                  try
+                  {
+                     bw.close();
+                  }
+                  catch (IOException ignore)
+                  {
+                     // Ignore
+                  }
+               }
+               if (fw != null)
+               {
+                  try
+                  {
+                     fw.close();
+                  }
+                  catch (IOException ignore)
+                  {
+                     // Ignore
+                  }
+               }
+            }
+         }
+         else
+         {
+            errorText = fh.asText(validator.getResourceBundle());
+         }
+      }
+      return errorText;
+   }
+
+   /**
+    * Cehck for failures at a certain level
+    * @param failures The failures
+    * @param severity The level
+    * @return True if a failure is found with the specified severity; otherwise false
+    */
+   protected boolean hasFailuresLevel(Collection<Failure> failures, int severity)
+   {
+      if (failures != null)
+      {
+         for (Failure failure : failures)
+         {
+            if (failure.getSeverity() == severity)
+            {
+               return true;
+            }
+         }
+      }
+      return false;
+   }
+
+   /**
+    * Start the resource adapter
+    * @param resourceAdapter The resource adapter
+    * @param bootstrapIdentifier The bootstrap context identifier; may be <code>null</code>
+    * @throws DeployException Thrown if the resource adapter cant be started
+    */
+   @SuppressWarnings("unchecked")
+   protected void startContext(ResourceAdapter resourceAdapter, String bootstrapIdentifier) throws DeployException
+   {
+      try
+      {
+         Class clz = resourceAdapter.getClass();
+         Method start = clz.getMethod("start", new Class[] {BootstrapContext.class});
+
+         CloneableBootstrapContext cbc = null;
+
+         if (bootstrapIdentifier != null && getConfiguration().getBootstrapContexts() != null)
+         {
+            CloneableBootstrapContext bc = getConfiguration().getBootstrapContexts().get(bootstrapIdentifier);
+
+            if (bc != null)
+               cbc = bc.clone();
+         }
+
+         if (cbc == null)
+            cbc = getConfiguration().getDefaultBootstrapContext().clone();
+
+         start.invoke(resourceAdapter, new Object[]
+         {cbc});
+      }
+      catch (InvocationTargetException ite)
+      {
+         throw new DeployException("Unable to start " +
+                                   resourceAdapter.getClass().getName(), ite.getTargetException());
+      }
+      catch (Throwable t)
+      {
+         throw new DeployException("Unable to start " + resourceAdapter.getClass().getName(), t);
+      }
+   }
+
+   /**
+    * Associate resource adapter with ojects if they implement ResourceAdapterAssociation
+    * @param resourceAdapter The resource adapter
+    * @param object The of possible association object
+    * @throws DeployException Thrown if the resource adapter cant be started
+    */
+   @SuppressWarnings("unchecked")
+   protected void associateResourceAdapter(ResourceAdapter resourceAdapter, Object object)
+      throws DeployException
+   {
+      if (resourceAdapter != null && object != null)
+      {
+         if (object instanceof ResourceAdapterAssociation)
+         {
+            try
+            {
+               Class clz = object.getClass();
+
+               Method setResourceAdapter = clz.getMethod("setResourceAdapter",
+                                                         new Class[]
+                                                         {ResourceAdapter.class});
+
+               setResourceAdapter.invoke(object, new Object[]
+               {resourceAdapter});
+            }
+            catch (Throwable t)
+            {
+               throw new DeployException("Unable to associate " + object.getClass().getName(), t);
+            }
+         }
+      }
+   }
+
+   /**
+    * Initialize and inject configuration properties
+    * @param className The fully qualified class name
+    * @param configs The configuration properties
+    * @param cl The class loader
+    * @return The object
+    * @throws DeployException Thrown if the object cant be initialized
+    */
+   protected Object initAndInject(String className,
+                                  List<? extends ConfigProperty> configs,
+                                  ClassLoader cl)
+      throws DeployException
+   {
+      try
+      {
+         Class clz = Class.forName(className, true, cl);
+         Object o = clz.newInstance();
+
+         if (configs != null)
+         {
+            Injection injector = new Injection();
+            for (ConfigProperty cpmd : configs)
+            {
+               if (cpmd.isValueSet())
+                  injector.inject(cpmd.getConfigPropertyType().getValue(), cpmd.getConfigPropertyName().getValue(),
+                        cpmd.getConfigPropertyValue().getValue(), o);
+            }
+         }
+
+         return o;
+      }
+      catch (Throwable t)
+      {
+         throw new DeployException("Deployment " + className + " failed", t);
+      }
+   }
+
+   /**
+    * Get the URLs for the directory and all libraries located in the directory
+    * @param directory The directory
+    * @return The URLs
+    * @exception MalformedURLException MalformedURLException
+    * @exception IOException IOException
+    */
+   protected URL[] getUrls(File directory) throws MalformedURLException, IOException
+   {
+      List<URL> list = new LinkedList<URL>();
+
+      if (directory.exists() && directory.isDirectory())
+      {
+         // Add directory
+         list.add(directory.toURI().toURL());
+
+         // Add the contents of the directory too
+         File[] jars = directory.listFiles(new JarFilter());
+
+         if (jars != null)
+         {
+            for (int j = 0; j < jars.length; j++)
+            {
+               list.add(jars[j].getCanonicalFile().toURI().toURL());
+            }
+         }
+      }
+      return list.toArray(new URL[list.size()]);
+   }
+
+
+   /**
+    * Bind connection factory into JNDI
+    * @param deployment The deployment name
+    * @param cf The connection factory
+    * @return The JNDI names bound
+    * @exception Throwable Thrown if an error occurs
+    */
+   protected String[] bindConnectionFactory(String deployment, Object cf) throws Throwable
+   {
+      JndiStrategy js = getConfiguration().getJndiStrategy().clone();
+
+      return js.bindConnectionFactories(deployment, new Object[] {cf});
+   }
+
+   /**
+    * Start
+    */
+   public void start()
+   {
+      if (raConfiguration == null)
+         throw new IllegalStateException("Configuration not defined");
+   }
+}

Added: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java	                        (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,579 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-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.jca.deployers.fungal;
+
+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;
+import org.jboss.jca.common.api.metadata.ra.ConfigProperty;
+import org.jboss.jca.common.api.metadata.ra.ConnectionDefinition;
+import org.jboss.jca.common.api.metadata.ra.Connector;
+import org.jboss.jca.common.api.metadata.ra.ResourceAdapter1516;
+import org.jboss.jca.common.metadata.MetadataFactory;
+import org.jboss.jca.common.metadata.ds.DsParser;
+import org.jboss.jca.core.connectionmanager.ConnectionManager;
+import org.jboss.jca.core.connectionmanager.ConnectionManagerFactory;
+import org.jboss.jca.core.connectionmanager.pool.api.Pool;
+import org.jboss.jca.core.connectionmanager.pool.api.PoolConfiguration;
+import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
+import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
+import org.jboss.jca.core.naming.ExplicitJndiStrategy;
+import org.jboss.jca.core.spi.mdr.MetadataRepository;
+import org.jboss.jca.core.spi.naming.JndiStrategy;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
+import javax.transaction.TransactionManager;
+
+import org.jboss.logging.Logger;
+
+import com.github.fungal.api.Kernel;
+import com.github.fungal.api.util.Injection;
+import com.github.fungal.spi.deployers.DeployException;
+import com.github.fungal.spi.deployers.Deployer;
+import com.github.fungal.spi.deployers.Deployment;
+
+/**
+ * The -ds.xml deployer for JCA/SJC
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public final class DsXmlDeployer implements Deployer
+{
+   private static Logger log = Logger.getLogger(DsXmlDeployer.class);
+
+   private static boolean trace = log.isTraceEnabled();
+
+   private String jdbcLocal;
+
+   private String jdbcXA;
+
+   /** The transaction manager */
+   private TransactionManager transactionManager;
+
+   /** Metadata repository */
+   private MetadataRepository mdr;
+
+   /** The kernel */
+   private Kernel kernel;
+
+   /**
+    * Constructor
+    */
+   public DsXmlDeployer()
+   {
+      transactionManager = null;
+      jdbcLocal = null;
+      jdbcXA = null;
+      mdr = null;
+      kernel = null;
+   }
+
+   /**
+    * Set the name for the JDBC Local resource adapter
+    * @param value The value
+    */
+   public void setJDBCLocal(String value)
+   {
+      jdbcLocal = value;
+   }
+
+   /**
+    * Get the name for the JDBC Local resource adapter
+    * @return The value
+    */
+   public String getJDBCLocal()
+   {
+      return jdbcLocal;
+   }
+
+   /**
+    * Set the name for the JDBC XA resource adapter
+    * @param value The value
+    */
+   public void setJDBCXA(String value)
+   {
+      jdbcXA = value;
+   }
+
+   /**
+    * Get the name for the JDBC Xa resource adapter
+    * @return The value
+    */
+   public String getJDBCXA()
+   {
+      return jdbcXA;
+   }
+
+   /**
+    * Set the transaction manager
+    * @param value The value
+    */
+   public void setTransactionManager(TransactionManager value)
+   {
+      transactionManager = value;
+   }
+
+   /**
+    * Get the transaction manager
+    * @return The value
+    */
+   public TransactionManager getTransactionManager()
+   {
+      return transactionManager;
+   }
+
+   /**
+    * Set the metadata repository
+    * @param value The value
+    */
+   public void setMetadataRepository(MetadataRepository value)
+   {
+      mdr = value;
+   }
+
+   /**
+    * Get the metadata repository
+    * @return The handle
+    */
+   public MetadataRepository getMetadataRepository()
+   {
+      return mdr;
+   }
+
+   /**
+    * Set the kernel
+    * @param value The value
+    */
+   public void setKernel(Kernel value)
+   {
+      kernel = value;
+   }
+
+   /**
+    * Get the kernel
+    * @return The handle
+    */
+   public Kernel getKernel()
+   {
+      return kernel;
+   }
+
+   /**
+    * Deploy
+    * @param url The url
+    * @param parent The parent classloader
+    * @return The deployment
+    * @exception DeployException Thrown if an error occurs during deployment
+    */
+   @Override
+   public synchronized Deployment deploy(URL url, ClassLoader parent) throws DeployException
+   {
+      if (url == null || !(url.toExternalForm().endsWith("-ds.xml")))
+         return null;
+
+      log.debug("Deploying: " + url.toExternalForm());
+      
+      ClassLoader oldTCCL = SecurityActions.getThreadContextClassLoader();
+      InputStream is = null;
+      try
+      {
+         File f = new File(url.toURI());
+
+         if (!f.exists())
+            throw new IOException("Deployment " + url.toExternalForm() + " doesnt exists");
+
+         is = new FileInputStream(f);
+         DsParser dsParser = new DsParser();
+
+         DataSources dataSources = dsParser.parse(is);
+
+         String deploymentName = f.getName();
+
+         Set<URL> raDeployments = mdr.getResourceAdapters();
+         URL urlJdbcLocal = null;
+         URL urlJdbcXA = null;
+
+         for (URL u : raDeployments)
+         {
+            if (u.toExternalForm().endsWith(jdbcLocal))
+            {
+               urlJdbcLocal = u;
+            }
+            else if (u.toExternalForm().endsWith(jdbcXA))
+            {
+               urlJdbcXA = u;
+            }
+         }
+
+         List<Object> cfs = new ArrayList<Object>(1);
+         List<String> jndis = new ArrayList<String>(1);
+
+         if (urlJdbcLocal != null)
+         {
+            List<DataSource> ds = dataSources.getDataSource();
+            if (ds != null)
+            {
+               Deployment jdbcLocalDeployment = kernel.getDeployment(urlJdbcLocal);
+
+               for (DataSource dataSource : ds)
+               {
+                  try
+                  {
+                     Object cf = deployDataSource(dataSource, urlJdbcLocal, jdbcLocalDeployment.getClassLoader());
+                     String jndiName = dataSource.getJndiName();
+
+                     if (!jndiName.startsWith("java:/"))
+                        jndiName = "java:/" + jndiName;
+
+                     bindConnectionFactory(deploymentName, jndiName, cf);
+
+                     cfs.add(cf);
+                     jndis.add(jndiName);
+                  }
+                  catch (Throwable t)
+                  {
+                     log.error("Error during the deployment of " + dataSource.getJndiName(), t);
+                  }
+               }
+            }
+         }
+         else
+         {
+            if (dataSources.getDataSource() != null && dataSources.getDataSource().size() > 0)
+               log.error("Deployment of datasources disabled since jdbc-local.rar couldn't be found"); 
+         }
+
+         if (urlJdbcXA != null)
+         {
+            List<XaDataSource> xads = dataSources.getXaDataSource();
+            if (xads != null)
+            {
+               Deployment jdbcXADeployment = kernel.getDeployment(urlJdbcXA);
+
+               for (XaDataSource xaDataSource : xads)
+               {
+                  try
+                  {
+                     Object cf = deployXADataSource(xaDataSource, urlJdbcXA, jdbcXADeployment.getClassLoader());
+                     String jndiName = xaDataSource.getJndiName();
+
+                     if (!jndiName.startsWith("java:/"))
+                        jndiName = "java:/" + jndiName;
+
+                     bindConnectionFactory(deploymentName, jndiName, cf);
+
+                     cfs.add(cf);
+                     jndis.add(jndiName);
+                  }
+                  catch (Throwable t)
+                  {
+                     log.error("Error during the deployment of " + xaDataSource.getJndiName(), t);
+                  }
+               }
+            }
+         }
+         else
+         {
+            if (dataSources.getXaDataSource() != null && dataSources.getXaDataSource().size() > 0)
+               log.error("Deployment of XA datasources disabled since jdbc-xa.rar couldn't be found"); 
+         }
+         
+         return new DsXmlDeployment(url, 
+                                    deploymentName, 
+                                    cfs.toArray(new Object[cfs.size()]),
+                                    jndis.toArray(new String[jndis.size()]), 
+                                    parent);
+      }
+      catch (DeployException de)
+      {
+         // Just rethrow
+         throw de;
+      }
+      catch (Throwable t)
+      {
+         throw new DeployException("Deployment " + url.toExternalForm() + " failed", t);
+      }
+      finally
+      {
+         if (is != null)
+         {
+            try
+            {
+               is.close();
+            }
+            catch (IOException ioe)
+            {
+               // Ignore
+            }
+         }
+
+         SecurityActions.setThreadContextClassLoader(oldTCCL);
+      }
+   }
+
+   /**
+    * Deploy a datasource
+    * @param ds The datasource
+    * @param ra The resource adapter
+    * @param cl The class loader
+    * @return The connection factory
+    * @exception Throwable Thrown if an error occurs during deployment
+    */
+   private Object deployDataSource(DataSource ds, URL ra, ClassLoader cl) throws Throwable
+   {
+      log.debug("DataSource=" + ds);
+
+      MetadataFactory metaDataFactory = new MetadataFactory();
+
+      Connector md = mdr.getResourceAdapter(ra);
+      md = metaDataFactory.mergeConnectorAndDs(ds, md);
+
+      // Get the first connection definition as there is only one
+      ResourceAdapter1516 ra1516 = (ResourceAdapter1516)md.getResourceadapter();
+      List<ConnectionDefinition> cds = ra1516.getOutboundResourceadapter().getConnectionDefinitions();
+      ConnectionDefinition cd = cds.get(0);
+
+      // ManagedConnectionFactory
+      ManagedConnectionFactory mcf =
+         (ManagedConnectionFactory)initAndInject(cd.getManagedConnectionFactoryClass().getValue(),
+                                                 cd.getConfigProperties(),
+                                                 cl);
+      // Create the pool
+      Integer minSize = ds.getMinPoolSize();
+      Integer maxSize = ds.getMaxPoolSize();
+      Long blockingTimeout = ds.getTimeOut() != null ? ds.getTimeOut().getBlockingTimeoutMillis() : null;
+      Long idleTimeout = ds.getTimeOut() != null ? ds.getTimeOut().getIdleTimeoutMinutes() : null;
+      Long backgroundValidationInterval = null; // TODO
+      Boolean prefill = ds.isPrefill();
+      Boolean strictMin = null; // TODO
+      Boolean useFastFail = ds.getValidation() != null ? ds.getValidation().isUseFastFail() : null;
+
+      PoolConfiguration pc = createPoolConfiguration(minSize,
+                                                     maxSize,
+                                                     blockingTimeout, // TODO
+                                                     idleTimeout,
+                                                     backgroundValidationInterval,
+                                                     prefill,
+                                                     strictMin,
+                                                     useFastFail);
+
+      PoolFactory pf = new PoolFactory();
+      Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
+
+      // Select the correct connection manager
+      TransactionSupportLevel tsl = TransactionSupportLevel.LocalTransaction;
+      ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+      ConnectionManager cm = cmf.create(tsl, pool, getTransactionManager());
+
+      // ConnectionFactory
+      Object cf = mcf.createConnectionFactory(cm);
+      
+      return cf;
+   }
+
+   /**
+    * Deploy an XA datasource
+    * @param ds The datasource
+    * @param ra The resource adapter
+    * @param cl The class loader
+    * @return The connection factory
+    * @exception Throwable Thrown if an error occurs during deployment
+    */
+   private Object deployXADataSource(XaDataSource ds, URL ra, ClassLoader cl) throws Throwable
+   {
+      log.debug("XaDataSource=" + ds);
+
+      MetadataFactory metaDataFactory = new MetadataFactory();
+
+      Connector md = mdr.getResourceAdapter(ra);
+      md = metaDataFactory.mergeConnectorAndDs(ds, md);
+
+      // Get the first connection definition as there is only one
+      ResourceAdapter1516 ra1516 = (ResourceAdapter1516)md.getResourceadapter();
+      List<ConnectionDefinition> cds = ra1516.getOutboundResourceadapter().getConnectionDefinitions();
+      ConnectionDefinition cd = cds.get(0);
+
+      // ManagedConnectionFactory
+      ManagedConnectionFactory mcf =
+         (ManagedConnectionFactory)initAndInject(cd.getManagedConnectionFactoryClass().getValue(),
+                                                 cd.getConfigProperties(),
+                                                 cl);
+      // Create the pool
+      Integer minSize = ds.getMinPoolSize();
+      Integer maxSize = ds.getMaxPoolSize();
+      Long blockingTimeout = ds.getTimeOut() != null ? ds.getTimeOut().getBlockingTimeoutMillis() : null;
+      Long idleTimeout = ds.getTimeOut() != null ? ds.getTimeOut().getIdleTimeoutMinutes() : null;
+      Long backgroundValidationInterval = null; // TODO
+      Boolean prefill = ds.isPrefill();
+      Boolean strictMin = null; // TODO
+      Boolean useFastFail = ds.getValidation() != null ? ds.getValidation().isUseFastFail() : null;
+
+      PoolConfiguration pc = createPoolConfiguration(minSize,
+                                                     maxSize,
+                                                     blockingTimeout, // TODO
+                                                     idleTimeout,
+                                                     backgroundValidationInterval,
+                                                     prefill,
+                                                     strictMin,
+                                                     useFastFail);
+
+      PoolFactory pf = new PoolFactory();
+      Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
+
+      // Select the correct connection manager
+      TransactionSupportLevel tsl = TransactionSupportLevel.LocalTransaction;
+      ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+      ConnectionManager cm = cmf.create(tsl, pool, getTransactionManager());
+
+      // ConnectionFactory
+      Object cf = mcf.createConnectionFactory(cm);
+      
+      return cf;
+   }
+
+   /**
+    * Create an instance of the pool configuration based on the input
+    * @param minSize The min size
+    * @param maxSize The max size
+    * @param blockingTimeout The blocking timeout
+    * @param idleTimeout The idle timeout
+    * @param backgroundValidationInterval The background valdation interval
+    * @param prefill The prefill
+    * @param strictMin The strict min
+    * @param useFastFail The use fast fail
+    * @return The configuration
+    */
+   private PoolConfiguration createPoolConfiguration(Integer minSize,
+                                                     Integer maxSize,
+                                                     Long blockingTimeout,
+                                                     Long idleTimeout,
+                                                     Long backgroundValidationInterval,
+                                                     Boolean prefill,
+                                                     Boolean strictMin,
+                                                     Boolean useFastFail)
+   {
+      PoolConfiguration pc = new PoolConfiguration();
+
+      if (minSize != null)
+         pc.setMinSize(minSize.intValue());
+
+      if (maxSize != null)
+         pc.setMaxSize(maxSize.intValue());
+
+      if (blockingTimeout != null)
+         pc.setBlockingTimeout(blockingTimeout.intValue()); // TODO - Long -> int
+
+      if (idleTimeout != null)
+         pc.setIdleTimeout(idleTimeout.longValue());
+
+      if (backgroundValidationInterval != null)
+         pc.setBackgroundValidationInterval(backgroundValidationInterval.longValue());
+
+      if (prefill != null)
+         pc.setPrefill(prefill.booleanValue());
+
+      if (strictMin != null)
+         pc.setStrictMin(strictMin.booleanValue());
+
+      if (useFastFail != null)
+         pc.setUseFastFail(useFastFail.booleanValue());
+
+      return pc;
+   }
+
+   /**
+    * Initialize and inject configuration properties
+    * @param className The fully qualified class name
+    * @param configs The configuration properties
+    * @param cl The class loader
+    * @return The object
+    * @throws DeployException Thrown if the object cant be initialized
+    */
+   private Object initAndInject(String className,
+                                List<? extends ConfigProperty> configs,
+                                ClassLoader cl)
+      throws DeployException
+   {
+      try
+      {
+         Class clz = Class.forName(className, true, cl);
+         Object o = clz.newInstance();
+
+         if (configs != null)
+         {
+            Injection injector = new Injection();
+            for (ConfigProperty cpmd : configs)
+            {
+               if (cpmd.isValueSet())
+                  injector.inject(cpmd.getConfigPropertyType().getValue(), cpmd.getConfigPropertyName().getValue(),
+                        cpmd.getConfigPropertyValue().getValue(), o);
+            }
+         }
+
+         return o;
+      }
+      catch (Throwable t)
+      {
+         throw new DeployException("Deployment " + className + " failed", t);
+      }
+   }
+
+   /**
+    * Bind connection factory into JNDI
+    * @param deployment The deployment name
+    * @param jndi The JNDI name
+    * @param cf The connection factory
+    * @return The JNDI names bound
+    * @exception Exception thrown if an error occurs
+    */
+   private String[] bindConnectionFactory(String deployment, String jndi, Object cf) throws Throwable
+   {
+      JndiStrategy js = new ExplicitJndiStrategy();
+
+      return js.bindConnectionFactories(deployment, new Object[] {cf}, new String[] {jndi});
+   }
+
+   /**
+    * Start
+    */
+   public void start()
+   {
+      if (transactionManager == null)
+         throw new IllegalStateException("TransactionManager not defined");
+
+      if (mdr == null)
+         throw new IllegalStateException("MetadataRepository not defined");
+
+      if (kernel == null)
+         throw new IllegalStateException("Kernel not defined");
+   }
+}

Added: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployment.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployment.java	                        (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployment.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, 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.deployers.fungal;
+
+import org.jboss.jca.core.naming.ExplicitJndiStrategy;
+import org.jboss.jca.core.spi.naming.JndiStrategy;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.net.URL;
+
+import org.jboss.logging.Logger;
+
+import com.github.fungal.spi.deployers.Deployment;
+
+/**
+ * A datasource deployment for JCA/SJC
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class DsXmlDeployment implements Deployment
+{
+   /** The logger */
+   private static Logger log = Logger.getLogger(DsXmlDeployment.class);
+
+   /** The deployment */
+   private URL deployment;
+
+   /** The deployment name */
+   private String deploymentName;
+
+   /** The connection factories */
+   private Object[] cfs;
+
+   /** The JNDI names */
+   private String[] jndis;
+
+   /** The classloader */
+   private ClassLoader cl;
+
+   /**
+    * Constructor
+    * @param deployment The deployment
+    * @param deploymentName The unique deployment name
+    * @param cfs The connection factories
+    * @param jndis The JNDI names for the factories
+    * @param cl The classloader
+    */
+   public DsXmlDeployment(URL deployment,
+                          String deploymentName,
+                          Object[] cfs,
+                          String[] jndis,
+                          ClassLoader cl)
+   {
+      this.deployment = deployment;
+      this.deploymentName = deploymentName;
+      this.cfs = cfs;
+      this.jndis = jndis;
+      this.cl = cl;
+   }
+
+   /**
+    * Get the unique URL for the deployment
+    * @return The URL
+    */
+   public URL getURL()
+   {
+      return deployment;
+   }
+
+   /**
+    * Get the classloader
+    * @return The classloader
+    */
+   public ClassLoader getClassLoader()
+   {
+      return cl;
+   }
+
+   /**
+    * Stop
+    */
+   public void stop()
+   {
+      log.debug("Undeploying: " + deployment.toExternalForm());
+
+      if (cfs != null)
+      {
+         JndiStrategy jndiStrategy = new ExplicitJndiStrategy();
+
+         try
+         {
+            jndiStrategy.unbindConnectionFactories(deploymentName, cfs, jndis);
+         }
+         catch (Throwable t)
+         {
+            log.warn("Exception during JNDI unbinding", t);
+         }
+      }
+   }
+
+   /**
+    * Destroy
+    */
+   public void destroy()
+   {
+      if (cl != null && cl instanceof Closeable)
+      {
+         try
+         {
+            ((Closeable)cl).close();
+         }
+         catch (IOException ioe)
+         {
+            // Swallow
+         }
+      }
+   }
+}

Added: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java	                        (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,697 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-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.jca.deployers.fungal;
+
+import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
+import org.jboss.jca.common.api.metadata.ra.AdminObject;
+import org.jboss.jca.common.api.metadata.ra.ConfigProperty;
+import org.jboss.jca.common.api.metadata.ra.ConnectionDefinition;
+import org.jboss.jca.common.api.metadata.ra.Connector;
+import org.jboss.jca.common.api.metadata.ra.Connector.Version;
+import org.jboss.jca.common.api.metadata.ra.MessageListener;
+import org.jboss.jca.common.api.metadata.ra.ResourceAdapter1516;
+import org.jboss.jca.common.api.metadata.ra.ra10.ResourceAdapter10;
+import org.jboss.jca.core.connectionmanager.ConnectionManager;
+import org.jboss.jca.core.connectionmanager.ConnectionManagerFactory;
+import org.jboss.jca.core.connectionmanager.pool.api.Pool;
+import org.jboss.jca.core.connectionmanager.pool.api.PoolConfiguration;
+import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
+import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
+import org.jboss.jca.validator.ValidateObject;
+import org.jboss.jca.validator.Validator;
+import org.jboss.jca.validator.ValidatorException;
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.Serializable;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.resource.Referenceable;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.TransactionSupport;
+import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
+
+import org.jboss.logging.Logger;
+
+import com.github.fungal.api.Kernel;
+import com.github.fungal.api.classloading.ClassLoaderFactory;
+import com.github.fungal.api.classloading.KernelClassLoader;
+import com.github.fungal.api.util.FileUtil;
+import com.github.fungal.spi.deployers.DeployException;
+import com.github.fungal.spi.deployers.DeployerPhases;
+import com.github.fungal.spi.deployers.Deployment;
+
+/**
+ * The RA activator for JCA/SJC
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public final class RAActivator extends AbstractResourceAdapterDeployer implements DeployerPhases
+{
+   /** The logger */
+   private static Logger log = Logger.getLogger(RAActivator.class);
+
+   /** Trace enabled */
+   private static boolean trace = log.isTraceEnabled();
+
+   /** The kernel */
+   private Kernel kernel;
+
+   /** The archives that should be excluded for activation */
+   private Set<String> excludeArchives;
+
+   /** The list of generated deployments */
+   private List<Deployment> deployments;
+
+   /**
+    * Constructor
+    */
+   public RAActivator()
+   {
+   }
+
+   /**
+    * Get the kernel
+    * @return The kernel
+    */
+   public Kernel getKernel()
+   {
+      return kernel;
+   }
+
+   /**
+    * Set the kernel
+    * @param kernel The kernel
+    */
+   public void setKernel(Kernel kernel)
+   {
+      this.kernel = kernel;
+   }
+
+   /**
+    * Get the exclude archives
+    * @return The archives
+    */
+   public Set<String> getExcludeArchives()
+   {
+      return excludeArchives;
+   }
+
+   /**
+    * Set the exclude archives
+    * @param archives The archives
+    */
+   public void setExcludeArchives(Set<String> archives)
+   {
+      this.excludeArchives = archives;
+   }
+
+   /**
+    * Pre deploy
+    * @exception Throwable Thrown if an error occurs
+    */
+   public void preDeploy() throws Throwable
+   {
+   }
+
+   /**
+    * Post deploy
+    * @exception Throwable Thrown if an error occurs
+    */
+   public void postDeploy() throws Throwable
+   {
+      Set<URL> rarDeployments = getConfiguration().getMetadataRepository().getResourceAdapters();
+
+      for (URL deployment : rarDeployments)
+      {
+         if (trace)
+            log.trace("Processing: " + deployment.toExternalForm());
+
+         boolean include = true;
+         
+         if (excludeArchives != null)
+         {
+            for (String excludedArchive : excludeArchives)
+            {
+               if (deployment.toExternalForm().endsWith(excludedArchive))
+                  include = false;
+            }
+         }
+
+         if (include)
+         {
+            Map<String, String> jndiMappings = null; // getMetadataRepository().getJndiMappings();
+
+            // If there isn't any JNDI mappings then the archive isn't active
+            // so activate it
+            if (jndiMappings == null)
+            {
+               Deployment raDeployment = deploy(deployment, kernel.getKernelClassLoader());
+               if (raDeployment != null)
+               {
+                  if (deployments == null)
+                     deployments = new ArrayList<Deployment>(1);
+
+                  deployments.add(raDeployment);
+
+                  kernel.getMainDeployer().registerDeployment(raDeployment);
+               }
+            }
+         }
+      }
+   }
+
+   /**
+    * Pre undeploy
+    * @exception Throwable Thrown if an error occurs
+    */
+   public void preUndeploy() throws Throwable
+   {
+      if (deployments != null)
+      {
+         for (Deployment raDeployment : deployments)
+         {
+            try
+            {
+               kernel.getMainDeployer().unregisterDeployment(raDeployment);
+            }
+            catch (Throwable t)
+            {
+               log.warn("Error during undeployment of " + raDeployment.getURL());
+            }
+         }
+      }
+   }
+
+   /**
+    * Post undeploy
+    * @exception Throwable Thrown if an error occurs
+    */
+   public void postUndeploy() throws Throwable
+   {
+   }
+
+   /**
+    * Deploy
+    * @param url The url
+    * @param parent The parent classloader
+    * @return The deployment
+    * @exception DeployException Thrown if an error occurs during deployment
+    */
+   public Deployment deploy(URL url, ClassLoader parent) throws DeployException
+   {
+      Set<Failure> failures = null;
+
+      log.debug("Deploying: " + url.toExternalForm());
+
+      ClassLoader oldTCCL = SecurityActions.getThreadContextClassLoader();
+      try
+      {
+         File f = new File(url.toURI());
+
+         if (!f.exists())
+            return null;
+
+         File root = null;
+         File destination = null;
+
+         if (f.isFile())
+         {
+            FileUtil fileUtil = new FileUtil();
+            destination = new File(SecurityActions.getSystemProperty("iron.jacamar.home"), "/tmp/");
+            root = fileUtil.extract(f, destination);
+         }
+         else
+         {
+            root = f;
+         }
+
+         // Create classloader
+         URL[] urls = getUrls(root);
+         KernelClassLoader cl = null;
+         if (getConfiguration().getScopeDeployment())
+         {
+            cl = ClassLoaderFactory.create(ClassLoaderFactory.TYPE_PARENT_LAST, urls, parent);
+         }
+         else
+         {
+            cl = ClassLoaderFactory.create(ClassLoaderFactory.TYPE_PARENT_FIRST, urls, parent);
+         }
+         SecurityActions.setThreadContextClassLoader(cl);
+
+         // Get metadata
+         Connector cmd = getConfiguration().getMetadataRepository().getResourceAdapter(url);
+
+         // Notify regarding license terms
+         if (cmd != null && cmd.getLicense() != null && cmd.getLicense().isLicenseRequired())
+            log.info("Required license terms for " + url.toExternalForm());
+
+         ResourceAdapter resourceAdapter = null;
+         List<Validate> archiveValidationObjects = new ArrayList<Validate>();
+         List<Failure> partialFailures = null;
+         List<Object> beanValidationObjects = new ArrayList<Object>();
+
+         String deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
+         Object[] cfs = null;
+
+         // Create objects and inject values
+         if (cmd != null)
+         {
+            // ResourceAdapter
+            if (cmd.getVersion() != Version.V_10)
+            {
+               ResourceAdapter1516 ra1516 = (ResourceAdapter1516)cmd.getResourceadapter();
+               if (ra1516 != null && ra1516.getResourceadapterClass() != null)
+               {
+                  resourceAdapter =
+                     (ResourceAdapter) initAndInject(
+                         ra1516.getResourceadapterClass(), ra1516.getConfigProperties(), cl);
+
+                  if (trace)
+                  {
+                     log.trace("ResourceAdapter: " + resourceAdapter.getClass().getName());
+                     log.trace("ResourceAdapter defined in classloader: " +
+                               resourceAdapter.getClass().getClassLoader());
+                  }
+
+                  archiveValidationObjects.add(new ValidateObject(Key.RESOURCE_ADAPTER,
+                                                                  resourceAdapter,
+                                                                  ra1516.getConfigProperties()));
+                  beanValidationObjects.add(resourceAdapter);
+               }
+            }
+
+            // ManagedConnectionFactory
+            if (cmd.getVersion() == Version.V_10)
+            {
+
+               ManagedConnectionFactory mcf =
+                     (ManagedConnectionFactory) initAndInject(((ResourceAdapter10) cmd.getResourceadapter())
+                           .getManagedConnectionFactoryClass()
+                           .getValue(), ((ResourceAdapter10) cmd.getResourceadapter())
+                           .getConfigProperties(), cl);
+
+               if (trace)
+               {
+                  log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
+                  log.trace("ManagedConnectionFactory defined in classloader: " +
+                         mcf.getClass().getClassLoader());
+               }
+
+               mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
+
+               archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
+                                                               mcf,
+                                                               ((ResourceAdapter10) cmd.getResourceadapter())
+                                                               .getConfigProperties()));
+               beanValidationObjects.add(mcf);
+               associateResourceAdapter(resourceAdapter, mcf);
+
+               // Create the pool
+               PoolConfiguration pc = new PoolConfiguration();
+               PoolFactory pf = new PoolFactory();
+
+               Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
+
+               // Add a connection manager
+               ConnectionManager cm = null;
+
+               TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
+               TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
+
+               tsmd = ((ResourceAdapter10) cmd.getResourceadapter()).getTransactionSupport();
+
+               if (tsmd == TransactionSupportEnum.NoTransaction)
+               {
+                  tsl = TransactionSupportLevel.NoTransaction;
+               }
+               else if (tsmd == TransactionSupportEnum.LocalTransaction)
+               {
+                  tsl = TransactionSupportLevel.LocalTransaction;
+               }
+               else if (tsmd == TransactionSupportEnum.XATransaction)
+               {
+                  tsl = TransactionSupportLevel.XATransaction;
+               }
+               // Section 7.13 -- Read from metadata -> overwrite with specified value if present
+               if (mcf instanceof TransactionSupport)
+                  tsl = ((TransactionSupport) mcf).getTransactionSupport();
+
+               // Select the correct connection manager
+               ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+               cm = cmf.create(tsl, pool, getConfiguration().getTransactionManager());
+
+               // ConnectionFactory
+               Object cf = mcf.createConnectionFactory(cm);
+
+               if (cf == null)
+               {
+                  log.error("ConnectionFactory is null");
+               }
+               else
+               {
+                  if (trace)
+                  {
+                     log.trace("ConnectionFactory: " + cf.getClass().getName());
+                     log.trace("ConnectionFactory defined in classloader: "
+                           + cf.getClass().getClassLoader());
+                  }
+               }
+
+               archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
+
+               if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
+               {
+                  bindConnectionFactory(deploymentName, cf);
+                  cfs = new Object[] {cf};
+               }
+            }
+            else
+            {
+               ResourceAdapter1516 ra = (ResourceAdapter1516) cmd.getResourceadapter();
+               if (ra != null &&
+                   ra.getOutboundResourceadapter() != null &&
+                   ra.getOutboundResourceadapter().getConnectionDefinitions() != null)
+               {
+                  List<ConnectionDefinition> cdMetas = ra.getOutboundResourceadapter().getConnectionDefinitions();
+                  if (cdMetas.size() > 0)
+                  {
+                     for (ConnectionDefinition cdMeta : cdMetas)
+                     {
+                        ManagedConnectionFactory mcf =
+                           (ManagedConnectionFactory) initAndInject(cdMeta.getManagedConnectionFactoryClass()
+                                                                    .getValue(), cdMeta
+                                                                    .getConfigProperties(), cl);
+
+                        if (trace)
+                        {
+                           log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
+                           log.trace("ManagedConnectionFactory defined in classloader: " +
+                                     mcf.getClass().getClassLoader());
+                        }
+
+                        mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
+
+                        archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
+                                                                        mcf,
+                                                                        cdMeta.getConfigProperties()));
+                        beanValidationObjects.add(mcf);
+                        associateResourceAdapter(resourceAdapter, mcf);
+
+                        // Create the pool
+                        PoolConfiguration pc = new PoolConfiguration();
+                        PoolFactory pf = new PoolFactory();
+
+                        Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
+
+                        // Add a connection manager
+                        ConnectionManager cm = null;
+                        TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
+                        TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
+
+                        tsmd = ra.getOutboundResourceadapter().getTransactionSupport();
+                        
+                        if (tsmd == TransactionSupportEnum.NoTransaction)
+                        {
+                           tsl = TransactionSupportLevel.NoTransaction;
+                        }
+                        else if (tsmd == TransactionSupportEnum.LocalTransaction)
+                        {
+                           tsl = TransactionSupportLevel.LocalTransaction;
+                        }
+                        else if (tsmd == TransactionSupportEnum.XATransaction)
+                        {
+                           tsl = TransactionSupportLevel.XATransaction;
+                        }
+
+                        // Section 7.13 -- Read from metadata -> overwrite with specified value if present
+                        if (mcf instanceof TransactionSupport)
+                           tsl = ((TransactionSupport) mcf).getTransactionSupport();
+
+                        // Select the correct connection manager
+                        ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+                        cm = cmf.create(tsl, pool, getConfiguration().getTransactionManager());
+
+                        // ConnectionFactory
+                        Object cf = mcf.createConnectionFactory(cm);
+
+                        if (cf == null)
+                        {
+                           log.error("ConnectionFactory is null");
+                        }
+                        else
+                        {
+                           if (trace)
+                           {
+                              log.trace("ConnectionFactory: " + cf.getClass().getName());
+                              log.trace("ConnectionFactory defined in classloader: "
+                                        + cf.getClass().getClassLoader());
+                           }
+                        }
+
+                        archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
+                        
+                        if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
+                        {
+                           if (cdMetas.size() == 1)
+                           {
+                              deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
+                              bindConnectionFactory(deploymentName, cf);
+                              cfs = new Object[] {cf};
+                           }
+                           else
+                           {
+                              log.warn("NYI: There are multiple connection factories for: " + f.getName());
+                           }
+                        }
+                     }
+                  }
+               }
+            }
+
+            // ActivationSpec
+            if (cmd.getVersion() != Version.V_10)
+            {
+               ResourceAdapter1516 ra1516 = (ResourceAdapter1516) cmd.getResourceadapter();
+               if (ra1516 != null &&
+                   ra1516.getInboundResourceadapter() != null &&
+                   ra1516.getInboundResourceadapter().getMessageadapter() != null &&
+                   ra1516.getInboundResourceadapter().getMessageadapter().getMessagelisteners() != null)
+               {
+                  List<MessageListener> mlMetas = 
+                     ra1516.getInboundResourceadapter().getMessageadapter().getMessagelisteners();
+
+                  if (mlMetas.size() > 0)
+                  {
+                     for (MessageListener mlMeta : mlMetas)
+                     {
+                        if (mlMeta.getActivationspec() != null &&
+                            mlMeta.getActivationspec().getActivationspecClass().getValue() != null)
+                        {
+                           List<? extends ConfigProperty> cpm = mlMeta
+                                 .getActivationspec().getConfigProperties();
+
+                           Object o = initAndInject(mlMeta
+                                 .getActivationspec().getActivationspecClass().getValue(), cpm, cl);
+
+                           if (trace)
+                           {
+                              log.trace("ActivationSpec: " + o.getClass().getName());
+                              log.trace("ActivationSpec defined in classloader: " + o.getClass().getClassLoader());
+                           }
+
+                           archiveValidationObjects.add(new ValidateObject(Key.ACTIVATION_SPEC, o, cpm));
+                           beanValidationObjects.add(o);
+                           associateResourceAdapter(resourceAdapter, o);
+                        }
+                     }
+                  }
+               }
+            }
+
+            // AdminObject
+            if (cmd.getVersion() != Version.V_10)
+            {
+               ResourceAdapter1516 ra1516 = (ResourceAdapter1516) cmd.getResourceadapter();
+               if (ra1516 != null && ra1516.getAdminobjects() != null)
+               {
+                  List<AdminObject> aoMetas = ((ResourceAdapter1516) cmd.getResourceadapter()).getAdminobjects();
+                  if (aoMetas.size() > 0)
+                  {
+                     for (AdminObject aoMeta : aoMetas)
+                     {
+                        if (aoMeta.getAdminobjectClass() != null &&
+                            aoMeta.getAdminobjectClass().getValue() != null)
+                        {
+                           Object o =
+                              initAndInject(aoMeta.getAdminobjectClass().getValue(), aoMeta.getConfigProperties(),
+                                            cl);
+
+                           if (trace)
+                           {
+                              log.trace("AdminObject: " + o.getClass().getName());
+                              log.trace("AdminObject defined in classloader: " + o.getClass().getClassLoader());
+                           }
+
+                           archiveValidationObjects
+                                 .add(new ValidateObject(Key.ADMIN_OBJECT, o, aoMeta.getConfigProperties()));
+                           beanValidationObjects.add(o);
+                        }
+                     }
+                  }
+               }
+            }
+         }
+
+         // Archive validation
+         partialFailures = validateArchive(url, archiveValidationObjects);
+
+         if (partialFailures != null)
+         {
+            if (failures == null)
+            {
+               failures = new HashSet<Failure>();
+            }
+            failures.addAll(partialFailures);
+         }
+
+         if ((getConfiguration().getArchiveValidationFailOnWarn() && hasFailuresLevel(failures, Severity.WARNING)) ||
+             (getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
+         {
+            throw new ValidatorException(printFailuresLog(url.getPath(), new Validator(), failures, null), failures);
+         }
+         else
+         {
+            printFailuresLog(url.getPath(), new Validator(), failures, null);
+         }
+
+         // Bean validation
+         if (getConfiguration().getBeanValidation())
+         {
+            //JbossRa20 jrmd20 = null;
+            List<Class> groupsClasses = null;
+
+            /*
+            if (jrmd instanceof JbossRa20)
+            {
+               jrmd20 = (JbossRa20) jrmd;
+            }
+
+            if (jrmd20 != null && 
+                jrmd20.getBeanValidationGroups() != null &&
+                jrmd20.getBeanValidationGroups().size() > 0)
+            {
+               BeanValidationGroup bvGroups = jrmd20.getBeanValidationGroups().get(0);
+               groupsClasses = new ArrayList<Class>();
+               for (String group : bvGroups.getBeanValidationGroup())
+               {
+                  groupsClasses.add(Class.forName(group, true, cl));
+               }
+            }
+            */
+
+            if (beanValidationObjects.size() > 0)
+            {
+               BeanValidation beanValidator = new BeanValidation();
+               for (Object o : beanValidationObjects)
+               {
+                  beanValidator.validate(o, groupsClasses);
+               }
+            }
+         }
+
+         // Activate deployment
+         if (resourceAdapter != null)
+         {
+            String bootstrapIdentifier = null;
+
+            /*
+            if (jrmd != null && jrmd instanceof JbossRa20)
+            {
+               JbossRa20 jrmd20 = (JbossRa20) jrmd;
+               bootstrapIdentifier = jrmd20.getBootstrapContext();
+            }
+            */
+
+            startContext(resourceAdapter, bootstrapIdentifier);
+         }
+
+         log.info("Deployed: " + url.toExternalForm());
+
+         RADeployment depoyment = new RADeployment(url, 
+                                                   deploymentName, 
+                                                   true,
+                                                   resourceAdapter, 
+                                                   getConfiguration().getJndiStrategy(), 
+                                                   getConfiguration().getMetadataRepository(), 
+                                                   cfs,
+                                                   destination, 
+                                                   cl,
+                                                   log);
+
+         return depoyment;
+      }
+      catch (DeployException de)
+      {
+         // Just rethrow
+         throw de;
+      }
+      catch (Throwable t)
+      {
+         if ((getConfiguration().getArchiveValidationFailOnWarn() && hasFailuresLevel(failures, Severity.WARNING)) ||
+             (getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
+            throw new DeployException("Deployment " + url.toExternalForm() + " failed",
+                  new ValidatorException(printFailuresLog(url.getPath(), new Validator(), failures, null), failures));
+         else
+         {
+            printFailuresLog(url.getPath(), new Validator(), failures, null);
+            throw new DeployException("Deployment " + url.toExternalForm() + " failed", t);
+         }
+      }
+      finally
+      {
+         SecurityActions.setThreadContextClassLoader(oldTCCL);
+      }
+   }
+
+   /**
+    * Start
+    */
+   @Override
+   public void start()
+   {
+      super.start();
+
+      if (kernel == null)
+         throw new IllegalStateException("Kernel not defined");
+   }
+}

Added: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAConfiguration.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAConfiguration.java	                        (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAConfiguration.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,302 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-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.jca.deployers.fungal;
+
+import org.jboss.jca.core.api.bootstrap.CloneableBootstrapContext;
+import org.jboss.jca.core.spi.mdr.MetadataRepository;
+import org.jboss.jca.core.spi.naming.JndiStrategy;
+
+import java.io.PrintStream;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.transaction.TransactionManager;
+
+import org.jboss.logging.Logger;
+
+/**
+ * A configuration for the resource adapter deployer chain
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class RAConfiguration
+{
+   private static Logger log = Logger.getLogger(RAConfiguration.class);
+
+   private static boolean trace = log.isTraceEnabled();
+
+   /** The transaction manager */
+   private TransactionManager transactionManager = null;
+
+   /** Preform bean validation */
+   private AtomicBoolean beanValidation = new AtomicBoolean(true);
+
+   /** Preform archive validation */
+   private AtomicBoolean archiveValidation = new AtomicBoolean(true);
+
+   /** Archive validation: Fail on Warn */
+   private AtomicBoolean archiveValidationFailOnWarn = new AtomicBoolean(false);
+
+   /** Archive validation: Fail on Error */
+   private AtomicBoolean archiveValidationFailOnError = new AtomicBoolean(true);
+
+   /** Print stream */
+   private PrintStream printStream = null;
+
+   /** Default bootstrap context */
+   private CloneableBootstrapContext defaultBootstrapContext = null;
+
+   /** Bootstrap contexts */
+   private Map<String, CloneableBootstrapContext> bootstrapContexts = null;
+
+   /** Scope deployment */
+   private AtomicBoolean scopeDeployment = new AtomicBoolean(false);
+
+   /** JNDI strategy */
+   private JndiStrategy jndiStrategy = null;
+
+   /** Metadata repository */
+   private MetadataRepository mdr = null;
+
+   /**
+    * Constructor
+    */
+   public RAConfiguration()
+   {
+   }
+
+   /**
+    * Set the transaction manager
+    * @param value The value
+    */
+   public void setTransactionManager(TransactionManager value)
+   {
+      transactionManager = value;
+   }
+
+   /**
+    * Get the transaction manager
+    * @return The value
+    */
+   public TransactionManager getTransactionManager()
+   {
+      return transactionManager;
+   }
+
+   /**
+    * Set if bean validation should be performed
+    * @param value The value
+    */
+   public void setBeanValidation(boolean value)
+   {
+      beanValidation.set(value);
+   }
+
+   /**
+    * Should bean validation be performed
+    * @return True if validation; otherwise false
+    */
+   public boolean getBeanValidation()
+   {
+      return beanValidation.get();
+   }
+
+   /**
+    * Set if archive validation should be performed
+    * @param value The value
+    */
+   public void setArchiveValidation(boolean value)
+   {
+      archiveValidation.set(value);
+   }
+
+   /**
+    * Should archive validation be performed
+    * @return True if validation; otherwise false
+    */
+   public boolean getArchiveValidation()
+   {
+      return archiveValidation.get();
+   }
+
+   /**
+    * Set if a failed warning archive validation report should fail the deployment
+    * @param value The value
+    */
+   public void setArchiveValidationFailOnWarn(boolean value)
+   {
+      archiveValidationFailOnWarn.set(value);
+   }
+
+   /**
+    * Does a failed archive validation warning report fail the deployment
+    * @return True if failing; otherwise false
+    */
+   public boolean getArchiveValidationFailOnWarn()
+   {
+      return archiveValidationFailOnWarn.get();
+   }
+
+   /**
+    * Set if a failed error archive validation report should fail the deployment
+    * @param value The value
+    */
+   public void setArchiveValidationFailOnError(boolean value)
+   {
+      archiveValidationFailOnError.set(value);
+   }
+
+   /**
+    * Does a failed archive validation error report fail the deployment
+    * @return True if failing; otherwise false
+    */
+   public boolean getArchiveValidationFailOnError()
+   {
+      return archiveValidationFailOnError.get();
+   }
+
+   /**
+    * Set the print stream
+    * @param value The value
+    */
+   public void setPrintStream(PrintStream value)
+   {
+      printStream = value;
+   }
+
+   /**
+    * Get the print stream
+    * @return The handle
+    */
+   public PrintStream getPrintStream()
+   {
+      return printStream;
+   }
+
+   /**
+    * Set the default bootstrap context
+    * @param value The value
+    */
+   public void setDefaultBootstrapContext(CloneableBootstrapContext value)
+   {
+      defaultBootstrapContext = value;
+   }
+
+   /**
+    * Get the default bootstrap context
+    * @return The handle
+    */
+   public CloneableBootstrapContext getDefaultBootstrapContext()
+   {
+      return defaultBootstrapContext;
+   }
+
+   /**
+    * Set the bootstrap context map
+    * @param value The value
+    */
+   public void setBootstrapContexts(Map<String, CloneableBootstrapContext> value)
+   {
+      bootstrapContexts = value;
+   }
+
+   /**
+    * Get the bootstrap context map
+    * @return The handle
+    */
+   public Map<String, CloneableBootstrapContext> getBootstrapContexts()
+   {
+      return bootstrapContexts;
+   }
+
+   /**
+    * Set if deployments should be scoped
+    * @param value The value
+    */
+   public void setScopeDeployment(boolean value)
+   {
+      scopeDeployment.set(value);
+   }
+
+   /**
+    * Are the deployments scoped
+    * @return True if scoped; otherwise false
+    */
+   public boolean getScopeDeployment()
+   {
+      return scopeDeployment.get();
+   }
+
+   /**
+    * Set the JNDI strategy
+    * @param value The value
+    */
+   public void setJndiStrategy(JndiStrategy value)
+   {
+      jndiStrategy = value;
+   }
+
+   /**
+    * Get the JNDI strategy
+    * @return The handle
+    */
+   public JndiStrategy getJndiStrategy()
+   {
+      return jndiStrategy;
+   }
+
+   /**
+    * Set the metadata repository
+    * @param value The value
+    */
+   public void setMetadataRepository(MetadataRepository value)
+   {
+      mdr = value;
+   }
+
+   /**
+    * Get the metadata repository
+    * @return The handle
+    */
+   public MetadataRepository getMetadataRepository()
+   {
+      return mdr;
+   }
+
+   /**
+    * Start
+    */
+   public void start()
+   {
+      if (defaultBootstrapContext == null)
+         throw new IllegalStateException("DefaultBootstrapContext not defined");
+
+      if (printStream == null)
+         throw new IllegalStateException("PrintStream not defined");
+
+      if (jndiStrategy == null)
+         throw new IllegalStateException("JndiStrategy not defined");
+
+      if (mdr == null)
+         throw new IllegalStateException("MetadataRepository not defined");
+   }
+}

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -36,17 +36,13 @@
 import org.jboss.jca.common.api.metadata.ra.ResourceAdapter1516;
 import org.jboss.jca.common.api.metadata.ra.ra10.ResourceAdapter10;
 import org.jboss.jca.common.metadata.MetadataFactory;
-import org.jboss.jca.core.api.bootstrap.CloneableBootstrapContext;
 import org.jboss.jca.core.connectionmanager.ConnectionManager;
 import org.jboss.jca.core.connectionmanager.ConnectionManagerFactory;
 import org.jboss.jca.core.connectionmanager.pool.api.Pool;
 import org.jboss.jca.core.connectionmanager.pool.api.PoolConfiguration;
 import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
 import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
-import org.jboss.jca.core.naming.NoopJndiStrategy;
-import org.jboss.jca.core.spi.naming.JndiStrategy;
 import org.jboss.jca.validator.Failure;
-import org.jboss.jca.validator.FailureHelper;
 import org.jboss.jca.validator.Key;
 import org.jboss.jca.validator.Severity;
 import org.jboss.jca.validator.Validate;
@@ -55,47 +51,33 @@
 import org.jboss.jca.validator.Validator;
 import org.jboss.jca.validator.ValidatorException;
 
-import java.io.BufferedWriter;
 import java.io.File;
-import java.io.FileWriter;
 import java.io.IOException;
-import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.io.Serializable;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.HashSet;
-import java.util.LinkedList;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.resource.Referenceable;
-import javax.resource.spi.BootstrapContext;
 import javax.resource.spi.ManagedConnectionFactory;
 import javax.resource.spi.ResourceAdapter;
-import javax.resource.spi.ResourceAdapterAssociation;
 import javax.resource.spi.TransactionSupport;
 import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
-import javax.transaction.TransactionManager;
 
 import org.jboss.logging.Logger;
 
 import com.github.fungal.api.classloading.ClassLoaderFactory;
 import com.github.fungal.api.classloading.KernelClassLoader;
 import com.github.fungal.api.util.FileUtil;
-import com.github.fungal.api.util.Injection;
-import com.github.fungal.api.util.JarFilter;
-import com.github.fungal.spi.deployers.CloneableDeployer;
 import com.github.fungal.spi.deployers.DeployException;
 import com.github.fungal.spi.deployers.Deployer;
+import com.github.fungal.spi.deployers.DeployerOrder;
 import com.github.fungal.spi.deployers.Deployment;
+import com.github.fungal.spi.deployers.MultiStageDeployer;
 
 /**
  * The RA deployer for JCA/SJC
@@ -103,42 +85,14 @@
  * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
  * @author <a href="mailto:stefano.maestri at javalinux.it">Stefano Maestri</a>
  */
-public final class RADeployer implements CloneableDeployer
+public final class RADeployer extends AbstractResourceAdapterDeployer implements Deployer,
+                                                                                 MultiStageDeployer,
+                                                                                 DeployerOrder
 {
    private static Logger log = Logger.getLogger(RADeployer.class);
 
    private static boolean trace = log.isTraceEnabled();
 
-   /** The transaction manager */
-   private static TransactionManager transactionManager = null;
-
-   /** Preform bean validation */
-   private static AtomicBoolean beanValidation = new AtomicBoolean(true);
-
-   /** Preform archive validation */
-   private static AtomicBoolean archiveValidation = new AtomicBoolean(true);
-
-   /** Archive validation: Fail on Warn */
-   private static AtomicBoolean archiveValidationFailOnWarn = new AtomicBoolean(false);
-
-   /** Archive validation: Fail on Error */
-   private static AtomicBoolean archiveValidationFailOnError = new AtomicBoolean(true);
-
-   /** Print stream */
-   private static PrintStream printStream = null;
-
-   /** Default bootstrap context */
-   private static CloneableBootstrapContext defaultBootstrapContext = null;
-
-   /** Bootstrap contexts */
-   private static Map<String, CloneableBootstrapContext> bootstrapContexts = null;
-
-   /** Scope deployment */
-   private static AtomicBoolean scopeDeployment = new AtomicBoolean(false);
-
-   /** JNDI strategy */
-   private static JndiStrategy jndiStrategy = null;
-
    /**
     * Constructor
     */
@@ -147,186 +101,15 @@
    }
 
    /**
-    * Set the transaction manager
-    * @param value The value
+    * Deployer order
+    * @return The deployment
     */
-   public synchronized void setTransactionManager(TransactionManager value)
+   public int getOrder()
    {
-      transactionManager = value;
+      return Integer.MIN_VALUE;
    }
 
    /**
-    * Get the transaction manager
-    * @return The value
-    */
-   public synchronized TransactionManager getTransactionManager()
-   {
-      return transactionManager;
-   }
-
-   /**
-    * Set if bean validation should be performed
-    * @param value The value
-    */
-   public void setBeanValidation(boolean value)
-   {
-      beanValidation.set(value);
-   }
-
-   /**
-    * Should bean validation be performed
-    * @return True if validation; otherwise false
-    */
-   public boolean getBeanValidation()
-   {
-      return beanValidation.get();
-   }
-
-   /**
-    * Set if archive validation should be performed
-    * @param value The value
-    */
-   public void setArchiveValidation(boolean value)
-   {
-      archiveValidation.set(value);
-   }
-
-   /**
-    * Should archive validation be performed
-    * @return True if validation; otherwise false
-    */
-   public boolean getArchiveValidation()
-   {
-      return archiveValidation.get();
-   }
-
-   /**
-    * Set if a failed warning archive validation report should fail the deployment
-    * @param value The value
-    */
-   public void setArchiveValidationFailOnWarn(boolean value)
-   {
-      archiveValidationFailOnWarn.set(value);
-   }
-
-   /**
-    * Does a failed archive validation warning report fail the deployment
-    * @return True if failing; otherwise false
-    */
-   public boolean getArchiveValidationFailOnWarn()
-   {
-      return archiveValidationFailOnWarn.get();
-   }
-
-   /**
-    * Set if a failed error archive validation report should fail the deployment
-    * @param value The value
-    */
-   public void setArchiveValidationFailOnError(boolean value)
-   {
-      archiveValidationFailOnError.set(value);
-   }
-
-   /**
-    * Does a failed archive validation error report fail the deployment
-    * @return True if failing; otherwise false
-    */
-   public boolean getArchiveValidationFailOnError()
-   {
-      return archiveValidationFailOnError.get();
-   }
-
-   /**
-    * Set the print stream
-    * @param value The value
-    */
-   public synchronized void setPrintStream(PrintStream value)
-   {
-      printStream = value;
-   }
-
-   /**
-    * Get the print stream
-    * @return The handle
-    */
-   public synchronized PrintStream getPrintStream()
-   {
-      return printStream;
-   }
-
-   /**
-    * Set the default bootstrap context
-    * @param value The value
-    */
-   public synchronized void setDefaultBootstrapContext(CloneableBootstrapContext value)
-   {
-      defaultBootstrapContext = value;
-   }
-
-   /**
-    * Get the default bootstrap context
-    * @return The handle
-    */
-   public synchronized CloneableBootstrapContext getDefaultBootstrapContext()
-   {
-      return defaultBootstrapContext;
-   }
-
-   /**
-    * Set the bootstrap context map
-    * @param value The value
-    */
-   public synchronized void setBootstrapContexts(Map<String, CloneableBootstrapContext> value)
-   {
-      bootstrapContexts = value;
-   }
-
-   /**
-    * Get the bootstrap context map
-    * @return The handle
-    */
-   public synchronized Map<String, CloneableBootstrapContext> getBootstrapContexts()
-   {
-      return bootstrapContexts;
-   }
-
-   /**
-    * Set if deployments should be scoped
-    * @param value The value
-    */
-   public void setScopeDeployment(boolean value)
-   {
-      scopeDeployment.set(value);
-   }
-
-   /**
-    * Are the deployments scoped
-    * @return True if scoped; otherwise false
-    */
-   public boolean getScopeDeployment()
-   {
-      return scopeDeployment.get();
-   }
-
-   /**
-    * Set the JNDI strategy
-    * @param value The value
-    */
-   public synchronized void setJndiStrategy(JndiStrategy value)
-   {
-      jndiStrategy = value;
-   }
-
-   /**
-    * Get the JNDI strategy
-    * @return The handle
-    */
-   public synchronized JndiStrategy getJndiStrategy()
-   {
-      return jndiStrategy;
-   }
-
-   /**
     * Deploy
     * @param url The url
     * @param parent The parent classloader
@@ -334,7 +117,7 @@
     * @exception DeployException Thrown if an error occurs during deployment
     */
    @Override
-   public Deployment deploy(URL url, ClassLoader parent) throws DeployException
+   public synchronized Deployment deploy(URL url, ClassLoader parent) throws DeployException
    {
       if (url == null || !(url.toExternalForm().endsWith(".rar") || url.toExternalForm().endsWith(".rar/")))
          return null;
@@ -368,7 +151,7 @@
          // Create classloader
          URL[] urls = getUrls(root);
          KernelClassLoader cl = null;
-         if (scopeDeployment.get())
+         if (getConfiguration().getScopeDeployment())
          {
             cl = ClassLoaderFactory.create(ClassLoaderFactory.TYPE_PARENT_LAST, urls, parent);
          }
@@ -401,10 +184,13 @@
          List<Validate> archiveValidationObjects = new ArrayList<Validate>();
          List<Failure> partialFailures = null;
          List<Object> beanValidationObjects = new ArrayList<Object>();
-
-         String deploymentName = null;
          Object[] cfs = null;
 
+         String deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
+
+         // Check metadata for JNDI information and activate explicit
+         boolean activateDeployment = false;
+
          // Create objects and inject values
          if (cmd != null)
          {
@@ -424,23 +210,27 @@
                      failures.addAll(partialFailures);
                   }
 
-                  if (!(getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
+                  if (!(getConfiguration().getArchiveValidationFailOnError() && 
+                        hasFailuresLevel(failures, Severity.ERROR)))
                   {
-                     resourceAdapter =
-                           (ResourceAdapter) initAndInject(
-                                 ra1516.getResourceadapterClass(), ra1516.getConfigProperties(), cl);
-
-                     if (trace)
+                     if (activateDeployment)
                      {
-                        log.trace("ResourceAdapter: " + resourceAdapter.getClass().getName());
-                        log.trace("ResourceAdapter defined in classloader: " +
-                                  resourceAdapter.getClass().getClassLoader());
-                     }
+                        resourceAdapter =
+                           (ResourceAdapter)initAndInject(ra1516.getResourceadapterClass(), 
+                                                          ra1516.getConfigProperties(), cl);
 
-                     archiveValidationObjects.add(new ValidateObject(Key.RESOURCE_ADAPTER,
-                                                                     resourceAdapter,
-                                                                     ra1516.getConfigProperties()));
-                     beanValidationObjects.add(resourceAdapter);
+                        if (trace)
+                        {
+                           log.trace("ResourceAdapter: " + resourceAdapter.getClass().getName());
+                           log.trace("ResourceAdapter defined in classloader: " +
+                                     resourceAdapter.getClass().getClassLoader());
+                        }
+
+                        archiveValidationObjects.add(new ValidateObject(Key.RESOURCE_ADAPTER,
+                                                                        resourceAdapter,
+                                                                        ra1516.getConfigProperties()));
+                        beanValidationObjects.add(resourceAdapter);
+                     }
                   }
                }
             }
@@ -448,97 +238,90 @@
             // ManagedConnectionFactory
             if (cmd.getVersion() == Version.V_10)
             {
+               ResourceAdapter10 ra10 = (ResourceAdapter10)cmd.getResourceadapter();
 
-               ManagedConnectionFactory mcf =
-                     (ManagedConnectionFactory) initAndInject(((ResourceAdapter10) cmd.getResourceadapter())
-                           .getManagedConnectionFactoryClass()
-                           .getValue(), ((ResourceAdapter10) cmd.getResourceadapter())
-                           .getConfigProperties(), cl);
-
-               if (trace)
+               if (activateDeployment)
                {
-                  log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
-                  log.trace("ManagedConnectionFactory defined in classloader: " +
-                         mcf.getClass().getClassLoader());
-               }
+                  ManagedConnectionFactory mcf =
+                     (ManagedConnectionFactory) initAndInject(ra10.getManagedConnectionFactoryClass().getValue(), 
+                                                              ra10.getConfigProperties(), cl);
 
-               mcf.setLogWriter(new PrintWriter(printStream));
+                  if (trace)
+                  {
+                     log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
+                     log.trace("ManagedConnectionFactory defined in classloader: " +
+                               mcf.getClass().getClassLoader());
+                  }
 
-               archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
-                                                            mcf,
-                                                            ((ResourceAdapter10) cmd.getResourceadapter())
-                                                                  .getConfigProperties()));
-               beanValidationObjects.add(mcf);
-               associateResourceAdapter(resourceAdapter, mcf);
+                  mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
 
-               // Create the pool
-               PoolConfiguration pc = new PoolConfiguration();
-               PoolFactory pf = new PoolFactory();
+                  archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
+                                                                  mcf, ra10.getConfigProperties()));
+                  beanValidationObjects.add(mcf);
+                  associateResourceAdapter(resourceAdapter, mcf);
 
-               Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
+                  // Create the pool
+                  PoolConfiguration pc = new PoolConfiguration();
+                  PoolFactory pf = new PoolFactory();
 
-               // Add a connection manager
-               ConnectionManager cm = null;
+                  Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
 
-               TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
-               TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
+                  // Add a connection manager
+                  ConnectionManager cm = null;
 
-               tsmd = ((ResourceAdapter10) cmd.getResourceadapter()).getTransactionSupport();
+                  TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
+                  TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
 
-               if (tsmd == TransactionSupportEnum.NoTransaction)
-               {
-                  tsl = TransactionSupportLevel.NoTransaction;
-               }
-               else if (tsmd == TransactionSupportEnum.LocalTransaction)
-               {
-                  tsl = TransactionSupportLevel.LocalTransaction;
-               }
-               else if (tsmd == TransactionSupportEnum.XATransaction)
-               {
-                  tsl = TransactionSupportLevel.XATransaction;
-               }
-               // Section 7.13 -- Read from metadata -> overwrite with specified value if present
-               if (mcf instanceof TransactionSupport)
-                  tsl = ((TransactionSupport) mcf).getTransactionSupport();
+                  tsmd = ((ResourceAdapter10) cmd.getResourceadapter()).getTransactionSupport();
 
-               // Select the correct connection manager
-               ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-               cm = cmf.create(tsl, pool, transactionManager);
-
-               // ConnectionFactory
-               Object cf = mcf.createConnectionFactory(cm);
-
-               if (cf == null)
-               {
-                  log.error("ConnectionFactory is null");
-               }
-               else
-               {
-                  if (trace)
+                  if (tsmd == TransactionSupportEnum.NoTransaction)
                   {
-                     log.trace("ConnectionFactory: " + cf.getClass().getName());
-                     log.trace("ConnectionFactory defined in classloader: "
-                           + cf.getClass().getClassLoader());
+                     tsl = TransactionSupportLevel.NoTransaction;
                   }
-               }
+                  else if (tsmd == TransactionSupportEnum.LocalTransaction)
+                  {
+                     tsl = TransactionSupportLevel.LocalTransaction;
+                  }
+                  else if (tsmd == TransactionSupportEnum.XATransaction)
+                  {
+                     tsl = TransactionSupportLevel.XATransaction;
+                  }
 
-               archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
+                  // Select the correct connection manager
+                  ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+                  cm = cmf.create(tsl, pool, getConfiguration().getTransactionManager());
 
-               if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
-               {
-                  deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
-                  bindConnectionFactory(deploymentName, cf);
-                  cfs = new Object[]
-                  {cf};
-               }
+                  // ConnectionFactory
+                  Object cf = mcf.createConnectionFactory(cm);
 
+                  if (cf == null)
+                  {
+                     log.error("ConnectionFactory is null");
+                  }
+                  else
+                  {
+                     if (trace)
+                     {
+                        log.trace("ConnectionFactory: " + cf.getClass().getName());
+                        log.trace("ConnectionFactory defined in classloader: "
+                                  + cf.getClass().getClassLoader());
+                     }
+                  }
+                  
+                  archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
+                  
+                  if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
+                  {
+                     bindConnectionFactory(deploymentName, cf);
+                     cfs = new Object[] {cf};
+                  }
+               }
             }
             else
             {
                ResourceAdapter1516 ra = (ResourceAdapter1516) cmd.getResourceadapter();
-               if (ra != null &&
-                     ra.getOutboundResourceadapter() != null &&
-                     ra.getOutboundResourceadapter().getConnectionDefinitions() != null)
+               if (ra != null && ra.getOutboundResourceadapter() != null &&
+                   ra.getOutboundResourceadapter().getConnectionDefinitions() != null)
                {
                   List<ConnectionDefinition> cdMetas = ra.getOutboundResourceadapter().getConnectionDefinitions();
                   if (cdMetas.size() > 0)
@@ -556,93 +339,96 @@
                            failures.addAll(partialFailures);
                         }
 
-                        if (!(getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
+                        if (!(getConfiguration().getArchiveValidationFailOnError() && 
+                              hasFailuresLevel(failures, Severity.ERROR)))
                         {
-                           ManagedConnectionFactory mcf =
+                           if (activateDeployment)
+                           {
+                              ManagedConnectionFactory mcf =
                                  (ManagedConnectionFactory) initAndInject(cdMeta.getManagedConnectionFactoryClass()
-                                       .getValue(), cdMeta
-                                       .getConfigProperties(), cl);
+                                                                          .getValue(), cdMeta
+                                                                          .getConfigProperties(), cl);
 
-                           if (trace)
-                           {
-                              log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
-                              log.trace("ManagedConnectionFactory defined in classloader: " +
-                                        mcf.getClass().getClassLoader());
-                           }
+                              if (trace)
+                              {
+                                 log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
+                                 log.trace("ManagedConnectionFactory defined in classloader: " +
+                                           mcf.getClass().getClassLoader());
+                              }
 
-                           mcf.setLogWriter(new PrintWriter(printStream));
+                              mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
 
-                           archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
-                                                                           mcf,
-                                                                           cdMeta.getConfigProperties()));
-                           beanValidationObjects.add(mcf);
-                           associateResourceAdapter(resourceAdapter, mcf);
+                              archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
+                                                                              mcf,
+                                                                              cdMeta.getConfigProperties()));
+                              beanValidationObjects.add(mcf);
+                              associateResourceAdapter(resourceAdapter, mcf);
 
-                           // Create the pool
-                           PoolConfiguration pc = new PoolConfiguration();
-                           PoolFactory pf = new PoolFactory();
+                              // Create the pool
+                              PoolConfiguration pc = new PoolConfiguration();
+                              PoolFactory pf = new PoolFactory();
 
-                           Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
+                              Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
+                              
+                              // Add a connection manager
+                              ConnectionManager cm = null;
+                              TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
+                              TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
 
-                           // Add a connection manager
-                           ConnectionManager cm = null;
-                           TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
-                           TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
+                              tsmd = ra.getOutboundResourceadapter().getTransactionSupport();
 
-                           tsmd = ra.getOutboundResourceadapter().getTransactionSupport();
+                              if (tsmd == TransactionSupportEnum.NoTransaction)
+                              {
+                                 tsl = TransactionSupportLevel.NoTransaction;
+                              }
+                              else if (tsmd == TransactionSupportEnum.LocalTransaction)
+                              {
+                                 tsl = TransactionSupportLevel.LocalTransaction;
+                              }
+                              else if (tsmd == TransactionSupportEnum.XATransaction)
+                              {
+                                 tsl = TransactionSupportLevel.XATransaction;
+                              }
 
-                           if (tsmd == TransactionSupportEnum.NoTransaction)
-                           {
-                              tsl = TransactionSupportLevel.NoTransaction;
-                           }
-                           else if (tsmd == TransactionSupportEnum.LocalTransaction)
-                           {
-                              tsl = TransactionSupportLevel.LocalTransaction;
-                           }
-                           else if (tsmd == TransactionSupportEnum.XATransaction)
-                           {
-                              tsl = TransactionSupportLevel.XATransaction;
-                           }
+                              // Section 7.13 -- Read from metadata -> overwrite with specified value if present
+                              if (mcf instanceof TransactionSupport)
+                                 tsl = ((TransactionSupport) mcf).getTransactionSupport();
 
-                           // Section 7.13 -- Read from metadata -> overwrite with specified value if present
-                           if (mcf instanceof TransactionSupport)
-                              tsl = ((TransactionSupport) mcf).getTransactionSupport();
+                              // Select the correct connection manager
+                              ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+                              cm = cmf.create(tsl, pool, getConfiguration().getTransactionManager());
 
-                           // Select the correct connection manager
-                           ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-                           cm = cmf.create(tsl, pool, transactionManager);
+                              // ConnectionFactory
+                              Object cf = mcf.createConnectionFactory(cm);
 
-                           // ConnectionFactory
-                           Object cf = mcf.createConnectionFactory(cm);
-
-                           if (cf == null)
-                           {
-                              log.error("ConnectionFactory is null");
-                           }
-                           else
-                           {
-                              if (trace)
+                              if (cf == null)
                               {
-                                 log.trace("ConnectionFactory: " + cf.getClass().getName());
-                                 log.trace("ConnectionFactory defined in classloader: "
-                                       + cf.getClass().getClassLoader());
+                                 log.error("ConnectionFactory is null");
                               }
-                           }
-
-                           archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
-
-                           if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
-                           {
-                              if (cdMetas.size() == 1)
+                              else
                               {
-                                 deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
-                                 bindConnectionFactory(deploymentName, cf);
-                                 cfs = new Object[]
-                                 {cf};
+                                 if (trace)
+                                 {
+                                    log.trace("ConnectionFactory: " + cf.getClass().getName());
+                                    log.trace("ConnectionFactory defined in classloader: "
+                                              + cf.getClass().getClassLoader());
+                                 }
                               }
-                              else
+
+                              archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
+                              
+                              if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
                               {
-                                 log.warn("NYI: There are multiple connection factories for: " + f.getName());
+                                 if (cdMetas.size() == 1)
+                                 {
+                                    deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
+                                    bindConnectionFactory(deploymentName, cf);
+                                    cfs = new Object[] {cf};
+                                 }
+                                 else
+                                 {
+                                    log.warn("NYI: There are multiple connection factories for: " + f.getName());
+                                 }
                               }
                            }
                         }
@@ -652,52 +438,57 @@
             }
 
             // ActivationSpec
-            if (cmd.getVersion() != Version.V_10
-                  && cmd.getResourceadapter() != null
-                  && ((ResourceAdapter1516) cmd.getResourceadapter()).getInboundResourceadapter() != null
-                  && ((ResourceAdapter1516) cmd.getResourceadapter()).getInboundResourceadapter()
-                        .getMessageadapter() != null
-                  && ((ResourceAdapter1516) cmd.getResourceadapter()).getInboundResourceadapter().getMessageadapter()
-                        .getMessagelisteners() != null)
+            if (cmd.getVersion() != Version.V_10)
             {
-               List<MessageListener> mlMetas = ((ResourceAdapter1516) cmd.getResourceadapter())
-                     .getInboundResourceadapter().getMessageadapter().getMessagelisteners();
-               if (mlMetas.size() > 0)
+               ResourceAdapter1516 ra1516 = (ResourceAdapter1516)cmd.getResourceadapter();
+               if (ra1516 != null &&
+                   ra1516.getInboundResourceadapter() != null &&
+                   ra1516.getInboundResourceadapter().getMessageadapter() != null &&
+                   ra1516.getInboundResourceadapter().getMessageadapter().getMessagelisteners() != null)
                {
-                  for (MessageListener mlMeta : mlMetas)
+                  List<MessageListener> mlMetas = ra1516.getInboundResourceadapter().getMessageadapter().
+                     getMessagelisteners();
+
+                  if (mlMetas.size() > 0)
                   {
-                     if (mlMeta.getActivationspec() != null
-                           && mlMeta.getActivationspec().getActivationspecClass().getValue() != null)
+                     for (MessageListener mlMeta : mlMetas)
                      {
-                        partialFailures =
-                              validateArchive(url, Arrays
-                                    .asList((Validate) new ValidateClass(Key.ACTIVATION_SPEC, mlMeta
-                                          .getActivationspec().getActivationspecClass().getValue(), cl, mlMeta
-                                          .getActivationspec().getConfigProperties())));
-
-                        if (partialFailures != null)
+                        if (mlMeta.getActivationspec() != null &&
+                            mlMeta.getActivationspec().getActivationspecClass().getValue() != null)
                         {
-                           failures = new HashSet<Failure>();
-                           failures.addAll(partialFailures);
-                        }
+                           partialFailures =
+                              validateArchive(url, Arrays.asList((Validate) new ValidateClass(Key.ACTIVATION_SPEC, 
+                                 mlMeta.getActivationspec().getActivationspecClass().getValue(), cl, 
+                                 mlMeta.getActivationspec().getConfigProperties())));
 
-                        if (!(getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
-                        {
-                           List<? extends ConfigProperty> cpm = mlMeta
-                                 .getActivationspec().getConfigProperties();
-
-                           Object o = initAndInject(mlMeta
-                                 .getActivationspec().getActivationspecClass().getValue(), cpm, cl);
-
-                           if (trace)
+                           if (partialFailures != null)
                            {
-                              log.trace("ActivationSpec: " + o.getClass().getName());
-                              log.trace("ActivationSpec defined in classloader: " + o.getClass().getClassLoader());
+                              failures = new HashSet<Failure>();
+                              failures.addAll(partialFailures);
                            }
 
-                           archiveValidationObjects.add(new ValidateObject(Key.ACTIVATION_SPEC, o, cpm));
-                           beanValidationObjects.add(o);
-                           associateResourceAdapter(resourceAdapter, o);
+                           if (!(getConfiguration().getArchiveValidationFailOnError() && 
+                                 hasFailuresLevel(failures, Severity.ERROR)))
+                           {
+                              if (activateDeployment)
+                              {
+                                 List<? extends ConfigProperty> cpm = mlMeta.getActivationspec().getConfigProperties();
+                              
+                                 Object o = initAndInject(mlMeta
+                                    .getActivationspec().getActivationspecClass().getValue(), cpm, cl);
+
+                                 if (trace)
+                                 {
+                                    log.trace("ActivationSpec: " + o.getClass().getName());
+                                    log.trace("ActivationSpec defined in classloader: " + 
+                                              o.getClass().getClassLoader());
+                                 }
+
+                                 archiveValidationObjects.add(new ValidateObject(Key.ACTIVATION_SPEC, o, cpm));
+                                 beanValidationObjects.add(o);
+                                 associateResourceAdapter(resourceAdapter, o);
+                              }
+                           }
                         }
                      }
                   }
@@ -705,43 +496,49 @@
             }
 
             // AdminObject
-            if (cmd.getVersion() != Version.V_10 && cmd.getResourceadapter() != null &&
-                  ((ResourceAdapter1516) cmd.getResourceadapter()).getAdminobjects() != null)
+            if (cmd.getVersion() != Version.V_10)
             {
-               List<AdminObject> aoMetas = ((ResourceAdapter1516) cmd.getResourceadapter()).getAdminobjects();
-               if (aoMetas.size() > 0)
+               ResourceAdapter1516 ra1516 = (ResourceAdapter1516)cmd.getResourceadapter();
+               if (ra1516 != null && ra1516.getAdminobjects() != null)
                {
-                  for (AdminObject aoMeta : aoMetas)
+                  List<AdminObject> aoMetas = ((ResourceAdapter1516) cmd.getResourceadapter()).getAdminobjects();
+                  if (aoMetas.size() > 0)
                   {
-                     if (aoMeta.getAdminobjectClass() != null
-                           && aoMeta.getAdminobjectClass().getValue() != null)
+                     for (AdminObject aoMeta : aoMetas)
                      {
-                        partialFailures =
-                              validateArchive(url, Arrays
-                                    .asList((Validate) new ValidateClass(Key.ADMIN_OBJECT,
-                                          aoMeta.getAdminobjectClass().getValue(), cl, aoMeta.getConfigProperties())));
-
-                        if (partialFailures != null)
+                        if (aoMeta.getAdminobjectClass() != null &&
+                            aoMeta.getAdminobjectClass().getValue() != null)
                         {
-                           failures = new HashSet<Failure>();
-                           failures.addAll(partialFailures);
-                        }
-
-                        if (!(getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
-                        {
-                           Object o =
-                                 initAndInject(aoMeta.getAdminobjectClass().getValue(), aoMeta.getConfigProperties(),
-                                       cl);
-
-                           if (trace)
+                           partialFailures =
+                              validateArchive(url, Arrays.asList((Validate) new ValidateClass(Key.ADMIN_OBJECT,
+                                 aoMeta.getAdminobjectClass().getValue(), cl, aoMeta.getConfigProperties())));
+                           
+                           if (partialFailures != null)
                            {
-                              log.trace("AdminObject: " + o.getClass().getName());
-                              log.trace("AdminObject defined in classloader: " + o.getClass().getClassLoader());
+                              failures = new HashSet<Failure>();
+                              failures.addAll(partialFailures);
                            }
 
-                           archiveValidationObjects
-                                 .add(new ValidateObject(Key.ADMIN_OBJECT, o, aoMeta.getConfigProperties()));
-                           beanValidationObjects.add(o);
+                           if (!(getConfiguration().getArchiveValidationFailOnError() && 
+                                 hasFailuresLevel(failures, Severity.ERROR)))
+                           {
+                              if (activateDeployment)
+                              {
+                                 Object o =
+                                    initAndInject(aoMeta.getAdminobjectClass().getValue(), aoMeta.getConfigProperties(),
+                                                  cl);
+
+                                 if (trace)
+                                 {
+                                    log.trace("AdminObject: " + o.getClass().getName());
+                                    log.trace("AdminObject defined in classloader: " + o.getClass().getClassLoader());
+                                 }
+                                 
+                                 archiveValidationObjects
+                                    .add(new ValidateObject(Key.ADMIN_OBJECT, o, aoMeta.getConfigProperties()));
+                                 beanValidationObjects.add(o);
+                              }
+                           }
                         }
                      }
                   }
@@ -761,8 +558,8 @@
             failures.addAll(partialFailures);
          }
 
-         if ((getArchiveValidationFailOnWarn() && hasFailuresLevel(failures, Severity.WARNING)) ||
-               (getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
+         if ((getConfiguration().getArchiveValidationFailOnWarn() && hasFailuresLevel(failures, Severity.WARNING)) ||
+             (getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
          {
             throw new ValidatorException(printFailuresLog(url.getPath(), new Validator(), failures, null), failures);
          }
@@ -771,384 +568,104 @@
             printFailuresLog(url.getPath(), new Validator(), failures, null);
          }
 
-         // Bean validation
-         if (getBeanValidation())
+         if (cmd != null)
          {
-            JbossRa20 jrmd20 = null;
-            List<Class> groupsClasses = null;
-            if (jrmd instanceof JbossRa20)
-            {
-               jrmd20 = (JbossRa20) jrmd;
-            }
-            if (jrmd20 != null && jrmd20.getBeanValidationGroups() != null
-                  && jrmd20.getBeanValidationGroups().size() > 0)
-            {
-               BeanValidationGroup bvGroups = jrmd20.getBeanValidationGroups().get(0);
-               groupsClasses = new ArrayList<Class>();
-               for (String group : bvGroups.getBeanValidationGroup())
-               {
-                  groupsClasses.add(Class.forName(group, true, cl));
-               }
-            }
-
-            if (beanValidationObjects.size() > 0)
-            {
-               BeanValidation beanValidator = new BeanValidation();
-               for (Object o : beanValidationObjects)
-               {
-                  beanValidator.validate(o, groupsClasses);
-               }
-            }
+            // Register with MDR
+            getConfiguration().getMetadataRepository().registerResourceAdapter(url, cmd);
          }
 
-         // Activate deployment
-         if (resourceAdapter != null)
+         if (activateDeployment)
          {
-            String bootstrapIdentifier = null;
-
-            if (jrmd != null && jrmd instanceof JbossRa20)
+            // Bean validation
+            if (getConfiguration().getBeanValidation())
             {
-               JbossRa20 jrmd20 = (JbossRa20) jrmd;
-               bootstrapIdentifier = jrmd20.getBootstrapContext();
-            }
+               JbossRa20 jrmd20 = null;
+               List<Class> groupsClasses = null;
 
-            startContext(resourceAdapter, bootstrapIdentifier);
-         }
+               if (jrmd instanceof JbossRa20)
+               {
+                  jrmd20 = (JbossRa20) jrmd;
+               }
 
-         log.info("Deployed: " + url.toExternalForm());
-         RADeployment depoyment = new RADeployment(url, deploymentName, resourceAdapter, jndiStrategy, cfs,
-               destination, cl);
-         return depoyment;
-      }
-      catch (DeployException de)
-      {
-         // Just rethrow
-         throw de;
-      }
-      catch (Throwable t)
-      {
-         if ((getArchiveValidationFailOnWarn() && hasFailuresLevel(failures, Severity.WARNING)) ||
-               (getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
-            throw new DeployException("Deployment " + url.toExternalForm() + " failed",
-                  new ValidatorException(printFailuresLog(url.getPath(), new Validator(), failures, null), failures));
-         else
-         {
-            printFailuresLog(url.getPath(), new Validator(), failures, null);
-            throw new DeployException("Deployment " + url.toExternalForm() + " failed", t);
-         }
-      }
-      finally
-      {
-         SecurityActions.setThreadContextClassLoader(oldTCCL);
-      }
-   }
-
-   /**
-    * validate archive
-    *
-    * @param url of the archive
-    * @param archiveValidation classes and/or to validate.
-    * @return The list of failures gotten. Null in case of no failures or if validation is not run according to
-    *   {@link #getArchiveValidation()} Settin
-    */
-   //IT IS PACKAGE PROTECTED ONLY FOR TESTS ACCESSIBILITY
-   List<Failure> validateArchive(URL url, List<Validate> archiveValidation)
-   {
-      // Archive validation
-      if (!getArchiveValidation())
-      {
-         return null;
-      }
-      Validator validator = new Validator();
-      List<Failure> failures = validator.validate(archiveValidation);
-
-      return failures;
-   }
-
-   /**
-    * print Failures into Log files.
-    *
-    * @param urlFileName filename Of deployed rar
-    * @param validator validator instance used to run validation rules
-    * @param failures the list of Failures to be printed
-    * @param reportDirectory where to put various logs
-    * @param fhInput optional parameter. Normally used only for test or in case of
-    *   FailureHelper already present in context
-    * @return the error Text
-    *
-    */
-   //IT IS PACKAGE PROTECTED ONLY FOR TESTS ACCESSIBILITY
-   String printFailuresLog(String urlFileName, Validator validator, Collection<Failure> failures,
-         File reportDirectory, FailureHelper... fhInput)
-   {
-      String errorText = "";
-      FailureHelper fh = null;
-      if (fhInput.length == 0)
-         fh = new FailureHelper(failures);
-      else
-         fh = fhInput[0];
-
-      if (failures != null && failures.size() > 0)
-      {
-         if (reportDirectory == null)
-         {
-            reportDirectory = new File(SecurityActions.getSystemProperty("iron.jacamar.home"), "/log/");
-         }
-         if (reportDirectory.exists())
-         {
-            int lastSlashIndex = urlFileName.lastIndexOf("/");
-            int lastSepaIndex = urlFileName.lastIndexOf(File.separator);
-
-            int lastIndex = lastSlashIndex > lastSepaIndex ? lastSlashIndex : lastSepaIndex;
-            if (lastIndex != -1)
-               urlFileName = urlFileName.substring(lastIndex + 1);
-            urlFileName += ".log";
-
-            File report = new File(reportDirectory, urlFileName);
-            FileWriter fw = null;
-            BufferedWriter bw = null;
-            try
-            {
-               fw = new FileWriter(report);
-               bw = new BufferedWriter(fw, 8192);
-               bw.write(fh.asText(validator.getResourceBundle()));
-               bw.flush();
-
-               errorText = "Validation failures - see: " + report.getAbsolutePath();
-            }
-            catch (IOException ioe)
-            {
-               log.warn(ioe.getMessage(), ioe);
-            }
-            finally
-            {
-               if (bw != null)
+               if (jrmd20 != null && jrmd20.getBeanValidationGroups() != null &&
+                   jrmd20.getBeanValidationGroups().size() > 0)
                {
-                  try
+                  BeanValidationGroup bvGroups = jrmd20.getBeanValidationGroups().get(0);
+                  groupsClasses = new ArrayList<Class>();
+                  for (String group : bvGroups.getBeanValidationGroup())
                   {
-                     bw.close();
+                     groupsClasses.add(Class.forName(group, true, cl));
                   }
-                  catch (IOException ignore)
-                  {
-                     // Ignore
-                  }
                }
-               if (fw != null)
+
+               if (beanValidationObjects.size() > 0)
                {
-                  try
+                  BeanValidation beanValidator = new BeanValidation();
+                  for (Object o : beanValidationObjects)
                   {
-                     fw.close();
+                     beanValidator.validate(o, groupsClasses);
                   }
-                  catch (IOException ignore)
-                  {
-                     // Ignore
-                  }
                }
             }
-         }
-         else
-         {
-            errorText = fh.asText(validator.getResourceBundle());
-         }
-      }
-      return errorText;
-   }
 
-   private boolean hasFailuresLevel(Collection<Failure> failures, int severity)
-   {
-      if (failures != null)
-      {
-         for (Failure failure : failures)
-         {
-            if (failure.getSeverity() == severity)
+            // Activate deployment
+            if (resourceAdapter != null)
             {
-               return true;
+               String bootstrapIdentifier = null;
+
+               if (jrmd != null && jrmd instanceof JbossRa20)
+               {
+                  JbossRa20 jrmd20 = (JbossRa20) jrmd;
+                  bootstrapIdentifier = jrmd20.getBootstrapContext();
+               }
+
+               startContext(resourceAdapter, bootstrapIdentifier);
             }
          }
-      }
-      return false;
-   }
 
-   /**
-    * Start the resource adapter
-    * @param resourceAdapter The resource adapter
-    * @param bootstrapIdentifier The bootstrap context identifier; may be <code>null</code>
-    * @throws DeployException Thrown if the resource adapter cant be started
-    */
-   @SuppressWarnings("unchecked")
-   private void startContext(ResourceAdapter resourceAdapter, String bootstrapIdentifier) throws DeployException
-   {
-      try
-      {
-         Class clz = resourceAdapter.getClass();
-         Method start = clz.getMethod("start", new Class[]
-         {BootstrapContext.class});
-
-         CloneableBootstrapContext cbc = null;
-
-         if (bootstrapIdentifier != null && bootstrapContexts != null)
+         if (activateDeployment)
          {
-            CloneableBootstrapContext bc = bootstrapContexts.get(bootstrapIdentifier);
-
-            if (bc != null)
-               cbc = bc.clone();
+            log.info("Deployed: " + url.toExternalForm());
          }
+         else
+         {
+            log.debug("Activated: " + url.toExternalForm());
+         }
+         
+         return new RADeployment(url, 
+                                 deploymentName, 
+                                 activateDeployment,
+                                 resourceAdapter, 
+                                 getConfiguration().getJndiStrategy(), 
+                                 getConfiguration().getMetadataRepository(),
+                                 cfs,
+                                 destination, 
+                                 cl,
+                                 log);
 
-         if (cbc == null)
-            cbc = defaultBootstrapContext.clone();
-
-         start.invoke(resourceAdapter, new Object[]
-         {cbc});
       }
-      catch (InvocationTargetException ite)
+      catch (DeployException de)
       {
-         throw new DeployException("Unable to start " +
-                                   resourceAdapter.getClass().getName(), ite.getTargetException());
+         // Just rethrow
+         throw de;
       }
       catch (Throwable t)
       {
-         throw new DeployException("Unable to start " + resourceAdapter.getClass().getName(), t);
-      }
-   }
-
-   /**
-    * Associate resource adapter with ojects if they implement ResourceAdapterAssociation
-    * @param resourceAdapter The resource adapter
-    * @param object The of possible association object
-    * @throws DeployException Thrown if the resource adapter cant be started
-    */
-   @SuppressWarnings("unchecked")
-   private void associateResourceAdapter(ResourceAdapter resourceAdapter, Object object)
-      throws DeployException
-   {
-      if (resourceAdapter != null && object != null)
-      {
-         if (object instanceof ResourceAdapterAssociation)
+         if ((getConfiguration().getArchiveValidationFailOnWarn() && hasFailuresLevel(failures, Severity.WARNING)) ||
+             (getConfiguration().getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
          {
-            try
-            {
-               Class clz = object.getClass();
-
-               Method setResourceAdapter = clz.getMethod("setResourceAdapter",
-                                                         new Class[]
-                                                         {ResourceAdapter.class});
-
-               setResourceAdapter.invoke(object, new Object[]
-               {resourceAdapter});
-            }
-            catch (Throwable t)
-            {
-               throw new DeployException("Unable to associate " + object.getClass().getName(), t);
-            }
+            throw new DeployException("Deployment " + url.toExternalForm() + " failed",
+               new ValidatorException(printFailuresLog(url.getPath(), new Validator(), failures, null), failures));
          }
-      }
-   }
-
-   /**
-    * Initialize and inject configuration properties
-    * @param className The fully qualified class name
-    * @param configs The configuration properties
-    * @param cl The class loader
-    * @return The object
-    * @throws DeployException Thrown if the object cant be initialized
-    */
-   private Object initAndInject(String className,
-                                List<? extends ConfigProperty> configs,
-                                ClassLoader cl)
-      throws DeployException
-   {
-      try
-      {
-         Class clz = Class.forName(className, true, cl);
-         Object o = clz.newInstance();
-
-         if (configs != null)
+         else
          {
-            Injection injector = new Injection();
-            for (ConfigProperty cpmd : configs)
-            {
-               if (cpmd.isValueSet())
-                  injector.inject(cpmd.getConfigPropertyType().getValue(), cpmd.getConfigPropertyName().getValue(),
-                        cpmd.getConfigPropertyValue().getValue(), o);
-            }
+            printFailuresLog(url.getPath(), new Validator(), failures, null);
+            throw new DeployException("Deployment " + url.toExternalForm() + " failed", t);
          }
-
-         return o;
       }
-      catch (Throwable t)
+      finally
       {
-         throw new DeployException("Deployment " + className + " failed", t);
+         SecurityActions.setThreadContextClassLoader(oldTCCL);
       }
    }
-
-   /**
-    * Get the URLs for the directory and all libraries located in the directory
-    * @param directory The directory
-    * @return The URLs
-    * @exception MalformedURLException MalformedURLException
-    * @exception IOException IOException
-    */
-   private URL[] getUrls(File directory) throws MalformedURLException, IOException
-   {
-      List<URL> list = new LinkedList<URL>();
-
-      if (directory.exists() && directory.isDirectory())
-      {
-         // Add directory
-         list.add(directory.toURI().toURL());
-
-         // Add the contents of the directory too
-         File[] jars = directory.listFiles(new JarFilter());
-
-         if (jars != null)
-         {
-            for (int j = 0; j < jars.length; j++)
-            {
-               list.add(jars[j].getCanonicalFile().toURI().toURL());
-            }
-         }
-      }
-      return list.toArray(new URL[list.size()]);
-   }
-
-   /**
-    * Bind connection factory into JNDI
-    * @param deployment The deployment name
-    * @param cf The connection factory
-    * @return The JNDI names bound
-    * @exception Exception thrown if an error occurs
-    */
-   private String[] bindConnectionFactory(String deployment, Object cf) throws Throwable
-   {
-      if (jndiStrategy == null)
-         jndiStrategy = new NoopJndiStrategy();
-
-      JndiStrategy js = jndiStrategy.clone();
-
-      return js.bindConnectionFactories(deployment, new Object[]
-      {cf});
-   }
-
-   /**
-    * Start
-    */
-   public void start()
-   {
-      if (defaultBootstrapContext == null)
-         throw new IllegalStateException("DefaultBootstrapContext not defined");
-
-      if (printStream == null)
-         throw new IllegalStateException("PrintStream not defined");
-   }
-
-   /**
-    * Clone
-    * @return The copy of the object
-    * @exception CloneNotSupportedException Thrown if a copy can't be created
-    */
-   @Override
-   public Deployer clone() throws CloneNotSupportedException
-   {
-      return new RADeployer();
-   }
 }

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployment.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployment.java	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployment.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -22,6 +22,7 @@
 
 package org.jboss.jca.deployers.fungal;
 
+import org.jboss.jca.core.spi.mdr.MetadataRepository;
 import org.jboss.jca.core.spi.naming.JndiStrategy;
 
 import java.io.Closeable;
@@ -42,7 +43,8 @@
  */
 public class RADeployment implements Deployment
 {
-   private static Logger log = Logger.getLogger(RADeployer.class);
+   /** The logger */
+   private Logger log;
 
    /** The deployment */
    private URL deployment;
@@ -50,12 +52,18 @@
    /** The deployment name */
    private String deploymentName;
 
+   /** Activator */
+   private boolean activator;
+
    /** The resource adapter instance */
    private ResourceAdapter ra;
 
    /** The JNDI strategy */
    private JndiStrategy jndiStrategy;
 
+   /** The MDR */
+   private MetadataRepository mdr;
+
    /** The connection factories */
    private Object[] cfs;
 
@@ -69,27 +77,36 @@
     * Constructor
     * @param deployment The deployment
     * @param deploymentName The deployment name
+    * @param activator Is this the activator of the deployment
     * @param ra The resource adapter instance if present
     * @param jndiStrategy The JNDI strategy
+    * @param metadataRepository The metadata repository
     * @param cfs The connection factories
     * @param tmpDirectory The temporary directory
     * @param cl The classloader for the deployment
+    * @param log The logger
     */
    public RADeployment(URL deployment, 
                        String deploymentName,
+                       boolean activator,
                        ResourceAdapter ra, 
                        JndiStrategy jndiStrategy,
+                       MetadataRepository metadataRepository,
                        Object[] cfs, 
                        File tmpDirectory, 
-                       ClassLoader cl)
+                       ClassLoader cl,
+                       Logger log)
    {
       this.deployment = deployment;
       this.deploymentName = deploymentName;
+      this.activator = activator;
       this.ra = ra;
       this.jndiStrategy = jndiStrategy;
+      this.mdr = metadataRepository;
       this.cfs = cfs;
       this.tmpDirectory = tmpDirectory;
       this.cl = cl;
+      this.log = log;
    }
 
    /**
@@ -115,24 +132,39 @@
     */
    public void stop()
    {
-      log.debug("Undeploying: " + deployment.toExternalForm());
+      if (activator)
+      {
+         log.debug("Undeploying: " + deployment.toExternalForm());
 
-      if (cfs != null)
-      {
-         try
+         if (mdr != null)
          {
-            jndiStrategy.unbindConnectionFactories(deploymentName, cfs);
+            try
+            {
+               mdr.unregisterResourceAdapter(deployment);
+            }
+            catch (Throwable t)
+            {
+               log.warn("Exception during unregistering deployment", t);
+            }
          }
-         catch (Throwable t)
+
+         if (cfs != null)
          {
-            log.warn("Exception during JNDI unbinding", t);
+            try
+            {
+               jndiStrategy.unbindConnectionFactories(deploymentName, cfs);
+            }
+            catch (Throwable t)
+            {
+               log.warn("Exception during JNDI unbinding", t);
+            }
          }
-      }
 
-      if (ra != null)
-      {
-         ra.stop();
-         ra = null;
+         if (ra != null)
+         {
+            ra.stop();
+            ra = null;
+         }
       }
    }
 
@@ -153,19 +185,22 @@
          }
       }
 
-      if (tmpDirectory != null && tmpDirectory.exists())
+      if (activator)
       {
-         try
+         if (tmpDirectory != null && tmpDirectory.exists())
          {
-            FileUtil fu = new FileUtil();
-            fu.recursiveDelete(tmpDirectory);
+            try
+            {
+               FileUtil fu = new FileUtil();
+               fu.recursiveDelete(tmpDirectory);
+            }
+            catch (IOException ioe)
+            {
+               // Ignore
+            }
          }
-         catch (IOException ioe)
-         {
-            // Ignore
-         }
+         
+         log.info("Undeployed: " + deployment.toExternalForm());
       }
-
-      log.info("Undeployed: " + deployment.toExternalForm());
    }
 }

Modified: projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/deployers/fungal/RADeployerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/deployers/fungal/RADeployerTestCase.java	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/deployers/fungal/RADeployerTestCase.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -62,8 +62,11 @@
    public void validateArchiveShouldReturnNullIfNoValidationIsPerformed() throws Throwable
    {
       //given
+      RAConfiguration configuration = new RAConfiguration();
       RADeployer deployer = new RADeployer();
-      deployer.setArchiveValidation(false);
+      deployer.setConfiguration(configuration);
+
+      deployer.getConfiguration().setArchiveValidation(false);
       //when
       List<Failure> returnValue = deployer.validateArchive(null, null);
       //then
@@ -79,7 +82,10 @@
    public void printFailuresLogShouldReturnNotEmptyStringForWarning() throws Throwable
    {
       //given
+      RAConfiguration configuration = new RAConfiguration();
       RADeployer deployer = new RADeployer();
+      deployer.setConfiguration(configuration);
+
       File mockedDirectory = mock(File.class);
       given(mockedDirectory.exists()).willReturn(false);
       Failure failure = mock(Failure.class);
@@ -88,7 +94,7 @@
       FailureHelper fh = mock(FailureHelper.class);
       given(fh.asText((ResourceBundle) anyObject())).willReturn("myText");
 
-      deployer.setArchiveValidationFailOnWarn(true);
+      deployer.getConfiguration().setArchiveValidationFailOnWarn(true);
 
       //when
       String returnValue = deployer.printFailuresLog(null, mock(Validator.class), failures, mockedDirectory, fh);
@@ -107,7 +113,10 @@
    public void printFailuresLogShouldReturnNotEmptyStringForError() throws Throwable
    {
       //given
+      RAConfiguration configuration = new RAConfiguration();
       RADeployer deployer = new RADeployer();
+      deployer.setConfiguration(configuration);
+
       File mockedDirectory = mock(File.class);
       given(mockedDirectory.exists()).willReturn(false);
       Failure failure = mock(Failure.class);
@@ -116,7 +125,7 @@
       FailureHelper fh = mock(FailureHelper.class);
       given(fh.asText((ResourceBundle) anyObject())).willReturn("myText");
 
-      deployer.setArchiveValidationFailOnError(true);
+      deployer.getConfiguration().setArchiveValidationFailOnError(true);
 
       //when
       String returnValue = deployer.printFailuresLog(null, mock(Validator.class), failures, mockedDirectory, fh);
@@ -136,8 +145,11 @@
       BufferedReader input = null;
 
       //given
+      RAConfiguration configuration = new RAConfiguration();
       RADeployer deployer = new RADeployer();
-      deployer.setArchiveValidationFailOnError(true);
+      deployer.setConfiguration(configuration);
+
+      deployer.getConfiguration().setArchiveValidationFailOnError(true);
       Failure failure = mock(Failure.class);
       given(failure.getSeverity()).willReturn(Severity.ERROR);
       List<Failure> failures = Arrays.asList(failure);

Modified: projects/jboss-jca/trunk/doc/developerguide/en/modules/deployers.xml
===================================================================
--- projects/jboss-jca/trunk/doc/developerguide/en/modules/deployers.xml	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/doc/developerguide/en/modules/deployers.xml	2010-08-23 16:51:50 UTC (rev 107739)
@@ -12,7 +12,7 @@
     <section id="rardeployer_fungal">
       <title>Fungal</title>
 
-      <para>The Fungal kernel features a simple deployment framework, so only two classes are needed for the
+      <para>The Fungal kernel features a simple deployment framework, so only three classes are needed for the
         deployer chain.</para>
 
       <para>The classes are located in the</para>
@@ -50,11 +50,14 @@
             Perform bean validation
           </listitem>
           <listitem>
-            Identify and activate the resource adapter objects
+            Register the metadata in the metadata repository
           </listitem>
           <listitem>
-            Bind connection factories and admin objects into JNDI
+            Identify and activate the resource adapter objects - if JNDI information is available
           </listitem>
+          <listitem>
+            Bind connection factories and admin objects into JNDI - if JNDI information is available
+          </listitem>
         </itemizedlist>
 
       
@@ -75,7 +78,7 @@
 
         <itemizedlist>
           <listitem>
-            Unbind connection factories and admin objects in JNDI
+            Unbind connection factories and admin objects in JNDI - if the deployment was activated
           </listitem>
           <listitem>
             Close the classloader
@@ -87,6 +90,35 @@
 
       </section>
 
+      <section id="rardeployer_fungal_raactivator">
+        <title>RAActivator</title>
+      
+        <para>This class will activate all resource adapters which hasn't been deployed by a previous step.
+          The class implements the </para>
+
+        <programlisting>
+com.github.fungal.spi.deployers.DeployerPhases
+        </programlisting>
+
+        <para>interface. This interface allows the class to hook into the deployer lifecycle of the kernel
+          and receive callback notifications.</para>
+
+        <para>The responsible of the class is to</para>
+
+        <itemizedlist>
+          <listitem>
+            Find any resource adapters which hasn't been deployed through the metadata repository
+          </listitem>
+          <listitem>
+            Perform a deployment like <code>RADeployer</code>
+          </listitem>
+          <listitem>
+            Register each deployment with the kernel through the main deployer
+          </listitem>
+        </itemizedlist>
+
+      </section>
+
     </section>
 
   </section>
@@ -94,5 +126,74 @@
   <section id="dsdeployer">
     <title>DataSource Deployer</title>
 
+    <para>The responsibility of the datasource deployer is to deploy a datasource deployment (-ds.xml) file.</para>
+
+    <section id="dsdeployer_fungal">
+      <title>Fungal</title>
+
+      <para>The Fungal datasource deployer chain consists of two classes.</para>
+
+      <para>The classes are located in the</para>
+
+      <programlisting>
+deployers/src/main/java/org/jboss/jca/deployers/fungal
+      </programlisting>
+
+      <para>directory.</para>
+
+      <section id="dsdeployer_fungal_dsxmldeployer">
+        <title>DsXmlDeployer</title>
+
+        <para>This class represent a datasource deployer and implements the</para>
+
+        <programlisting>
+com.github.fungal.spi.deployers.Deployer
+        </programlisting>
+
+        <para>interface.</para>
+
+        <para>The responsible of the class is to</para>
+
+        <itemizedlist>
+          <listitem>
+            Locate metadata about JDBC in the metadata repository
+          </listitem>
+          <listitem>
+            Activate each <code>DataSource</code> using <code>jdbc-local.rar</code> as a template
+          </listitem>
+          <listitem>
+            Activate each <code>XaDataSource</code> using <code>jdbc-xa.rar</code> as a template
+          </listitem>
+        </itemizedlist>
+      
+      </section>
+
+      <section id="dsdeployer_fungal_dsxmldeployment">
+        <title>DsXmlDeployment</title>
+      
+        <para>This class represent a datasource deployment and implements the</para>
+
+        <programlisting>
+com.github.fungal.spi.deployers.Deployment
+        </programlisting>
+
+        <para>interface.</para>
+
+        <para>The responsible of the class is to</para>
+
+        <itemizedlist>
+          <listitem>
+            Unbind the datasource in JNDI
+          </listitem>
+          <listitem>
+            Close the classloader
+          </listitem>
+        </itemizedlist>
+
+      </section>
+
+    </section>
+
+
   </section>
 </chapter>

Modified: projects/jboss-jca/trunk/doc/developerguide/en/modules/metadata.xml
===================================================================
--- projects/jboss-jca/trunk/doc/developerguide/en/modules/metadata.xml	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/doc/developerguide/en/modules/metadata.xml	2010-08-23 16:51:50 UTC (rev 107739)
@@ -94,20 +94,22 @@
       <title>Interface</title>
       <para>The interface of the metadata repository is located in:</para>
       <programlisting>
-org.jboss.jca.core.api.MetaDataRepository
+org.jboss.jca.core.spi.MetaDataRepository
       </programlisting>
       <para>providing methods to query and update the repository.</para>
     </section>
 
     <section id="mdrbean">
       <title>Bean</title>
-      <para>The JBoss Microcontainer bean for the metadata repository can be defined as:</para>
+      <para>The implementation of the metadata repository can be defined as:</para>
       <programlisting>
 &lt;bean name="MetaDataRepository" 
-      interface="org.jboss.jca.core.api.MetaDataRepository" 
-      class="org.jboss.jca.core.mdr.MetaDataRepositoryImpl"&gt;
+      interface="org.jboss.jca.core.spi.MetaDataRepository" 
+      class="org.jboss.jca.core.mdr.SimpleMetaDataRepository"&gt;
 &lt;/bean&gt;
       </programlisting>
+
+      <para>which is a simple implementation of the metadata repository service provider interface (SPI).</para>
     </section>
 
 

Modified: projects/jboss-jca/trunk/doc/userguide/en/modules/configuration.xml
===================================================================
--- projects/jboss-jca/trunk/doc/userguide/en/modules/configuration.xml	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/doc/userguide/en/modules/configuration.xml	2010-08-23 16:51:50 UTC (rev 107739)
@@ -51,131 +51,263 @@
 config/bootstrap/jca.xml
         </programlisting>
 
-        <para>file, as the</para>
+        <para>file.</para>
 
-        <programlisting>
+        <section id="jca_deployer_configuration">
+          <title>Configuration</title>
+
+          <para>The configuration of the resource adapter deployer chain is handled
+            by a <code>org.jboss.jca.deployers.fungal.RAConfiguration</code> bean.</para>
+
+          <programlisting>
 <![CDATA[
-<bean name="RADeployer" 
-      interface="com.github.fungal.spi.deployers.Deployer" 
-      class="org.jboss.jca.deployers.fungal.RADeployer">
+<bean name="RAConfiguration"
+      class="org.jboss.jca.deployers.fungal.RAConfiguration">
   <property name="ArchiveValidation">true</property>
   <property name="ArchiveValidationFailOnWarn">false</property>
   <property name="ArchiveValidationFailOnError">true</property>
   <property name="BeanValidation">true</property>
   <property name="PrintStream"><inject bean="JBossStdioContext" property="Out"/></property>
   <property name="DefaultBootstrapContext"><inject bean="DefaultBootstrapContext"/></property>
-  <property name="JndiStrategy"><inject bean="JNDIStrategy"/></property>
+  <property name="JndiStrategy"><inject bean="JndiStrategy"/></property>
   <property name="TransactionManager"><inject bean="RealTransactionManager"/></property>
+  <property name="MetadataRepository"><inject bean="MDR"/></property>
+</bean>
+ ]]>
+          </programlisting>
+          
+
+          <table frame="all">
+            <title>Resource adapter deployer configuration</title>
+            <tgroup cols="3" align="left" colsep="1" rowsep="1">
+              <colspec colname="c1" colwidth="2*"/>
+              <colspec colname="c2"/>
+              <colspec colname="c3" colwidth="3*"/>
+              <thead>
+                <row>
+                  <entry align="left">Property</entry>
+                  <entry align="left">Type</entry>
+                  <entry align="left">Description</entry>
+                </row>
+              </thead>
+              <tbody>
+                <row>
+                  <entry><code>ArchiveValidation</code></entry>
+                  <entry><code>boolean</code></entry>
+                  <entry>
+                    Toggle archive validation for the deployment units.
+                    <para>Default: <code>true</code></para>
+                  </entry>
+                </row>
+                <row>
+                  <entry><code>ArchiveValidationFailOnWarn</code></entry>
+                  <entry><code>boolean</code></entry>
+                  <entry>
+                    Should an archive validation warning report fail the deployment.
+                    <para>Default: <code>false</code></para>
+                  </entry>
+                </row>
+                <row>
+                  <entry><code>ArchiveValidationFailOnError</code></entry>
+                  <entry><code>boolean</code></entry>
+                  <entry>
+                    Should an archive validation error report fail the deployment.
+                    <para>Default: <code>true</code></para>
+                  </entry>
+                </row>
+                <row>
+                  <entry><code>BeanValidation</code></entry>
+                  <entry><code>boolean</code></entry>
+                  <entry>
+                    Toggle bean validation (JSR-303) for the deployment units.
+                    <para>Default: <code>true</code></para>
+                  </entry>
+                </row>
+                <row>
+                  <entry><code>DefaultBootstrapContext</code></entry>
+                  <entry><code>org.jboss.jca.core.api.bootstrap.CloneableBootstrapContext</code></entry>
+                  <entry>
+                    Specifies the default bootstrap context for resource adapters
+                  </entry>
+                </row>
+                <row>
+                  <entry><code>BootstrapContexts</code></entry>
+                  <entry><code>Map&lt;String, org.jboss.jca.core.api.bootstrap.CloneableBootstrapContext&gt;</code></entry>
+                  <entry>
+                    Bootstrap context map (unique name to a cloneable bootstrap context) which allows
+                    developers to bind (through <code>jboss-ra.xml</code>) their resource adapter to
+                    a specific bootstrap context instance.
+                  </entry>
+                </row>
+                <row>
+                  <entry><code>PrintStream</code></entry>
+                  <entry><code>java.io.PrintStream</code></entry>
+                  <entry>
+                    Specifies which print stream that should be used to handle the <code>LogWriter</code>s
+                  </entry>
+                </row>
+                <row>
+                  <entry><code>MetadataRepository</code></entry>
+                  <entry><code>org.jboss.jca.core.spi.mdr.MetadataRepository</code></entry>
+                  <entry>
+                    The metadata repository
+                  </entry>
+                </row>
+                <row>
+                  <entry><code>ScopeDeployment</code></entry>
+                  <entry><code>boolean</code></entry>
+                  <entry>
+                    Should each deployment be scoped (isolated) from the container. This feature allows
+                    deployment of libraries of a different version than used in the container environment.
+                    <para>Default: <code>false</code></para>
+                  </entry>
+                </row>
+                <row>
+                  <entry><code>JndiStrategy</code></entry>
+                  <entry><code>org.jboss.jca.core.spi.naming.JndiStrategy</code></entry>
+                  <entry>
+                    Specifies the JNDI strategy policy for binding the connection factories into
+                    the naming environment
+                    
+                    <para>The JNDI strategies are located in the <code>org.jboss.jca.core.naming</code>
+                      package</para>
+                    <itemizedlist spacing="compact">
+                      <listitem>
+                        <code>NoopJndiStrategy</code>: A no operation JNDI strategy 
+                        which doesn't bind/unbind any objects
+                      </listitem>
+                      <listitem>
+                        <code>SimpleJndiStrategy</code>: A simple JNDI strategy 
+                        which can bind/unbind a single connection factory
+                      </listitem>
+                    </itemizedlist>
+                  </entry>
+                </row>
+              </tbody>
+            </tgroup>
+          </table>
+
+        </section>
+
+        <section id="jca_deployer_radeployer">
+          <title>Resource adapter deployer</title>
+
+          <para>The initial deployer for resource adapter archives is handled
+            by a <code>org.jboss.jca.deployers.fungal.RADeployer</code> bean.</para>
+
+          <programlisting>
+<![CDATA[
+<bean name="RADeployer"
+      interface="com.github.fungal.spi.deployers.Deployer" 
+      class="org.jboss.jca.deployers.fungal.RADeployer">
+  <property name="Configuration"><inject bean="RAConfiguration"/></property>
   <depends>BeanValidation</depends>
   <depends>JBossStdioContextSelector</depends>
 </bean>
  ]]>
-        </programlisting>
+          </programlisting>
 
-        <para>bean.</para>
+          <para>This deployer will register the resource adapters with the metadata repository in
+            the system.</para>
+          
 
-        <table frame="all">
-          <title>JCA Deployer</title>
-          <tgroup cols="3" align="left" colsep="1" rowsep="1">
-            <colspec colname="c1" colwidth="2*"/>
-            <colspec colname="c2"/>
-            <colspec colname="c3" colwidth="3*"/>
-            <thead>
-              <row>
-                <entry align="left">Property</entry>
-                <entry align="left">Type</entry>
-                <entry align="left">Description</entry>
-              </row>
-            </thead>
-            <tbody>
-              <row>
-                <entry><code>ArchiveValidation</code></entry>
-                <entry><code>boolean</code></entry>
-                <entry>
-                  Toggle archive validation for the deployment units.
-                  <para>Default: <code>true</code></para>
-                </entry>
-              </row>
-              <row>
-                <entry><code>ArchiveValidationFailOnWarn</code></entry>
-                <entry><code>boolean</code></entry>
-                <entry>
-                  Should an archive validation warning report fail the deployment.
-                  <para>Default: <code>false</code></para>
-                </entry>
-              </row>
-              <row>
-                <entry><code>ArchiveValidationFailOnError</code></entry>
-                <entry><code>boolean</code></entry>
-                <entry>
-                  Should an archive validation error report fail the deployment.
-                  <para>Default: <code>true</code></para>
-                </entry>
-              </row>
-              <row>
-                <entry><code>BeanValidation</code></entry>
-                <entry><code>boolean</code></entry>
-                <entry>
-                  Toggle bean validation (JSR-303) for the deployment units.
-                  <para>Default: <code>true</code></para>
-                </entry>
-              </row>
-              <row>
-                <entry><code>DefaultBootstrapContext</code></entry>
-                <entry><code>org.jboss.jca.core.api.bootstrap.CloneableBootstrapContext</code></entry>
-                <entry>
-                  Specifies the default bootstrap context for resource adapters
-                </entry>
-              </row>
-              <row>
-                <entry><code>BootstrapContexts</code></entry>
-                <entry><code>Map&lt;String, org.jboss.jca.core.api.bootstrap.CloneableBootstrapContext&gt;</code></entry>
-                <entry>
-                  Bootstrap context map (unique name to a cloneable bootstrap context) which allows
-                  developers to bind (through <code>jboss-ra.xml</code>) their resource adapter to
-                  a specific bootstrap context instance.
-                </entry>
-              </row>
-              <row>
-                <entry><code>PrintStream</code></entry>
-                <entry><code>java.io.PrintStream</code></entry>
-                <entry>
-                  Specifies which print stream that should be used to handle the <code>LogWriter</code>s
-                </entry>
-              </row>
-              <row>
-                <entry><code>ScopeDeployment</code></entry>
-                <entry><code>boolean</code></entry>
-                <entry>
-                  Should each deployment be scoped (isolated) from the container. This feature allows
-                  deployment of libraries of a different version than used in the container environment.
-                  <para>Default: <code>false</code></para>
-                </entry>
-              </row>
-              <row>
-                <entry><code>JndiStrategy</code></entry>
-                <entry><code>org.jboss.jca.core.spi.naming.JndiStrategy</code></entry>
-                <entry>
-                  Specifies the JNDI strategy policy for binding the connection factories into
-                  the naming environment
+          <table frame="all">
+            <title>Resource adapter deployer</title>
+            <tgroup cols="3" align="left" colsep="1" rowsep="1">
+              <colspec colname="c1" colwidth="2*"/>
+              <colspec colname="c2"/>
+              <colspec colname="c3" colwidth="3*"/>
+              <thead>
+                <row>
+                  <entry align="left">Property</entry>
+                  <entry align="left">Type</entry>
+                  <entry align="left">Description</entry>
+                </row>
+              </thead>
+              <tbody>
+                <row>
+                  <entry><code>Configuration</code></entry>
+                  <entry><code>org.jboss.jca.deployers.fungal.RAConfiguration</code></entry>
+                  <entry>
+                    The configuration for the deployer
+                  </entry>
+                </row>
+              </tbody>
+            </tgroup>
+          </table>
 
-                  <para>The JNDI strategies are located in the <code>org.jboss.jca.core.naming</code>
-                    package</para>
-                  <itemizedlist spacing="compact">
-                    <listitem>
-                      <code>NoopJndiStrategy</code>: A no operation JNDI strategy 
-                      which doesn't bind/unbind any objects
-                    </listitem>
-                    <listitem>
-                      <code>SimpleJndiStrategy</code>: A simple JNDI strategy 
-                      which can bind/unbind a single connection factory
-                    </listitem>
-                  </itemizedlist>
-                </entry>
-              </row>
-            </tbody>
-          </tgroup>
-        </table>
+        </section>
+
+        <section id="jca_deployer_raactivator">
+          <title>Resource adapter activator</title>
+
+          <para>The deployer chain features an activator for resource adapter archives is handled
+            by the <code>org.jboss.jca.deployers.fungal.RAActivator</code> bean.</para>
+
+          <programlisting>
+<![CDATA[
+<bean name="RAActivator" 
+      class="org.jboss.jca.deployers.fungal.RAActivator">
+  <property name="Configuration"><inject bean="RAConfiguration"/></property>
+  <property name="Kernel"><inject bean="Kernel"/></property>
+  <property name="ExcludeArchives">
+    <set elementClass="java.lang.String">
+      <value>jdbc-local.rar</value>
+      <value>jdbc-xa.rar</value>
+    </set>
+  </property>
+  <depends>BeanValidation</depends>
+  <depends>JBossStdioContextSelector</depends>
+</bean>
+ ]]>
+          </programlisting>
+
+          <para>This activator will activate any resource adapters which hasn't been activated yet
+            unless they are in the excluded list.</para>
+          
+
+          <table frame="all">
+            <title>Resource adapter activator</title>
+            <tgroup cols="3" align="left" colsep="1" rowsep="1">
+              <colspec colname="c1" colwidth="2*"/>
+              <colspec colname="c2"/>
+              <colspec colname="c3" colwidth="3*"/>
+              <thead>
+                <row>
+                  <entry align="left">Property</entry>
+                  <entry align="left">Type</entry>
+                  <entry align="left">Description</entry>
+                </row>
+              </thead>
+              <tbody>
+                <row>
+                  <entry><code>Configuration</code></entry>
+                  <entry><code>org.jboss.jca.deployers.fungal.RAConfiguration</code></entry>
+                  <entry>
+                    The configuration for the deployer
+                  </entry>
+                </row>
+                <row>
+                  <entry><code>Kernel</code></entry>
+                  <entry><code>com.github.fungal.api.Kernel</code></entry>
+                  <entry>
+                    The kernel instance
+                  </entry>
+                </row>
+                <row>
+                  <entry><code>ExcludeArchives</code></entry>
+                  <entry><code>java.util.Set</code></entry>
+                  <entry>
+                    A set of resource adapter archives which should be excluded 
+                    from activation
+                  </entry>
+                </row>
+              </tbody>
+            </tgroup>
+          </table>
+
+        </section>
+
       </section>
 
       <section id="jca_security">
@@ -235,6 +367,85 @@
 
    </section>
 
+   <section id="datasources">
+      <title>Datasources</title>
+
+      <para>The IronJacamar project can deploy datasources using the <code>datasources-1_0.xsd</code> schema.</para>
+
+      <para>The configuration is done in the</para>
+
+      <programlisting>
+config/bootstrap/ds.xml
+      </programlisting>
+
+      <para>file.</para>
+
+      <table frame="all">
+        <title>DsXmlDeployer</title>
+        <tgroup cols="3" align="left" colsep="1" rowsep="1">
+          <colspec colname="c1" colwidth="2*"/>
+          <colspec colname="c2"/>
+          <colspec colname="c3" colwidth="3*"/>
+          <thead>
+            <row>
+              <entry align="left">Property</entry>
+              <entry align="left">Type</entry>
+              <entry align="left">Description</entry>
+            </row>
+          </thead>
+          <tbody>
+            <row>
+              <entry><code>JDBCLocal</code></entry>
+              <entry><code>String</code></entry>
+              <entry>
+                The name of the <code>jdbc-local.rar</code> deployment
+              </entry>
+            </row>
+            <row>
+              <entry><code>JDBCXA</code></entry>
+              <entry><code>String</code></entry>
+              <entry>
+                The name of the <code>jdbc-xa.rar</code> deployment
+              </entry>
+            </row>
+            <row>
+              <entry><code>TransactionManager</code></entry>
+              <entry><code>javax.transaction.TransactionManager</code></entry>
+              <entry>
+                The transaction manager
+              </entry>
+            </row>
+            <row>
+              <entry><code>MetadataRepository</code></entry>
+              <entry><code>org.jboss.jca.core.spi.mdr.MetadataRepository</code></entry>
+              <entry>
+                The metadata repository
+              </entry>
+            </row>
+            <row>
+              <entry><code>Kernel</code></entry>
+              <entry><code>com.github.fungal.api.Kernel</code></entry>
+              <entry>
+                The kernel
+              </entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </table>
+
+      <para>The datasource deployer can be removed from the environment by removing the <code>ds.xml</code>
+        file in</para>
+
+      <programlisting>
+config/bootstrap/
+      </programlisting>
+
+      <para>as well as the reference in <code>config/bootstrap/bootstrap.xml</code> to the file.</para>
+
+      <para>Furthermore all JDBC-*.RAR files in the <code>system/</code> directory should be removed too.</para>
+
+   </section>
+
    <section id="webserver">
       <title>Web server</title>
 

Modified: projects/jboss-jca/trunk/doc/userguide/en/modules/deployment.xml
===================================================================
--- projects/jboss-jca/trunk/doc/userguide/en/modules/deployment.xml	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/doc/userguide/en/modules/deployment.xml	2010-08-23 16:51:50 UTC (rev 107739)
@@ -35,7 +35,7 @@
       <title>Deploying resource adapters</title>
 
       <para>Resource adapters (.rar) are deployed by copying the resource adapter into the 
-        deploy/ directory</para>
+        <code>deploy/</code> directory</para>
 
      <programlisting>
 cp example.rar ironjacamar-1.0.0/deploy
@@ -62,4 +62,29 @@
 
    </section>
 
+   <section id="deployingds">
+      <title>Deploying datasources</title>
+
+      <para>Datasources (-ds.xml) are deployed by copying the definition into the 
+        <code>deploy/</code> directory</para>
+
+     <programlisting>
+cp postgres-xa-ds.xml ironjacamar-1.0.0/deploy
+     </programlisting>
+
+     <para>on a Un*x based system or</para>
+
+     <programlisting>
+copy postgres-xa-ds.xml ironjacamar-1.0.0\deploy
+     </programlisting>
+
+     <para>on Windows.</para>
+
+     <para>You will need to install the database JDBC driver into the <code>lib/</code> directory.</para>
+
+     <para>You can find examples of datasource definitions in the <code>doc/datasources</code> directory
+       and the schema itself <code>doc/datasources_1_0.xsd</code>.</para>
+
+   </section>
+
 </chapter>

Modified: projects/jboss-jca/trunk/doc/userguide/en/modules/schemas.xml
===================================================================
--- projects/jboss-jca/trunk/doc/userguide/en/modules/schemas.xml	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/doc/userguide/en/modules/schemas.xml	2010-08-23 16:51:50 UTC (rev 107739)
@@ -2712,4 +2712,615 @@
     </programlisting>
   </section>
 
+  <section id="ds10">
+    <title>Datasources 1.0</title>
+
+    <programlisting>
+<![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+  <xs:element name="datasources" type="datasourcesType">
+    <xs:annotation>
+      <xs:documentation>
+        The datasources element is the root of the jdbc datasource configuration 
+      </xs:documentation>
+    </xs:annotation>
+  </xs:element>
+  <xs:complexType name="datasourcesType">
+    <xs:choice minOccurs="0" maxOccurs="unbounded">
+      <xs:element name="datasource" type="datasourceType">
+        <xs:annotation>
+          <xs:documentation>
+            Specify a jca-jdbc non-XADatasource (local) wrapper, using local 
+            transactions
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="xa-datasource" type="xa-datasourceType">
+        <xs:annotation>
+          <xs:documentation>
+            Specify a jca-jdbc XADatasource wrapper
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+    </xs:choice>
+  </xs:complexType>
+  <xs:complexType name="datasourceType" mixed="false">
+    <xs:sequence>
+      <xs:element name="min-pool-size" type="xs:nonNegativeInteger" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            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>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="max-pool-size" type="xs:nonNegativeInteger" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            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. 
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="prefill" type="xs:boolean" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Whether to attempt to prefill the connection pool. Empty element denotes 
+            a true value. e.g. <prefill>true</prefill>.
+            Default is true
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="user-name" type="xs:token" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Specify the default username used when creating a new connection. 
+            Ex: <user-name>sa</user-name>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="password" type="xs:token" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Specify the default password used when creating a new connection. 
+            Ex: <password>sa-pass</password>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="connection-url" type="xs:token">
+        <xs:annotation>
+          <xs:documentation>
+            The JDBC driver connection URL string Ex: <connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="driver-class" type="xs:token">
+        <xs:annotation>
+          <xs:documentation>
+            The fully qualifed name of the JDBC driver class Ex: <driver-class>org.hsqldb.jdbcDriver</driver-class>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="transaction-isolation" type="transaction-isolationType" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Set java.sql.Connection transaction isolation level to use. The constants 
+            defined by transaction-isolation-values are the possible transaction isolation 
+            levels and include: TRANSACTION_READ_UNCOMMITTED TRANSACTION_READ_COMMITTED 
+            TRANSACTION_REPEATABLE_READ TRANSACTION_SERIALIZABLE TRANSACTION_NONE
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="connection-property" type="connection-propertyType" minOccurs="0" maxOccurs="unbounded">
+        <xs:annotation>
+          <xs:documentation>
+            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>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="time-out" type="time-outType" minOccurs="0" />
+      <xs:element name="security" type="securityType" minOccurs="0">
+      </xs:element>
+      <xs:element name="statement" type="statementType" minOccurs="0">
+      </xs:element>
+      <xs:element name="validation" type="validationType" minOccurs="0" />
+      <xs:element name="url-delimiter" type="xs:token" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Specifies the delimeter for URLs in connection-url for ha datasources
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="url-selector-strategy-class-name" type="xs:token" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            A class that implements org.jboss.resource.adapter.jdbc.URLSelectorStrategy
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="new-connection-sql" type="xs:string" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Specify an SQL statement to execute whenever a connection is added 
+            to the connection pool.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+    </xs:sequence>
+    <xs:attributeGroup ref="common-datasourceAttributes" />
+  </xs:complexType>
+  <xs:complexType name="xa-datasourceType">
+    <xs:sequence>
+      <xs:element name="min-pool-size" type="xs:nonNegativeInteger" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            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>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="max-pool-size" type="xs:nonNegativeInteger" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            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. 
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="prefill" type="xs:boolean" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Whether to attempt to prefill the connection pool. Empty element denotes 
+            a false value. e.g. <prefill>true</prefill>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="user-name " type="xs:token" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Specify the default username used when creating a new connection. 
+            Ex: <user-name>sa</user-name>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="password" type="xs:token" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Specify the default password used when creating a new connection. 
+            Ex: <password>sa-pass</password>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="xa-datasource-property" type="xa-datasource-propertyType" minOccurs="1"
+        maxOccurs="unbounded">
+        <xs:annotation>
+          <xs:documentation>
+            InSpecify 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>  
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="xa-datasource-class" type="xs:token">
+        <xs:annotation>
+          <xs:documentation>
+            The fully qualifed name of the javax.sql.XADataSource implementation 
+            class. Ex: <xa-datasource-class>com.informix.jdbcx.IfxXADataSource</xa-datasource-class>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="transaction-isolation" type="transaction-isolationType" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Set java.sql.Connection transaction isolation level to use. The constants 
+            defined by transaction-isolation-values are the possible transaction isolation 
+            levels and include: TRANSACTION_READ_UNCOMMITTED TRANSACTION_READ_COMMITTED 
+            TRANSACTION_REPEATABLE_READ TRANSACTION_SERIALIZABLE TRANSACTION_NONE
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="is-same-rm-override" type="xs:boolean" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            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>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="interleaving" type="boolean-presenceType" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            An element to enable interleaving for XA connection factories Ex: 
+            <interleaving/>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="recovery" type="recoveryType" minOccurs="0" />
+      <xs:element name="time-out" type="time-outType" minOccurs="0" />
+      <xs:element name="security" type="securityType" minOccurs="0"></xs:element>
+      <xs:element name="statement" minOccurs="0">
+        <xs:complexType>
+          <xs:sequence>
+            <xs:element name="track-statements" type="track-statementsType" minOccurs="0">
+              <xs:annotation>
+                <xs:documentation>
+                  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>
+                </xs:documentation>
+              </xs:annotation>
+            </xs:element>
+            <xs:element name="prepared-statement-cache-size" type="xs:nonNegativeInteger" minOccurs="0">
+              <xs:annotation>
+                <xs:documentation>
+                  The number of prepared statements per connection in an LRU cache
+                </xs:documentation>
+              </xs:annotation>
+            </xs:element>
+            <xs:element name="share-prepared-statements" type="boolean-presenceType" minOccurs="0">
+              <xs:annotation>
+                <xs:documentation>
+                  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/>
+                </xs:documentation>
+              </xs:annotation>
+            </xs:element>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="validation" type="validationType" minOccurs="0" />
+      <xs:element name="url-delimiter" type="xs:token" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Specifies the delimeter for URLs in connection-url for ha datasources
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="url-selector-strategy-class-name" type="xs:token" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            A class that implements org.jboss.resource.adapter.jdbc.URLSelectorStrategy
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="new-connection-sql" type="xs:string" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Specify an SQL statement to execute whenever a connection is added 
+            to the connection pool.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="pad-xid" type="xs:boolean" default="false" minOccurs="0" />
+      <xs:element name="wrap-xa-resource" type="xs:boolean" default="false" minOccurs="0" />
+      <xs:element name="no-tx-separate-pools" type="boolean-presenceType" minOccurs="0" />
+      <xs:element name="track-connection-by-tx" type="xs:boolean" minOccurs="0"></xs:element>
+    </xs:sequence>
+    <xs:attributeGroup ref="common-datasourceAttributes" />
+  </xs:complexType>
+  <xs:complexType name="boolean-presenceType" />
+  <xs:attributeGroup name="common-datasourceAttributes">
+    <xs:attribute name="jndi-name" type="xs:token" use="required" />
+    <xs:attribute name="pool-name" type="xs:token" use="required" />
+    <xs:attribute name="enabled" type="xs:boolean" default="true" form="unqualified" use="optional" />
+    <xs:attribute default="false" name="use-java-context" type="xs:boolean">
+      <xs:annotation>
+        <xs:documentation>
+          Setting this to false will bind the DataSource into global jndi
+          Ex:
+          <use-java-context>false</use-java-context>
+        </xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+  </xs:attributeGroup>
+  <xs:simpleType name="transaction-isolationType">
+    <xs:annotation>
+      <xs:documentation> Define constants used as the possible transaction isolation levels in transaction-isolation
+        type. Include: TRANSACTION_READ_UNCOMMITTED TRANSACTION_READ_COMMITTED TRANSACTION_REPEATABLE_READ
+        TRANSACTION_SERIALIZABLE TRANSACTION_NONE</xs:documentation>
+    </xs:annotation>
+    <xs:restriction base="xs:token">
+      <xs:enumeration value="TRANSACTION_READ_UNCOMMITTED" />
+      <xs:enumeration value="TRANSACTION_READ_COMMITTED" />
+      <xs:enumeration value="TRANSACTION_REPEATABLE_READ" />
+      <xs:enumeration value="TRANSACTION_SERIALIZABLE" />
+      <xs:enumeration value="TRANSACTION_NONE" />
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:simpleType name="security-managerType">
+    <xs:annotation>
+      <xs:documentation> Define constants used as the possible security manager in security-settings_type. See there for
+        complete documentation Include: APPLICATION DOMAIN APPLICATION_AND_DOMAIN NONE</xs:documentation>
+    </xs:annotation>
+    <xs:restriction base="xs:token">
+      <xs:enumeration value="APPLICATION" />
+      <xs:enumeration value="DOMAIN" />
+      <xs:enumeration value="APPLICATION_AND_DOMAIN" />
+      <xs:enumeration value="NONE" />
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:complexType name="securityType">
+    <xs:sequence>
+      <xs:element name="security-manager" type="security-managerType" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Possible value are:
+            * APPLICATION: Indicates that app supplied parameters (such as from getConnection(user, 
+            pw)) are used to distinguish connections in the pool.
+            * DOMAIN: Indicates Subject (from security domain) are used to distinguish connections 
+            in the pool. The content is the security-domain is the name of the JAAS security
+            manager that will handle authentication.
+            * APPLICATION-AND-DOMAIN: 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 is the security-domain is the name of the JAAS security
+            manager that will handle authentication.
+            * NONE: user/password provided in datasource definition are used.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="security-domain" type="xs:token" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            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> 
+            used for DOMAIN and APPLICATION-AND-DOMAIN security manager
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="xa-datasource-propertyType" mixed="true">
+    <xs:attribute use="required" name="name" type="xs:token" />
+  </xs:complexType>
+  <xs:complexType name="connection-propertyType" mixed="true">
+    <xs:attribute use="required" name="name" type="xs:token" />
+  </xs:complexType>
+  <xs:complexType name="validationType">
+    <xs:sequence>
+      <xs:element name="valid-connection-checker-class-name" type="xs:token" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            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>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="check-valid-connection-sql " type="xs:string" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Specify an SQL statement to check validity of a pool connection. This 
+            may be called when managed connection is taken from pool for use. 
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="validate-on-match " type="xs:boolean" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            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 
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="background-validation" type="xs:boolean" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            An element to specify that connections should be validated on a background 
+            thread versus being validated prior to use 
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="background-validation-minutes" type="xs:nonNegativeInteger" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            The background-validation-minutes element specifies the amount of 
+            time, in minutes, that background validation will run. 
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="use-fast-fail" type="xs:boolean" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            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>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element minOccurs="0" name="stale-connection-checker-class-name" type="xs:token">
+        <xs:annotation>
+          <xs:documentation>
+            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> 
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="exception-sorter-class-name" type="xs:token" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            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>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="time-outType">
+    <xs:sequence>
+      <xs:element name="blocking-timeout-millis" type="xs:nonNegativeInteger" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            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).  
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="idle-timeout-minutes" type="xs:nonNegativeInteger" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            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. 
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="set-tx-query-timeout" type="boolean-presenceType" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            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/>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="query-timeout" type="xs:nonNegativeInteger" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Any configured query timeout in seconds The default is no timeout 
+            e.g. 5 minutes <query-timeout>300</query-timeout>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="use-try-lock" type="xs:nonNegativeInteger" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Any configured timeout for internal locks on the resource adapter 
+            objects in seconds The default is a 60 second timeout e.g. 5 minutes <use-try-lock>300</use-try-lock>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="allocation-retry" type="xs:nonNegativeInteger" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            The allocation retry element indicates the number of times that allocating 
+            a connection should be tried before throwing an exception. The default is 
+            0.  
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="allocation-retry-wait-millis" type="xs:nonNegativeInteger" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            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). 
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="xa-resource-timeout" type="xs:token" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Passed to XAResource.setTransactionTimeout() Default is zero which 
+            does not invoke the setter e.g. 5 minutes <xa-resource-timeout>300</xa-resource-timeout>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="recoveryType">
+    <xs:choice>
+      <xs:element name="no-recover" type="xs:boolean" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Specify if the xa-datasource should be excluded from recovery. Default: 
+            false Ex: <no-recover>true</no-recover>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:sequence minOccurs="0">
+        <xs:element name="recover-user-name" type="xs:token" minOccurs="0">
+          <xs:annotation>
+            <xs:documentation>
+              Specify the username used when creating a connection during recovery. 
+              Ex: <recover-user-name>sa</recover-user-name>
+            </xs:documentation>
+          </xs:annotation>
+        </xs:element>
+        <xs:element name="recover-password " type="xs:token" minOccurs="0">
+          <xs:annotation>
+            <xs:documentation>
+              Specify the password used when creating a connection during recovery. 
+              Ex: <recover-password>sa-pass</recover-password>
+            </xs:documentation>
+          </xs:annotation>
+        </xs:element>
+        <xs:element name="recover-security-domain" type="xs:token" minOccurs="0">
+          <xs:annotation>
+            <xs:documentation>
+              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> 
+            </xs:documentation>
+          </xs:annotation>
+        </xs:element>
+      </xs:sequence>
+    </xs:choice>
+  </xs:complexType>
+  <xs:simpleType name="track-statementsType">
+    <xs:restriction base="xs:token">
+      <xs:enumeration value="true" />
+      <xs:enumeration value="false" />
+      <xs:enumeration value="nowarn" />
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:complexType name="statementType">
+    <xs:sequence>
+      <xs:element name="track-statements" type="track-statementsType" minOccurs="0">
+        <xs:annotation></xs:annotation>
+      </xs:element>
+      <xs:element name="prepared-statement-cache-size" type="xs:nonNegativeInteger" minOccurs="0">
+        <xs:annotation></xs:annotation>
+      </xs:element>
+      <xs:element name="share-prepared-statements" type="boolean-presenceType" minOccurs="0">
+        <xs:annotation></xs:annotation>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema> ]]>
+    </programlisting>
+  </section>
+
+
 </appendix>

Modified: projects/jboss-jca/trunk/embedded/src/main/java/org/jboss/jca/embedded/EmbeddedJCA.java
===================================================================
--- projects/jboss-jca/trunk/embedded/src/main/java/org/jboss/jca/embedded/EmbeddedJCA.java	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/embedded/src/main/java/org/jboss/jca/embedded/EmbeddedJCA.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -36,6 +36,7 @@
 import com.github.fungal.api.Kernel;
 import com.github.fungal.api.KernelFactory;
 import com.github.fungal.api.classloading.ClassLoaderFactory;
+import com.github.fungal.api.configuration.DeploymentOrder;
 import com.github.fungal.api.configuration.KernelConfiguration;
 
 /**
@@ -81,6 +82,11 @@
     */
    public void startup() throws Throwable
    {
+      List<String> order = new ArrayList<String>(3);
+      order.add(".xml");
+      order.add(".rar");
+      order.add("-ds.xml");
+
       KernelConfiguration kernelConfiguration = new KernelConfiguration();
       kernelConfiguration = kernelConfiguration.name("iron.jacamar");
       kernelConfiguration = kernelConfiguration.home(null);
@@ -90,6 +96,7 @@
       kernelConfiguration = kernelConfiguration.hotDeployment(false);
       kernelConfiguration = kernelConfiguration.eventListener(new PreClassLoaderEventListener());
       kernelConfiguration = kernelConfiguration.eventListener(new PostClassLoaderEventListener());
+      kernelConfiguration = kernelConfiguration.deploymentOrder(new DeploymentOrder(order));
 
       kernel = KernelFactory.create(kernelConfiguration);
       kernel.startup();
@@ -100,6 +107,7 @@
          deploy(EmbeddedJCA.class.getClassLoader(), "transaction.xml");
          deploy(EmbeddedJCA.class.getClassLoader(), "stdio.xml");
          deploy(EmbeddedJCA.class.getClassLoader(), "jca.xml");
+         deploy(EmbeddedJCA.class.getClassLoader(), "ds.xml");
       }
    }
 
@@ -120,6 +128,7 @@
 
       if (fullProfile)
       {
+         undeploy(EmbeddedJCA.class.getClassLoader(), "ds.xml");
          undeploy(EmbeddedJCA.class.getClassLoader(), "jca.xml");
          undeploy(EmbeddedJCA.class.getClassLoader(), "stdio.xml");
          undeploy(EmbeddedJCA.class.getClassLoader(), "transaction.xml");

Added: projects/jboss-jca/trunk/embedded/src/main/resources/ds.xml
===================================================================
--- projects/jboss-jca/trunk/embedded/src/main/resources/ds.xml	                        (rev 0)
+++ projects/jboss-jca/trunk/embedded/src/main/resources/ds.xml	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,13 @@
+<deployment>
+
+  <!-- Datasource deployer -->
+  <bean name="DsXmlDeployer" 
+        class="org.jboss.jca.deployers.fungal.DsXmlDeployer">
+    <property name="JDBCLocal">jdbc-local.rar</property>
+    <property name="JDBCXA">jdbc-xa.rar</property>
+    <property name="TransactionManager"><inject bean="RealTransactionManager"/></property>
+    <property name="MetadataRepository"><inject bean="MDR"/></property>
+    <property name="Kernel"><inject bean="Kernel"/></property>
+  </bean>
+
+</deployment>

Modified: projects/jboss-jca/trunk/embedded/src/main/resources/jca.xml
===================================================================
--- projects/jboss-jca/trunk/embedded/src/main/resources/jca.xml	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/embedded/src/main/resources/jca.xml	2010-08-23 16:51:50 UTC (rev 107739)
@@ -125,22 +125,51 @@
   </bean>
 
   <!-- JNDI strategy -->
-  <bean name="JNDIStrategy"
+  <bean name="JndiStrategy"
         interface="org.jboss.jca.core.spi.naming.JndiStrategy"
         class="org.jboss.jca.core.naming.SimpleJndiStrategy"/>
 
-  <!-- RA deployer -->
-  <bean name="RADeployer" interface="com.github.fungal.spi.deployers.Deployer" class="org.jboss.jca.deployers.fungal.RADeployer">
+  <!-- MDR -->
+  <bean name="MDR"
+        interface="org.jboss.jca.core.spi.mdr.MetadataRepository"
+        class="org.jboss.jca.core.mdr.SimpleMetadataRepository"/>
+
+  <!-- RA configuration -->
+  <bean name="RAConfiguration"
+        class="org.jboss.jca.deployers.fungal.RAConfiguration">
     <property name="ArchiveValidation">true</property>
     <property name="ArchiveValidationFailOnWarn">false</property>
     <property name="ArchiveValidationFailOnError">true</property>
     <property name="BeanValidation">true</property>
     <property name="PrintStream"><inject bean="JBossStdioContext" property="Out"/></property>
     <property name="DefaultBootstrapContext"><inject bean="DefaultBootstrapContext"/></property>
-    <property name="JndiStrategy"><inject bean="JNDIStrategy"/></property>
+    <property name="JndiStrategy"><inject bean="JndiStrategy"/></property>
     <property name="TransactionManager"><inject bean="RealTransactionManager"/></property>
+    <property name="MetadataRepository"><inject bean="MDR"/></property>
+  </bean>
+
+  <!-- RA deployer -->
+  <bean name="RADeployer"
+        interface="com.github.fungal.spi.deployers.Deployer"
+        class="org.jboss.jca.deployers.fungal.RADeployer">
+    <property name="Configuration"><inject bean="RAConfiguration"/></property>
     <depends>BeanValidation</depends>
     <depends>JBossStdioContextSelector</depends>
   </bean>
 
+  <!-- RA activator -->
+  <bean name="RAActivator" 
+        class="org.jboss.jca.deployers.fungal.RAActivator">
+    <property name="Configuration"><inject bean="RAConfiguration"/></property>
+    <property name="Kernel"><inject bean="Kernel"/></property>
+    <property name="ExcludeArchives">
+      <set elementClass="java.lang.String">
+        <value>jdbc-local.rar</value>
+        <value>jdbc-xa.rar</value>
+      </set>
+    </property>
+    <depends>BeanValidation</depends>
+    <depends>JBossStdioContextSelector</depends>
+  </bean>
+
 </deployment>

Modified: projects/jboss-jca/trunk/ivy.xml
===================================================================
--- projects/jboss-jca/trunk/ivy.xml	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/ivy.xml	2010-08-23 16:51:50 UTC (rev 107739)
@@ -81,6 +81,7 @@
     <dependency org="apache-logging" name="commons-logging" rev="${version.apache-logging}" conf="common,ironjacamar-depchain"/>
     <dependency org="com.github.fungal" name="fungal" rev="${version.fungal}" conf="sjc,ironjacamar-depchain,ironjacamar-deployers-fungal,ironjacamar-embedded"/>
     <dependency org="com.github.fungal" name="fungal-cli" rev="${version.fungal}" conf="sjc,ironjacamar-depchain"/>
+    <dependency org="com.h2database" name="h2" rev="${version.h2}" conf="test"/>
     <dependency org="com.sun.xml.bind" name="jaxb-impl" rev="${version.jaxb.impl}" conf="common,ironjacamar-depchain"/>
     <dependency org="dom4j" name="dom4j" rev="${version.dom4j}" conf="tools"/>
     <dependency org="javassist" name="javassist" rev="${version.javassist}" conf="common,ironjacamar-depchain"/>

Modified: projects/jboss-jca/trunk/sjc/build.xml
===================================================================
--- projects/jboss-jca/trunk/sjc/build.xml	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/sjc/build.xml	2010-08-23 16:51:50 UTC (rev 107739)
@@ -106,6 +106,7 @@
     <mkdir dir="${target.dir}/sjc/config/bootstrap"/>
     <mkdir dir="${target.dir}/sjc/doc"/>
     <mkdir dir="${target.dir}/sjc/doc/codegenerator"/>
+    <mkdir dir="${target.dir}/sjc/doc/datasources"/>
     <mkdir dir="${target.dir}/sjc/doc/validator"/>
     <mkdir dir="${target.dir}/sjc/lib"/>
     <mkdir dir="${target.dir}/sjc/lib/embedded"/>
@@ -161,6 +162,13 @@
       </fileset>
     </copy>
 
+    <copy todir="${target.dir}/sjc/system">
+      <fileset dir="${target.dir}">
+        <include name="jdbc-local.rar"/>
+        <include name="jdbc-xa.rar"/>
+      </fileset>
+    </copy>
+
     <copy todir="${target.dir}/sjc/lib">
       <fileset dir="${target.dir}">
         <include name="*.jar"/>
@@ -245,9 +253,16 @@
         <include name="dtd/connector_1_0.dtd"/>
         <include name="schema/connector_1_5.xsd"/>
         <include name="schema/connector_1_6.xsd"/>
+        <include name="schema/datasources_1_0.xsd"/>
       </fileset>
     </copy>
 
+    <copy todir="${target.dir}/sjc/doc/datasources" flatten="true">
+      <fileset dir="../common/src/test/resources/ds">
+        <include name="*.xml"/>
+      </fileset>
+    </copy>
+
     <copy todir="${target.dir}/sjc/doc/codegenerator">
       <fileset dir="../codegenerator/src/main/resources/">
         <include name="**/*.sh"/>

Modified: projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/Main.java
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/Main.java	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/Main.java	2010-08-23 16:51:50 UTC (rev 107739)
@@ -25,10 +25,13 @@
 import java.io.File;
 import java.lang.reflect.Method;
 import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
 
 import com.github.fungal.api.Kernel;
 import com.github.fungal.api.KernelFactory;
 import com.github.fungal.api.classloading.ClassLoaderFactory;
+import com.github.fungal.api.configuration.DeploymentOrder;
 import com.github.fungal.api.configuration.KernelConfiguration;
 
 /**
@@ -59,6 +62,12 @@
    {
       try
       {
+         List<String> order = new ArrayList<String>(4);
+         order.add(".xml");
+         order.add(".rar");
+         order.add("-ds.xml");
+         order.add(".war");
+
          KernelConfiguration kernelConfiguration = new KernelConfiguration();
          kernelConfiguration = kernelConfiguration.name("iron.jacamar");
          kernelConfiguration = kernelConfiguration.classLoader(ClassLoaderFactory.TYPE_PARENT_FIRST);
@@ -67,6 +76,7 @@
          kernelConfiguration = kernelConfiguration.eventListener(new PreClassLoaderEventListener());
          kernelConfiguration = kernelConfiguration.eventListener(new PostClassLoaderEventListener());
          kernelConfiguration = kernelConfiguration.command(new Shutdown());
+         kernelConfiguration = kernelConfiguration.deploymentOrder(new DeploymentOrder(order));
 
          String home = SecurityActions.getSystemProperty("iron.jacamar.home");
          if (home != null)

Added: projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/ds.xml
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/ds.xml	                        (rev 0)
+++ projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/ds.xml	2010-08-23 16:51:50 UTC (rev 107739)
@@ -0,0 +1,13 @@
+<deployment>
+
+  <!-- Datasource deployer -->
+  <bean name="DsXmlDeployer" 
+        class="org.jboss.jca.deployers.fungal.DsXmlDeployer">
+    <property name="JDBCLocal">jdbc-local.rar</property>
+    <property name="JDBCXA">jdbc-xa.rar</property>
+    <property name="TransactionManager"><inject bean="RealTransactionManager"/></property>
+    <property name="MetadataRepository"><inject bean="MDR"/></property>
+    <property name="Kernel"><inject bean="Kernel"/></property>
+  </bean>
+
+</deployment>

Modified: projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/jca.xml
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/jca.xml	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/jca.xml	2010-08-23 16:51:50 UTC (rev 107739)
@@ -128,22 +128,51 @@
   </bean>
 
   <!-- JNDI strategy -->
-  <bean name="JNDIStrategy"
+  <bean name="JndiStrategy"
         interface="org.jboss.jca.core.spi.naming.JndiStrategy"
         class="org.jboss.jca.core.naming.SimpleJndiStrategy"/>
 
-  <!-- RA deployer -->
-  <bean name="RADeployer" interface="com.github.fungal.spi.deployers.Deployer" class="org.jboss.jca.deployers.fungal.RADeployer">
+  <!-- MDR -->
+  <bean name="MDR"
+        interface="org.jboss.jca.core.spi.mdr.MetadataRepository"
+        class="org.jboss.jca.core.mdr.SimpleMetadataRepository"/>
+
+  <!-- RA configuration -->
+  <bean name="RAConfiguration"
+        class="org.jboss.jca.deployers.fungal.RAConfiguration">
     <property name="ArchiveValidation">true</property>
     <property name="ArchiveValidationFailOnWarn">false</property>
     <property name="ArchiveValidationFailOnError">true</property>
     <property name="BeanValidation">true</property>
     <property name="PrintStream"><inject bean="JBossStdioContext" property="Out"/></property>
     <property name="DefaultBootstrapContext"><inject bean="DefaultBootstrapContext"/></property>
-    <property name="JndiStrategy"><inject bean="JNDIStrategy"/></property>
+    <property name="JndiStrategy"><inject bean="JndiStrategy"/></property>
     <property name="TransactionManager"><inject bean="RealTransactionManager"/></property>
+    <property name="MetadataRepository"><inject bean="MDR"/></property>
+  </bean>
+
+  <!-- RA deployer -->
+  <bean name="RADeployer"
+        interface="com.github.fungal.spi.deployers.Deployer" 
+        class="org.jboss.jca.deployers.fungal.RADeployer">
+    <property name="Configuration"><inject bean="RAConfiguration"/></property>
     <depends>BeanValidation</depends>
     <depends>JBossStdioContextSelector</depends>
   </bean>
 
+  <!-- RA activator -->
+  <bean name="RAActivator" 
+        class="org.jboss.jca.deployers.fungal.RAActivator">
+    <property name="Configuration"><inject bean="RAConfiguration"/></property>
+    <property name="Kernel"><inject bean="Kernel"/></property>
+    <property name="ExcludeArchives">
+      <set elementClass="java.lang.String">
+        <value>jdbc-local.rar</value>
+        <value>jdbc-xa.rar</value>
+      </set>
+    </property>
+    <depends>BeanValidation</depends>
+    <depends>JBossStdioContextSelector</depends>
+  </bean>
+
 </deployment>

Modified: projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap.xml
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap.xml	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap.xml	2010-08-23 16:51:50 UTC (rev 107739)
@@ -4,5 +4,6 @@
   <url>bootstrap/stdio.xml</url>
   <url>bootstrap/transaction.xml</url>
   <url>bootstrap/jca.xml</url>
+  <url>bootstrap/ds.xml</url>
 
 </bootstrap>

Modified: projects/jboss-jca/trunk/tools/findbugs/filter.xml
===================================================================
--- projects/jboss-jca/trunk/tools/findbugs/filter.xml	2010-08-23 16:23:59 UTC (rev 107738)
+++ projects/jboss-jca/trunk/tools/findbugs/filter.xml	2010-08-23 16:51:50 UTC (rev 107739)
@@ -35,11 +35,11 @@
 
   <!--  org.jboss.jca.core filter -->
   <Match>
-    <Class name="org.jboss.jca.core.api.ConnectionManager"/>
+    <Class name="org.jboss.jca.core.api.connectionmanager.ConnectionManager"/>
     <Bug code="Nm"/>
   </Match>
   <Match>
-    <Class name="org.jboss.jca.core.api.WorkManager"/>
+    <Class name="org.jboss.jca.core.api.workmanager.WorkManager"/>
     <Bug code="Nm"/>
   </Match>
   <Match>
@@ -47,12 +47,28 @@
     <Bug code="Nm"/>
   </Match>
   <Match>
+    <Class name="org.jboss.jca.core.mdr.SimpleMetadataRepository"/>
+    <Bug code="Dm"/>
+  </Match>
+  <Match>
     <Class name="org.jboss.jca.core.security.UsersRoles"/>
     <Bug code="Se,PZLA"/>
   </Match>
+  <Match>
+    <Class name="org.jboss.jca.core.spi.mdr.MetadataRepository"/>
+    <Bug code="Dm"/>
+  </Match>
 
   <!--  org.jboss.jca.deployers filter -->
   <Match>
+    <Class name="org.jboss.jca.deployers.fungal.DsXmlDeployer"/>
+    <Bug code="IS"/>
+  </Match>
+  <Match>
+    <Class name="org.jboss.jca.deployers.fungal.DsXmlDeployment"/>
+    <Bug code="EI2"/>
+  </Match>
+  <Match>
     <Class name="org.jboss.jca.deployers.fungal.RADeployer"/>
     <Bug code="DLS,ST"/>
   </Match>
@@ -75,6 +91,12 @@
     <Bug code="Dm,PZLA"/>
   </Match>
 
+  <!--  org.jboss.jca.validator filter -->
+  <Match>
+    <Class name="org.jboss.jca.validator.maven.ValidatorMojo"/>
+    <Bug code="EI,EI2"/>
+  </Match>
+
   <!--  org.jboss.jca.web filter -->
   <Match>
     <Class name="org.jboss.jca.web.WARDeployer"/>
@@ -117,5 +139,4 @@
     <Bug code="RCN"/>
   </Match>
   
-
 </FindBugsFilter>



More information about the jboss-cvs-commits mailing list