[jboss-cvs] JBossAS SVN: r75254 - in projects/jpa/trunk/deployers: src/main/java/org/jboss/jpa and 12 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jul 1 05:31:57 EDT 2008


Author: wolfc
Date: 2008-07-01 05:31:56 -0400 (Tue, 01 Jul 2008)
New Revision: 75254

Added:
   projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployers/PersistenceDeployer.java
   projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/
   projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/ManagedEntityManagerFactory.java
   projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceDeployment.java
   projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceUnitDeployment.java
   projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceUnitInfoImpl.java
   projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/spi/
   projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/spi/PersistenceUnit.java
   projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/spi/PersistenceUnitRegistry.java
   projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/util/
   projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/util/ThreadLocalStack.java
   projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/common/
   projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/common/MainDeployerTestDelegate.java
   projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/deployment/
   projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/deployment/DeploymentTestCase.java
   projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/common/
   projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/common/MainDeployer-beans.xml
   projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/deployment/
   projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/deployment/DeploymentTestCase.xml
   projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/deployment/pu/
   projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/deployment/pu/META-INF/
   projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/deployment/pu/META-INF/persistence.xml
Modified:
   projects/jpa/trunk/deployers/.classpath
   projects/jpa/trunk/deployers/pom.xml
Log:
First attempt at a PersistenceDeployer

Modified: projects/jpa/trunk/deployers/.classpath
===================================================================
--- projects/jpa/trunk/deployers/.classpath	2008-07-01 09:31:09 UTC (rev 75253)
+++ projects/jpa/trunk/deployers/.classpath	2008-07-01 09:31:56 UTC (rev 75254)
@@ -5,14 +5,33 @@
   <classpathentry kind="output" path="eclipse-target/classes"/>
   <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
   <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.0.2/activation-1.0.2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar" sourcepath="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/asm/asm/1.5.3/asm-1.5.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/asm/asm-attrs/1.5.3/asm-attrs-1.5.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/cglib/cglib/2.1_3/cglib-2.1_3.jar" sourcepath="M2_REPO/cglib/cglib/2.1_3/cglib-2.1_3-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/2.1.1/commons-collections-2.1.1.jar" sourcepath="M2_REPO/commons-collections/commons-collections/2.1.1/commons-collections-2.1.1-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/apache-httpclient/commons-httpclient/2.0.2/commons-httpclient-2.0.2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar" sourcepath="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar" sourcepath="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/net/sf/ehcache/ehcache/1.2.3/ehcache-1.2.3.jar" sourcepath="M2_REPO/net/sf/ehcache/ehcache/1.2.3/ehcache-1.2.3-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/hibernate/ejb3-persistence/1.0.1.GA/ejb3-persistence-1.0.1.GA.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate/3.2.6.ga/hibernate-3.2.6.ga.jar" sourcepath="M2_REPO/org/hibernate/hibernate/3.2.6.ga/hibernate-3.2.6.ga-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.3.1.GA/hibernate-annotations-3.3.1.GA.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-commons-annotations/3.0.0.ga/hibernate-commons-annotations-3.0.0.ga.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-entitymanager/3.3.2.GA/hibernate-entitymanager-3.3.2.GA.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javassist/javassist/3.4.GA/javassist-3.4.GA.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/javassist/3.7.1.GA/javassist-3.7.1.GA.jar" sourcepath="M2_REPO/org/jboss/javassist/3.7.1.GA/javassist-3.7.1.GA-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar" sourcepath="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/cl/jboss-classloader/2.0.0.Beta12/jboss-classloader-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/cl/jboss-classloader/2.0.0.Beta12/jboss-classloader-2.0.0.Beta12-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/cl/jboss-classloading/2.0.0.Beta12/jboss-classloading-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/cl/jboss-classloading/2.0.0.Beta12/jboss-classloading-2.0.0.Beta12-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-classloading-spi/5.0.0.Beta4/jboss-classloading-spi-5.0.0.Beta4.jar" sourcepath="M2_REPO/org/jboss/jboss-classloading-spi/5.0.0.Beta4/jboss-classloading-spi-5.0.0.Beta4-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/cl/jboss-classloading-vfs/2.0.0.Beta12/jboss-classloading-vfs-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/cl/jboss-classloading-vfs/2.0.0.Beta12/jboss-classloading-vfs-2.0.0.Beta12-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.7.GA/jboss-common-core-2.2.7.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.7.GA/jboss-common-core-2.2.7.GA-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.3.GA/jboss-common-core-2.2.3.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.3.GA/jboss-common-core-2.2.3.GA-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-dependency/2.0.0.Beta16/jboss-dependency-2.0.0.Beta16.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-dependency/2.0.0.Beta16/jboss-dependency-2.0.0.Beta16-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/deployers/jboss-deployers-client/2.0.0.Beta18/jboss-deployers-client-2.0.0.Beta18.jar" sourcepath="M2_REPO/org/jboss/deployers/jboss-deployers-client/2.0.0.Beta18/jboss-deployers-client-2.0.0.Beta18-sources.jar"/>
@@ -28,6 +47,7 @@
   <classpathentry kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api/0.3/jboss-ejb3-ext-api-0.3.jar" sourcepath="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api/0.3/jboss-ejb3-ext-api-0.3-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/jboss/jbossws/jboss-jaxrpc/1.0.4.GA/jboss-jaxrpc-1.0.4.GA.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-jaxws/2.0.1.GA/jboss-jaxws-2.0.1.GA.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jca-api/1.5.0.20070913080910/jboss-jca-api-1.5.0.20070913080910.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-jca-api/1.5.0.20070913080910/jboss-jca-api-1.5.0.20070913080910-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jms-api/1.1.0.CR1/jboss-jms-api-1.1.0.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-jms-api/1.1.0.CR1/jboss-jms-api-1.1.0.CR1-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.0.0.Beta16/jboss-kernel-2.0.0.Beta16.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.0.0.Beta16/jboss-kernel-2.0.0.Beta16-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
