[jboss-cvs] JBossAS SVN: r75627 - in trunk: component-matrix and 15 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 10 09:54:13 EDT 2008


Author: wolfc
Date: 2008-07-10 09:54:13 -0400 (Thu, 10 Jul 2008)
New Revision: 75627

Added:
   trunk/ejb3/src/main/org/jboss/as/
   trunk/ejb3/src/main/org/jboss/as/javaee/
   trunk/ejb3/src/main/org/jboss/as/javaee/SimpleJavaEEModuleInformer.java
   trunk/ejb3/src/main/org/jboss/as/jpa/
   trunk/ejb3/src/main/org/jboss/as/jpa/resolvers/
   trunk/ejb3/src/main/org/jboss/as/jpa/resolvers/JBossASDataSourceDependencyResolver.java
   trunk/ejb3/src/resources/META-INF/jpa-deployers-beans.xml
Modified:
   trunk/build/build-distr.xml
   trunk/component-matrix/pom.xml
   trunk/ejb3/.classpath
   trunk/ejb3/build.xml
   trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3Deployer.java
   trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java
   trunk/ejb3/src/main/org/jboss/ejb3/deployers/JBossASDepdencyPolicy.java
   trunk/server/.classpath
   trunk/server/build.xml
   trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
   trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployment.java
   trunk/testsuite/.classpath
   trunk/thirdparty/pom.xml
   trunk/tomcat/.classpath
   trunk/tomcat/build.xml
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
Log:
JBAS-5756: use the new jpa deployers

Modified: trunk/build/build-distr.xml
===================================================================
--- trunk/build/build-distr.xml	2008-07-10 12:49:58 UTC (rev 75626)
+++ trunk/build/build-distr.xml	2008-07-10 13:54:13 UTC (rev 75627)
@@ -184,6 +184,9 @@
       <fileset dir="${hibernate.entitymanager.lib}" includes="*.jar"/>
       <fileset dir="${hibernate.annotations.lib}" includes="*.jar"/>
       <fileset dir="${hibernate.validator.lib}" includes="*.jar"/>
+      
+      <fileset dir="${jboss.jboss.jpa.deployers.lib}" includes="*.jar"
+               excludes="*-sources.jar, *-javadoc.jar"/>
     </copy>
 
     <!-- Copy across client jars -->

Modified: trunk/component-matrix/pom.xml
===================================================================
--- trunk/component-matrix/pom.xml	2008-07-10 12:49:58 UTC (rev 75626)
+++ trunk/component-matrix/pom.xml	2008-07-10 13:54:13 UTC (rev 75627)
@@ -39,7 +39,7 @@
     <version.jboss.messaging>1.4.1.CR1</version.jboss.messaging>
     <version.jboss.web>2.1.1.CR4</version.jboss.web>
     <version.org.jboss.aop>2.0.0.CR13</version.org.jboss.aop>
-    <version.org.jboss.ejb3>0.1.6</version.org.jboss.ejb3>
+    <version.org.jboss.ejb3>0.1.7</version.org.jboss.ejb3>
     <version.org.jboss.mdr>2.0.0.Beta15</version.org.jboss.mdr>
     <version.org.jboss.vfs>2.0.0.Beta20</version.org.jboss.vfs>
     <version.org.jboss.cl>2.0.0.Beta12</version.org.jboss.cl>

Modified: trunk/ejb3/.classpath
===================================================================
--- trunk/ejb3/.classpath	2008-07-10 12:49:58 UTC (rev 75626)
+++ trunk/ejb3/.classpath	2008-07-10 13:54:13 UTC (rev 75627)
@@ -20,5 +20,6 @@
 	<classpathentry kind="lib" path="/thirdparty/org/jboss/ejb3/lib/jboss-ejb3-async.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/org/jboss/ws/lib/jbossws-spi.jar" sourcepath="/thirdparty/org/jboss/ws/lib/jbossws-spi-sources.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/hibernate/lib/hibernate-core.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-jpa-deployers/lib/jboss-jpa-deployers.jar" sourcepath="/thirdparty/jboss/jboss-jpa-deployers/lib/jboss-jpa-deployers-sources.jar"/>
 	<classpathentry kind="output" path="output/eclipse-classes"/>
 </classpath>

