From 1159fafeb76c76a5f5669c0b1b6b24ca2e8c5984 Mon Sep 17 00:00:00 2001
From: Carlo de Wolf <cdewolf@redhat.com>
Date: Thu, 29 Apr 2010 10:30:49 +0200
Subject: [PATCH 3/3] JBPAPP-4128: integrated ejb3-pom-eap5 0.1.0

---
 build/build-distr.xml                              |   20 +
 component-matrix/pom.xml                           |   35 +-
 ejb3/build.xml                                     |    5 +
 ejb3/pom.xml                                       |    5 +
 .../org/jboss/as/ejb3/deployers/EJBsDeployer.java  |  135 -----
 .../org/jboss/ejb3/client/ClientContainer.java     |   40 +--
 .../clientmodule/ClientENCInjectionContainer.java  |   47 +--
 .../jboss/ejb3/deployers/JBoss5DeploymentUnit.java |   36 +-
 .../META-INF/ejb3-deployers-jboss-beans.xml        |  549 ++++++++++----------
 .../META-INF/ejb3-iiop-deployers-jboss-beans.xml   |    3 -
 thirdparty/pom.xml                                 |   69 +++-
 tomcat/build.xml                                   |    2 +
 .../tomcat/service/TomcatInjectionContainer.java   |   51 +--
 13 files changed, 464 insertions(+), 533 deletions(-)
 delete mode 100644 ejb3/src/main/org/jboss/as/ejb3/deployers/EJBsDeployer.java

diff --git a/build/build-distr.xml b/build/build-distr.xml
index 66b6bd3..251a9da 100644
--- a/build/build-distr.xml
+++ b/build/build-distr.xml
@@ -111,6 +111,14 @@
     <property name="_module.name" value="ejb3" override="true"/>
     <property name="_module.output" override="true" value="${project.root}/${_module.name}/output"/>
 
+    <unjar src="${jboss.jboss.ejb3.deployers.lib}/jboss-ejb3-deployers.jar"
+      dest="${install.server}/all/deployers">
+      <patternset>
+         <include name="META-INF/ejb3-deployers-jboss-beans.xml"/>
+      </patternset>
+      <mapper type="flatten"/>
+    </unjar>
+
     <copy todir="${install.server}/all/deploy" filtering="no">
       <fileset dir="${_module.output}/resources">
         <include name="ejb3-container-jboss-beans.xml"/>
@@ -136,6 +144,10 @@
                excludes="*-sources.jar, *-javadoc.jar"/>
       <fileset dir="${jboss.jboss.ejb3.common.lib}" includes="*.jar"
                excludes="*-sources.jar, *-javadoc.jar, *-client.jar, *-tests.jar"/>
+      <fileset dir="${jboss.jboss.ejb3.context.base.lib}" includes="*.jar"
+               excludes="*-sources.jar, *-javadoc.jar"/>
+      <fileset dir="${jboss.jboss.ejb3.context.naming.lib}" includes="*.jar"
+               excludes="*-sources.jar, *-javadoc.jar"/>
       <fileset dir="${jboss.jboss.ejb3.core.lib}" includes="*.jar"
                excludes="*-sources.jar, *-javadoc.jar, *-client.jar, *-tests.jar"/>
       <fileset dir="${jboss.jboss.ejb3.deployers.lib}" includes="*.jar"
@@ -164,6 +176,14 @@
                excludes="*-sources.jar, *-javadoc.jar"/>
       <fileset dir="${jboss.jboss.ejb3.transactions.lib}" includes="*.jar"
                excludes="*-sources.jar, *-javadoc.jar"/>
+      <fileset dir="${jboss.jboss.ejb3.timeout.spi.lib}" includes="*.jar"
+               excludes="*-sources.jar, *-javadoc.jar"/>
+      <fileset dir="${jboss.jboss.ejb3.timeout.3.0.lib}" includes="*.jar"
+               excludes="*-sources.jar, *-javadoc.jar"/>
+      <fileset dir="${jboss.jboss.ejb3.vfs.spi.lib}" includes="*.jar"
+               excludes="*-sources.jar, *-javadoc.jar"/>
+      <fileset dir="${jboss.jboss.ejb3.vfs.impl.vfs2.lib}" includes="*.jar"
+               excludes="*-sources.jar, *-javadoc.jar"/>
       <fileset dir="${hibernate.commons.annotations.lib}" includes="*.jar"
                 excludes="*-sources.jar, *-javadoc.jar"/>
       <fileset dir="${hibernate.entitymanager.lib}" includes="*.jar"
diff --git a/component-matrix/pom.xml b/component-matrix/pom.xml
index 02add3a..56fb30a 100644
--- a/component-matrix/pom.xml
+++ b/component-matrix/pom.xml
@@ -65,8 +65,9 @@
     <version.org.jboss.cluster.server.api>1.1.1.GA</version.org.jboss.cluster.server.api>
     <version.org.jboss.common.core>2.2.16.GA</version.org.jboss.common.core>
     <version.org.jboss.deployers>2.0.8.SP1</version.org.jboss.deployers>
+    <version.org.jboss.ejb3.bom>0.1.0-SNAPSHOT</version.org.jboss.ejb3.bom>
+    <!--
     <version.org.jboss.ejb3.common.client>1.0.1</version.org.jboss.ejb3.common.client>
-    <version.org.jboss.ejb3.core.client>1.1.22</version.org.jboss.ejb3.core.client>
     <version.org.jboss.ejb3.jpa.int>1.0.0</version.org.jboss.ejb3.jpa.int>
     <version.org.jboss.ejb3.proxy.impl.client>1.0.6</version.org.jboss.ejb3.proxy.impl.client>
     <version.org.jboss.ejb3.proxy.spi.client>1.0.0</version.org.jboss.ejb3.proxy.spi.client>
@@ -76,7 +77,7 @@
     <version.org.jboss.ejb3.endpoint.deployer>0.1.4</version.org.jboss.ejb3.endpoint.deployer>
     <version.org.jboss.ejb3.metrics.deployer>1.0.2</version.org.jboss.ejb3.metrics.deployer>
     <version.org.jboss.ejb3.transactions>1.0.2</version.org.jboss.ejb3.transactions>
-    <version.org.jboss.ejb3.interceptors>1.0.6</version.org.jboss.ejb3.interceptors>
+    -->
     <version.org.jboss.integration>5.1.0.SP1</version.org.jboss.integration>
     <version.org.jboss.jbossxb>2.0.1.GA</version.org.jboss.jbossxb>
     <version.org.jboss.jopr>1.3.2.GA</version.org.jboss.jopr>    
@@ -1698,11 +1699,24 @@
       </dependency>
 
       <dependency>
-        <groupId>org.jboss.ejb3</groupId>
-        <artifactId>jboss-ejb3-interceptors</artifactId>
-        <version>${version.org.jboss.ejb3.interceptors}</version>
+        <groupId>org.jboss.ejb3.bom</groupId>
+        <artifactId>bom-eap5</artifactId>
+        <version>0.1.0-SNAPSHOT</version>
+        <type>pom</type>
+        <scope>import</scope>
+        <exclusions>
+          <exclusion>
+            <groupId>org.jboss.jbossas</groupId>
+            <artifactId>jboss-as-server</artifactId>
+          </exclusion>
+           <exclusion>
+             <groupId>org.jboss.microcontainer</groupId>
+             <artifactId>jboss-jmx-mc-int</artifactId>
+           </exclusion>
+        </exclusions>
       </dependency>
 