@@ -36,13 +56,19 @@
   <classpathentry kind="var" path="M2_REPO/org/jboss/metadata/jboss-metadata/1.0.0.Beta26/jboss-metadata-1.0.0.Beta26.jar" sourcepath="M2_REPO/org/jboss/metadata/jboss-metadata/1.0.0.Beta26/jboss-metadata-1.0.0.Beta26-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-metatype/2.0.0.Beta12/jboss-metatype-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/man/jboss-metatype/2.0.0.Beta12/jboss-metatype-2.0.0.Beta12-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-persistence-api/3.0.0.CR1/jboss-persistence-api-3.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-persistence-api/3.0.0.CR1/jboss-persistence-api-3.0.0.CR1-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.0.Beta12/jboss-reflect-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.0.Beta12/jboss-reflect-2.0.0.Beta12-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.CR1/jboss-transaction-api-1.0.1.CR1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.CR1/jboss-transaction-api-1.0.1.CR1-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-test/1.0.5.GA/jboss-test-1.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-test/1.0.5.GA/jboss-test-1.0.5.GA-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.20070913080910/jboss-transaction-api-1.0.1.20070913080910.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.20070913080910/jboss-transaction-api-1.0.1.20070913080910-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-transaction-spi/5.0.0.Beta4/jboss-transaction-spi-5.0.0.Beta4.jar" sourcepath="M2_REPO/org/jboss/jboss-transaction-spi/5.0.0.Beta4/jboss-transaction-spi-5.0.0.Beta4-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-vfs/2.0.0.Beta19/jboss-vfs-2.0.0.Beta19.jar" sourcepath="M2_REPO/org/jboss/jboss-vfs/2.0.0.Beta19/jboss-vfs-2.0.0.Beta19-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/ws/jbossws-spi/1.0.2.GA/jbossws-spi-1.0.2.GA.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.0.CR10/jbossxb-2.0.0.CR10.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.0.CR10/jbossxb-2.0.0.CR10-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar"/>
   <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar" sourcepath="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/apache-slide/webdavlib/2.0/webdavlib-2.0.jar"/>
   <classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.9.1/xml-apis-2.9.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.7.1/xml-apis-2.7.1.jar"/>
 </classpath>
\ No newline at end of file

Modified: projects/jpa/trunk/deployers/pom.xml
===================================================================
--- projects/jpa/trunk/deployers/pom.xml	2008-07-01 09:31:09 UTC (rev 75253)
+++ projects/jpa/trunk/deployers/pom.xml	2008-07-01 09:31:56 UTC (rev 75254)
@@ -24,6 +24,22 @@
       <version>4.4</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.hibernate</groupId>
+      <artifactId>hibernate-entitymanager</artifactId>
+      <version>3.3.2.GA</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-transaction-spi</artifactId>
+      <version>5.0.0.Beta4</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-test</artifactId>
+      <version>1.0.5.GA</version>
+      <scope>test</scope>
+    </dependency>
   	<dependency>
       <groupId>org.jboss.deployers</groupId>
       <artifactId>jboss-deployers-vfs</artifactId>

