[jboss-dev-forums] [Design of EJB 3.0] - Re: trunk Ejb3Deployment is incompatible with jbossas trunk

alesj do-not-reply at jboss.com
Wed Jun 4 09:47:07 EDT 2008


This is the 'svn diff' that I have locally:

  | Index: ejb3/src/main/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java
  | ===================================================================
  | --- ejb3/src/main/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java	(revision 74099)
  | +++ ejb3/src/main/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java	(working copy)
  | @@ -22,27 +22,29 @@
  |  package org.jboss.ejb3.deployers;
  |  
  |  import java.util.Map;
  | -
  |  import javax.management.MBeanServer;
  |  import javax.management.ObjectName;
  | -import javax.management.MalformedObjectNameException;
  |  import javax.security.jacc.PolicyConfiguration;
  |  
  |  import org.jboss.beans.metadata.plugins.AbstractSupplyMetaData;
  |  import org.jboss.deployment.MappedReferenceMetaDataResolverDeployer;
  |  import org.jboss.deployment.dependency.ContainerDependencyMetaData;
  | -import org.jboss.ejb3.*;
  | +import org.jboss.ejb3.Container;
  | +import org.jboss.ejb3.DependencyPolicy;
  | +import org.jboss.ejb3.DeploymentScope;
  | +import org.jboss.ejb3.DeploymentUnit;
  | +import org.jboss.ejb3.EJBContainer;
  | +import org.jboss.ejb3.Ejb3Deployment;
  | +import org.jboss.ejb3.MCDependencyPolicy;
  |  import org.jboss.ejb3.javaee.JavaEEComponent;
  | -import org.jboss.ejb3.javaee.JavaEEModule;
  | -import org.jboss.ejb3.javaee.JavaEEApplication;
  |  import org.jboss.ejb3.kernel.JNDIKernelRegistryPlugin;
  | -import org.jboss.ejb3.metadata.jpa.spec.PersistenceUnitsMetaData;
  |  import org.jboss.kernel.Kernel;
  |  import org.jboss.logging.Logger;
  |  import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
  |  import org.jboss.metadata.ejb.jboss.JBossMetaData;
  |  import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
  |  import org.jboss.metadata.ejb.jboss.jndipolicy.spi.EjbDeploymentSummary;
  | +import org.jboss.metadata.jpa.spec.PersistenceMetaData;
  |  
  |  /**
  |   * JBoss 5.0 Microkernel specific implementation
  | @@ -57,7 +59,7 @@
  |     private org.jboss.deployers.structure.spi.DeploymentUnit jbossUnit;
  |     private Map<String, ContainerDependencyMetaData> endpoints;
  |  
  | -   public Ejb3JBoss5Deployment(DeploymentUnit ejb3Unit, Kernel kernel, MBeanServer mbeanServer, org.jboss.deployers.structure.spi.DeploymentUnit jbossUnit, DeploymentScope deploymentScope, JBossMetaData metaData, PersistenceUnitsMetaData persistenceUnitsMetaData)
  | +   public Ejb3JBoss5Deployment(DeploymentUnit ejb3Unit, Kernel kernel, MBeanServer mbeanServer, org.jboss.deployers.structure.spi.DeploymentUnit jbossUnit, DeploymentScope deploymentScope, JBossMetaData metaData, PersistenceMetaData persistenceUnitsMetaData)
  |     {
  |        super(ejb3Unit, deploymentScope, metaData, persistenceUnitsMetaData);
  |        this.jbossUnit = jbossUnit;
  | Index: ejb3/src/main/org/jboss/ejb3/deployers/PersistenceUnitParsingDeployer.java
  | ===================================================================
  | --- ejb3/src/main/org/jboss/ejb3/deployers/PersistenceUnitParsingDeployer.java	(revision 74099)
  | +++ ejb3/src/main/org/jboss/ejb3/deployers/PersistenceUnitParsingDeployer.java	(working copy)
  | @@ -21,21 +21,9 @@
  |   */
  |  package org.jboss.ejb3.deployers;
  |  
  | -import java.net.URL;
  | -import java.util.HashMap;
  | +import org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer;
  | +import org.jboss.metadata.jpa.spec.PersistenceMetaData;
  |  
  | -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.ejb3.protocol.jarjar.Handler;
  | -import org.jboss.logging.Logger;
  | -import org.jboss.virtual.VirtualFile;
  | -
  |  /**
  |   * Find and parse persistence.xml.
  |   * 
  | @@ -46,74 +34,15 @@
  |   * WEB-INF/classes/META-INF/persistence.xml
  |   *
  |   * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
  | + * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  |   * @version $Revision$
  |   */
  | -public class PersistenceUnitParsingDeployer extends AbstractVFSParsingDeployer<PersistenceUnitsMetaData>
  | +public class PersistenceUnitParsingDeployer extends SchemaResolverDeployer<PersistenceMetaData>
  |  {
  | -   private static final Logger log = Logger.getLogger(PersistenceUnitParsingDeployer.class);
  | -   
  | -   static
  | -   {
  | -      Handler.init();
  | -   }
  | -   
  |     public PersistenceUnitParsingDeployer()
  |     {
  | -      super(PersistenceUnitsMetaData.class);
  | +      super(PersistenceMetaData.class);
  |        setName("persistence.xml");
  | +      setRegisterWithJBossXB(true);
  |     }
  | -
  | -   @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
  | -   {
  | -      VirtualFile persistenceRoot = file.getParent().getParent();
  | -      
  | -      // We can't pass in a VFS url.
  | -      //URL persistenceUnitRootUrl = persistenceRoot.toURL();
  | -      
  | -      // FIXME: is this a supported hack?
  | -      // This introduces severe regression, will go the jar: url way (EJB-326)
  | -      //URL persistenceUnitRootUrl = new URL("jarjar:" + persistenceRoot.getHandler().toURL());
  | -      
  | -      // http://opensource.atlassian.com/projects/hibernate/browse/EJB-326
  | -      URL persistenceUnitRootUrl = persistenceRoot.toURL();
  | -      assert persistenceUnitRootUrl.getProtocol().equals("jar") || persistenceUnitRootUrl.getProtocol().equals("file") : "expected a jar or file url, but was " + persistenceUnitRootUrl;
  | -      
  | -      URL persistenceXmlUrl = file.toURL();
  | -      PersistenceUnitsMetaData metaData = new PersistenceUnitsMetaData(persistenceUnitRootUrl, 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;
  | -   }
  |  }
  | Index: ejb3/src/main/org/jboss/ejb3/deployers/Ejb3Deployer.java
  | ===================================================================
  | --- ejb3/src/main/org/jboss/ejb3/deployers/Ejb3Deployer.java	(revision 74099)
  | +++ ejb3/src/main/org/jboss/ejb3/deployers/Ejb3Deployer.java	(working copy)
  | @@ -23,7 +23,6 @@
  |  
  |  import java.util.Properties;
  |  import java.util.Set;
  | -
  |  import javax.management.MBeanServer;
  |  
  |  import org.jboss.deployers.spi.DeploymentException;
  | @@ -41,8 +40,8 @@
  |  import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry;
  |  import org.jboss.kernel.Kernel;
  |  import org.jboss.kernel.spi.deployment.KernelDeployment;
  | -import org.jboss.metadata.ear.jboss.JBossAppMetaData;
  |  import org.jboss.metadata.ejb.jboss.JBossMetaData;
  | +import org.jboss.metadata.jpa.spec.PersistenceMetaData;
  |  import org.jboss.metadata.web.jboss.JBossWebMetaData;
  |  import org.jboss.virtual.VirtualFile;
  |  
  | @@ -92,10 +91,10 @@
  |     @Override
  |     public void deploy(VFSDeploymentUnit unit) throws DeploymentException
  |     {
  | -      deploy(unit, unit.getAttachment(JBossMetaData.class), unit.getAttachment(PersistenceUnitsMetaData.class));
  | +      deploy(unit, unit.getAttachment(JBossMetaData.class), unit.getAttachment(PersistenceMetaData.class));
  |     }
  |     
  | -   public void deploy(VFSDeploymentUnit unit, JBossMetaData metaData, PersistenceUnitsMetaData persistenceUnitsMetaData) throws DeploymentException
  | +   public void deploy(VFSDeploymentUnit unit, JBossMetaData metaData, PersistenceMetaData persistenceUnitsMetaData) throws DeploymentException
  |     {
  |        try
  |        {
  | 

Which fixes this.

btw: I've commited the change + released VFS 2.0.0.Beta13.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4155681#4155681

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4155681



More information about the jboss-dev-forums mailing list