+      <!--
       <dependency>
         <groupId>org.jboss.ejb3</groupId>
         <artifactId>jboss-ejb3-common</artifactId>
@@ -1765,8 +1779,8 @@
           </exclusion>
         </exclusions>
       </dependency>
-      
-      <!-- Normally comes in via ejb3-as-int, but we need some exclusions -->
+
+      < ! - - Normally comes in via ejb3-as-int, but we need some exclusions  - - >
       <dependency>
         <groupId>org.jboss.ejb3</groupId>
         <artifactId>jboss-ejb3-metrics-deployer</artifactId>
@@ -1835,8 +1849,8 @@
           </exclusion>
         </exclusions>
       </dependency>
-      
-      <!-- Normally comes in via ejb3-as-int, but we need a newer version -->
+
+      < ! - - Normally comes in via ejb3-as-int, but we need a newer version - - >
       <dependency>
         <groupId>org.jboss.ejb3</groupId>
         <artifactId>jboss-ejb3-transactions</artifactId>
@@ -1848,7 +1862,6 @@
         <artifactId>jboss-ejb3-endpoint-deployer</artifactId>
         <version>${version.org.jboss.ejb3.endpoint.deployer}</version>
         <exclusions>
-          <!-- EJB3 artifacts come in via jboss-ejb3-as-int -->
           <exclusion>
             <groupId>org.jboss.ejb3</groupId>
             <artifactId>jboss-ejb3-core</artifactId>
@@ -1899,6 +1912,7 @@
           </exclusion>
         </exclusions>
       </dependency>
+      -->
       
       <dependency>
         <groupId>org.jboss.javaee</groupId>
@@ -2361,6 +2375,7 @@
 			<!-- JBAS-6904: use org.hibernate:hibernate-core -->
 			<exclude>org.hibernate:hibernate</exclude>
                         <exclude>org.jboss.jbossas:jboss-as-bootstrap</exclude> <!-- org.jboss.bootstrap:jboss-bootstrap JBAS-6171 -->
+                        <exclude>org.jboss.metadata:jboss-metadata-common</exclude>
                       </excludes>
                     </bannedDependencies>
                   </rules>
diff --git a/ejb3/build.xml b/ejb3/build.xml
index c7cf324..dbb9270 100755
--- a/ejb3/build.xml
+++ b/ejb3/build.xml
@@ -1,4 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+   vi:ts=3:sw=3:expandtab
+-->
 <!DOCTYPE project [
    <!ENTITY buildmagic SYSTEM "../tools/etc/buildmagic/buildmagic.ent">
    <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
@@ -123,6 +126,8 @@
          <path refid="jboss.jboss.ejb3.proxy.impl.classpath" />
          <path refid="jboss.jboss.ejb3.proxy.spi.classpath" />
          <path refid="jboss.jboss.ejb3.timerservice.spi.classpath" />
+         <path refid="jboss.jboss.ejb3.vfs.spi.classpath" />
+         <path refid="jboss.jboss.ejb3.vfs.impl.vfs2.classpath" />
          <path refid="jboss.jboss.jpa.deployers.classpath"/>
          <path refid="jboss.jboss.mdr.classpath"/>
          <path refid="jboss.jboss.reflect.classpath" />
diff --git a/ejb3/pom.xml b/ejb3/pom.xml
index e103f3d..3a2e8bd 100644
--- a/ejb3/pom.xml
+++ b/ejb3/pom.xml
@@ -125,6 +125,11 @@
     </dependency>
     
     <dependency>
+      <groupId>org.jboss.ejb3.vfs</groupId>
+      <artifactId>jboss-ejb3-vfs-impl-vfs2</artifactId>
+    </dependency>
+
+    <dependency>
       <groupId>org.jboss.ejb3</groupId>
       <artifactId>jboss-ejb3-core</artifactId>
       <classifier>client</classifier>
diff --git a/ejb3/src/main/org/jboss/as/ejb3/deployers/EJBsDeployer.java b/ejb3/src/main/org/jboss/as/ejb3/deployers/EJBsDeployer.java
deleted file mode 100644
index 4bd60e7..0000000
--- a/ejb3/src/main/org/jboss/as/ejb3/deployers/EJBsDeployer.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.as.ejb3.deployers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
-import org.jboss.deployers.spi.deployer.helpers.AbstractDeploymentVisitor;
-import org.jboss.deployers.spi.deployer.helpers.DeploymentVisitor;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.ejb3.common.deployers.spi.AttachmentNames;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-
-/**
- * Create components out of EJB 3 JBossMetaData.
- * 
- * @author <a href="mailto:cdewolf@redhat.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
-public class EJBsDeployer extends AbstractComponentDeployer<JBossMetaData, JBossEnterpriseBeanMetaData>
-{
-   private static final Logger log = Logger.getLogger(EJBsDeployer.class);
-   
-   private static final JBossDeploymentVisitor deploymentVisitor = new JBossDeploymentVisitor();
-   
-   /**
-    * 
-    */
-   public EJBsDeployer()
-   {
-      // Since we don't set component visitor
-      addInput(deploymentVisitor.getVisitorType());
-      setOutput(deploymentVisitor.getComponentType());
-      
-      // for ordering
-      addInput(AttachmentNames.PROCESSED_METADATA);
-      
-      setDeploymentVisitor(deploymentVisitor);
-   }
-   
-   private static class JBossDeploymentVisitor extends AbstractDeploymentVisitor<JBossEnterpriseBeanMetaData, JBossMetaData>
-   {
-      @Override
-      public Class<JBossEnterpriseBeanMetaData> getComponentType()
-      {
-         return JBossEnterpriseBeanMetaData.class;
-      }
-
-      @Override
-      protected List<? extends JBossEnterpriseBeanMetaData> getComponents(JBossMetaData deployment)
-      {
-         return new ArrayList<JBossEnterpriseBeanMetaData>(deployment.getEnterpriseBeans());
-      }
-
-      @Override
-      protected String getComponentName(JBossEnterpriseBeanMetaData attachment)
-      {
-         return JBossEnterpriseBeanMetaData.class.getName() + "." + attachment.getEjbName();
-      }
-
-      public Class<JBossMetaData> getVisitorType()
-      {
-         return JBossMetaData.class;
-      }
-   }
-   
-   @Override
-   protected <U> void deploy(DeploymentUnit unit, DeploymentVisitor<U> visitor) throws DeploymentException
-   {
-      // I only want a single attachment deployed
-      
-      U deployment = unit.getAttachment(visitor.getVisitorType());
-      try
-      {
-         visitor.deploy(unit, deployment);
-      }
-      catch(Throwable t)
-      {
-         throw DeploymentException.rethrowAsDeploymentException("Error deploying: " + unit.getName(), t);
-      }
-   }
-   
-   @Override
-   public void internalDeploy(DeploymentUnit unit) throws DeploymentException
-   {
-      if(!isValid(unit))
-         return;
-      
-      log.debug("Processing " + unit);
-      
-      super.internalDeploy(unit);
-   }
-   
-   @Override
-   public void internalUndeploy(DeploymentUnit unit)
-   {
-      // if we don't check then undeploy will be done for stuff that was never deployed.
-      if(!isValid(unit))
-         return;
-      
-      super.internalUndeploy(unit);
-   }
-   
-   protected boolean isValid(DeploymentUnit unit)
-   {
-      // for good measure, we only do this for EJB 3 deployments
-      JBossMetaData md = unit.getAttachment(JBossMetaData.class);
-      if(md == null || !md.isEJB3x())
-         return false;
-      return true;
-   }
-}
diff --git a/ejb3/src/main/org/jboss/ejb3/client/ClientContainer.java b/ejb3/src/main/org/jboss/ejb3/client/ClientContainer.java
index 6e70223..393acc5 100644
--- a/ejb3/src/main/org/jboss/ejb3/client/ClientContainer.java
+++ b/ejb3/src/main/org/jboss/ejb3/client/ClientContainer.java
@@ -21,45 +21,25 @@
  */
 package org.jboss.ejb3.client;
 
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Proxy;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.naming.Context;
-import javax.naming.LinkRef;
-import javax.naming.NameClassPair;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-
 import org.jboss.ejb3.Container;
 import org.jboss.ejb3.DependencyPolicy;
 import org.jboss.ejb3.InitialContextFactory;
 import org.jboss.ejb3.client.injection.ClientPersistenceUnitHandler;