Added: projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployers/PersistenceDeployer.java
===================================================================
--- projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployers/PersistenceDeployer.java	                        (rev 0)
+++ projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployers/PersistenceDeployer.java	2008-07-01 09:31:56 UTC (rev 75254)
@@ -0,0 +1,56 @@
+/*
+ * 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.jpa.deployers;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.jpa.deployment.PersistenceDeployment;
+import org.jboss.metadata.jpa.spec.PersistenceMetaData;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class PersistenceDeployer extends AbstractSimpleRealDeployer<PersistenceMetaData>
+{
+   public PersistenceDeployer()
+   {
+      super(PersistenceMetaData.class);
+      addOutput(BeanMetaData.class);
+   }
+
+   @Override
+   public void deploy(DeploymentUnit unit, PersistenceMetaData deployment) throws DeploymentException
+   {
+      PersistenceDeployment bean = new PersistenceDeployment((VFSDeploymentUnit) unit, null, deployment);
+      BeanMetaDataBuilder bmdb = BeanMetaDataBuilder.createBuilder("PersistenceDeployment", PersistenceDeployment.class.getName());
+      bmdb.setConstructorValue(bean);
+//      AbstractBeanMetaData bmd = new AbstractBeanMetaData("PersistenceDeployment", PersistenceDeployment.class.getName());
+//      AbstractConstructorMetaData constructor = new AbstractConstructorMetaData();
+//      constructor.setValueObject(bean);
+      unit.addAttachment(BeanMetaData.class, bmdb.getBeanMetaData());
+   }
+}

Copied: projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/ManagedEntityManagerFactory.java (from rev 75203, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/ManagedEntityManagerFactory.java)
===================================================================
--- projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/ManagedEntityManagerFactory.java	                        (rev 0)
+++ projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/ManagedEntityManagerFactory.java	2008-07-01 09:31:56 UTC (rev 75254)
@@ -0,0 +1,199 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.jpa.deployment;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.TransactionRequiredException;
+import javax.transaction.RollbackException;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+
+import org.jboss.jpa.util.ThreadLocalStack;
+import org.jboss.logging.Logger;
+import org.jboss.tm.TransactionLocal;
+import org.jboss.tm.TxUtils;
+
+/**
+ * @author <a href="mailto:gavine at hibernate.org">Gavin King</a>
+ * @version $Revision$
+ */
+public class ManagedEntityManagerFactory
+{
+   private static final Logger log = Logger.getLogger(ManagedEntityManagerFactory.class);
+
+   protected EntityManagerFactory entityManagerFactory;
+   protected TransactionLocal session = new TransactionLocal();
+   protected String kernelName;
+
+   public static ThreadLocalStack<Map<ManagedEntityManagerFactory, EntityManager>> nonTxStack = new ThreadLocalStack<Map<ManagedEntityManagerFactory, EntityManager>>();
+
+   public EntityManager getNonTxEntityManager()
+   {
+      Map<ManagedEntityManagerFactory, EntityManager> map = nonTxStack.get();
+      
+      EntityManager em = null;
+      if (map != null)
+         em = map.get(this);
+      else
+      {
+         map = new HashMap<ManagedEntityManagerFactory, EntityManager>();
+         nonTxStack.push(map);
+      }
+      
+      if (em == null)
+      {
+         em = entityManagerFactory.createEntityManager();
+         map.put(this, em);
+      }
+      return em;
+   }
+
+   public ManagedEntityManagerFactory(EntityManagerFactory sf, String kernelName)
+   {
+      this.entityManagerFactory = sf;
+      this.kernelName = kernelName;
+   }
+
+   public EntityManagerFactory getEntityManagerFactory()
+   {
+      return entityManagerFactory;
+   }
+
+   public String getKernelName()
+   {
+      return kernelName;
+   }
+
+   public void destroy()
+   {
+      entityManagerFactory.close();
+   }
+
+   private static class SessionSynchronization implements Synchronization
+   {
+      private EntityManager manager;
+//      private Transaction tx;
+      private boolean closeAtTxCompletion;
+
+      public SessionSynchronization(EntityManager session, Transaction tx, boolean close)
+      {
+         this.manager = session;
+//         this.tx = tx;
+         closeAtTxCompletion = close;
+      }
+
+      public void beforeCompletion()
+      {
+         /*  IF THIS GETS REACTIVATED THEN YOU MUST remove the if(closeAtTxCompletion) block in getSession()
+         try
+         {
+            int status = tx.getStatus();
+            if (status != Status.STATUS_ROLLEDBACK && status != Status.STATUS_ROLLING_BACK && status != Status.STATUS_MARKED_ROLLBACK)
+            {
+               if (FlushModeInterceptor.getTxFlushMode() != FlushModeType.NEVER)
+               {
+                  log.debug("************** flushing.....");
+                  manager.flush();
+               }
+            }
+         }
+         catch (SystemException e)
+         {
+            throw new RuntimeException(e);
+         }
+         */
+      }
+
+      public void afterCompletion(int status)
+      {
+         if (closeAtTxCompletion)
+         {
+            log.debug("************** closing entity managersession **************");
+            manager.close();
+         }
+      }
+   }
+
+   public TransactionLocal getTransactionSession()
+   {
+      return session;
+   }
+
+   public void registerExtendedWithTransaction(EntityManager pc)
+   {
+      pc.joinTransaction();
+      session.set(pc);
+   }
+
+   public void verifyInTx()
+   {
+      Transaction tx = session.getTransaction();
+      if (tx == null || !TxUtils.isActive(tx)) throw new TransactionRequiredException("EntityManager must be access within a transaction");
+      if (!TxUtils.isActive(tx))
+         throw new TransactionRequiredException("Transaction must be active to access EntityManager");
+   }
+   public boolean isInTx()
+   {
+      Transaction tx = session.getTransaction();
+      if (tx == null || !TxUtils.isActive(tx)) return false;
+      return true;
+   }
+
+   public EntityManager getTransactionScopedEntityManager()
+   {
+      Transaction tx = session.getTransaction();
+      if (tx == null || !TxUtils.isActive(tx)) return getNonTxEntityManager();
+
+      EntityManager rtnSession = (EntityManager) session.get();
+      if (rtnSession == null)
+      {
+         rtnSession = createEntityManager();
+         try
+         {
+            tx.registerSynchronization(new SessionSynchronization(rtnSession, tx, true));
+         }
+         catch (RollbackException e)
+         {
+            throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
+         }
+         catch (SystemException e)
+         {
+            throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
+         }
+         session.set(rtnSession);
+         rtnSession.joinTransaction(); // force registration with TX
+      }
+      return rtnSession;
+   }
+
+   public EntityManager createEntityManager()
+   {
+      return entityManagerFactory.createEntityManager();
+   }
+
+
+}