Modified: trunk/ejb3/build.xml
===================================================================
--- trunk/ejb3/build.xml	2008-07-10 12:49:58 UTC (rev 75626)
+++ trunk/ejb3/build.xml	2008-07-10 13:54:13 UTC (rev 75627)
@@ -119,6 +119,8 @@
          <path refid="jboss.jboss.ejb3.ext.api.impl.classpath" />
          <path refid="jboss.jboss.ejb3.interceptors.classpath" />
          <path refid="jboss.jboss.ejb3.metadata.classpath" />
+         <path refid="jboss.jboss.jpa.deployers.classpath"/>
+         <path refid="jboss.jboss.mdr.classpath"/>
          <path refid="jboss.jboss.reflect.classpath" />
       </path>
 
@@ -306,6 +308,9 @@
       <!-- jboss-ejb3-deployer.jar -->
       <jar jarfile="${build.lib}/jboss-ejb3-deployer.jar" manifest="${build.etc}/default.mf">
          <fileset dir="${build.classes}">
+            <!-- TODO: another jar? -->
+            <include name="org/jboss/as/**"/>
+            
             <include name="org/jboss/ejb3/deployers/**"/>
             <include name="org/jboss/ejb3/clientmodule/*"/>
          </fileset>
@@ -328,6 +333,7 @@
          </fileset>
          <fileset dir="${resources}">
             <include name="META-INF/ejb3-deployers-beans.xml"/>
+            <include name="META-INF/jpa-deployers-beans.xml"/>
          </fileset>
          <fileset dir="output/resources">
             <include name="META-INF/persistence.properties"/>

Added: trunk/ejb3/src/main/org/jboss/as/javaee/SimpleJavaEEModuleInformer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/as/javaee/SimpleJavaEEModuleInformer.java	                        (rev 0)
+++ trunk/ejb3/src/main/org/jboss/as/javaee/SimpleJavaEEModuleInformer.java	2008-07-10 13:54:13 UTC (rev 75627)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.as.javaee;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.jpa.javaee.JavaEEModuleInformer;
+import org.jboss.metadata.client.jboss.JBossClientMetaData;
+import org.jboss.metadata.ear.jboss.JBossAppMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEntityBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class SimpleJavaEEModuleInformer implements JavaEEModuleInformer
+{
+   public String getApplicationName(DeploymentUnit unit)
+   {
+      DeploymentUnit topLevel = unit.getTopLevel();
+      if(topLevel.isAttachmentPresent(JBossAppMetaData.class))
+         return topLevel.getSimpleName();
+      return null;
+   }
+
+   public String getModulePath(DeploymentUnit unit)
+   {
+      return unit.getRelativePath();
+   }
+
+   public ModuleType getModuleType(DeploymentUnit unit)
+   {
+      if(unit.isAttachmentPresent(JBossClientMetaData.class))
+         return ModuleType.APP_CLIENT;
+      if(unit.isAttachmentPresent(JBossMetaData.class) && isReallyAnEjbDeployment(unit))
+         return ModuleType.EJB;
+      if(unit.isAttachmentPresent(JBossWebMetaData.class))
+         return ModuleType.WEB;
+      return ModuleType.JAVA;
+   }
+
+   /*
+    * Some hacks to counter problems.
+    */
+   private boolean isReallyAnEjbDeployment(DeploymentUnit unit)
+   {
+      JBossMetaData metaData = unit.getAttachment(JBossMetaData.class);
+      // JBMETA-69
+      if(metaData.getEnterpriseBeans() == null || metaData.getEnterpriseBeans().size() == 0)
+         return false;
+      // JBMETA-70
+      // The chance of a persistence unit being defined with couple of EJB entity beans is
+      // pretty slim.
+      for(JBossEnterpriseBeanMetaData bean : metaData.getEnterpriseBeans())
+      {
+         if(!(bean instanceof JBossEntityBeanMetaData))
+            return true;
+      }
+      return false;
+   }
+}