-import org.jboss.injection.DependsHandler;
-import org.jboss.injection.EncInjector;
-import org.jboss.injection.InjectionContainer;
-import org.jboss.injection.InjectionHandler;
-import org.jboss.injection.Injector;
-import org.jboss.injection.WebServiceRefHandler;
+import org.jboss.ejb3.vfs.spi.VirtualFile;
+import org.jboss.injection.*;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.client.jboss.JBossClientMetaData;
 import org.jboss.metadata.javaee.spec.LifecycleCallbacksMetaData;
 import org.jboss.metadata.javaee.spec.RemoteEnvironment;
 import org.jboss.util.NotImplementedException;
-import org.jboss.virtual.VirtualFile;
+
+import javax.naming.*;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.*;
+import java.net.URL;
+import java.util.*;
 
 /**
  * Injection of the application client main class is handled from here.
diff --git a/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java b/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java
index c1e3773..16cc3ee 100644
--- a/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java
+++ b/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java
@@ -21,31 +21,10 @@
  */
 package org.jboss.ejb3.clientmodule;
 
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.naming.Context;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-
 import org.jboss.beans.metadata.api.annotations.Start;
 import org.jboss.beans.metadata.api.annotations.Stop;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.ejb3.Container;
-import org.jboss.ejb3.DependencyPolicy;
-import org.jboss.ejb3.DeploymentScope;
-import org.jboss.ejb3.DeploymentUnit;
-import org.jboss.ejb3.Ejb3Module;
+import org.jboss.ejb3.*;
 import org.jboss.ejb3.deployers.JBoss5DeploymentScope;
 import org.jboss.ejb3.deployers.JBoss5DeploymentUnit;
 import org.jboss.ejb3.deployers.JBossASDepdencyPolicy;
@@ -53,12 +32,9 @@ import org.jboss.ejb3.enc.DeploymentEjbResolver;
 import org.jboss.ejb3.enc.MessageDestinationResolver;
 import org.jboss.ejb3.javaee.AbstractJavaEEComponent;
 import org.jboss.ejb3.javaee.SimpleJavaEEModule;
-import org.jboss.injection.DependsHandler;
-import org.jboss.injection.EncInjector;
-import org.jboss.injection.ExtendedInjectionContainer;
-import org.jboss.injection.InjectionHandler;
-import org.jboss.injection.Injector;
-import org.jboss.injection.WebServiceRefHandler;
+import org.jboss.ejb3.vfs.spi.UnifiedVirtualFileFactory;
+import org.jboss.ejb3.vfs.spi.VirtualFile;
+import org.jboss.injection.*;
 import org.jboss.jpa.resolvers.PersistenceUnitDependencyResolver;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.client.jboss.JBossClientMetaData;
@@ -66,10 +42,19 @@ import org.jboss.metadata.javaee.spec.RemoteEnvironment;
 import org.jboss.metadata.javaee.spec.ServiceReferenceMetaData;
 import org.jboss.metadata.javaee.spec.ServiceReferencesMetaData;
 import org.jboss.metadata.serviceref.ServiceReferenceHandler;
-import org.jboss.metadata.serviceref.VirtualFileAdaptor;
-import org.jboss.virtual.VirtualFile;
 import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
 
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.naming.Context;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.*;
+
 /**
  * This class builds up the java:comp namespace for JavaEE 5 application clients.
  * It uses the existing injection framework to get this done.
@@ -360,7 +345,7 @@ public class ClientENCInjectionContainer extends AbstractJavaEEComponent impleme
                      String encName = "env/" + name;
                      Context encCtx = getEnc();
 
-                     UnifiedVirtualFile vfsRoot = new VirtualFileAdaptor(getRootFile());
+                     UnifiedVirtualFile vfsRoot = UnifiedVirtualFileFactory.getInstance().create(getRootFile());
                      new ServiceReferenceHandler().bindServiceRef(encCtx, encName, vfsRoot, getClassloader(), sref);
 
                   }
diff --git a/ejb3/src/main/org/jboss/ejb3/deployers/JBoss5DeploymentUnit.java b/ejb3/src/main/org/jboss/ejb3/deployers/JBoss5DeploymentUnit.java
index fdf88e1..99f8030 100644
--- a/ejb3/src/main/org/jboss/ejb3/deployers/JBoss5DeploymentUnit.java
+++ b/ejb3/src/main/org/jboss/ejb3/deployers/JBoss5DeploymentUnit.java
@@ -21,23 +21,21 @@
 */
 package org.jboss.ejb3.deployers;
 
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Collections;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
 import org.jboss.ejb3.interceptor.InterceptorInfoRepository;