Copied: projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceDeployment.java (from rev 75203, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3Deployment.java)
===================================================================
--- projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceDeployment.java	                        (rev 0)
+++ projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceDeployment.java	2008-07-01 09:31:56 UTC (rev 75254)
@@ -0,0 +1,286 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.jpa.deployment;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.naming.InitialContext;
+
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractConstructorMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.jpa.spi.PersistenceUnitRegistry;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.jpa.spec.PersistenceMetaData;
+import org.jboss.metadata.jpa.spec.PersistenceUnitMetaData;
+
+/**
+ * An EjbModule represents a collection of beans that are deployed as a unit.
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author adrian at jboss.org
+ * @version $Revision$
+ */
+public class PersistenceDeployment //extends ServiceMBeanSupport
+//  implements JavaEEModule, Ejb3DeploymentMBean
+{
+   private static final Logger log = Logger.getLogger(PersistenceDeployment.class);
+
+//   public static final String ACTUAL_ENTITY_MANAGER_FACTORY_CONTEXT = "java:/ActualEntityManagerFactories";
+//
+//   public static final String MANAGED_ENTITY_FACTORY_CONTEXT = "java:/managedEntityFactories";
+
+   private PersistenceMetaData metaData;
+   
+   protected VFSDeploymentUnit unit;
+
+//   protected LinkedHashMap<ObjectName, Container> ejbContainers = new LinkedHashMap<ObjectName, Container>();
+
+   protected boolean hasEntities;
+
+   protected List<String> explicitEntityClasses = new ArrayList<String>();
+
+   protected List<PersistenceUnitDeployment> persistenceUnitDeployments = new ArrayList<PersistenceUnitDeployment>();
+
+   protected InitialContext initialContext;
+
+   private String earName;
+
+   public PersistenceDeployment(VFSDeploymentUnit unit, String earName, PersistenceMetaData metaData)
+   {
+      assert unit != null : "unit is null";
+      assert metaData != null : "metaData is null";
+      
+      this.unit = unit;
+      this.earName = earName;
+      this.metaData = metaData;
+   }
+
+//   public JavaEEApplication getApplication()
+//   {
+//      return deploymentScope;
+//   }
+
+   public VFSDeploymentUnit getDeploymentUnit()
+   {
+      return unit;
+   }
+
+   /**
+    * Returns a partial MBean attribute name of the form
+    * ",ear=foo.ear,jar=foo.jar"
+    *
+    * @return
+    */
+   public String getScopeKernelName()
+   {
+      String scopedKernelName = "";
+      if (earName != null)
+         scopedKernelName += ",ear=" + earName;
+      scopedKernelName += ",jar=" + unit.getSimpleName();
+      return scopedKernelName;
+   }
+
+   protected String getJaccContextId()
+   {
+      return unit.getSimpleName();
+   }
+
+   public List<PersistenceUnitDeployment> getPersistenceUnitDeployments()
+   {
+      return persistenceUnitDeployments;
+   }
+
+//   protected abstract PolicyConfiguration createPolicyConfiguration() throws Exception;
+//
+//   protected abstract void putJaccInService(PolicyConfiguration pc, DeploymentUnit unit);
+
+   /**
+    * Return the container injection handler collection. If not specified(null)
+    * a default handler collection will be created.
+    * @return the injection handler collection to use, null if the container
+    *    should use a default setup.
+    */
+//   protected Collection<InjectionHandler<Environment>> getHandlers()
+//   {
+//      return null;
+//   }
+
+   /**
+    * Create all EJB containers and Persistence Units
+    * The only things that should be initialized is metadata that does not need access to any
+    * other deployment.  This is because we want the entire EAR to be initialized so that we do not
+    * have to guess on dependencies MBean names.  This is because of the silly scoping rules for persistence units
+    * and EJBs.
+    *
+    * @throws Exception
+    */
+   public void create() throws Exception
+   {
+      long start = System.currentTimeMillis();
+
+      //pc = createPolicyConfiguration();
+
+      initializePersistenceUnits();
+      
+      log.debug("Persistence deployment time took: " + (System.currentTimeMillis() - start));
+   }
+   
+   public void destroy()
+   {
+      persistenceUnitDeployments.clear();
+   }
+   
+   public void start() throws Exception
+   {
+      try
+      {
+         startPersistenceUnits();
+      }
+      catch (Exception ex)
+      {
+         try
+         {
+            stop();
+         }
+         catch (Exception ignored)
+         {
+         }
+         throw ex;
+      }
+   }
+   
+   public void stop() //throws Exception
+   {
+      stopPersistenceUnits();
+   }
+
+   protected void initializePersistenceUnits() throws Exception
+   {
+      // TODO: What is the meaning of this piece of code?
+//      if (unit.getClasses() != null)
+//      {
+//         for (Class<?> explicit : unit.getClasses())
+//         {
+//            if (explicit.isAnnotationPresent(Entity.class))
+//            {
+//               explicitEntityClasses.add(explicit.getName());
+//            }
+//         }
+//      }
+
+      List<PersistenceUnitMetaData> pumds = metaData.getPersistenceUnits();
+      for (PersistenceUnitMetaData metaData : pumds)
+      {
+         // FIXME: determine scoping
+//         boolean isScoped = ejbContainers.size() > 0;
+         boolean isScoped = false;
+
+         Map<String, String> properties = metaData.getProperties();
+         if (properties == null)
+         {
+            properties = new HashMap<String, String>();
+            metaData.setProperties(properties);
+         }
+         // FIXME: reinstate
+//         // Ensure 2nd level cache entries are segregated from other deployments
+//         String cache_prefix = properties.get(SecondLevelCacheUtil.HIBERNATE_CACHE_REGION_PREFIX);
+//         if (cache_prefix == null)
+//         {
+//            // Create a region_prefix for the 2nd level cache to ensure
+//            // deployments are segregated
+//            String jarName = isScoped ? unit.getShortName() : null;
+//            cache_prefix = SecondLevelCacheUtil.createCacheRegionPrefix(earShortName, jarName, metaData.getName());
+//            properties.put(SecondLevelCacheUtil.HIBERNATE_CACHE_REGION_PREFIX, cache_prefix);
+//         }
+         PersistenceUnitDeployment deployment = new PersistenceUnitDeployment(initialContext, this, explicitEntityClasses, metaData, earName, unit.getSimpleName(), isScoped);
+         PersistenceUnitRegistry.register(deployment);
+         persistenceUnitDeployments.add(deployment);
+      }
+   }
+
+//   public abstract DependencyPolicy createDependencyPolicy(JavaEEComponent component);
+
+   protected void startPersistenceUnits()
+   {
+      if (persistenceUnitDeployments == null)
+         return;
+
+      for (PersistenceUnitDeployment entityDeployment : persistenceUnitDeployments)
+      {
+         if (entityDeployment != null)
+         {
+//            DependencyPolicy policy = createDependencyPolicy(entityDeployment);
+//            entityDeployment.addDependencies(policy);
+            AbstractBeanMetaData bmd = new AbstractBeanMetaData("ToDo");
+            AbstractConstructorMetaData constructor = new AbstractConstructorMetaData();
+            constructor.setValueObject(entityDeployment);
+            bmd.setConstructor(constructor);
+            unit.addAttachment(BeanMetaData.class, bmd);
+//            kernelAbstraction.install(entityDeployment.getKernelName(), policy, unit, entityDeployment);
+         }
+      }
+   }
+
+   protected void stopPersistenceUnits()
+   {
+      if (persistenceUnitDeployments == null)
+         return;
+
+//      for (PersistenceUnitDeployment entityDeployment : persistenceUnitDeployments)
+//      {
+//         try
+//         {
+//            PersistenceUnitRegistry.unregister(entityDeployment);
+//            if (entityDeployment != null)
+//            {
+//               kernelAbstraction.uninstall(entityDeployment.getKernelName());
+//            }
+//         }
+//         catch (Exception e)
+//         {
+//            log.debug("error trying to shut down persistence unit", e);
+//         }
+//      }
+//      
+//      persistenceUnitDeployments = new ArrayList<PersistenceUnitDeployment>();
+   }
+
+   /**
+    * Get the meta data associated with this deployment or null if none.
+    * 
+    * @return   meta data or null
+    */
+   public PersistenceMetaData getMetaData()
+   {
+      return metaData;
+   }
+
+   public String getName()
+   {
+      return unit.getSimpleName();
+   }
+}