Added: trunk/ejb3/src/main/org/jboss/as/jpa/resolvers/JBossASDataSourceDependencyResolver.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/as/jpa/resolvers/JBossASDataSourceDependencyResolver.java	                        (rev 0)
+++ trunk/ejb3/src/main/org/jboss/as/jpa/resolvers/JBossASDataSourceDependencyResolver.java	2008-07-10 13:54:13 UTC (rev 75627)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.as.jpa.resolvers;
+
+import org.jboss.ejb3.deployers.JBossASDepdencyPolicy;
+import org.jboss.jpa.resolvers.DataSourceDependencyResolver;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class JBossASDataSourceDependencyResolver implements DataSourceDependencyResolver
+{
+   public String resolveDataSourceSupplier(String jndiName)
+   {
+      return JBossASDepdencyPolicy.createDataSourceKernelName(jndiName);
+   }
+}

Modified: trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3Deployer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3Deployer.java	2008-07-10 12:49:58 UTC (rev 75626)
+++ trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3Deployer.java	2008-07-10 13:54:13 UTC (rev 75627)
@@ -23,8 +23,10 @@
 
 import java.util.Properties;
 import java.util.Set;
+
 import javax.management.MBeanServer;
 
+import org.jboss.beans.metadata.api.annotations.Inject;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
@@ -38,6 +40,7 @@
 import org.jboss.ejb3.metadata.jpa.spec.PersistenceUnitsMetaData;
 import org.jboss.ejb3.pool.PoolFactoryRegistry;
 import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry;
+import org.jboss.jpa.resolvers.PersistenceUnitDependencyResolver;
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.spi.deployment.KernelDeployment;
 import org.jboss.metadata.ear.jboss.JBossAppMetaData;
@@ -78,6 +81,8 @@
    /** A flag indicating if wars should be scanned for ejbs */
    private boolean scanWars = false;
    
+   private PersistenceUnitDependencyResolver persistenceUnitDependencyResolver;
+   
    public Ejb3Deployer()
    {
       addInput(MergedJBossMetaDataDeployer.EJB_MERGED_ATTACHMENT_NAME);
@@ -170,6 +175,8 @@
          }
          deployment.setCacheFactoryRegistry(this.getCacheFactoryRegistry());
          deployment.setPersistenceManagerFactoryRegistry(this.getPersistenceManagerFactoryRegistry());
+         // TODO: if the deployment becomes a proper MC bean, it'll get injected by MC.
+         deployment.setPersistenceUnitDependencyResolver(persistenceUnitDependencyResolver);
          deployment.setRemoteProxyFactoryRegistry(this.getRemoteProxyFactoryRegistry());
          deployment.setPoolFactoryRegistry(this.getPoolFactoryRegistry());
          if (scope != null)
@@ -238,6 +245,12 @@
       this.persistenceManagerFactoryRegistry = persistenceManagerFactoryRegistry;
    }
 
