[jboss-cvs] JBossAS SVN: r67553 - in trunk/ejb3/src: main/org/jboss/ejb3/deployers and 7 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Nov 28 07:14:03 EST 2007
Author: wolfc
Date: 2007-11-28 07:14:03 -0500 (Wed, 28 Nov 2007)
New Revision: 67553
Added:
trunk/ejb3/src/main/org/jboss/ejb3/deployers/PersistenceUnitParsingDeployer.java
trunk/ejb3/src/main/org/jboss/ejb3/metadata/
trunk/ejb3/src/main/org/jboss/ejb3/metadata/jpa/
trunk/ejb3/src/main/org/jboss/ejb3/metadata/jpa/spec/
trunk/ejb3/src/main/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitMetaData.java
trunk/ejb3/src/main/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitsMetaData.java
Modified:
trunk/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java
trunk/ejb3/src/main/org/jboss/ejb3/Ejb3JmxDeployment.java
trunk/ejb3/src/main/org/jboss/ejb3/deployers/EJBRegistrationDeployer.java
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/embedded/EJB3StandaloneDeployment.java
trunk/ejb3/src/main/org/jboss/ejb3/entity/PersistenceUnitDeployment.java
trunk/ejb3/src/resources/META-INF/ejb3-deployers-beans.xml
trunk/ejb3/src/test/org/jboss/ejb3/test/cachepassivation/MockEjb3Deployment.java
Log:
EJBTHREE-1138: added PersistenceUnitsParsingDeployer
Modified: trunk/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java 2007-11-28 12:11:31 UTC (rev 67552)
+++ trunk/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java 2007-11-28 12:14:03 UTC (rev 67553)
@@ -24,7 +24,6 @@
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.InputStream;
-import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -40,11 +39,9 @@
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
import javax.persistence.Entity;
-import javax.persistence.spi.PersistenceUnitTransactionType;
import javax.security.jacc.PolicyConfiguration;
import javax.security.jacc.PolicyConfigurationFactory;
-import org.hibernate.cfg.EJB3DTDEntityResolver;
import org.hibernate.ejb.packaging.PersistenceMetadata;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.ejb3.cache.CacheFactoryRegistry;
@@ -53,11 +50,12 @@
import org.jboss.ejb3.enc.EjbModulePersistenceUnitResolver;
import org.jboss.ejb3.enc.MessageDestinationResolver;
import org.jboss.ejb3.entity.PersistenceUnitDeployment;
-import org.jboss.ejb3.entity.PersistenceXmlLoader;
import org.jboss.ejb3.entity.SecondLevelCacheUtil;
import org.jboss.ejb3.javaee.JavaEEApplication;
import org.jboss.ejb3.javaee.JavaEEComponent;
import org.jboss.ejb3.javaee.JavaEEModule;
+import org.jboss.ejb3.metadata.jpa.spec.PersistenceUnitMetaData;
+import org.jboss.ejb3.metadata.jpa.spec.PersistenceUnitsMetaData;
import org.jboss.ejb3.remoting.RemoteProxyFactoryRegistry;
import org.jboss.logging.Logger;
import org.jboss.metadata.ejb.jboss.JBossMetaData;
@@ -80,6 +78,8 @@
public static final String MANAGED_ENTITY_FACTORY_CONTEXT = "java:/managedEntityFactories";
private JBossMetaData metaData;
+
+ private PersistenceUnitsMetaData persistenceUnitsMetaData;
protected DeploymentUnit unit;
@@ -121,15 +121,17 @@
//The JACC PolicyConfiguration
PolicyConfiguration pc;
- public Ejb3Deployment(DeploymentUnit unit, DeploymentScope deploymentScope, JBossMetaData metaData,
+ public Ejb3Deployment(DeploymentUnit unit, DeploymentScope deploymentScope, JBossMetaData metaData, PersistenceUnitsMetaData persistenceUnitsMetaData,
Ejb3Deployer deployer)
{
assert unit != null : "unit is null";
+ assert deployer != null : "deployer is null";
this.unit = unit;
this.deployer = deployer;
this.deploymentScope = deploymentScope;
this.metaData = metaData;
+ this.persistenceUnitsMetaData = persistenceUnitsMetaData;
try
{
initialContext = InitialContextFactory.getInitialContext(unit.getJndiProperties());
@@ -537,17 +539,14 @@
protected void initializePersistenceUnits() throws Exception
{
- URL persistenceXmlUrl = null;
- persistenceXmlUrl = unit.getPersistenceXml();
+ hasEntities = persistenceUnitsMetaData != null;
- hasEntities = persistenceXmlUrl != null;
-
if (!hasEntities)
return;
if (unit.getClasses() != null)
{
- for (Class explicit : unit.getClasses())
+ for (Class<?> explicit : unit.getClasses())
{
if (explicit.isAnnotationPresent(Entity.class))
{
@@ -558,10 +557,10 @@
// scope the unitName if this is an ejb archive
// todo revert to this: List<PersistenceMetadata> persistenceMetadata = PersistenceXmlLoader.deploy(persistenceXmlUrl, new HashMap(), new EJB3DTDEntityResolver());
- List<PersistenceMetadata> persistenceMetadata = PersistenceXmlLoader.deploy(persistenceXmlUrl, new HashMap(),
- new EJB3DTDEntityResolver(), PersistenceUnitTransactionType.JTA);
- for (PersistenceMetadata metadata : persistenceMetadata)
+ for (PersistenceUnitMetaData persistenceUnitMetaData : persistenceUnitsMetaData)
{
+ PersistenceMetadata metadata = persistenceUnitMetaData.getLegacyMetadata();
+
String earShortName = deploymentScope == null ? null : deploymentScope.getShortName();
boolean isScoped = ejbContainers.size() > 0;
@@ -576,7 +575,7 @@
metadata.getProps().setProperty(SecondLevelCacheUtil.HIBERNATE_CACHE_REGION_PREFIX, cache_prefix);
}
PersistenceUnitDeployment deployment = new PersistenceUnitDeployment(initialContext, this,
- explicitEntityClasses, persistenceXmlUrl, metadata, earShortName, unit.getShortName(), isScoped);
+ explicitEntityClasses, metadata, earShortName, unit.getShortName(), isScoped);
PersistenceUnitRegistry.register(deployment);
persistenceUnitDeployments.add(deployment);
}
Modified: trunk/ejb3/src/main/org/jboss/ejb3/Ejb3JmxDeployment.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/Ejb3JmxDeployment.java 2007-11-28 12:11:31 UTC (rev 67552)
+++ trunk/ejb3/src/main/org/jboss/ejb3/Ejb3JmxDeployment.java 2007-11-28 12:14:03 UTC (rev 67553)
@@ -43,7 +43,7 @@
public Ejb3JmxDeployment(DeploymentInfo di, DeploymentScope deploymentScope)
{
- super(new JmxDeploymentUnit(di), deploymentScope, null, null);
+ super(new JmxDeploymentUnit(di), deploymentScope, null, null, null);
this.deploymentInfo = di;
kernelAbstraction = new JmxKernelAbstraction(di);
Modified: trunk/ejb3/src/main/org/jboss/ejb3/deployers/EJBRegistrationDeployer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/deployers/EJBRegistrationDeployer.java 2007-11-28 12:11:31 UTC (rev 67552)
+++ trunk/ejb3/src/main/org/jboss/ejb3/deployers/EJBRegistrationDeployer.java 2007-11-28 12:14:03 UTC (rev 67553)
@@ -191,7 +191,7 @@
}
JBoss5DeploymentUnit du = new JBoss5DeploymentUnit(unit);
du.setDefaultPersistenceProperties(defaultPersistenceProperties);
- Ejb3JBoss5Deployment deployment = new Ejb3JBoss5Deployment(du, kernel, mbeanServer, unit, scope, null, null);
+ Ejb3JBoss5Deployment deployment = new Ejb3JBoss5Deployment(du, kernel, mbeanServer, unit, scope, null, null, null);
if (scope != null) scope.register(deployment);
// create() creates initial EJB containers and initializes metadata.
deployment.create();
Modified: trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3Deployer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3Deployer.java 2007-11-28 12:11:31 UTC (rev 67552)
+++ trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3Deployer.java 2007-11-28 12:14:03 UTC (rev 67553)
@@ -33,6 +33,7 @@
import org.jboss.ejb3.DeploymentScope;
import org.jboss.ejb3.Ejb3Deployment;
import org.jboss.ejb3.cache.CacheFactoryRegistry;
+import org.jboss.ejb3.metadata.jpa.spec.PersistenceUnitsMetaData;
import org.jboss.ejb3.pool.PoolFactoryRegistry;
import org.jboss.ejb3.remoting.RemoteProxyFactoryRegistry;
import org.jboss.kernel.Kernel;
@@ -72,6 +73,8 @@
// TODO: when the annotation scanner deployer comes on, we will always have JBossMetaData
//super(JBossMetaData.class);
addInput(JBossMetaData.class);
+ // TODO: PersistenceUnits will have it's own component deployer
+ addInput(PersistenceUnitsMetaData.class);
// TODO: should we really output this
setOutput(Ejb3Deployment.class);
}
@@ -79,16 +82,18 @@
@Override
public void deploy(VFSDeploymentUnit unit) throws DeploymentException
{
- deploy(unit, unit.getAttachment(JBossMetaData.class));
+ deploy(unit, unit.getAttachment(JBossMetaData.class), unit.getAttachment(PersistenceUnitsMetaData.class));
}
- public void deploy(VFSDeploymentUnit unit, JBossMetaData metaData) throws DeploymentException
+ public void deploy(VFSDeploymentUnit unit, JBossMetaData metaData, PersistenceUnitsMetaData persistenceUnitsMetaData) throws DeploymentException
{
try
{
// Pickup any deployment which doesn't have metaData or metaData with ejbVersion unknown or 3
if(metaData != null && (metaData.isEJB2x() || metaData.isEJB1x()))
{
+ assert persistenceUnitsMetaData == null : "Found persistence units in legacy deployment";
+
log.debug("Ignoring legacy EJB deployment " + unit);
return;
}
@@ -107,7 +112,7 @@
// If DDs are required and none are present, skip deployment
// EJBTHREE-1040
- if (this.isDeploymentDescriptorRequired() && (metaData == null))
+ if (this.isDeploymentDescriptorRequired() && (metaData == null) && persistenceUnitsMetaData == null)
{
log.trace(this.getClass().getSimpleName() + " skipping deployment \"" + unit.getSimpleName()
+ "\", jar: \"" + jar.getName()
@@ -130,7 +135,7 @@
}
JBoss5DeploymentUnit du = new JBoss5DeploymentUnit(unit);
du.setDefaultPersistenceProperties(defaultPersistenceProperties);
- Ejb3JBoss5Deployment deployment = new Ejb3JBoss5Deployment(du, kernel, mbeanServer, unit, scope, metaData,
+ Ejb3JBoss5Deployment deployment = new Ejb3JBoss5Deployment(du, kernel, mbeanServer, unit, scope, metaData, persistenceUnitsMetaData,
this);
if (scope != null) scope.register(deployment);
// create() creates initial EJB containers and initializes metadata.
Modified: trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java 2007-11-28 12:11:31 UTC (rev 67552)
+++ trunk/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java 2007-11-28 12:14:03 UTC (rev 67553)
@@ -30,6 +30,7 @@
import org.jboss.ejb3.Ejb3Deployment;
import org.jboss.ejb3.MCKernelAbstraction;
import org.jboss.ejb3.javaee.JavaEEComponent;
+import org.jboss.ejb3.metadata.jpa.spec.PersistenceUnitsMetaData;
import org.jboss.ejb3.security.JaccHelper;
import org.jboss.kernel.Kernel;
import org.jboss.logging.Logger;
@@ -48,9 +49,9 @@
private org.jboss.deployers.structure.spi.DeploymentUnit jbossUnit;
- public Ejb3JBoss5Deployment(DeploymentUnit ejb3Unit, Kernel kernel, MBeanServer mbeanServer, org.jboss.deployers.structure.spi.DeploymentUnit jbossUnit, DeploymentScope deploymentScope, JBossMetaData metaData, Ejb3Deployer deployer)
+ public Ejb3JBoss5Deployment(DeploymentUnit ejb3Unit, Kernel kernel, MBeanServer mbeanServer, org.jboss.deployers.structure.spi.DeploymentUnit jbossUnit, DeploymentScope deploymentScope, JBossMetaData metaData, PersistenceUnitsMetaData persistenceUnitsMetaData, Ejb3Deployer deployer)
{
- super(ejb3Unit, deploymentScope, metaData, deployer);
+ super(ejb3Unit, deploymentScope, metaData, persistenceUnitsMetaData, deployer);
this.jbossUnit = jbossUnit;
kernelAbstraction = new MCKernelAbstraction(kernel, mbeanServer);
Added: trunk/ejb3/src/main/org/jboss/ejb3/deployers/PersistenceUnitParsingDeployer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/deployers/PersistenceUnitParsingDeployer.java (rev 0)
+++ trunk/ejb3/src/main/org/jboss/ejb3/deployers/PersistenceUnitParsingDeployer.java 2007-11-28 12:14:03 UTC (rev 67553)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ejb3.deployers;
+
+import java.net.URL;
+import java.util.HashMap;
+
+import javax.persistence.spi.PersistenceUnitTransactionType;
+
+import org.hibernate.cfg.EJB3DTDEntityResolver;
+import org.hibernate.ejb.packaging.PersistenceXmlLoader;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.ejb3.metadata.jpa.spec.PersistenceUnitsMetaData;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Find and parse persistence.xml.
+ *
+ * In a jar:
+ * META-INF/persistence.xml
+ *
+ * In a war (JPA 6.2):
+ * WEB-INF/classes/META-INF/persistence.xml
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class PersistenceUnitParsingDeployer extends AbstractVFSParsingDeployer<PersistenceUnitsMetaData>
+{
+ private static final Logger log = Logger.getLogger(PersistenceUnitParsingDeployer.class);
+
+ public PersistenceUnitParsingDeployer()
+ {
+ super(PersistenceUnitsMetaData.class);
+ setName("persistence.xml");
+ }
+
+ @Override
+ protected PersistenceUnitsMetaData parse(DeploymentUnit unit, String name, PersistenceUnitsMetaData root) throws Exception
+ {
+ // Try to find the metadata
+ VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit) unit;
+
+ VirtualFile file = vfsDeploymentUnit.getMetaDataFile(name);
+ if (file == null)
+ {
+ // FIXME: hack to get a war persistence unit
+ try
+ {
+ file = vfsDeploymentUnit.getFile("WEB-INF/classes/META-INF/persistence.xml");
+ if(file == null)
+ return null;
+ }
+ catch(IllegalStateException e)
+ {
+ return null;
+ }
+ // -- //
+ }
+
+ PersistenceUnitsMetaData result = parse(vfsDeploymentUnit, file, root);
+ if (result != null)
+ init(vfsDeploymentUnit, result, file);
+ return result;
+ }
+
+ @Override
+ protected PersistenceUnitsMetaData parse(VFSDeploymentUnit unit, VirtualFile file, PersistenceUnitsMetaData root)
+ throws Exception
+ {
+ URL persistenceXmlUrl = file.toURL();
+ PersistenceUnitsMetaData metaData = new PersistenceUnitsMetaData(PersistenceXmlLoader.deploy(persistenceXmlUrl, new HashMap<String, String>(),
+ new EJB3DTDEntityResolver(), PersistenceUnitTransactionType.JTA));
+ log.info("Found persistence units " + metaData);
+ // FIXME: if in EAR then unscoped else scoped
+ return metaData;
+ }
+}
Property changes on: trunk/ejb3/src/main/org/jboss/ejb3/deployers/PersistenceUnitParsingDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/ejb3/src/main/org/jboss/ejb3/embedded/EJB3StandaloneDeployment.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/embedded/EJB3StandaloneDeployment.java 2007-11-28 12:11:31 UTC (rev 67552)
+++ trunk/ejb3/src/main/org/jboss/ejb3/embedded/EJB3StandaloneDeployment.java 2007-11-28 12:14:03 UTC (rev 67553)
@@ -45,7 +45,7 @@
{
public EJB3StandaloneDeployment(DeploymentUnit di, Kernel kernel, MBeanServer mbeanServer)
{
- super(di, null, null, null);
+ super(di, null, null, null, null);
defaultSFSBDomain = "Embedded Stateful Bean";
kernelAbstraction = new MCKernelAbstraction(kernel, mbeanServer);
Modified: trunk/ejb3/src/main/org/jboss/ejb3/entity/PersistenceUnitDeployment.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/entity/PersistenceUnitDeployment.java 2007-11-28 12:11:31 UTC (rev 67552)
+++ trunk/ejb3/src/main/org/jboss/ejb3/entity/PersistenceUnitDeployment.java 2007-11-28 12:14:03 UTC (rev 67553)
@@ -25,11 +25,13 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+
import javax.naming.InitialContext;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.spi.PersistenceProvider;
import javax.persistence.spi.PersistenceUnitTransactionType;
+
import org.hibernate.ejb.HibernatePersistence;
import org.hibernate.ejb.packaging.PersistenceMetadata;
import org.jboss.ejb3.DependencyPolicy;
@@ -37,7 +39,6 @@
import org.jboss.ejb3.Ejb3Deployment;
import org.jboss.ejb3.NonSerializableFactory;
import org.jboss.ejb3.javaee.AbstractJavaEEComponent;
-import org.jboss.ejb3.javaee.JavaEEComponent;
import org.jboss.ejb3.javaee.SimpleJavaEEModule;
import org.jboss.logging.Logger;
@@ -56,13 +57,12 @@
protected List<String> explicitEntityClasses = new ArrayList<String>();
protected ManagedEntityManagerFactory managedFactory;
protected EntityManagerFactory actualFactory;
- protected URL persistenceXmlUrl;
protected PersistenceMetadata xml;
protected String kernelName;
protected Ejb3Deployment deployment;
protected boolean scoped;
- public PersistenceUnitDeployment(InitialContext initialContext, Ejb3Deployment deployment, List<String> explicitEntityClasses, URL persistenceXmlUrl, PersistenceMetadata metadata, String ear, String jar, boolean isScoped)
+ public PersistenceUnitDeployment(InitialContext initialContext, Ejb3Deployment deployment, List<String> explicitEntityClasses, PersistenceMetadata metadata, String ear, String jar, boolean isScoped)
{
super(new SimpleJavaEEModule((deployment.getEar() != null ? deployment.getEar().getShortName() : null), deployment.getDeploymentUnit().getShortName()));
@@ -71,7 +71,6 @@
this.initialContext = initialContext;
this.di = deployment.getDeploymentUnit();
this.explicitEntityClasses = explicitEntityClasses;
- this.persistenceXmlUrl = persistenceXmlUrl;
xml = metadata;
kernelName = "persistence.units:";
String name = getEntityManagerName();
Added: trunk/ejb3/src/main/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitMetaData.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitMetaData.java (rev 0)
+++ trunk/ejb3/src/main/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitMetaData.java 2007-11-28 12:14:03 UTC (rev 67553)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ejb3.metadata.jpa.spec;
+
+import org.hibernate.ejb.packaging.PersistenceMetadata;
+import org.jboss.metadata.javaee.support.MappableMetaData;
+
+/**
+ * A wrapper around Hibernate's PersistenceMetadata.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class PersistenceUnitMetaData implements MappableMetaData
+{
+ private static final long serialVersionUID = 1L;
+
+ private PersistenceMetadata delegate;
+
+ public PersistenceUnitMetaData(PersistenceMetadata old)
+ {
+ assert old != null : "old is null";
+
+ this.delegate = old;
+ }
+
+ public String getKey()
+ {
+ return delegate.getName();
+ }
+
+ /**
+ * Return the legacy metadata. Do not use, it will be removed soon.
+ *
+ * @return
+ */
+ @Deprecated
+ public PersistenceMetadata getLegacyMetadata()
+ {
+ return delegate;
+ }
+}
Property changes on: trunk/ejb3/src/main/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: trunk/ejb3/src/main/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitsMetaData.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitsMetaData.java (rev 0)
+++ trunk/ejb3/src/main/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitsMetaData.java 2007-11-28 12:14:03 UTC (rev 67553)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ejb3.metadata.jpa.spec;
+
+import java.util.List;
+
+import org.hibernate.ejb.packaging.PersistenceMetadata;
+import org.jboss.metadata.javaee.support.AbstractMappedMetaData;
+
+/**
+ * The persistence xml meta data.
+ *
+ * Currently a wrapper around the Hibernate metadata.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class PersistenceUnitsMetaData extends AbstractMappedMetaData<PersistenceUnitMetaData>
+{
+ private static final long serialVersionUID = 1L;
+
+ protected PersistenceUnitsMetaData()
+ {
+ super("persistence unit meta data");
+ }
+
+ public PersistenceUnitsMetaData(List<PersistenceMetadata> list)
+ {
+ this();
+
+ for(PersistenceMetadata old : list)
+ {
+ add(new PersistenceUnitMetaData(old));
+ }
+ }
+}
Property changes on: trunk/ejb3/src/main/org/jboss/ejb3/metadata/jpa/spec/PersistenceUnitsMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/ejb3/src/resources/META-INF/ejb3-deployers-beans.xml
===================================================================
--- trunk/ejb3/src/resources/META-INF/ejb3-deployers-beans.xml 2007-11-28 12:11:31 UTC (rev 67552)
+++ trunk/ejb3/src/resources/META-INF/ejb3-deployers-beans.xml 2007-11-28 12:14:03 UTC (rev 67553)
@@ -233,5 +233,11 @@
</property>
</bean>
- <bean name="JNDIKernelRegistryPlugin" class="org.jboss.ejb3.kernel.JNDIKernelRegistryPlugin"/>
+ <bean name="JNDIKernelRegistryPlugin" class="org.jboss.ejb3.kernel.JNDIKernelRegistryPlugin"/>
+
+ <!-- Persistence Unit deployers -->
+ <bean name="PersistenceUnitParsingDeployer" class="org.jboss.ejb3.deployers.PersistenceUnitParsingDeployer">
+ <property name="type">car</property>
+ </bean>
+
</deployment>
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/cachepassivation/MockEjb3Deployment.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/cachepassivation/MockEjb3Deployment.java 2007-11-28 12:11:31 UTC (rev 67552)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/cachepassivation/MockEjb3Deployment.java 2007-11-28 12:14:03 UTC (rev 67553)
@@ -54,7 +54,7 @@
public MockEjb3Deployment(DeploymentUnit unit, DeploymentScope deploymentScope)
{
- super(unit, deploymentScope, null, null);
+ super(unit, deploymentScope, null, null, null);
PoolFactoryRegistry poolRegistry = new PoolFactoryRegistry();
HashMap<String, Class<? extends PoolFactory>> poolFactories = new HashMap<String, Class<? extends PoolFactory>>();
poolFactories.put("ThreadlocalPool", ThreadlocalPoolFactory.class);
More information about the jboss-cvs-commits
mailing list