Copied: projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceUnitDeployment.java (from rev 75203, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/PersistenceUnitDeployment.java)
===================================================================
--- projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceUnitDeployment.java	                        (rev 0)
+++ projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceUnitDeployment.java	2008-07-01 09:31:56 UTC (rev 75254)
@@ -0,0 +1,361 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.jpa.deployment;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.naming.InitialContext;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.spi.PersistenceProvider;
+import javax.persistence.spi.PersistenceUnitTransactionType;
+
+import org.hibernate.ejb.HibernatePersistence;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.jpa.spi.PersistenceUnit;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.jpa.spec.PersistenceUnitMetaData;
+import org.jboss.metadata.jpa.spec.TransactionType;
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class PersistenceUnitDeployment //extends AbstractJavaEEComponent
+   implements PersistenceUnit
+{
+   private static final Logger log = Logger.getLogger(PersistenceUnitDeployment.class);
+
+   protected InitialContext initialContext;
+   protected VFSDeploymentUnit di;
+   protected List<String> explicitEntityClasses = new ArrayList<String>();
+   protected ManagedEntityManagerFactory managedFactory;
+   protected EntityManagerFactory actualFactory;
+   protected PersistenceUnitMetaData metaData;
+   protected String kernelName;
+   protected PersistenceDeployment deployment;
+   protected boolean scoped;
+
+   public PersistenceUnitDeployment(InitialContext initialContext, PersistenceDeployment deployment, List<String> explicitEntityClasses, PersistenceUnitMetaData metadata, String ear, String jar, boolean isScoped)
+   {
+      //super(new SimpleJavaEEModule((deployment.getEar() != null ? deployment.getEar().getShortName() : null), deployment.getDeploymentUnit().getShortName()));
+      
+      this.scoped = isScoped;
+      this.deployment = deployment;
+      this.initialContext = initialContext;
+      this.di = deployment.getDeploymentUnit();
+      this.explicitEntityClasses = explicitEntityClasses;
+      this.metaData = metadata;
+      kernelName = "persistence.units:";
+      String name = getEntityManagerName();
+      if (name == null || name.length() == 0)
+         throw new RuntimeException("Null string is not allowed for a persistence unit name.  Fix your persistence.xml file");
+      
+      if (ear != null)
+      {
+         kernelName += "ear=" + ear;
+         if (!ear.endsWith(".ear")) kernelName += ".ear";
+         kernelName += ",";
+      }
+      if (isScoped)
+      {
+         kernelName += "jar=" + jar;
+         if (!jar.endsWith(".jar")) kernelName += ".jar";
+         kernelName += ",";
+      }
+      kernelName += "unitName=" + name;
+   }
+
+   public static String getDefaultKernelName(String unitName)
+   {
+      int hashIndex = unitName.indexOf('#');
+      if (hashIndex != -1)
+      {
+         String relativePath = unitName.substring(3, hashIndex);
+         String name = unitName.substring(hashIndex + 1);
+         return "persistence.units:jar=" + relativePath + "," + "unitName=" + name;
+      }
+      return "persistence.units:unitName=" + unitName;
+   }
+
+   public boolean isScoped()
+   {
+      return scoped;
+   }
+
+   public PersistenceDeployment getDeployment()
+   {
+      return deployment;
+   }
+
+   protected String getJaccContextId()
+   {
+      return di.getSimpleName();
+   }
+
+   public EntityManagerFactory getActualFactory()
+   {
+      return actualFactory;
+   }
+
+   public PersistenceUnitMetaData getXml()
+   {
+      return metaData;
+   }
+
+   public String getKernelName()
+   {
+      return kernelName;
+   }
+
+   public String getName()
+   {
+      return getKernelName();
+   }
+
+   public EntityManagerFactory getContainerEntityManagerFactory()
+   {
+      return getManagedFactory().getEntityManagerFactory();
+   }
+   
+   public String getEntityManagerName()
+   {
+      return metaData.getName();
+   }
+
+   public ManagedEntityManagerFactory getManagedFactory()
+   {
+      if(managedFactory == null)
+         log.warn("managed factory is null, persistence unit " + kernelName + " has not yet been started");
+      return managedFactory;
+   }
+
+   protected Map<String, String> getProperties()
+   {
+      Map<String, String> properties = metaData.getProperties();
+      return (properties != null) ? properties : Collections.<String, String>emptyMap();
+   }
+
+   private URL getRelativeURL(String jar)
+   {
+      try
+      {
+         return new URL(jar);
+      }
+      catch (MalformedURLException e)
+      {
+         try
+         {
+            URL url = getDeployment().getDeploymentUnit().getFile("").toURL();
+            return new URL(url, jar);
+         }
+         catch (Exception e1)
+         {
+            throw new RuntimeException("could not find relative path: " + jar, e1);
+         }
+      }
+   }
+   
+//   public void addDependencies(DependencyPolicy policy)
+//   {
+//      Map<String, String> props = getProperties();
+//      if (!props.containsKey("jboss.no.implicit.datasource.dependency"))
+//      {
+//         if (metaData.getJtaDataSource() != null)
+//         {
+//            String ds = metaData.getJtaDataSource();
+//            policy.addDatasource(ds);
+//         }
+//         if (metaData.getNonJtaDataSource() != null)
+//         {
+//            String ds = metaData.getNonJtaDataSource();
+//            policy.addDatasource(ds);
+//         }
+//      }
+//      for (Object prop : props.keySet())
+//      {
+//         String property = (String)prop;
+//         if (property.startsWith("jboss.depends"))
+//         {
+//            policy.addDependency(props.get(property));
+//         }
+//      }
+//
+//   }
+
+   protected PersistenceUnitTransactionType getJPATransactionType()
+   {
+      TransactionType type = metaData.getTransactionType();
+      if (type == TransactionType.RESOURCE_LOCAL)
+         return PersistenceUnitTransactionType.RESOURCE_LOCAL;
+      else // default or actually being JTA
+         return PersistenceUnitTransactionType.JTA;
+   }
+
+   private List<String> safeList(Set<String> set)
+   {
+      return (set == null || set.isEmpty()) ? Collections.<String>emptyList() : new ArrayList<String>(set);
+   }
+
+   public void start() throws Exception
+   {
+      log.info("Starting persistence unit " + kernelName);
+      
+      Properties props = new Properties();
+      // FIXME: reinstate
+//      props.putAll(di.getDefaultPersistenceProperties());
+      props.put(HibernatePersistence.JACC_CONTEXT_ID, getJaccContextId());
+
+      PersistenceUnitInfoImpl pi = new PersistenceUnitInfoImpl();
+      log.debug("Using class loader " + di.getClassLoader());
+      pi.setClassLoader(di.getClassLoader());
+
+      ArrayList<URL> jarFiles = new ArrayList<URL>();
+      pi.setJarFiles(jarFiles);
+      pi.setPersistenceProviderClassName(HibernatePersistence.class.getName());
+      log.debug("Found persistence.xml file in EJB3 jar");
+      props.putAll(getProperties());
+      pi.setManagedClassnames(safeList(metaData.getClasses()));
+      pi.setPersistenceUnitName(metaData.getName());
+      pi.setMappingFileNames(safeList(metaData.getMappingFiles()));
+      pi.setExcludeUnlistedClasses(metaData.isExcludeUnlistedClasses());
+      VirtualFile root = di.getRoot();
+      log.debug("Persistence root: " + root);
+      // TODO - update this with VFSUtils helper method
+      // hack the JPA url
+      URL url = root.toURL();
+      // is not nested, so direct VFS URL is not an option
+      if (VFSUtils.isNestedFile(root) == false)
+      {
+         String urlString = url.toExternalForm();
+         if (urlString.startsWith("vfs"))
+         {
+            // treat vfszip as file
+            if (urlString.startsWith("vfszip"))
+               url = new URL("file" + urlString.substring(6));
+            else
+               url = new URL(urlString.substring(3)); // (vfs)file and (vfs)jar are ok
+         }
+      }
+      pi.setPersistenceUnitRootUrl(url);
+      PersistenceUnitTransactionType transactionType = getJPATransactionType();
+      pi.setTransactionType(transactionType);
+
+      Set<String> files = metaData.getJarFiles();
+      if (files != null)
+      {
+         for (String jar : files)
+         {
+            jarFiles.add(getRelativeURL(jar));
+         }
+      }
+
+      if (metaData.getProvider() != null) pi.setPersistenceProviderClassName(metaData.getProvider());
+      if (explicitEntityClasses.size() > 0)
+      {
+         List<String> classes = pi.getManagedClassNames();
+         if (classes == null) classes = explicitEntityClasses;
+         else classes.addAll(explicitEntityClasses);
+         pi.setManagedClassnames(classes);
+      }
+      if (metaData.getJtaDataSource() != null)
+      {
+         pi.setJtaDataSource((javax.sql.DataSource) initialContext.lookup(metaData.getJtaDataSource()));
+      }
+      else if (transactionType == PersistenceUnitTransactionType.JTA)
+      {
+         throw new RuntimeException("Specification violation [EJB3 JPA 6.2.1.2] - "
+               + "You have not defined a jta-data-source for a JTA enabled persistence context named: " + metaData.getName());
+      }
+      if (metaData.getNonJtaDataSource() != null)
+      {
+         pi.setNonJtaDataSource((javax.sql.DataSource) initialContext.lookup(metaData.getNonJtaDataSource()));
+      }
+      else if (transactionType == PersistenceUnitTransactionType.RESOURCE_LOCAL)
+      {
+         throw new RuntimeException("Specification violation [EJB3 JPA 6.2.1.2] - "
+               + "You have not defined a non-jta-data-source for a RESOURCE_LOCAL enabled persistence context named: "
+               + metaData.getName());
+      }
+      pi.setProperties(props);
+
+      if (pi.getPersistenceUnitName() == null)
+      {
+         throw new RuntimeException("you must specify a name in persistence.xml");
+      }
+
+      Class<?> providerClass = Thread.currentThread().getContextClassLoader().loadClass(pi.getPersistenceProviderClassName());
+
+      // EJBTHREE-893
+      if(!pi.getProperties().containsKey("hibernate.session_factory_name"))
+      {
+         pi.getProperties().put("hibernate.session_factory_name", kernelName);
+      }
+      
+      PersistenceProvider pp = (PersistenceProvider) providerClass.newInstance();
+      actualFactory = pp.createContainerEntityManagerFactory(pi, null);
+
+      managedFactory = new ManagedEntityManagerFactory(actualFactory, kernelName);
+
+      // FIXME: Reinstate
+//      String entityManagerJndiName = (String) props.get("jboss.entity.manager.jndi.name");
+//      if (entityManagerJndiName != null)
+//      {
+//         EntityManager injectedManager = new TransactionScopedEntityManager(managedFactory);
+//         NonSerializableFactory.rebind(initialContext, entityManagerJndiName, injectedManager);
+//      }
+//      String entityManagerFactoryJndiName = (String) props.get("jboss.entity.manager.factory.jndi.name");
+//      if (entityManagerFactoryJndiName != null)
+//      {
+//         EntityManagerFactory injectedFactory = new InjectedEntityManagerFactory(managedFactory);
+//         NonSerializableFactory.rebind(initialContext, entityManagerFactoryJndiName, injectedFactory);
+//      }
+   }
+
+   public void stop() throws Exception
+   {
+      log.info("Stopping persistence unit " + kernelName);
+
+      // FIXME: reinstate
+//      String entityManagerJndiName = getProperties().get("jboss.entity.manager.jndi.name");
+//      if (entityManagerJndiName != null)
+//      {
+//         NonSerializableFactory.unbind(initialContext, entityManagerJndiName);
+//      }
+//      String entityManagerFactoryJndiName = getProperties().get("jboss.entity.manager.factory.jndi.name");
+//      if (entityManagerFactoryJndiName != null)
+//      {
+//         NonSerializableFactory.unbind(initialContext, entityManagerFactoryJndiName);
+//      }
+      managedFactory.destroy();
+   }
+}