+   @Inject
+   public void setPersistenceUnitDeploymentResolver(PersistenceUnitDependencyResolver resolver)
+   {
+      this.persistenceUnitDependencyResolver = resolver;
+   }
+   
    public boolean isScanWars()
    {
       return scanWars;

Modified: trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java	2008-07-10 12:49:58 UTC (rev 75626)
+++ trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java	2008-07-10 13:54:13 UTC (rev 75627)
@@ -22,6 +22,7 @@
 package org.jboss.ejb3.deployers;
 
 import java.util.Map;
+
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 import javax.security.jacc.PolicyConfiguration;
@@ -61,7 +62,11 @@
 
    public Ejb3JBoss5Deployment(DeploymentUnit ejb3Unit, Kernel kernel, MBeanServer mbeanServer, org.jboss.deployers.structure.spi.DeploymentUnit jbossUnit, DeploymentScope deploymentScope, JBossMetaData metaData, PersistenceMetaData persistenceUnitsMetaData)
    {
-      super(ejb3Unit, deploymentScope, metaData, persistenceUnitsMetaData);
+      // Either call the old constructor and do process persistence units
+      //super(ejb3Unit, deploymentScope, metaData, persistenceUnitsMetaData);
+      // or call the new constructor and don't process persistence units
+      super(jbossUnit, ejb3Unit, deploymentScope, metaData);
+      
       this.jbossUnit = jbossUnit;
       kernelAbstraction = new JBossASKernel(kernel, mbeanServer);
 
@@ -69,6 +74,9 @@
       this.mbeanServer = mbeanServer;
       org.jboss.deployers.structure.spi.DeploymentUnit topUnit = jbossUnit.getTopLevel();
       endpoints = (Map<String, ContainerDependencyMetaData>) topUnit.getAttachment(MappedReferenceMetaDataResolverDeployer.ENDPOINT_MAP_KEY);
+      
+      // depends on the mode
+      setProcessPersistenceUnits(false);
    }
 
    protected PolicyConfiguration createPolicyConfiguration() throws Exception

Modified: trunk/ejb3/src/main/org/jboss/ejb3/deployers/JBossASDepdencyPolicy.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/deployers/JBossASDepdencyPolicy.java	2008-07-10 12:49:58 UTC (rev 75626)
+++ trunk/ejb3/src/main/org/jboss/ejb3/deployers/JBossASDepdencyPolicy.java	2008-07-10 13:54:13 UTC (rev 75627)
@@ -136,6 +136,11 @@
    }
    public void addDatasource(String jndiName)
    {
+      addDependency(createDataSourceKernelName(jndiName));
+   }
+   
+   public static String createDataSourceKernelName(String jndiName)
+   {
       String ds = jndiName;
       if (ds.startsWith("java:/"))
       {
@@ -147,6 +152,6 @@
          ds = ds.substring(5);
       }
       String onStr = "jboss.jca:name=" + ds + ",service=DataSourceBinding";
-      addDependency(onStr);
+      return onStr;
    }
 }

Added: trunk/ejb3/src/resources/META-INF/jpa-deployers-beans.xml
===================================================================
--- trunk/ejb3/src/resources/META-INF/jpa-deployers-beans.xml	                        (rev 0)
+++ trunk/ejb3/src/resources/META-INF/jpa-deployers-beans.xml	2008-07-10 13:54:13 UTC (rev 75627)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <bean name="DataSourceDependencyResolver" class="org.jboss.as.jpa.resolvers.JBossASDataSourceDependencyResolver"/>
+   
+   <bean name="JavaEEModuleInformer" class="org.jboss.as.javaee.SimpleJavaEEModuleInformer"/>
+   
+   <bean name="PersistenceUnitDependencyResolver" class="org.jboss.jpa.resolvers.DefaultPersistenceUnitDependencyResolver"/>
+   
+   <bean name="PersistenceParsingDeployer" class="org.jboss.jpa.deployers.PersistenceParsingDeployer"/>
+
+   <bean name="PersistenceDeployer" class="org.jboss.jpa.deployers.PersistenceDeployer"/>
+   <bean name="PersistenceUnitDeployer" class="org.jboss.jpa.deployers.PersistenceUnitDeployer">
+      <property name="defaultPersistenceProperties">
+         <map keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>hibernate.transaction.manager_lookup_class</key>
+               <value>org.hibernate.transaction.JBossTransactionManagerLookup</value>
+            </entry>
+         </map>
+      </property>
+   </bean>
+</deployment>
\ No newline at end of file