+import org.jboss.ejb3.vfs.impl.vfs2.VirtualFileFilterAdapter;
+import org.jboss.ejb3.vfs.impl.vfs2.VirtualFileWrapper;
 import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
 import org.jboss.virtual.VisitorAttributes;
 import org.jboss.virtual.plugins.context.jar.JarUtils;
 import org.jboss.virtual.plugins.vfs.helpers.FilterVirtualFileVisitor;
 import org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter;
 
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.*;
+
 /**
  * Comment
  *
@@ -77,9 +75,9 @@ public class JBoss5DeploymentUnit implements org.jboss.ejb3.DeploymentUnit
       return unit.removeAttachment(name);
    }
 
-   public VirtualFile getRootFile()
+   public org.jboss.ejb3.vfs.spi.VirtualFile getRootFile()
    {
-      return unit.getFile("");
+      return new VirtualFileWrapper(unit.getFile(""));
    }
    
    public String getRelativePath()
@@ -137,9 +135,9 @@ public class JBoss5DeploymentUnit implements org.jboss.ejb3.DeploymentUnit
       return extractDescriptorUrl("jboss.xml");
    }
 
-   public VirtualFile getMetaDataFile(String name)
+   public org.jboss.ejb3.vfs.spi.VirtualFile getMetaDataFile(String name)
    {
-      return unit.getMetaDataFile(name);
+      return new VirtualFileWrapper(unit.getMetaDataFile(name));
    }
    
    public List<Class> getClasses()
@@ -202,7 +200,7 @@ public class JBoss5DeploymentUnit implements org.jboss.ejb3.DeploymentUnit
       throw new IllegalStateException("EJBTHREE-1852: InterceptorInfoRepository must not be used anymore");
    }
 
-   public List<VirtualFile> getResources(VirtualFileFilter filter)
+   public List<org.jboss.ejb3.vfs.spi.VirtualFile> getResources(org.jboss.ejb3.vfs.spi.VirtualFileFilter filter)
    {
       List<VirtualFile> classPath = unit.getClassPath();
       if(classPath == null || classPath.isEmpty())
@@ -212,7 +210,7 @@ public class JBoss5DeploymentUnit implements org.jboss.ejb3.DeploymentUnit
       va.setLeavesOnly(true);
       SuffixesExcludeFilter noJars = new SuffixesExcludeFilter(JarUtils.getSuffixes());
       va.setRecurseFilter(noJars);
-      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, va);
+      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(new VirtualFileFilterAdapter(filter), va);
 
       for(VirtualFile root : classPath)
       {
@@ -227,6 +225,12 @@ public class JBoss5DeploymentUnit implements org.jboss.ejb3.DeploymentUnit
          }
       }
       
-      return visitor.getMatched();
+      final List<VirtualFile> matches = visitor.getMatched();
+      final List<org.jboss.ejb3.vfs.spi.VirtualFile> wrappedMatches = new ArrayList<org.jboss.ejb3.vfs.spi.VirtualFile>(matches.size());
+      for(VirtualFile match : matches)
+      {
+         wrappedMatches.add(new VirtualFileWrapper(match));
+      }
+      return wrappedMatches;
    }
 }
diff --git a/ejb3/src/resources/META-INF/ejb3-deployers-jboss-beans.xml b/ejb3/src/resources/META-INF/ejb3-deployers-jboss-beans.xml
index f40c50a..06225d0 100644
--- a/ejb3/src/resources/META-INF/ejb3-deployers-jboss-beans.xml
+++ b/ejb3/src/resources/META-INF/ejb3-deployers-jboss-beans.xml
@@ -1,12 +1,14 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-    EJB3 Deployers
--->
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    EJB3 Deployers
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
 
    <bean name="MessageDestinationReferenceResolver" class="org.jboss.ejb3.resolvers.DefaultMessageDestinationReferenceResolver"/>
-   
+
+   <bean name="EJBContextBinder" class="org.jboss.ejb3.context.naming.EJBContextBinder"/>
+   
    <bean name="Ejb3DependenciesDeployer" class="org.jboss.ejb3.deployers.Ejb3DependenciesDeployer">
       <!-- TODO: allow for configuration
       <property name="dependencies">
@@ -17,245 +19,245 @@
       -->
    </bean>
    
-   <bean name="Ejb3Deployer" class="org.jboss.ejb3.deployers.Ejb3Deployer">
-      <install bean="ManagedDeploymentCreator" method="addVersionedAttachmentType">
-         <parameter>
-            <value>org.jboss.metadata.ejb.jboss.JBossMetaData</value>
-         </parameter>
-         <parameter>
-            <value>ejb3x</value>
-         </parameter>
-         <parameter>
-            <value>3.*</value>
-         </parameter>
-         <parameter>
-            <value>getEjbVersion</value>
-         </parameter>
-      </install>
-      <uninstall bean="ManagedDeploymentCreator" method="removeVersionedAttachmentType">
-         <parameter>
-            <value>org.jboss.metadata.ejb.jboss.JBossMetaData</value>
-         </parameter>
-         <parameter>
-            <value>ejb3x</value>
-         </parameter>
-      </uninstall>
-      <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
-      <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
-      <property name="cacheFactoryRegistry"><inject bean="EJB3CacheFactoryRegistry" /></property>
-      <property name="poolFactoryRegistry"><inject bean="EJB3PoolFactoryRegistry" /></property>
-      <property name="persistenceManagerFactoryRegistry"><inject bean="EJB3PersistenceManagerFactoryRegistry" /></property>
-      <!-- Should war deployments be scanned for annotated ejbs -->
-      <property name="scanWars">false</property>
-      
-      <!-- 
-   
-      Configure the deployer to optionally require a deployment 
-      descriptor for deployable units.  By turning this switch to "true", 
-      "META-INF/jboss.xml" or the EJB3 Deployment Descriptor "META-INF/ejb-jar.xml" 
-      will be required for deployment, enabling a performance increace in deployment by
-      not scanning for annotations in non-deployable EJB3 JARs.
-      
-      Default for this value is "false".
-      
-      -->
-      <property name="deploymentDescriptorRequired">false</property>
-      
-      <property name="ignoredJarsSet">
-         <set elementClass="java.lang.String">
-            <value>snmp-adaptor.jar</value>
-            <value>otherimages.jar</value>
-            <value>applet.jar</value>
-            <value>jcommon.jar</value>
-            <value>console-mgr-classes.jar</value>
-            <value>jfreechart.jar</value>
-            <value>juddi-service.jar</value>
-            <value>wsdl4j.jar</value>
-            <value>commons-collections.jar</value>
-            <value>commons-pool.jar</value>
-            <value>juddi.jar</value>
-            <value>commons-discovery.jar</value>
-            <value>uddi4j.jar</value>
-            <value>axis.jar</value>
-            <value>commons-dbcp.jar</value>
-            <value>jboss-juddiaxis.jar</value>
-            <value>trove.jar</value>
-            <value>javassist.jar</value>
-            <value>jboss-aop-jdk50.jar</value>
-            <value>jboss-aspect-library-jdk50.jar</value>
-            <value>ejb3-persistence.jar</value>
-            <value>commons-validator-1.1.3.jar</value>
-            <value>commons-collections.jar</value>
-            <value>commons-fileupload.jar</value>
-            <value>commons-pool.jar</value>
-            <value>hibernate-entitymanager.jar</value>
-            <value>jboss-ejb3x.jar</value>
-            <value>commons-digester-1.6.jar</value>
-            <value>cglib-2.1.1.jar</value>
-            <value>commons-discovery.jar</value>
-            <value>jboss-annotations-ejb3.jar</value>
-            <value>jaxen-1.1-beta-4.jar</value>
-            <value>hibernate-annotations.jar</value>
-            <value>commons-httpclient.jar</value>
-            <value>commons-logging.jar</value>
-            <value>commons-vfs.jar</value>
-            <value>hibernate3.jar</value>
-            <value>commons-logging-api.jar</value>
-            <value>asm.jar</value>
-            <value>asm-attrs.jar</value>
-            <value>commons-lang-2.0.jar</value>
-            <value>commons-beanutils.jar</value>
-            <value>jboss-ejb3.jar</value>
-            <value>dom4j.jar</value>
-            <value>commons-codec-1.2.jar</value>
-            <value>wsdl4j.jar</value>
-            <value>xmlsec.jar</value>
-            <value>jbossws.jar</value>
-            <value>jboss-bean-deployer.jar</value>
-            <value>jboss-microcontainer.jar</value>
-            <value>jboss-dependency.jar</value>
-            <value>jboss-container.jar</value>
-            <value>tomcat-coyote.jar</value>
-            <value>commons-collections.jar</value>
-            <value>myfaces.jar</value>
-            <value>jstl.jar</value>
-            <value>commons-digester-1.6.jar</value>
-            <value>myfaces-impl.jar</value>
-            <value>commons-beanutils.jar</value>
-            <value>myfaces-jsf-api.jar</value>
-            <value>commons-codec-1.2.jar</value>
-            <value>catalina-optional.jar</value>
-            <value>tomcat-util.jar</value>
-            <value>jasper-compiler.jar</value>
-            <value>commons-el.jar</value>
-            <value>jasper-compiler-jdt.jar</value>
-            <value>tomcat-http.jar</value>
-            <value>catalina-manager.jar</value>
-            <value>jasper-runtime.jar</value>
-            <value>tomcat55-service.jar</value>
-            <value>servlets-invoker.jar</value>
-            <value>catalina.jar</value>
-            <value>naming-resources.jar</value>
-            <value>servlets-default.jar</value>
-            <value>tomcat-ajp.jar</value>
-            <value>commons-modeler.jar</value>
-            <value>tomcat-apr.jar</value>
-            <value>servlets-webdav.jar</value>
-         </set>
-      </property>
-      <depends>AspectLibrary</depends>
-   </bean>
-   
-   <bean name="AppClientParsingDeployer" class="org.jboss.ejb3.deployers.AppClientParsingDeployer">
-      <!-- TODO: check depends -->
-      <depends>AspectLibrary</depends>
-   </bean>
-   
-   <bean name="JBossClientParsingDeployer" class="org.jboss.ejb3.deployers.JBossClientParsingDeployer">
-      <depends>AppClientParsingDeployer</depends>
-   </bean>
-   <bean name="MergedJBossClientMetaDataDeployer" class="org.jboss.ejb3.deployers.MergedJBossClientMetaDataDeployer">
-      <depends>AppClientParsingDeployer</depends>
-   </bean>
-
-   <bean name="Ejb3ClientDeployer" class="org.jboss.ejb3.deployers.Ejb3ClientDeployer">
-      <install bean="ManagedDeploymentCreator" method="addAttachmentType">
-         <parameter>
-            <value>org.jboss.metadata.client.jboss.JBossClientMetaData</value>
-         </parameter>
-         <parameter>
-            <value>car</value>
-         </parameter>
-      </install>
-      <uninstall bean="ManagedDeploymentCreator" method="removeAttachmentType">
-         <parameter>
-            <value>org.jboss.metadata.client.jboss.JBossClientMetaData</value>
-         </parameter>
-      </uninstall>
-      <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
-      <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
-      <!-- TODO: check depends -->
-      <depends>AspectLibrary</depends>
-   </bean>
-   
-   <!-- EJB3 Cache Factory Registry -->
-   <bean name="EJB3CacheFactoryRegistry" class="org.jboss.ejb3.cache.CacheFactoryRegistry">
-      <property name="factories">
-         <!-- Define each of the registered factories -->
-         <map class="java.util.HashMap" keyClass="java.lang.String"
-            valueClass="java.lang.Class">
-            <!-- NoPassivationCache -->
-            <entry>
-               <key>NoPassivationCache</key>
-               <value>org.jboss.ejb3.cache.NoPassivationCacheFactory</value>
-            </entry>
-            <!-- SimpleStatefulCache -->
-            <entry>
-               <key>SimpleStatefulCache</key>
-               <value>org.jboss.ejb3.cache.simple.SimpleStatefulCacheFactory</value>
-            </entry>
-            <!-- StatefulTreeCache -->
-            <entry>
-               <key>StatefulTreeCache</key>
-               <value>org.jboss.ejb3.cache.tree.StatefulTreeCacheFactory</value>
-            </entry>
-         </map>
-      </property>
-   </bean>
-   
-   <!-- EJB3 Pool Factory Registry -->
-   <bean name="EJB3PoolFactoryRegistry" class="org.jboss.ejb3.pool.PoolFactoryRegistry">
-      <property name="factories">
-         <!-- Define each of the registered factories -->
-         <map class="java.util.HashMap" keyClass="java.lang.String"
-            valueClass="java.lang.Class">
-            <!-- ThreadlocalPool -->
-            <entry>
-               <key>ThreadlocalPool</key>
-               <value>org.jboss.ejb3.pool.ThreadlocalPoolFactory</value>
-            </entry>
-            <!-- StrictMaxPool -->
-            <entry>
-               <key>StrictMaxPool</key>
-               <value>org.jboss.ejb3.pool.StrictMaxPoolFactory</value>
-            </entry>
-         </map>
-      </property>
-   </bean>
-   
-   <!-- EJB3 Persistence Manager Factory Registry -->
-   <bean name="EJB3PersistenceManagerFactoryRegistry" class="org.jboss.ejb3.cache.persistence.PersistenceManagerFactoryRegistry">
-      <property name="factories">
-         <!-- Define each of the registered factories -->
-         <map class="java.util.HashMap" keyClass="java.lang.String"
-            valueClass="java.lang.Class">
-            <!-- StatefulSessionFilePersistenceManager -->
-            <entry>
-               <key>StatefulSessionFilePersistenceManager</key>
-               <value>org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManagerFactory</value>
-            </entry>
-         </map>
-      </property>
-   </bean>
-   
-   <bean name="JNDIKernelRegistryPlugin" class="org.jboss.ejb3.kernel.JNDIKernelRegistryPlugin"/>
-   
-   <!-- Persistence Unit deployers -->
-   <bean name="PersistenceUnitParsingDeployer" class="org.jboss.ejb3.deployers.PersistenceUnitParsingDeployer">
-      <install bean="ManagedDeploymentCreator" method="addAttachmentType">
-         <parameter>
-            <value>org.jboss.metadata.jpa.spec.PersistenceMetaData</value>
-         </parameter>
-         <parameter>
-            <value>par</value>
-         </parameter>
-      </install>
-      <uninstall bean="ManagedDeploymentCreator" method="removeAttachmentType">
-         <parameter>
-            <value>org.jboss.metadata.jpa.spec.PersistenceMetaData</value>
-         </parameter>
-      </uninstall>
-   </bean>
+   <bean name="Ejb3Deployer" class="org.jboss.ejb3.deployers.Ejb3Deployer">
+      <install bean="ManagedDeploymentCreator" method="addVersionedAttachmentType">
+         <parameter>
+            <value>org.jboss.metadata.ejb.jboss.JBossMetaData</value>
+         </parameter>
+         <parameter>
+            <value>ejb3x</value>
+         </parameter>
+         <parameter>
+            <value>3.*</value>
+         </parameter>
+         <parameter>
+            <value>getEjbVersion</value>
+         </parameter>
+      </install>
+      <uninstall bean="ManagedDeploymentCreator" method="removeVersionedAttachmentType">
+         <parameter>
+            <value>org.jboss.metadata.ejb.jboss.JBossMetaData</value>
+         </parameter>
+         <parameter>
+            <value>ejb3x</value>
+         </parameter>
+      </uninstall>
+      <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
+      <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+      <property name="cacheFactoryRegistry"><inject bean="EJB3CacheFactoryRegistry" /></property>
+      <property name="poolFactoryRegistry"><inject bean="EJB3PoolFactoryRegistry" /></property>
+      <property name="persistenceManagerFactoryRegistry"><inject bean="EJB3PersistenceManagerFactoryRegistry" /></property>
+      <!-- Should war deployments be scanned for annotated ejbs -->
+      <property name="scanWars">false</property>
+      
+      <!-- 
+   
+      Configure the deployer to optionally require a deployment 
+      descriptor for deployable units.  By turning this switch to "true", 
+      "META-INF/jboss.xml" or the EJB3 Deployment Descriptor "META-INF/ejb-jar.xml" 
+      will be required for deployment, enabling a performance increace in deployment by
+      not scanning for annotations in non-deployable EJB3 JARs.
+      
+      Default for this value is "false".
+      
+      -->
+      <property name="deploymentDescriptorRequired">false</property>
+      
+      <property name="ignoredJarsSet">
+         <set elementClass="java.lang.String">
+            <value>snmp-adaptor.jar</value>
+            <value>otherimages.jar</value>
+            <value>applet.jar</value>
+            <value>jcommon.jar</value>
+            <value>console-mgr-classes.jar</value>
+            <value>jfreechart.jar</value>
+            <value>juddi-service.jar</value>
+            <value>wsdl4j.jar</value>
+            <value>commons-collections.jar</value>
+            <value>commons-pool.jar</value>
+            <value>juddi.jar</value>
+            <value>commons-discovery.jar</value>
+            <value>uddi4j.jar</value>
+            <value>axis.jar</value>
+            <value>commons-dbcp.jar</value>
+            <value>jboss-juddiaxis.jar</value>
+            <value>trove.jar</value>
+            <value>javassist.jar</value>
+            <value>jboss-aop-jdk50.jar</value>
+            <value>jboss-aspect-library-jdk50.jar</value>
+            <value>ejb3-persistence.jar</value>
+            <value>commons-validator-1.1.3.jar</value>
+            <value>commons-collections.jar</value>
+            <value>commons-fileupload.jar</value>
+            <value>commons-pool.jar</value>
+            <value>hibernate-entitymanager.jar</value>
+            <value>jboss-ejb3x.jar</value>
+            <value>commons-digester-1.6.jar</value>
+            <value>cglib-2.1.1.jar</value>
+            <value>commons-discovery.jar</value>
+            <value>jboss-annotations-ejb3.jar</value>
+            <value>jaxen-1.1-beta-4.jar</value>
+            <value>hibernate-annotations.jar</value>
+            <value>commons-httpclient.jar</value>
+            <value>commons-logging.jar</value>
+            <value>commons-vfs.jar</value>
+            <value>hibernate3.jar</value>
+            <value>commons-logging-api.jar</value>
+            <value>asm.jar</value>
+            <value>asm-attrs.jar</value>
+            <value>commons-lang-2.0.jar</value>
+            <value>commons-beanutils.jar</value>
+            <value>jboss-ejb3.jar</value>
+            <value>dom4j.jar</value>
+            <value>commons-codec-1.2.jar</value>
+            <value>wsdl4j.jar</value>
+            <value>xmlsec.jar</value>
+            <value>jbossws.jar</value>
+            <value>jboss-bean-deployer.jar</value>
+            <value>jboss-microcontainer.jar</value>
+            <value>jboss-dependency.jar</value>
+            <value>jboss-container.jar</value>
+            <value>tomcat-coyote.jar</value>
+            <value>commons-collections.jar</value>
+            <value>myfaces.jar</value>
+            <value>jstl.jar</value>
+            <value>commons-digester-1.6.jar</value>
+            <value>myfaces-impl.jar</value>
+            <value>commons-beanutils.jar</value>
+            <value>myfaces-jsf-api.jar</value>
+            <value>commons-codec-1.2.jar</value>
+            <value>catalina-optional.jar</value>
+            <value>tomcat-util.jar</value>
+            <value>jasper-compiler.jar</value>
+            <value>commons-el.jar</value>
+            <value>jasper-compiler-jdt.jar</value>
+            <value>tomcat-http.jar</value>
+            <value>catalina-manager.jar</value>
+            <value>jasper-runtime.jar</value>
+            <value>tomcat55-service.jar</value>
+            <value>servlets-invoker.jar</value>
+            <value>catalina.jar</value>
+            <value>naming-resources.jar</value>
+            <value>servlets-default.jar</value>
+            <value>tomcat-ajp.jar</value>
+            <value>commons-modeler.jar</value>
+            <value>tomcat-apr.jar</value>
+            <value>servlets-webdav.jar</value>
+         </set>
+      </property>
+      <depends>AspectLibrary</depends>
+   </bean>
+   
+   <bean name="AppClientParsingDeployer" class="org.jboss.ejb3.deployers.AppClientParsingDeployer">
+      <!-- TODO: check depends -->
+      <depends>AspectLibrary</depends>
+   </bean>
+   
+   <bean name="JBossClientParsingDeployer" class="org.jboss.ejb3.deployers.JBossClientParsingDeployer">
+      <depends>AppClientParsingDeployer</depends>
+   </bean>
+   <bean name="MergedJBossClientMetaDataDeployer" class="org.jboss.ejb3.deployers.MergedJBossClientMetaDataDeployer">
+      <depends>AppClientParsingDeployer</depends>
+   </bean>
+
+   <bean name="Ejb3ClientDeployer" class="org.jboss.ejb3.deployers.Ejb3ClientDeployer">
+      <install bean="ManagedDeploymentCreator" method="addAttachmentType">
+         <parameter>
+            <value>org.jboss.metadata.client.jboss.JBossClientMetaData</value>
+         </parameter>
+         <parameter>
+            <value>car</value>
+         </parameter>
+      </install>
+      <uninstall bean="ManagedDeploymentCreator" method="removeAttachmentType">
+         <parameter>
+            <value>org.jboss.metadata.client.jboss.JBossClientMetaData</value>
+         </parameter>
+      </uninstall>
+      <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
+      <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+      <!-- TODO: check depends -->
+      <depends>AspectLibrary</depends>
+   </bean>
+   
+   <!-- EJB3 Cache Factory Registry -->
+   <bean name="EJB3CacheFactoryRegistry" class="org.jboss.ejb3.cache.CacheFactoryRegistry">
+      <property name="factories">
+         <!-- Define each of the registered factories -->
+         <map class="java.util.HashMap" keyClass="java.lang.String"
+            valueClass="java.lang.Class">
+            <!-- NoPassivationCache -->
+            <entry>
+               <key>NoPassivationCache</key>
+               <value>org.jboss.ejb3.cache.NoPassivationCacheFactory</value>
+            </entry>
+            <!-- SimpleStatefulCache -->
+            <entry>
+               <key>SimpleStatefulCache</key>
+               <value>org.jboss.ejb3.cache.simple.SimpleStatefulCacheFactory</value>
+            </entry>
+            <!-- StatefulTreeCache -->
+            <entry>
+               <key>StatefulTreeCache</key>
+               <value>org.jboss.ejb3.cache.tree.StatefulTreeCacheFactory</value>
+            </entry>
+         </map>
+      </property>
+   </bean>
+   
+   <!-- EJB3 Pool Factory Registry -->
+   <bean name="EJB3PoolFactoryRegistry" class="org.jboss.ejb3.pool.PoolFactoryRegistry">
+      <property name="factories">
+         <!-- Define each of the registered factories -->
+         <map class="java.util.HashMap" keyClass="java.lang.String"
+            valueClass="java.lang.Class">
+            <!-- ThreadlocalPool -->
+            <entry>
+               <key>ThreadlocalPool</key>
+               <value>org.jboss.ejb3.pool.ThreadlocalPoolFactory</value>
+            </entry>
+            <!-- StrictMaxPool -->
+            <entry>
+               <key>StrictMaxPool</key>
+               <value>org.jboss.ejb3.pool.StrictMaxPoolFactory</value>
+            </entry>
+         </map>
+      </property>
+   </bean>
+   
+   <!-- EJB3 Persistence Manager Factory Registry -->
+   <bean name="EJB3PersistenceManagerFactoryRegistry" class="org.jboss.ejb3.cache.persistence.PersistenceManagerFactoryRegistry">
+      <property name="factories">
+         <!-- Define each of the registered factories -->
+         <map class="java.util.HashMap" keyClass="java.lang.String"
+            valueClass="java.lang.Class">
+            <!-- StatefulSessionFilePersistenceManager -->
+            <entry>
+               <key>StatefulSessionFilePersistenceManager</key>
+               <value>org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManagerFactory</value>
+            </entry>
+         </map>
+      </property>
+   </bean>
+   
+   <bean name="JNDIKernelRegistryPlugin" class="org.jboss.ejb3.kernel.JNDIKernelRegistryPlugin"/>
+   
+   <!-- Persistence Unit deployers -->
+   <bean name="PersistenceUnitParsingDeployer" class="org.jboss.ejb3.deployers.PersistenceUnitParsingDeployer">
+      <install bean="ManagedDeploymentCreator" method="addAttachmentType">
+         <parameter>
+            <value>org.jboss.metadata.jpa.spec.PersistenceMetaData</value>
+         </parameter>
+         <parameter>
+            <value>par</value>
+         </parameter>
+      </install>
+      <uninstall bean="ManagedDeploymentCreator" method="removeAttachmentType">
+         <parameter>
+            <value>org.jboss.metadata.jpa.spec.PersistenceMetaData</value>
+         </parameter>
+      </uninstall>
+   </bean>
 
    <!-- 
     
@@ -296,7 +298,7 @@
       </parameter>
     </constructor>
   </bean>
-   
+   
   <bean name="org.jboss.ejb3.ProxyClusteringRegistry"
         class="org.jboss.ejb3.proxy.clustered.registry.ProxyClusteringRegistry"/>
 
@@ -322,35 +324,32 @@
     </constructor>
   </bean>
 
-  <!-- EJB3 ProcessorChain Deployer -->
-  <bean name="Ejb3MetadataProcessingDeployer"
-    class="org.jboss.ejb3.deployers.Ejb3MetadataProcessingDeployer" />
   <!-- EJB3 JNDI Policy Decorator Deployer -->
   <bean name="EjbMetadataJndiPolicyDecoratorDeployer"
-    class="org.jboss.ejb3.deployers.EjbMetadataJndiPolicyDecoratorDeployer" />
-    
-  <!-- EJB Reference Resolver -->
-  <bean name="org.jboss.ejb3.EjbReferenceResolver" class="org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolver">
-    <constructor factoryClass="org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolverFactory"
-                 factoryMethod="newInstance">
-      <parameter>org.jboss.ejb3.common.resolvers.plugins.FirstMatchEjbReferenceResolver</parameter>
-    </constructor>
-  </bean>
-  
-  <!-- Add Annotation Plugins upon installation -->
-  <bean name="org.jboss.ejb3.AddAnnotationPluginOnBeanAnnotationAdaptorCallbackService" 
-    class="org.jboss.ejb3.mcint.annotationadaptor.AddAnnotationPluginOnBeanAnnotationAdaptorCallbackService">
-    <constructor>
-      <parameter><inject bean="jboss.kernel:service=Kernel"/></parameter>
-    </constructor>
-  </bean>
-    
-  <!-- EJB Reference Annotation Plugin -->
-  <bean name="org.jboss.ejb3.EjbReferenceAnnotationPlugin"
-    class="org.jboss.ejb3.mcint.metadata.plugins.EjbReferenceAnnotationPlugin">
-    <constructor>
-      <parameter><inject bean="org.jboss.ejb3.EjbReferenceResolver" /></parameter>
-    </constructor>
+    class="org.jboss.ejb3.deployers.EjbMetadataJndiPolicyDecoratorDeployer" />
+    
+  <!-- EJB Reference Resolver -->
+  <bean name="org.jboss.ejb3.EjbReferenceResolver" class="org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolver">
+    <constructor factoryClass="org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolverFactory"
+                 factoryMethod="newInstance">
+      <parameter>org.jboss.ejb3.common.resolvers.plugins.FirstMatchEjbReferenceResolver</parameter>
+    </constructor>
+  </bean>
+  
+  <!-- Add Annotation Plugins upon installation -->
+  <bean name="org.jboss.ejb3.AddAnnotationPluginOnBeanAnnotationAdaptorCallbackService" 
+    class="org.jboss.ejb3.mcint.annotationadaptor.AddAnnotationPluginOnBeanAnnotationAdaptorCallbackService">
+    <constructor>
+      <parameter><inject bean="jboss.kernel:service=Kernel"/></parameter>
+    </constructor>
+  </bean>
+    
+  <!-- EJB Reference Annotation Plugin -->
+  <bean name="org.jboss.ejb3.EjbReferenceAnnotationPlugin"
+    class="org.jboss.ejb3.mcint.metadata.plugins.EjbReferenceAnnotationPlugin">
+    <constructor>
+      <parameter><inject bean="org.jboss.ejb3.EjbReferenceResolver" /></parameter>
+    </constructor>
   </bean>
 
-</deployment>
+</deployment>
diff --git a/ejb3/src/resources/META-INF/ejb3-iiop-deployers-jboss-beans.xml b/ejb3/src/resources/META-INF/ejb3-iiop-deployers-jboss-beans.xml
index 05c65e1..94df77f 100644
--- a/ejb3/src/resources/META-INF/ejb3-iiop-deployers-jboss-beans.xml
+++ b/ejb3/src/resources/META-INF/ejb3-iiop-deployers-jboss-beans.xml
@@ -1,7 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <deployment xmlns="urn:jboss:bean-deployer:2.0">
-   <!-- This will be taken over by a deployer from ejb3 project -->
-   <bean name="EJBsDeployer" class="org.jboss.as.ejb3.deployers.EJBsDeployer"/>
-   
    <bean name="EJB3IORDeployer" class="org.jboss.as.ejb3.deployers.IORDeployer"/>
 </deployment>
\ No newline at end of file
diff --git a/thirdparty/pom.xml b/thirdparty/pom.xml
index 80e3328..575a96c 100644
--- a/thirdparty/pom.xml
+++ b/thirdparty/pom.xml
@@ -638,7 +638,48 @@
                 <componentId>jboss.jboss-ejb3-endpoint-deployer</componentId>
               </mapping>
             </dependency>
-
+	    <dependency>
+              <groupId>org.jboss.ejb3.context</groupId>
+              <artifactId>jboss-ejb3-context-base</artifactId>
+              <mapping>
+                <componentId>jboss.jboss-ejb3-context-base</componentId>
+              </mapping>
+            </dependency>
+	    <dependency>
+              <groupId>org.jboss.ejb3.context</groupId>
+              <artifactId>jboss-ejb3-context-naming</artifactId>
+              <mapping>
+                <componentId>jboss.jboss-ejb3-context-naming</componentId>
+              </mapping>
+            </dependency>
+	    <dependency>
+              <groupId>org.jboss.ejb3.timeout</groupId>
+              <artifactId>jboss-ejb3-timeout-spi</artifactId>
+              <mapping>
+                <componentId>jboss.jboss-ejb3-timeout-spi</componentId>
+              </mapping>
+            </dependency>
+	    <dependency>
+              <groupId>org.jboss.ejb3.timeout</groupId>
+              <artifactId>jboss-ejb3-timeout-3.0</artifactId>
+              <mapping>
+                <componentId>jboss.jboss-ejb3-timeout-3.0</componentId>
+              </mapping>
+            </dependency>
+	    <dependency>
+              <groupId>org.jboss.ejb3.vfs</groupId>
+              <artifactId>jboss-ejb3-vfs-spi</artifactId>
+              <mapping>
+                <componentId>jboss.jboss-ejb3-vfs-spi</componentId>
+              </mapping>
+            </dependency>
+	    <dependency>
+              <groupId>org.jboss.ejb3.vfs</groupId>
+              <artifactId>jboss-ejb3-vfs-impl-vfs2</artifactId>
+              <mapping>
+                <componentId>jboss.jboss-ejb3-vfs-impl-vfs2</componentId>
+              </mapping>
+            </dependency>
 
             <dependency>
               <groupId>org.jboss.jpa</groupId>
@@ -1711,6 +1752,32 @@
       <artifactId>jboss-deployers-vfs-spi</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.jboss.ejb3.context</groupId>
+      <artifactId>jboss-ejb3-context-base</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.ejb3.context</groupId>
+      <artifactId>jboss-ejb3-context-naming</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.ejb3.timeout</groupId>
+      <artifactId>jboss-ejb3-timeout-spi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.ejb3.timeout</groupId>
+      <artifactId>jboss-ejb3-timeout-3.0</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.ejb3.vfs</groupId>
+      <artifactId>jboss-ejb3-vfs-impl-vfs2</artifactId>
+      <exclusions>
+        <exclusion>
+	  <groupId>org.jboss.metadata</groupId>
+	  <artifactId>jboss-metadata-common</artifactId>
+	</exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
       <groupId>org.jboss.microcontainer</groupId>
       <artifactId>jboss-kernel</artifactId>
     </dependency>
diff --git a/tomcat/build.xml b/tomcat/build.xml
index da7f25e..fda2399 100644
--- a/tomcat/build.xml
+++ b/tomcat/build.xml
@@ -74,6 +74,8 @@
       <path refid="jboss.integration.classpath"/>
       <path refid="jboss.jboss.ejb3.core.classpath" />
       <path refid="jboss.jboss.ejb3.interceptors.classpath" />
+      <path refid="jboss.jboss.ejb3.vfs.spi.classpath" />
+      <path refid="jboss.jboss.ejb3.vfs.impl.vfs2.classpath" />
       <path refid="org.jboss.cluster.classpath"/>
       <path refid="jboss.jboss.jpa.deployers.classpath" />
       <path refid="jboss.jboss.reflect.classpath" />
diff --git a/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java b/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java
index 76498b2..3da7538 100644
--- a/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java
+++ b/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java
@@ -21,29 +21,6 @@
  */
 package org.jboss.web.tomcat.service;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-import javax.servlet.Filter;
