[jboss-cvs] JBossAS SVN: r97617 - in projects/jboss-jca/trunk/deployers: src/main/java/org/jboss/jca/deployers/fungal and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Dec 9 10:20:01 EST 2009
Author: jesper.pedersen
Date: 2009-12-09 10:20:00 -0500 (Wed, 09 Dec 2009)
New Revision: 97617
Added:
projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/
projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/TestActivationSpec.java
projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/TestManagedConnection.java
projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/TestManagedConnectionFactory.java
projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/TestResourceAdapter.java
projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/package.html
projects/jboss-jca/trunk/deployers/src/test/resources/ra16asso.rar/
projects/jboss-jca/trunk/deployers/src/test/resources/ra16asso.rar/META-INF/
projects/jboss-jca/trunk/deployers/src/test/resources/ra16asso.rar/META-INF/ra.xml
Modified:
projects/jboss-jca/trunk/deployers/build.xml
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/RarTestCase.java
Log:
[JBJCA-237] ResourceAdapterAssociation
Modified: projects/jboss-jca/trunk/deployers/build.xml
===================================================================
--- projects/jboss-jca/trunk/deployers/build.xml 2009-12-09 15:15:05 UTC (rev 97616)
+++ projects/jboss-jca/trunk/deployers/build.xml 2009-12-09 15:20:00 UTC (rev 97617)
@@ -340,6 +340,14 @@
includes="org/jboss/jca/test/deployers/spec/rars/ra16annoconfprop/*.class"/>
<fileset dir="src/test/resources/ra16annoconfprop.rar"/>
</jar>
+ <jar destfile="${build.deployers.dir}/ra16asso.rar"
+ manifest="src/main/resources/rar-manifest.mf">
+ <fileset dir="${build.deployers.dir}/test"
+ includes="org/jboss/jca/test/deployers/spec/rars/*.class"/>
+ <fileset dir="${build.deployers.dir}/test"
+ includes="org/jboss/jca/test/deployers/spec/rars/ra16asso/*.class"/>
+ <fileset dir="src/test/resources/ra16asso.rar"/>
+ </jar>
</target>
<!-- =================================
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 2009-12-09 15:15:05 UTC (rev 97616)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java 2009-12-09 15:20:00 UTC (rev 97617)
@@ -52,6 +52,7 @@
import javax.resource.spi.BootstrapContext;
import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterAssociation;
import org.jboss.logging.Logger;
@@ -281,6 +282,7 @@
ResourceAdapter resourceAdapter = null;
List<ValidateObject> archiveValidationObjects = new ArrayList<ValidateObject>();
List<Object> beanValidationObjects = new ArrayList<Object>();
+ List<Object> associationObjects = new ArrayList<Object>();
// Create objects and inject values
if (cmd != null)
@@ -310,6 +312,7 @@
cdMeta.getConfigProps(), cl);
archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY, o));
beanValidationObjects.add(o);
+ associationObjects.add(o);
}
}
}
@@ -333,6 +336,7 @@
mlMeta.getActivationSpecType().getConfigProps(), cl);
archiveValidationObjects.add(new ValidateObject(Key.ACTIVATION_SPEC, o));
beanValidationObjects.add(o);
+ associationObjects.add(o);
}
}
}
@@ -466,6 +470,9 @@
}
// Activate deployment
+ if (resourceAdapter != null && associationObjects.size() > 0)
+ associateResourceAdapter(resourceAdapter, associationObjects);
+
if (resourceAdapter != null)
startContext(resourceAdapter);
@@ -511,6 +518,37 @@
}
/**
+ * Associate resource adapter with ojects if they implement ResourceAdapterAssociation
+ * @param resourceAdapter The resource adapter
+ * @param associationObjects The list of possible objects
+ * @throws DeployException Thrown if the resource adapter cant be started
+ */
+ private void associateResourceAdapter(ResourceAdapter resourceAdapter,
+ List<Object> associationObjects)
+ throws DeployException
+ {
+ for (Object object : associationObjects)
+ {
+ 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
Modified: projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/RarTestCase.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/RarTestCase.java 2009-12-09 15:15:05 UTC (rev 97616)
+++ projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/RarTestCase.java 2009-12-09 15:20:00 UTC (rev 97617)
@@ -562,6 +562,30 @@
}
}
+ /**
+ * ra16asso.rar
+ * @throws Throwable throwable exception
+ */
+ @Test
+ public void testRa16asso() throws Throwable
+ {
+ URL archive = getURL("ra16asso.rar");
+
+ try
+ {
+ embedded.deploy(archive);
+ }
+ catch (Throwable t)
+ {
+ log.error(t.getMessage(), t);
+ fail(t.getMessage());
+ }
+ finally
+ {
+ embedded.undeploy(archive);
+ }
+ }
+
// --------------------------------------------------------------------------------||
// Lifecycle Methods --------------------------------------------------------------||
// --------------------------------------------------------------------------------||
Added: projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/TestActivationSpec.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/TestActivationSpec.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/TestActivationSpec.java 2009-12-09 15:20:00 UTC (rev 97617)
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+package org.jboss.jca.test.deployers.spec.rars.ra16asso;
+
+import org.jboss.jca.test.deployers.spec.rars.BaseActivationSpec;
+
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterAssociation;
+
+/**
+ * TestActivationSpec
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @version $Revision: $
+ */
+public class TestActivationSpec extends BaseActivationSpec implements ResourceAdapterAssociation
+{
+ private ResourceAdapter ra;
+
+ /**
+ * Constructor
+ */
+ public TestActivationSpec()
+ {
+ this.ra = null;
+ }
+
+ /**
+ * Get the resource adapter handle
+ * @return The handle
+ */
+ public ResourceAdapter getResourceAdapter()
+ {
+ return ra;
+ }
+
+ /**
+ * Set the resource adapter handle
+ * @param ra The handle
+ */
+ public void setResourceAdapter(ResourceAdapter ra)
+ {
+ this.ra = ra;
+ }
+}
Added: projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/TestManagedConnection.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/TestManagedConnection.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/TestManagedConnection.java 2009-12-09 15:20:00 UTC (rev 97617)
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+package org.jboss.jca.test.deployers.spec.rars.ra16asso;
+
+import org.jboss.jca.test.deployers.spec.rars.BaseManagedConnection;
+
+/**
+ * TestManagedConnection
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class TestManagedConnection extends BaseManagedConnection
+{
+
+}
Added: projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/TestManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/TestManagedConnectionFactory.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/TestManagedConnectionFactory.java 2009-12-09 15:20:00 UTC (rev 97617)
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+package org.jboss.jca.test.deployers.spec.rars.ra16asso;
+
+import org.jboss.jca.test.deployers.spec.rars.BaseManagedConnectionFactory;
+
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterAssociation;
+
+/**
+ * TestManagedConnectionFactory
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @version $Revision: $
+ */
+public class TestManagedConnectionFactory extends BaseManagedConnectionFactory implements ResourceAdapterAssociation
+{
+ private static final long serialVersionUID = 1L;
+
+ private ResourceAdapter ra;
+
+ /**
+ * Constructor
+ */
+ public TestManagedConnectionFactory()
+ {
+ this.ra = null;
+ }
+
+ /**
+ * Get the resource adapter handle
+ * @return The handle
+ */
+ public ResourceAdapter getResourceAdapter()
+ {
+ return ra;
+ }
+
+ /**
+ * Set the resource adapter handle
+ * @param ra The handle
+ */
+ public void setResourceAdapter(ResourceAdapter ra)
+ {
+ this.ra = ra;
+ }
+}
Added: projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/TestResourceAdapter.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/TestResourceAdapter.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/TestResourceAdapter.java 2009-12-09 15:20:00 UTC (rev 97617)
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+package org.jboss.jca.test.deployers.spec.rars.ra16asso;
+
+import org.jboss.jca.test.deployers.spec.rars.BaseResourceAdapter;
+
+/**
+ * TestResourceAdapter
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class TestResourceAdapter extends BaseResourceAdapter
+{
+
+}
Added: projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/package.html
===================================================================
--- projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/package.html (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16asso/package.html 2009-12-09 15:20:00 UTC (rev 97617)
@@ -0,0 +1,3 @@
+<body>
+Test case for ResourceAdapterAssociation.
+</body>
Added: projects/jboss-jca/trunk/deployers/src/test/resources/ra16asso.rar/META-INF/ra.xml
===================================================================
--- projects/jboss-jca/trunk/deployers/src/test/resources/ra16asso.rar/META-INF/ra.xml (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/test/resources/ra16asso.rar/META-INF/ra.xml 2009-12-09 15:20:00 UTC (rev 97617)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id $ -->
+
+<connector xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/j2ee/connector_1_6.xsd"
+ version="1.6" metadata-complete="true">
+
+ <vendor-name>Red Hat Middleware LLC</vendor-name>
+ <eis-type>Test RA</eis-type>
+ <resourceadapter-version>0.1</resourceadapter-version>
+
+ <resourceadapter>
+ <resourceadapter-class>org.jboss.jca.test.deployers.spec.rars.ra16asso.TestResourceAdapter</resourceadapter-class>
+
+ <outbound-resourceadapter>
+ <connection-definition>
+ <managedconnectionfactory-class>org.jboss.jca.test.deployers.spec.rars.ra16asso.TestManagedConnectionFactory</managedconnectionfactory-class>
+
+ <connectionfactory-interface>javax.resource.spi.ManagedConnection</connectionfactory-interface>
+ <connectionfactory-impl-class>org.jboss.jca.test.deployers.spec.rars.ra16asso.TestManagedConnection</connectionfactory-impl-class>
+ <connection-interface>org.jboss.jca.test.deployers.spec.rars.TestConnectionInterface</connection-interface>
+ <connection-impl-class>org.jboss.jca.test.deployers.spec.rars.TestConnection</connection-impl-class>
+ </connection-definition>
+ <transaction-support>LocalTransaction</transaction-support>
+ <reauthentication-support>false</reauthentication-support>
+ </outbound-resourceadapter>
+ <inbound-resourceadapter>
+ <messageadapter>
+ <messagelistener>
+ <messagelistener-type>org.jboss.jca.test.deployers.spec.rars.MessageListener</messagelistener-type>
+ <activationspec>
+ <activationspec-class>org.jboss.jca.test.deployers.spec.rars.ra16asso.TestActivationSpec</activationspec-class>
+ </activationspec>
+ </messagelistener>
+ </messageadapter>
+ </inbound-resourceadapter>
+ </resourceadapter>
+</connector>
More information about the jboss-cvs-commits
mailing list