Modified: trunk/server/.classpath
===================================================================
--- trunk/server/.classpath	2008-07-10 12:49:58 UTC (rev 75626)
+++ trunk/server/.classpath	2008-07-10 13:54:13 UTC (rev 75627)
@@ -17,5 +17,6 @@
 	<classpathentry exported="true" kind="lib" path="/thirdparty/jboss/jnpserver/lib/jnpserver.jar" sourcepath="/thirdparty/jboss/jnpserver/lib/jnpserver-sources.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/org/jboss/ws/lib/jbossws-spi.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/org/jboss/ws/native/lib/jbossws-native-jaxws.jar" sourcepath="/thirdparty/org/jboss/ws/native/lib/jbossws-native-jaxws-sources.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-jpa-deployers/lib/jboss-jpa-deployers.jar" sourcepath="/thirdparty/jboss/jboss-jpa-deployers/lib/jboss-jpa-deployers-sources.jar"/>
 	<classpathentry kind="output" path="output/eclipse-classes"/>
 </classpath>

Modified: trunk/server/build.xml
===================================================================
--- trunk/server/build.xml	2008-07-10 12:49:58 UTC (rev 75626)
+++ trunk/server/build.xml	2008-07-10 13:54:13 UTC (rev 75627)
@@ -91,6 +91,7 @@
       <path refid="jboss.jboss.man.classpath"/>
       <path refid="jboss.jboss.mdr.classpath"/>
       <path refid="jboss.microcontainer.classpath"/>
+      <path refid="jboss.jboss.jpa.deployers.classpath"/>
       <path refid="jboss.jboss.vfs.classpath"/>
       <path refid="junit.junit.classpath"/>
       <path refid="oswego.concurrent.classpath"/>

Modified: trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java	2008-07-10 12:49:58 UTC (rev 75626)
+++ trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java	2008-07-10 13:54:13 UTC (rev 75627)
@@ -34,12 +34,14 @@
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
+import org.jboss.beans.metadata.api.annotations.Inject;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.helpers.AttachmentLocator;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
 import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.jpa.resolvers.PersistenceUnitDependencyResolver;
 import org.jboss.metadata.ear.jboss.JBossAppMetaData;
 import org.jboss.metadata.ear.spec.ModuleMetaData;
 import org.jboss.metadata.ear.spec.WebModuleMetaData;
@@ -109,6 +111,8 @@
    /** Legacy support for MBeanServer */
    private MBeanServer server;
    private MainDeployerStructure mainDeployer;
+   
+   private PersistenceUnitDependencyResolver persistenceUnitDependencyResolver;
 
    /**
     * Create a new AbstractWarDeployer.
@@ -232,6 +236,12 @@
       this.defaultSecurityDomain = defaultSecurityDomain;
    }
 
+   @Inject
+   public void setPersistenceUnitDependencyResolver(PersistenceUnitDependencyResolver resolver)
+   {
+      this.persistenceUnitDependencyResolver = resolver;
+   }
+   
    /** Get the session attribute number under which the caller Subject is stored
     * @jmx:managed-attribute
     */
@@ -453,6 +463,8 @@
 
          AbstractWarDeployment deployment = getDeployment(unit, metaData);
          deployment.setMainDeployer(mainDeployer);
+         // TODO: until deployment is a MC bean
+         deployment.setPersistenceUnitDependencyResolver(persistenceUnitDependencyResolver);
          deployWebModule(unit, metaData, deployment);
       }
       catch (Exception e)

Modified: trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployment.java
===================================================================
--- trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployment.java	2008-07-10 12:49:58 UTC (rev 75626)
+++ trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployment.java	2008-07-10 13:54:13 UTC (rev 75627)
@@ -36,10 +36,12 @@
 import javax.naming.LinkRef;
 import javax.naming.NamingException;
 
+import org.jboss.beans.metadata.api.annotations.Inject;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
 import org.jboss.ejb.EjbUtil50;
+import org.jboss.jpa.resolvers.PersistenceUnitDependencyResolver;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.javaee.spec.EJBLocalReferenceMetaData;
 import org.jboss.metadata.javaee.spec.EJBLocalReferencesMetaData;
@@ -64,7 +66,7 @@
 import org.jboss.naming.Util;
 import org.jboss.security.ISecurityManagement;
 import org.jboss.security.authorization.PolicyRegistration;
-import org.jboss.web.WebApplication; 
+import org.jboss.web.WebApplication;
 import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
 import org.omg.CORBA.ORB;
 