-import javax.servlet.Servlet;
-
 import org.apache.InstanceManager;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
@@ -55,25 +32,35 @@ import org.jboss.ejb3.DependencyPolicy;
 import org.jboss.ejb3.deployers.JBoss5DependencyPolicy;
 import org.jboss.ejb3.javaee.AbstractJavaEEComponent;
 import org.jboss.ejb3.javaee.SimpleJavaEEModule;
-import org.jboss.injection.DependsHandler;
-import org.jboss.injection.EncInjector;
-import org.jboss.injection.ExtendedInjectionContainer;
-import org.jboss.injection.InjectionHandler;
-import org.jboss.injection.Injector;
-import org.jboss.injection.PersistenceContextHandler;
-import org.jboss.injection.PersistenceUnitHandler;
+import org.jboss.ejb3.vfs.impl.vfs2.VirtualFileWrapper;
+import org.jboss.ejb3.vfs.spi.VirtualFile;
+import org.jboss.injection.*;
 import org.jboss.jpa.resolvers.PersistenceUnitDependencyResolver;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.javaee.spec.Environment;
 import org.jboss.metadata.javaee.spec.LifecycleCallbackMetaData;
 import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.virtual.VirtualFile;
 import org.jboss.web.WebApplication;
 import org.jboss.web.tomcat.service.injection.TomcatInjectionUtils;
 import org.jboss.web.tomcat.service.injection.WebEJBHandler;
 import org.jboss.web.tomcat.service.injection.WebResourceHandler;
 import org.jboss.web.tomcat.service.injection.WebServiceRefInjectionHandler;
 
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+import javax.servlet.Filter;
+import javax.servlet.Servlet;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.*;
+
 /**
  * The TomcatInjectionContainer.
  *
@@ -574,7 +561,7 @@ public class TomcatInjectionContainer extends AbstractJavaEEComponent implements
    public VirtualFile getRootFile()
    {
       if (unit instanceof VFSDeploymentUnit)
-         return ((VFSDeploymentUnit)unit).getRoot();
+         return new VirtualFileWrapper(((VFSDeploymentUnit)unit).getRoot());
       else
          return null;
    }
-- 
1.6.3.3