Copied: projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceUnitInfoImpl.java (from rev 75203, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/entity/PersistenceUnitInfoImpl.java)
===================================================================
--- projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceUnitInfoImpl.java	                        (rev 0)
+++ projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceUnitInfoImpl.java	2008-07-01 09:31:56 UTC (rev 75254)
@@ -0,0 +1,188 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.jpa.deployment;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Properties;
+
+import javax.persistence.spi.ClassTransformer;
+import javax.persistence.spi.PersistenceUnitInfo;
+import javax.persistence.spi.PersistenceUnitTransactionType;
+import javax.sql.DataSource;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class PersistenceUnitInfoImpl implements PersistenceUnitInfo
+{
+   private String entityManagerName;
+   private DataSource jtaDataSource;
+   private DataSource nonJtaDataSource;
+   private List<String> mappingFileNames;
+   private List<URL> jarFiles;
+   private List<String> entityclassNames;
+   private Properties properties;
+   private ClassLoader classLoader;
+   private String persistenceProviderClassName;
+   private PersistenceUnitTransactionType transactionType;
+   private URL persistenceUnitRootUrl;
+   private boolean excludeClasses;
+
+   public PersistenceUnitInfoImpl()
+   {
+   }
+
+   public void addTransformer(ClassTransformer transformer)
+   {
+      //throw new RuntimeException("NOT IMPLEMENTED");
+   }
+
+   public ClassLoader getNewTempClassLoader()
+   {
+      return null;
+   }
+
+   public String getPersistenceProviderClassName()
+   {
+      return persistenceProviderClassName;
+   }
+
+   public void setPersistenceProviderClassName(String persistenceProviderClassName)
+   {
+      this.persistenceProviderClassName = persistenceProviderClassName;
+   }
+
+   public String getPersistenceUnitName()
+   {
+      return entityManagerName;
+   }
+
+   public void setPersistenceUnitName(String entityManagerName)
+   {
+      this.entityManagerName = entityManagerName;
+   }
+
+   public DataSource getJtaDataSource()
+   {
+      return jtaDataSource;
+   }
+
+   public void setJtaDataSource(DataSource jtaDataSource)
+   {
+      this.jtaDataSource = jtaDataSource;
+   }
+
+   public DataSource getNonJtaDataSource()
+   {
+      return nonJtaDataSource;
+   }
+
+   public void setNonJtaDataSource(DataSource nonJtaDataSource)
+   {
+      this.nonJtaDataSource = nonJtaDataSource;
+   }
+
+   public List<String> getMappingFileNames()
+   {
+      return mappingFileNames;
+   }
+
+   public void setMappingFileNames(List<String> mappingFileNames)
+   {
+      this.mappingFileNames = mappingFileNames;
+   }
+
+   public List<URL> getJarFileUrls()
+   {
+      return jarFiles;
+   }
+
+   public void setJarFiles(List<URL> jarFiles)
+   {
+      this.jarFiles = jarFiles;
+   }
+
+   public List<String> getManagedClassNames()
+   {
+      return entityclassNames;
+   }
+
+   public void setManagedClassnames(List<String> entityclassNames)
+   {
+      this.entityclassNames = entityclassNames;
+   }
+
+   public Properties getProperties()
+   {
+      return properties;
+   }
+
+   public void setProperties(Properties properties)
+   {
+      this.properties = properties;
+   }
+
+   public ClassLoader getClassLoader()
+   {
+      return classLoader;
+   }
+
+   public void setClassLoader(ClassLoader classLoader)
+   {
+      this.classLoader = classLoader;
+   }
+
+   public PersistenceUnitTransactionType getTransactionType()
+   {
+      return transactionType;
+   }
+
+   public void setTransactionType(PersistenceUnitTransactionType transactionType)
+   {
+      this.transactionType = transactionType;
+   }
+
+   public URL getPersistenceUnitRootUrl()
+   {
+      return persistenceUnitRootUrl;
+   }
+
+   public void setPersistenceUnitRootUrl(URL persistenceUnitRootUrl)
+   {
+      this.persistenceUnitRootUrl = persistenceUnitRootUrl;
+   }
+
+   public boolean excludeUnlistedClasses()
+   {
+      return excludeClasses;
+   }
+
+   public void setExcludeUnlistedClasses(boolean excludeClasses)
+   {
+      this.excludeClasses = excludeClasses;
+   }
+
+}