@@ -134,6 +136,8 @@
    /** The security management */
    protected ISecurityManagement securityManagement;
    
+   private PersistenceUnitDependencyResolver persistenceUnitDependencyResolver;
+   
    public AbstractWarDeployment()
    {
       log = Logger.getLogger(getClass());
@@ -278,6 +282,17 @@
       this.defaultSecurityDomain = defaultSecurityDomain;
    } 
 
+   protected PersistenceUnitDependencyResolver getPersistenceUnitDependencyResolver()
+   {
+      return persistenceUnitDependencyResolver;
+   }
+   
+   @Inject
+   public void setPersistenceUnitDependencyResolver(PersistenceUnitDependencyResolver resolver)
+   {
+      this.persistenceUnitDependencyResolver = resolver;
+   }
+   
    /**
     * Get the Policy Registration Name
     * @return

Modified: trunk/testsuite/.classpath
===================================================================
--- trunk/testsuite/.classpath	2008-07-10 12:49:58 UTC (rev 75626)
+++ trunk/testsuite/.classpath	2008-07-10 13:54:13 UTC (rev 75627)
@@ -31,7 +31,7 @@
 	<classpathentry kind="lib" path="/tools/lib/ant.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/httpunit/lib/httpunit.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar" sourcepath="/thirdparty/junit/lib/junit-sources.jar"/>
-	<classpathentry kind="lib" path="/thirdparty/jboss/test/lib/jboss-test.jar" sourcepath="/thirdparty/jboss/test/lib/jboss-test-src.zip"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/test/lib/jboss-test.jar" sourcepath="/thirdparty/jboss/test/lib/jboss-test-sources.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/org/jboss/aspects/lib/jboss-remoting-aspects.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/org/jboss/aspects/lib/jboss-security-aspects.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/org/jboss/aspects/lib/jboss-transaction-aspects.jar"/>

Modified: trunk/thirdparty/pom.xml
===================================================================
--- trunk/thirdparty/pom.xml	2008-07-10 12:49:58 UTC (rev 75626)
+++ trunk/thirdparty/pom.xml	2008-07-10 13:54:13 UTC (rev 75627)
@@ -517,6 +517,13 @@
               </mapping>
             </dependency>
             <dependency>
+              <groupId>org.jboss.jpa</groupId>
+              <artifactId>jboss-jpa-deployers</artifactId>
+              <mapping>
+                <componentId>jboss.jboss-jpa-deployers</componentId>
+              </mapping>
+            </dependency>
+            <dependency>
               <groupId>org.jboss.cluster</groupId>
               <artifactId>jboss-ha-client</artifactId>
               <mapping>

Modified: trunk/tomcat/.classpath
===================================================================
--- trunk/tomcat/.classpath	2008-07-10 12:49:58 UTC (rev 75626)
+++ trunk/tomcat/.classpath	2008-07-10 13:54:13 UTC (rev 75627)
@@ -26,5 +26,6 @@
 	<classpathentry kind="lib" path="/thirdparty/jboss/test/lib/jboss-test.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/org/jboss/ws/lib/jbossws-spi.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-jpa-deployers/lib/jboss-jpa-deployers.jar" sourcepath="/thirdparty/jboss/jboss-jpa-deployers/lib/jboss-jpa-deployers-sources.jar"/>
 	<classpathentry kind="output" path="output/eclipse-classes"/>
 </classpath>

Modified: trunk/tomcat/build.xml
===================================================================
--- trunk/tomcat/build.xml	2008-07-10 12:49:58 UTC (rev 75626)
+++ trunk/tomcat/build.xml	2008-07-10 13:54:13 UTC (rev 75627)
@@ -74,6 +74,7 @@
       <path refid="jboss.jboss.ejb3.core.classpath" />
       <path refid="jboss.jboss.ejb3.interceptors.classpath" />
       <path refid="jboss.jboss.ha.server.api.classpath"/>
+      <path refid="jboss.jboss.jpa.deployers.classpath" />
       <path refid="jboss.jboss.reflect.classpath" />
     </path>
 

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java	2008-07-10 12:49:58 UTC (rev 75626)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java	2008-07-10 13:54:13 UTC (rev 75627)
@@ -53,13 +53,14 @@
 import org.jboss.injection.DependsHandler;
 import org.jboss.injection.EJBHandler;
 import org.jboss.injection.EncInjector;
-import org.jboss.injection.InjectionContainer;
+import org.jboss.injection.ExtendedInjectionContainer;
 import org.jboss.injection.InjectionHandler;
 import org.jboss.injection.InjectionUtil;
 import org.jboss.injection.Injector;
 import org.jboss.injection.PersistenceContextHandler;
 import org.jboss.injection.PersistenceUnitHandler;
 import org.jboss.injection.WebServiceRefHandler;
+import org.jboss.jpa.resolvers.PersistenceUnitDependencyResolver;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.javaee.spec.Environment;
 import org.jboss.metadata.web.jboss.JBossServletsMetaData;
@@ -80,7 +81,7 @@
  * @author Scott.Stark at jboss.org
  * @version $Revision: 1.17 $
  */
-public class TomcatInjectionContainer extends AbstractJavaEEComponent implements InjectionContainer, InstanceManager
+public class TomcatInjectionContainer extends AbstractJavaEEComponent implements ExtendedInjectionContainer, InstanceManager
 {
    private static final Logger log = Logger.getLogger(TomcatInjectionContainer.class);
 
@@ -133,8 +134,9 @@
    protected WebApplication appInfo;
    protected JBossWebMetaData webDD;
    protected org.apache.catalina.Context catalinaContext;
+   private PersistenceUnitDependencyResolver persistenceUnitDependencyResolver;
 
-   public TomcatInjectionContainer(WebApplication appInfo, VFSDeploymentUnit unit, org.apache.catalina.Context catalinaContext)
+   public TomcatInjectionContainer(WebApplication appInfo, VFSDeploymentUnit unit, org.apache.catalina.Context catalinaContext, PersistenceUnitDependencyResolver resolver)
    {
       super(new SimpleJavaEEModule(appInfo.getName()));
       
@@ -147,6 +149,8 @@
       
       this.webDD = unit.getAttachment(JBossWebMetaData.class);
       assert this.webDD != null : "webDD is null (no JBossWebMetaData attachment in VFSDeploymentUnit)";
+      
+      this.persistenceUnitDependencyResolver = resolver;
    }
 
    public Environment getEnvironmentRefGroup()
@@ -433,7 +437,8 @@
 
    public PersistenceUnitDeployment getPersistenceUnitDeployment(String unitName) throws NameNotFoundException
    {
-      return persistenceUnitResolver.getPersistenceUnitDeployment(unitName);
+      //return persistenceUnitResolver.getPersistenceUnitDeployment(unitName);
+      throw new RuntimeException("Call resolvePersistenceUnitSupplier");
    }
 
    public boolean hasJNDIBinding(String jndiName)
@@ -496,4 +501,9 @@
    {
       throw new IllegalStateException("Resolution should not happen via injection container");
    }
+
+   public String resolvePersistenceUnitSupplier(String persistenceUnitName)
+   {
+      return persistenceUnitDependencyResolver.resolvePersistenceUnitSupplier(unit, persistenceUnitName);
+   }
 }
\ No newline at end of file

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java	2008-07-10 12:49:58 UTC (rev 75626)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java	2008-07-10 13:54:13 UTC (rev 75627)
@@ -165,7 +165,7 @@
 
       StandardContext context = (StandardContext)Class.forName(config.getContextClassName()).newInstance();
       
-      injectionContainer = new TomcatInjectionContainer(webApp, webApp.getDeploymentUnit(), context);
+      injectionContainer = new TomcatInjectionContainer(webApp, webApp.getDeploymentUnit(), context, getPersistenceUnitDependencyResolver());
 
       Loader webLoader = webApp.getDeploymentUnit().getAttachment(Loader.class);
       if (webLoader == null)




More information about the jboss-cvs-commits mailing list