Added: projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/spi/PersistenceUnit.java
===================================================================
--- projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/spi/PersistenceUnit.java	                        (rev 0)
+++ projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/spi/PersistenceUnit.java	2008-07-01 09:31:56 UTC (rev 75254)
@@ -0,0 +1,43 @@
+/*
+ * 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.jpa.spi;
+
+import javax.persistence.EntityManagerFactory;
+
+/**
+ * EJB 3 JPA 7.1.1. To create entity managers within a container
+ * there is a bean installed which conforms to this interface.
+ * 
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface PersistenceUnit
+{
+   /**
+    * Obtain the container entity manager factory.
+    * 
+    * @return an EntityManagerFactory
+    */
+   EntityManagerFactory getContainerEntityManagerFactory();
+   
+   String getName();
+}

Copied: projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/spi/PersistenceUnitRegistry.java (from rev 75203, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/PersistenceUnitRegistry.java)
===================================================================
--- projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/spi/PersistenceUnitRegistry.java	                        (rev 0)
+++ projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/spi/PersistenceUnitRegistry.java	2008-07-01 09:31:56 UTC (rev 75254)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.jpa.spi;
+
+import java.util.Collection;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class PersistenceUnitRegistry
+{
+//   private static final Logger log = Logger.getLogger(PersistenceUnitRegistry.class);
+
+   private static ConcurrentHashMap<String, PersistenceUnit> persistenceUnits = new ConcurrentHashMap<String, PersistenceUnit>();
+
+   public static void register(PersistenceUnit container)
+   {
+      if (persistenceUnits.contains(container.getName())) throw new RuntimeException("Persistence Unit is already registered: " + container.getName());
+      persistenceUnits.put(container.getName(), container);
+   }
+
+   public static void unregister(PersistenceUnit container)
+   {
+      persistenceUnits.remove(container.getName());
+   }
+
+   public static PersistenceUnit getPersistenceUnit(String name)
+   {
+      return persistenceUnits.get(name);
+   }
+
+   public static Collection<PersistenceUnit> getPersistenceUnits()
+   {
+      return persistenceUnits.values();
+   }
+
+}

Copied: projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/util/ThreadLocalStack.java (from rev 75203, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/ThreadLocalStack.java)
===================================================================
--- projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/util/ThreadLocalStack.java	                        (rev 0)
+++ projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/util/ThreadLocalStack.java	2008-07-01 09:31:56 UTC (rev 75254)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.jpa.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision$
+ */
+public class ThreadLocalStack<T>
+{
+   private ThreadLocal<ArrayList<T>> stack = new ThreadLocal<ArrayList<T>>();
+
+   public void push(T obj)
+   {
+      ArrayList<T> list = stack.get();
+      if (list == null)
+      {
+         list = new ArrayList<T>(1);
+         stack.set(list);
+      }
+      list.add(obj);
+   }
+
+   public T pop()
+   {
+      ArrayList<T> list = stack.get();
+      if (list == null)
+      {
+         return null;
+      }
+      T rtn = list.remove(list.size() - 1);
+      if (list.size() == 0)
+      {
+         stack.set(null);
+         list.clear();
+      }
+      return rtn;
+   }
+
+   public T get()
+   {
+      ArrayList<T> list = (ArrayList<T>)stack.get();
+      if (list == null)
+      {
+         return null;
+      }
+      return list.get(list.size() - 1);
+   }
+
+   public List<T> getList()
+   {
+      return stack.get();     
+   }
+}

Added: projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/common/MainDeployerTestDelegate.java
===================================================================
--- projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/common/MainDeployerTestDelegate.java	                        (rev 0)
+++ projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/common/MainDeployerTestDelegate.java	2008-07-01 09:31:56 UTC (rev 75254)
@@ -0,0 +1,64 @@
+/*
+ * 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.jpa.deployers.test.common;
+
+import java.net.URL;
+
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.test.kernel.junit.MicrocontainerTestDelegate;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class MainDeployerTestDelegate extends MicrocontainerTestDelegate
+{
+   private MainDeployer mainDeployer;
+
+   public MainDeployerTestDelegate(Class<?> clazz) throws Exception
+   {
+      super(clazz);
+   }
+   
+   public KernelDeployment deploy(URL url) throws Exception
+   {
+      return super.deploy(url);
+   }
+   
+   public MainDeployer getMainDeployer()
+   {
+      return mainDeployer;
+   }
+   
+   public void setUp() throws Exception
+   {
+      super.setUp();
+      
+      URL url = MainDeployerTestDelegate.class.getResource("MainDeployer-beans.xml");
+      deploy(url);
+      validate();
+      
+      mainDeployer = getBean("MainDeployer", ControllerState.INSTALLED, MainDeployer.class);
+   }
+}

Added: projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/deployment/DeploymentTestCase.java
===================================================================
--- projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/deployment/DeploymentTestCase.java	                        (rev 0)
+++ projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/deployment/DeploymentTestCase.java	2008-07-01 09:31:56 UTC (rev 75254)
@@ -0,0 +1,58 @@
+/*
+ * 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.jpa.deployers.test.deployment;
+
+import java.net.URL;
+
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.jpa.deployers.test.common.MainDeployerTestDelegate;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class DeploymentTestCase
+{
+   private static MainDeployerTestDelegate delegate;
+   
+   @BeforeClass
+   public static void beforeClass() throws Exception
+   {
+      delegate = new MainDeployerTestDelegate(DeploymentTestCase.class);
+      delegate.setUp();
+   }
+   
+   @Test
+   public void test1() throws Exception
+   {
+      String spec = "/org/jboss/jpa/deployers/test/deployment/pu";
+      URL url = getClass().getResource(spec);
+      VirtualFile file = VFS.getRoot(url);
+      VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(file);
+      delegate.getMainDeployer().deploy(deployment);
+   }
+}

Added: projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/common/MainDeployer-beans.xml
===================================================================
--- projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/common/MainDeployer-beans.xml	                        (rev 0)
+++ projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/common/MainDeployer-beans.xml	2008-07-01 09:31:56 UTC (rev 75254)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <!-- The MainDeployer -->
+   <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
+      <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
+      <property name="deployers"><inject bean="Deployers"/></property>
+      <!--property name="mgtDeploymentCreator"><inject bean="ManagedDeploymentCreator"/></property-->
+   </bean>
+      
+   <!-- The holder for deployers that determine structure -->
+   <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
+      <property name="structureBuilder">
+         <!-- The consolidator of the structure information -->
+         <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder"/>
+      </property>
+      <!-- Accept any implementor of structure deployer -->
+      <incallback method="addDeployer"/>
+      <uncallback method="removeDeployer"/>
+   </bean>
+   
+   <!-- The holder for deployers that do real deployment -->
+   <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
+      <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
+      <!-- Accept any implementor of deployer -->
+      <incallback method="addDeployer"/>
+      <uncallback method="removeDeployer"/>
+   </bean>
+   
+   <!-- File Structure -->
+   <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure"/>
+   
+   <!-- File Structure -->
+   <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure"/>
+   
+   <!-- POJO Deployment -->
+   <bean name="BeanDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanDeployer"/>
+   <bean name="KernelDeploymentDeployer" class="org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer"/>
+   <bean name="BeanMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer">
+      <constructor><parameter><inject bean="jboss.kernel:service=Kernel"/></parameter></constructor>
+   </bean>
+</deployment>

Added: projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/deployment/DeploymentTestCase.xml
===================================================================
--- projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/deployment/DeploymentTestCase.xml	                        (rev 0)
+++ projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/deployment/DeploymentTestCase.xml	2008-07-01 09:31:56 UTC (rev 75254)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <bean name="PersistenceParsingDeployer" class="org.jboss.jpa.deployers.PersistenceParsingDeployer"/>
+
+   <bean name="PersistenceDeployer" class="org.jboss.jpa.deployers.PersistenceDeployer"/>
+</deployment>

Added: projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/deployment/pu/META-INF/persistence.xml
===================================================================
--- projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/deployment/pu/META-INF/persistence.xml	                        (rev 0)
+++ projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/deployment/pu/META-INF/persistence.xml	2008-07-01 09:31:56 UTC (rev 75254)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+   version="1.0">
+   <persistence-unit name="dummy">
+      <jta-data-source>java:/DefaultDS</jta-data-source>
+      <properties>
+          <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+      </properties>
+   </persistence-unit>
+</persistence>




More information about the jboss-cvs-commits mailing list