[jboss-cvs] JBossAS SVN: r78652 - in projects/ejb3/trunk: embedded and 27 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Sep 17 13:39:55 EDT 2008


Author: wolfc
Date: 2008-09-17 13:39:55 -0400 (Wed, 17 Sep 2008)
New Revision: 78652

Added:
   projects/ejb3/trunk/embedded/
   projects/ejb3/trunk/embedded/.classpath
   projects/ejb3/trunk/embedded/.project
   projects/ejb3/trunk/embedded/.settings/
   projects/ejb3/trunk/embedded/.settings/org.eclipse.jdt.core.prefs
   projects/ejb3/trunk/embedded/.settings/org.maven.ide.eclipse.prefs
   projects/ejb3/trunk/embedded/pom.xml
   projects/ejb3/trunk/embedded/src/
   projects/ejb3/trunk/embedded/src/main/
   projects/ejb3/trunk/embedded/src/main/java/
   projects/ejb3/trunk/embedded/src/main/java/org/
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/JBossEJBContainer.java
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/JBossEJBContainerProvider.java
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbAnnotationMetaDataDeployer.java
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbComponentDeployer.java
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbMetadataJndiPolicyDecoratorDeployer.java
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbModuleDeployer.java
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbParsingDeployer.java
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbSomethingDeployer.java
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/JBossEjbParsingDeployer.java
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/MergedJBossMetaDataDeployer.java
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/SimpleClassLoaderDeployer.java
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployment/
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployment/EjbDeployment.java
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployment/EmbeddedEjb3DeploymentUnit.java
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/javaee/
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/javaee/SimpleJavaEEModuleInformer.java
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/resolvers/
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/resolvers/EmbeddedDataSourceDependencyResolver.java
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/resolvers/EmbeddedMessageDestinationReferenceResolver.java
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/service/
   projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/service/SimpleTransactionService.java
   projects/ejb3/trunk/embedded/src/main/resources/
   projects/ejb3/trunk/embedded/src/main/resources/META-INF/
   projects/ejb3/trunk/embedded/src/main/resources/META-INF/aop-beans.xml
   projects/ejb3/trunk/embedded/src/main/resources/META-INF/ejb-deployers-beans.xml
   projects/ejb3/trunk/embedded/src/main/resources/META-INF/embedded-bootstrap-beans.xml
   projects/ejb3/trunk/embedded/src/main/resources/META-INF/jpa-deployers-beans.xml
   projects/ejb3/trunk/embedded/src/main/resources/META-INF/namingserver-beans.xml
   projects/ejb3/trunk/embedded/src/main/resources/META-INF/services/
   projects/ejb3/trunk/embedded/src/main/resources/META-INF/services/org.jboss.ejb3.api.spi.EJBContainerProvider
   projects/ejb3/trunk/embedded/src/main/resources/META-INF/transactionmanager-beans.xml
   projects/ejb3/trunk/embedded/src/main/resources/jndi.properties
   projects/ejb3/trunk/embedded/src/test/
   projects/ejb3/trunk/embedded/src/test/java/
   projects/ejb3/trunk/embedded/src/test/java/org/
   projects/ejb3/trunk/embedded/src/test/java/org/jboss/
   projects/ejb3/trunk/embedded/src/test/java/org/jboss/ejb3/
   projects/ejb3/trunk/embedded/src/test/java/org/jboss/ejb3/embedded/
   projects/ejb3/trunk/embedded/src/test/java/org/jboss/ejb3/embedded/test/
   projects/ejb3/trunk/embedded/src/test/java/org/jboss/ejb3/embedded/test/stateless/
   projects/ejb3/trunk/embedded/src/test/java/org/jboss/ejb3/embedded/test/stateless/Greeter.java
   projects/ejb3/trunk/embedded/src/test/java/org/jboss/ejb3/embedded/test/stateless/GreeterBean.java
   projects/ejb3/trunk/embedded/src/test/java/org/jboss/ejb3/embedded/test/stateless/GreeterBean2.java
   projects/ejb3/trunk/embedded/src/test/java/org/jboss/ejb3/embedded/test/stateless/unit/
   projects/ejb3/trunk/embedded/src/test/java/org/jboss/ejb3/embedded/test/stateless/unit/GreeterTestCase.java
   projects/ejb3/trunk/embedded/src/test/resources/
   projects/ejb3/trunk/embedded/src/test/resources/META-INF/
   projects/ejb3/trunk/embedded/src/test/resources/META-INF/ejb-jar.xml
   projects/ejb3/trunk/embedded/src/test/resources/log4j.xml
Log:
EJBTHREE-1492: Initial import


Property changes on: projects/ejb3/trunk/embedded
___________________________________________________________________
Name: svn:ignore
   + target
eclipse-target


Added: projects/ejb3/trunk/embedded/.classpath
===================================================================
--- projects/ejb3/trunk/embedded/.classpath	                        (rev 0)
+++ projects/ejb3/trunk/embedded/.classpath	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,9 @@
+<classpath>
+  <classpathentry kind="src" path="src/main/java"/>
+  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+  <classpathentry kind="src" path="src/test/java" output="eclipse-target/tests-classes"/>
+  <classpathentry kind="src" path="src/test/resources" output="eclipse-target/tests-classes" excluding="**/*.java"/>
+  <classpathentry kind="output" path="eclipse-target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+</classpath>
\ No newline at end of file

Added: projects/ejb3/trunk/embedded/.project
===================================================================
--- projects/ejb3/trunk/embedded/.project	                        (rev 0)
+++ projects/ejb3/trunk/embedded/.project	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,20 @@
+<projectDescription>
+  <name>jboss-ejb3-embedded</name>
+  <comment>The JBoss EJB 3 Embedded component implements all functionality
+    specified in Chapter 22 (Embeddable Usage) of the EJB 3.1 specification.</comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+    <!-- 
+    <buildCommand>
+      <name>org.maven.ide.eclipse.maven2Builder</name>
+    </buildCommand>
+    -->
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+    <nature>org.maven.ide.eclipse.maven2Nature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Added: projects/ejb3/trunk/embedded/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/ejb3/trunk/embedded/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ projects/ejb3/trunk/embedded/.settings/org.eclipse.jdt.core.prefs	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,5 @@
+#Wed Sep 17 09:46:36 CEST 2008
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5

Added: projects/ejb3/trunk/embedded/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/ejb3/trunk/embedded/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ projects/ejb3/trunk/embedded/.settings/org.maven.ide.eclipse.prefs	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,8 @@
+#Wed Sep 17 12:30:44 CEST 2008
+activeProfiles=eclipse
+eclipse.preferences.version=1
+fullBuildGoals=
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=validate
+version=1

Added: projects/ejb3/trunk/embedded/pom.xml
===================================================================
--- projects/ejb3/trunk/embedded/pom.xml	                        (rev 0)
+++ projects/ejb3/trunk/embedded/pom.xml	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,199 @@
+<!-- 
+  vi:ts=2:sw=2:expandtab 
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.jboss.ejb3</groupId>
+    <artifactId>jboss-ejb3-build</artifactId>
+    <version>1.0.0-Beta1</version>
+    <relativePath>../build/pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>jboss-ejb3-embedded</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>JBoss EJB 3.0 Embedded</name>
+  <url>http://www.jboss.org</url>
+  <description>
+    The JBoss EJB 3 Embedded component implements all functionality
+    specified in Chapter 22 (Embeddable Usage) of the EJB 3.1 specification.
+  </description>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <!-- Because we fiddle with the class loader in BasicTestSuite.
+               Note that the other tests also change context class loader, but this is
+               to make surefire work at all. -->
+          <forkMode>pertest</forkMode>
+          <!--
+          <argLine>-enableassertions</argLine>
+          -->
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.jboss.microcontainer</groupId>
+        <artifactId>jboss-kernel</artifactId>
+        <version>2.0.0.CR1</version>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+  
+  <dependencies>
+    <dependency>
+      <groupId>jboss.jbossts</groupId>
+      <artifactId>jbossjta</artifactId>
+      <version>4.4.0.CR2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-vfs</artifactId>
+      <version>2.0.0.CR1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.aop</groupId>
+      <artifactId>jboss-aop-deployer-jdk50</artifactId>
+      <version>2.0.0.CR17</version>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.ejb3</groupId>
+      <artifactId>jboss-ejb3-api</artifactId>
+      <version>3.1.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.ejb3</groupId>
+      <artifactId>jboss-ejb3-core</artifactId>
+      <version>1.0.0-Beta3</version>
+      <exclusions>
+        <!-- 
+        <exclusion>
+          <groupId>org.jboss.cl</groupId>
+          <artifactId>jboss-classloader</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.deployers</groupId>
+          <artifactId>jboss-client-spi</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.deployers</groupId>
+          <artifactId>jboss-core-spi</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.deployers</groupId>
+          <artifactId>jboss-structure-spi</artifactId>
+        </exclusion>
+        -->
+        <!-- 
+        <exclusion>
+          <groupId>org.jboss.man</groupId>
+          <artifactId>jboss-managed</artifactId>
+        </exclusion>
+        -->
+        <exclusion>
+          <groupId>org.jboss.metadata</groupId>
+          <artifactId>jboss-metadata</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.microcontainer</groupId>
+          <artifactId>jboss-deployers-core-spi</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-vfs</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-core-spi</artifactId>
+      <version>2.0.0.CR1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-impl</artifactId>
+      <version>[2.0.0.CR1]</version>
+      <!-- scope>runtime</scope -->
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-vfs</artifactId>
+      <version>[2.0.0.CR1]</version>
+      <!-- scope>runtime</scope -->
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-structure-spi</artifactId>
+      <version>2.0.0.CR1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-log4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.jbossas</groupId>
+      <artifactId>jboss-as-server</artifactId>
+      <version>5.0.0.CR1</version>
+      <!-- scope>runtime</scope -->
+      <exclusions>
+         <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jbossxb</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.metadata</groupId>
+      <artifactId>jboss-metadata</artifactId>
+      <version>[1.0.0.CR1]</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.microcontainer</groupId>
+      <artifactId>jboss-dependency</artifactId>
+      <version>2.0.0.CR1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.microcontainer</groupId>
+      <artifactId>jboss-kernel</artifactId>
+      <version>[2.0.0.CR1]</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.naming</groupId>
+      <artifactId>jnpserver</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    
+    <!-- For Arjuna / JBoss Transaction -->
+    <dependency>
+      <groupId>apache-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.1.0.jboss</version>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>oswego-concurrent</groupId>
+      <artifactId>concurrent</artifactId>
+      <version>1.3.4-jboss-update1</version>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>jboss.jbossts</groupId>
+      <artifactId>jbossts-common</artifactId>
+      <version>4.4.0.CR1</version>
+    </dependency>
+  </dependencies>
+</project>

Added: projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/JBossEJBContainer.java
===================================================================
--- projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/JBossEJBContainer.java	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/JBossEJBContainer.java	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,223 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.embedded;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Map;
+
+import javax.ejb.EJBContainer;
+
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class JBossEJBContainer extends EJBContainer
+{
+   private ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+   
+   // stage 1
+   private BasicBootstrap bootstrap = new BasicBootstrap();
+   private Kernel kernel;
+   private BasicXMLDeployer deployer;
+   
+   // stage 2
+   private MainDeployer mainDeployer;
+   
+   public JBossEJBContainer(Map<?, ?> properties, String... modules) throws Throwable
+   {
+      try
+      {
+         bootstrap.run();
+         kernel = bootstrap.getKernel();
+         deployer = new BasicXMLDeployer(kernel);
+         // bring the main deployer online
+         deploy("META-INF/embedded-bootstrap-beans.xml");
+         
+         // we're at stage 2
+         mainDeployer = getBean("MainDeployer", ControllerState.INSTALLED, MainDeployer.class);
+         
+         deploy("META-INF/ejb-deployers-beans.xml");
+         
+         deploy("META-INF/namingserver-beans.xml");
+         
+         deploy("META-INF/aop-beans.xml");
+         
+         deploy("META-INF/transactionmanager-beans.xml");
+         
+         deploy("META-INF/jpa-deployers-beans.xml");
+         
+         deployMain("ejb3-interceptors-aop.xml");
+         
+         deployModules(modules);
+      }
+      catch(Throwable t)
+      {
+         close();
+         throw t;
+      }
+   }
+   
+   @Override
+   public void close()
+   {
+      if(mainDeployer != null)
+      {
+         mainDeployer.prepareShutdown();
+         mainDeployer.shutdown();
+         mainDeployer = null;
+      }
+      
+      if(deployer != null)
+      {
+         deployer.shutdown();
+         deployer = null;
+      }
+      kernel = null;
+      bootstrap = null;
+   }
+   
+   private KernelDeployment deploy(String name) throws Throwable
+   {
+      return deploy(getResource(name));
+   }
+   
+   private KernelDeployment deploy(URL url) throws Throwable
+   {
+      KernelDeployment deployment = deployer.deploy(url);
+      deployer.validate(deployment);
+      return deployment;
+   }
+   
+   private void deployMain(String name) throws DeploymentException, IllegalArgumentException, MalformedURLException, IOException
+   {
+      URL url = getResource(name);
+      VirtualFile root = VFS.getRoot(url);
+      VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(root);
+      mainDeployer.deploy(deployment);
+      mainDeployer.checkComplete(deployment);
+   }
+   
+   private void deployModules(String modules[]) throws MalformedURLException, IOException, DeploymentException
+   {
+      // TODO: deploy the world!
+      if(modules == null)
+         return;
+      
+      for(String module : modules)
+      {
+         VirtualFile root = VFS.getRoot(new URL(module));
+         VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(root);
+         mainDeployer.deploy(deployment);
+         mainDeployer.checkComplete(deployment);
+      }
+   }
+   
+   /**
+    * Get a bean
+    *
+    * @param name the name of the bean
+    * @param state the state of the bean
+    * @return the bean
+    * @throws IllegalStateException when the bean does not exist at that state
+    */
+   protected Object getBean(final Object name, final ControllerState state) throws IllegalStateException
+   {
+      KernelControllerContext context = getControllerContext(name, state);
+      return context.getTarget();
+   }
+   
+   /**
+    * Get a bean
+    *
+    * @param <T> the expected type
+    * @param name the name of the bean
+    * @param state the state of the bean
+    * @param expected the expected type
+    * @return the bean
+    * @throws ClassCastException when the bean can not be cast to the expected type
+    * @throws IllegalStateException when the bean does not exist at that state
+    */
+   protected <T> T getBean(final Object name, final ControllerState state, final Class<T> expected) throws ClassCastException, IllegalStateException
+   {
+      if (expected == null)
+         throw new IllegalArgumentException("Null expected");
+      Object bean = getBean(name, state);
+      return expected.cast(bean);
+   }
+   
+   /**
+    * Get a context
+    *
+    * @param name the name of the bean
+    * @param state the state of the bean
+    * @return the context
+    * @throws IllegalStateException when the context does not exist at that state
+    */
+   protected KernelControllerContext getControllerContext(final Object name, final ControllerState state) throws IllegalStateException
+   {
+      KernelController controller = kernel.getController();
+      KernelControllerContext context = (KernelControllerContext) controller.getContext(name, state);
+      if (context == null)
+         return handleNotFoundContext(controller, name, state);
+      return context;
+   }
+   
+   private URL getResource(String name) throws IllegalArgumentException
+   {
+      URL url = classLoader.getResource(name);
+      if(url == null)
+         throw new IllegalArgumentException("No resource named " + name + " found on " + classLoader);
+      return url;
+   }
+   
+   /**
+    * Handle not found context.
+    *
+    * @param controller the controller
+    * @param name the name of the bean
+    * @param state the state of the bean
+    * @return the context
+    * @throws IllegalStateException when the context does not exist at that state
+    */
+   protected KernelControllerContext handleNotFoundContext(Controller controller, Object name, ControllerState state) throws IllegalStateException
+   {
+      throw new IllegalStateException("Bean not found " + name + " at state " + state + " in controller " + controller);
+   }
+
+}

Added: projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/JBossEJBContainerProvider.java
===================================================================
--- projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/JBossEJBContainerProvider.java	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/JBossEJBContainerProvider.java	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.embedded;
+
+import java.util.Map;
+
+import javax.ejb.EJBContainer;
+import javax.ejb.EJBException;
+
+import org.jboss.ejb3.api.spi.EJBContainerProvider;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class JBossEJBContainerProvider implements EJBContainerProvider
+{
+   public EJBContainer createEJBContainer(Map<?, ?> properties, String... modules) throws EJBException
+   {
+      try
+      {
+         return new JBossEJBContainer(properties, modules);
+      }
+      catch(Throwable t)
+      {
+         if(t instanceof Error)
+            throw (Error) t;
+         if(t instanceof RuntimeException)
+            throw (RuntimeException) t;
+         if(t instanceof Exception)
+            throw new EJBException((Exception) t);
+         throw new RuntimeException(t);
+      }
+   }
+}

Added: projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbAnnotationMetaDataDeployer.java
===================================================================
--- projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbAnnotationMetaDataDeployer.java	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbAnnotationMetaDataDeployer.java	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.embedded.deployers;
+
+import java.io.IOException;
+import java.lang.reflect.AnnotatedElement;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.deployment.AnnotatedClassFilter;
+import org.jboss.metadata.annotation.creator.ejb.jboss.JBoss50Creator;
+import org.jboss.metadata.annotation.finder.AnnotationFinder;
+import org.jboss.metadata.annotation.finder.DefaultAnnotationFinder;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.spec.EjbJar3xMetaData;
+import org.jboss.metadata.ejb.spec.EjbJarMetaData;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class EjbAnnotationMetaDataDeployer extends AbstractDeployer
+{
+   public static final String EJB_ANNOTATED_ATTACHMENT_NAME = "annotated."+EjbJarMetaData.class.getName();
+
+   public EjbAnnotationMetaDataDeployer()
+   {
+      setStage(DeploymentStages.POST_CLASSLOADER);
+      addInput(EjbJarMetaData.class);
+      addOutput(EJB_ANNOTATED_ATTACHMENT_NAME);
+   }
+   
+   public void deploy(DeploymentUnit unit) throws DeploymentException
+   {
+      if (unit instanceof VFSDeploymentUnit == false)
+         return;
+      
+      VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit) unit;
+      deploy(vfsDeploymentUnit);
+   }
+   
+   protected void deploy(VFSDeploymentUnit unit) throws DeploymentException
+   {
+      boolean isComplete = false;
+      EjbJarMetaData ejbJarMetaData = unit.getAttachment(EjbJarMetaData.class);
+      if(ejbJarMetaData != null && ejbJarMetaData instanceof EjbJar3xMetaData)
+      {
+         isComplete |= ((EjbJar3xMetaData) ejbJarMetaData).isMetadataComplete();
+      }
+      
+      if(isComplete)
+      {
+         log.debug("Deployment is metadata-complete, skipping annotation processing"
+               + ", ejbJarMetaData="+ejbJarMetaData);
+         return;
+      }
+      
+      // why is this?
+      VirtualFile root = unit.getRoot();
+      boolean isLeaf = true;
+      try
+      {
+         isLeaf = root.isLeaf();
+      }
+      catch(IOException ignore)
+      {
+         // ignore
+      }
+      if(isLeaf == true)
+         return;
+
+      List<VirtualFile> classpath = unit.getClassPath();
+      if(classpath == null || classpath.isEmpty())
+         return;
+
+      boolean trace = log.isTraceEnabled();
+      if (trace)
+         log.trace("Deploying annotations for unit: " + unit + ", classpath: " + classpath);
+
+      try
+      {
+         processMetaData(unit, classpath);
+      }
+      catch (Exception e)
+      {
+         throw DeploymentException.rethrowAsDeploymentException("Cannot process metadata", e);
+      }
+   }
+   
+   /**
+    * Get the classes we want to scan.
+    *
+    * @param unit the deployment unit
+    * @param mainClassName the main class name
+    * @param classpath the classpath
+    * @return possible classes containing metadata annotations
+    * @throws IOException for any error
+    */
+   protected Collection<Class<?>> getClasses(VFSDeploymentUnit unit, List<VirtualFile> classpath) throws IOException
+   {
+      Map<VirtualFile, Class<?>> classpathClasses = new HashMap<VirtualFile, Class<?>>();
+      for(VirtualFile path : classpath)
+      {
+         AnnotatedClassFilter classVisitor = new AnnotatedClassFilter(unit, unit.getClassLoader(), path, null);
+         path.visit(classVisitor);
+         Map<VirtualFile, Class<?>> classes = classVisitor.getAnnotatedClasses();
+         if(classes != null && classes.size() > 0)
+         {
+            if(log.isTraceEnabled())
+               log.trace("Annotated classes: " + classes);
+            classpathClasses.putAll(classes);
+         }
+      }
+      return classpathClasses.values();
+   }
+
+   /**
+    * Process annotations.
+    *
+    * @param unit the deployment unit
+    * @param finder the annotation finder
+    * @param classes the candidate classes
+    */
+   protected void processJBossMetaData(VFSDeploymentUnit unit, AnnotationFinder<AnnotatedElement> finder, Collection<Class<?>> classes)
+   {
+      // Create the metadata model from the annotations
+      JBoss50Creator creator = new JBoss50Creator(finder);
+      JBossMetaData annotationMetaData = creator.create(classes);
+      if(annotationMetaData != null)
+         unit.addAttachment(EJB_ANNOTATED_ATTACHMENT_NAME, annotationMetaData, JBossMetaData.class);
+   }
+   
+   protected void processMetaData(VFSDeploymentUnit unit, List<VirtualFile> classpath) throws IOException
+   {
+      Collection<Class<?>> classes = getClasses(unit, classpath);
+      if(classes.size() > 0)
+      {
+         AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+         processJBossMetaData(unit, finder, classes);
+      }
+   }
+}

Added: projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbComponentDeployer.java
===================================================================
--- projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbComponentDeployer.java	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbComponentDeployer.java	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.embedded.deployers;
+
+import java.util.Hashtable;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.Domain;
+import org.jboss.aop.DomainDefinition;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.javaee.JavaEEComponentHelper;
+import org.jboss.ejb3.javaee.JavaEEModule;
+import org.jboss.ejb3.javaee.SimpleJavaEEModule;
+import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class EjbComponentDeployer extends AbstractSimpleRealDeployer<JBossEnterpriseBeanMetaData>
+{
+   public EjbComponentDeployer()
+   {
+      super(JBossEnterpriseBeanMetaData.class);
+      
+      setComponentsOnly(true);
+      
+      addOutput(BeanMetaData.class);
+   }
+
+   protected void addDependencies(BeanMetaDataBuilder builder, DeploymentUnit unit, JBossEnterpriseBeanMetaData metaData)
+   {
+      // TODO: ask something else for that name
+      builder.addDependency("org.jboss.ejb3.deployment:" + unit.getParent().getSimpleName());
+   }
+   
+   @Override
+   public void deploy(DeploymentUnit unit, JBossEnterpriseBeanMetaData metaData) throws DeploymentException
+   {
+      log.info("Found " + metaData + " in " + unit);
+      
+      JavaEEModule module = new SimpleJavaEEModule(unit.getParent().getSimpleName());
+      //unit.getAttachment(JavaEEModule.class);
+      
+      String ejbName = metaData.getEjbName();
+      String componentName = JavaEEComponentHelper.createObjectName(module, ejbName);
+      String componentClassName = metaData.getEjbClass();
+      
+      ClassLoader classLoader = unit.getClassLoader();
+      Domain domain;
+      Hashtable ctxProperties = null;
+      Ejb3Deployment deployment = unit.getAttachment(Ejb3Deployment.class);
+      
+      EJBContainer component;
+      if(metaData instanceof JBossSessionBeanMetaData)
+      {
+         try
+         {
+            boolean stateful = ((JBossSessionBeanMetaData) metaData).isStateful();
+            String domainName = metaData.getAopDomainName();
+            if(domainName == null)
+               domainName = deployment.getDefaultSLSBDomain();
+            DomainDefinition domainDefintion = AspectManager.instance().getContainer(domainName);
+            if(domainDefintion == null)
+               throw new DeploymentException("Can't find domain " + domainName + " for " + componentName);
+            domain = (Domain) domainDefintion.getManager();
+            component = new StatelessContainer(classLoader, componentClassName, ejbName, domain, ctxProperties, deployment, (JBossSessionBeanMetaData) metaData);
+         }
+         catch (ClassNotFoundException e)
+         {
+            throw new DeploymentException("Unable to find class " + componentClassName + " in class loader " + classLoader, e);
+         }
+      }
+      else
+         throw new DeploymentException("Can't deploy " + metaData.getEjbName() + ", " + metaData.getClass() + " is not supported");
+      
+      BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(componentName, component.getClass().getName());
+      builder.setConstructorValue(component);
+      addDependencies(builder, unit, metaData);
+      
+      unit.addAttachment(BeanMetaData.class, builder.getBeanMetaData());
+   }
+}

Copied: projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbMetadataJndiPolicyDecoratorDeployer.java (from rev 78629, trunk/server/src/main/org/jboss/ejb/deployers/EjbMetadataJndiPolicyDecoratorDeployer.java)
===================================================================
--- projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbMetadataJndiPolicyDecoratorDeployer.java	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbMetadataJndiPolicyDecoratorDeployer.java	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,259 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.embedded.deployers;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEntityBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy;
+import org.jboss.metadata.ejb.jboss.jndipolicy.plugins.JBossSessionPolicyDecorator;
+import org.jboss.metadata.ejb.jboss.jndipolicy.plugins.JbossEntityPolicyDecorator;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DefaultJndiBindingPolicy;
+
+/**
+ * EjbMetadataJndiPolicyDecoratorDeployer
+ * 
+ * Decorates merged EJB Metadata with the ability to resolve
+ * JNDI targets as dictated by an optionally-specified
+ * DefaultJndiBindingPolicy
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class EjbMetadataJndiPolicyDecoratorDeployer extends AbstractDeployer
+{
+
+   // ------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   private static final Logger log = Logger.getLogger(EjbMetadataJndiPolicyDecoratorDeployer.class);
+
+   /**
+    * Deployer Output flag signaling that this deployer has been run
+    */
+   public static final String EJB_DECORATED_FLAG = EjbMetadataJndiPolicyDecoratorDeployer.class.getSimpleName();
+
+   // ------------------------------------------------------------------------------||
+   // Constructor ------------------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   /**
+    * Constructor; sets deployment stage and requisite input/output chain
+    */
+   public EjbMetadataJndiPolicyDecoratorDeployer()
+   {
+      // Set the Stage to post-CL
+      this.setStage(DeploymentStages.POST_CLASSLOADER);
+
+      // Input is the JBossMetaData post-merge
+      this.addInput(MergedJBossMetaDataDeployer.EJB_MERGED_ATTACHMENT_NAME);
+
+      // Output is a flag upon which other deployers may rely
+      this.addOutput(EjbMetadataJndiPolicyDecoratorDeployer.EJB_DECORATED_FLAG);
+   }
+
+   // ------------------------------------------------------------------------------||
+   // Required Implementations -----------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   /* (non-Javadoc)
+    * @see org.jboss.deployers.spi.deployer.Deployer#deploy(org.jboss.deployers.structure.spi.DeploymentUnit)
+    */
+   public void deploy(DeploymentUnit du) throws DeploymentException
+   {
+      // Obtain the Merged Metadata
+      JBossMetaData md = du.getAttachment(MergedJBossMetaDataDeployer.EJB_MERGED_ATTACHMENT_NAME, JBossMetaData.class);
+
+      // If metadata's not present as an attachment, return
+      if (md == null)
+      {
+         return;
+      }
+
+      // If this is not an EJB3 Deployment, return
+      if (!md.isEJB3x())
+      {
+         return;
+      }
+
+      // Initialize Map of beans to replace
+      Map<JBossEnterpriseBeanMetaData, JBossEnterpriseBeanMetaData> beansToReplace = new HashMap<JBossEnterpriseBeanMetaData, JBossEnterpriseBeanMetaData>();
+
+      // Obtain defined JNDI Binding Policy
+      String mdJndiPolicyName = md.getJndiBindingPolicy();
+      if (mdJndiPolicyName != null && mdJndiPolicyName.trim().length() == 0)
+      {
+         mdJndiPolicyName = null;
+      }
+      if (mdJndiPolicyName != null)
+      {
+         log.debug(JBossMetaData.class.getSimpleName() + " " + md + " has defined "
+               + DefaultJndiBindingPolicy.class.getSimpleName() + " \"" + mdJndiPolicyName + "\"");
+      }
+
+      // For each of the Enterprise Beans
+      JBossEnterpriseBeansMetaData beans = md.getEnterpriseBeans();
+      for (JBossEnterpriseBeanMetaData bean : beans)
+      {
+         // Initialize a decorated instance
+         JBossEnterpriseBeanMetaData decoratedBean = null;
+
+         // Obtain a Policy
+         DefaultJndiBindingPolicy policy = this.getJndiBindingPolicy(bean, mdJndiPolicyName, du.getClassLoader());
+
+         // If this is a Session or Service Bean
+         if (bean.isSession() || bean.isService())
+         {
+            // Cast
+            assert bean instanceof JBossSessionBeanMetaData : JBossEnterpriseBeanMetaData.class.getSimpleName()
+                  + " representing as Session Bean is not castable to " + JBossSessionBeanMetaData.class.getName();
+            JBossSessionBeanMetaData sessionBean = (JBossSessionBeanMetaData) bean;
+
+            // Create a Session JNDI Policy Decorated Bean
+            decoratedBean = new JBossSessionPolicyDecorator(sessionBean, policy);
+         }
+
+         // If this is an Entity Bean
+         if (bean.isEntity())
+         {
+            // Cast
+            assert bean instanceof JBossEntityBeanMetaData : JBossEnterpriseBeanMetaData.class.getSimpleName()
+                  + " representing as Entity Bean is not castable to " + JBossEntityBeanMetaData.class.getName();
+            JBossEntityBeanMetaData entityBean = (JBossEntityBeanMetaData) bean;
+
+            // Create a Entity JNDI Policy Decorated Bean
+            decoratedBean = new JbossEntityPolicyDecorator(entityBean, policy);
+         }
+
+         // If we've decorated this bean, add to the map of beans to replace
+         if (decoratedBean != null)
+         {
+            beansToReplace.put(bean, decoratedBean);
+         }
+      }
+
+      // Replace with decorated beans
+      for (JBossEnterpriseBeanMetaData beanToReplace : beansToReplace.keySet())
+      {
+         JBossEnterpriseBeanMetaData beanToReplaceWith = beansToReplace.get(beanToReplace);
+         boolean removed = beans.remove(beanToReplace);
+         assert removed : "Remove operation of " + beanToReplace + " from " + beans + " resulted in no action";
+         beans.add(beanToReplaceWith);
+         log.debug("Replaced " + beanToReplace.getEjbName() + " with decorated instance fit with "
+               + DefaultJndiBindingPolicy.class.getSimpleName());
+      }
+
+      // Output
+      du.addAttachment(EjbMetadataJndiPolicyDecoratorDeployer.EJB_DECORATED_FLAG, true, Boolean.class);
+   }
+
+   // ------------------------------------------------------------------------------||
+   // Internal Helper Methods ------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   /**
+    * Obtains the JNDI Binding Policy instance to use for the specified metadata,
+    * defaulting to a BasicJndiBindingPolicy if none is explicitly specified either in
+    * the metadata itself or in its parent deployable unit
+    * 
+    * @param md The Bean Metadata
+    * @param deployableUnitDefaultJndiPolicyClassName The (optional) JNDI Policy declared 
+    *       by the deployable unit (JBossMetaData)
+    * @param cl The Deployable Unit's ClassLoader
+    */
+   protected DefaultJndiBindingPolicy getJndiBindingPolicy(JBossEnterpriseBeanMetaData md,
+         String deployableUnitDefaultJndiPolicyClassName, ClassLoader cl)
+   {
+      // Initialize a JNDI Binding Policy
+      DefaultJndiBindingPolicy policy = null;
+
+      // Obtain JNDI Policy Name defined at the EJB level
+      String beanJndiPolicyName = md.getJndiBindingPolicy();
+      if (beanJndiPolicyName != null && beanJndiPolicyName.trim().length() == 0)
+      {
+         beanJndiPolicyName = null;
+      }
+      if (beanJndiPolicyName != null)
+      {
+         log.debug("Session EJB " + md.getEjbName() + " has defined " + DefaultJndiBindingPolicy.class.getSimpleName()
+               + " of \"" + beanJndiPolicyName);
+      }
+
+      // Use JNDI Policy defined by MD, then override at bean level
+      String jndiPolicyName = deployableUnitDefaultJndiPolicyClassName != null
+            ? deployableUnitDefaultJndiPolicyClassName
+            : beanJndiPolicyName;
+
+      // If JNDI Policy is defined
+      if (jndiPolicyName != null)
+      {
+         // Load the configured JNDI Binding Policy
+         Class<?> policyClass = null;
+         try
+         {
+            policyClass = Class.forName(jndiPolicyName, true, cl);
+         }
+         catch (ClassNotFoundException cnfe)
+         {
+            throw new RuntimeException("Could not find defined JNDI Binding Policy Class: " + jndiPolicyName, cnfe);
+         }
+
+         // Instanciate the configured JNDI Binding Policy
+         try
+         {
+            policy = (DefaultJndiBindingPolicy) policyClass.newInstance();
+         }
+         catch (Throwable t)
+         {
+            throw new RuntimeException("Error in instanciating defined JNDI Binding Policy Class: " + jndiPolicyName, t);
+         }
+
+         // Log
+         log.debug("Using " + DefaultJndiBindingPolicy.class.getSimpleName() + " \"" + policy.getClass().getName()
+               + "\" for Session Bean " + md.getEjbName());
+      }
+
+      // If no JNDI Binding Policy was defined
+      if (policy == null)
+      {
+         // Default to BasicJndiBindingPolicy
+         policy = new BasicJndiBindingPolicy();
+         log.warn("Defaulting to " + DefaultJndiBindingPolicy.class.getSimpleName() + " of \""
+               + BasicJndiBindingPolicy.class.getName() + "\" for Session Bean " + md.getEjbName());
+      }
+
+      // Return
+      return policy;
+   }
+
+}

Added: projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbModuleDeployer.java
===================================================================
--- projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbModuleDeployer.java	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbModuleDeployer.java	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.embedded.deployers;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.beans.metadata.api.annotations.Start;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployerWithInput;
+import org.jboss.deployers.spi.deployer.helpers.DeploymentVisitor;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.DeploymentScope;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar;
+import org.jboss.ejb3.common.registrar.spi.Ejb3Registrar;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.embedded.deployment.EjbDeployment;
+import org.jboss.ejb3.embedded.deployment.EmbeddedEjb3DeploymentUnit;
+import org.jboss.kernel.Kernel;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class EjbModuleDeployer extends AbstractRealDeployerWithInput<JBossMetaData>
+{
+   @Deprecated
+   private Kernel kernel;
+   
+   public EjbModuleDeployer()
+   {
+      //addInput(EjbMetadataJndiPolicyDecoratorDeployer.EJB_DECORATED_FLAG);
+      
+      setDeploymentVisitor(new EjbDeploymentVisitor());
+      
+      addOutput(JBossEnterpriseBeanMetaData.class);
+      addOutput(BeanMetaData.class);
+   }
+   
+   private static Ejb3Deployment createModule(DeploymentUnit unit, JBossMetaData metaData)
+   {
+      org.jboss.ejb3.DeploymentUnit ejb3Unit = new EmbeddedEjb3DeploymentUnit(unit);
+      DeploymentScope scope = null;
+      return new EjbDeployment(unit, ejb3Unit, scope, metaData);
+   }
+   
+   private class EjbDeploymentVisitor implements DeploymentVisitor<JBossMetaData>
+   {
+      public void deploy(DeploymentUnit unit, JBossMetaData metaData) throws DeploymentException
+      {
+         log.info("Found " + metaData + " in " + unit);
+         
+         Ejb3Deployment module = createModule(unit, metaData);
+         unit.addAttachment(Ejb3Deployment.class, module);
+         
+         BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("org.jboss.ejb3.deployment:" + unit.getSimpleName(), module.getClass().getName());
+         builder.setConstructorValue(module);
+         unit.addAttachment(BeanMetaData.class, builder.getBeanMetaData());
+         
+         for(JBossEnterpriseBeanMetaData bean : metaData.getEnterpriseBeans())
+         {
+            DeploymentUnit component = unit.addComponent(bean.getEjbName());
+            component.addAttachment(JBossEnterpriseBeanMetaData.class, bean);
+         }
+      }
+
+      public Class<JBossMetaData> getVisitorType()
+      {
+         return JBossMetaData.class;
+      }
+
+      public void undeploy(DeploymentUnit unit, JBossMetaData metaData)
+      {
+         for(JBossEnterpriseBeanMetaData bean : metaData.getEnterpriseBeans())
+         {
+            unit.removeComponent(bean.getEjbName());
+         }
+         unit.removeAttachment(Ejb3Deployment.class);
+      }
+   }
+   
+   @Inject(bean="jboss.kernel:service=Kernel")
+   public void setKernel(Kernel kernel)
+   {
+      this.kernel = kernel;
+   }
+   
+   /**
+    * LifeCycle Start
+    * 
+    * Responsible for Binding an MC-based EJB3 Registrar Object Store
+    * 
+    * @author ALR
+    * @throws Throwable
+    */
+   @Start
+   public void start() throws Throwable
+   {
+      // FIXME: do all this stuff in beans.xml
+      
+      // Bind an EJB3 Registrar Implementation if not already bound
+      if (!Ejb3RegistrarLocator.isRegistrarBound())
+      {
+         // Obtain the Kernel
+         Kernel sanders = this.kernel;
+         assert sanders != null : Kernel.class.getSimpleName() + " must be provided in order to bind "
+               + Ejb3Registrar.class.getSimpleName();
+
+         // Create an EJB3 Registrar
+         Ejb3Registrar registrar = new Ejb3McRegistrar(sanders);
+
+         // Bind Registrar to the Locator
+         Ejb3RegistrarLocator.bindRegistrar(registrar);
+         
+         // Log
+         log.debug("Bound " + Ejb3Registrar.class.getSimpleName() + " to static "
+               + Ejb3RegistrarLocator.class.getSimpleName());
+      }
+   }
+}

Copied: projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbParsingDeployer.java (from rev 78629, trunk/server/src/main/org/jboss/deployment/EjbParsingDeployer.java)
===================================================================
--- projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbParsingDeployer.java	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbParsingDeployer.java	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * 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.embedded.deployers;
+
+import org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer;
+import org.jboss.metadata.ejb.spec.EjbJarMetaData;
+
+/**
+ * An ObjectModelFactoryDeployer for translating ejb-jar.xml descriptors into
+ * ApplicationMetaData instances.
+ * 
+ * Minus the JMX interface for embedded usage.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision$
+ */
+//@JMX(name="jboss.ejb:service=EjbParsingDeployer", exposedInterface=EjbParsingDeployerMBean.class)
+public class EjbParsingDeployer extends SchemaResolverDeployer<EjbJarMetaData>// implements EjbParsingDeployerMBean
+{
+   /**
+    * Create a new EjbParsingDeployer.
+    */
+   public EjbParsingDeployer()
+   {
+      super(EjbJarMetaData.class);
+      setName("ejb-jar.xml");
+   }
+}

Added: projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbSomethingDeployer.java
===================================================================
--- projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbSomethingDeployer.java	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbSomethingDeployer.java	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.embedded.deployers;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
+import org.jboss.deployers.spi.deployer.helpers.DeploymentVisitor;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+
+/**
+ * I still don't get AbstractComponentDeployer.
+ * 
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Deprecated
+public class EjbSomethingDeployer extends AbstractComponentDeployer<JBossMetaData, JBossEnterpriseBeanMetaData>
+{
+   public EjbSomethingDeployer()
+   {
+      setComponentVisitor(new EjbComponentVisitor());
+      setDeploymentVisitor(new EjbDeploymentVisitor());
+   }
+   
+   // TODO: what is this thing?
+   private class EjbComponentVisitor implements DeploymentVisitor<JBossEnterpriseBeanMetaData>
+   {
+      public void deploy(DeploymentUnit unit, JBossEnterpriseBeanMetaData deployment) throws DeploymentException
+      {
+         System.err.println("Found " + deployment);
+      }
+
+      public Class<JBossEnterpriseBeanMetaData> getVisitorType()
+      {
+         return JBossEnterpriseBeanMetaData.class;
+      }
+
+      public void undeploy(DeploymentUnit unit, JBossEnterpriseBeanMetaData deployment)
+      {
+      }
+   }
+   
+   private static class EjbDeploymentVisitor implements DeploymentVisitor<JBossMetaData>
+   {
+      public void deploy(DeploymentUnit unit, JBossMetaData deployment) throws DeploymentException
+      {
+         for(JBossEnterpriseBeanMetaData bean : deployment.getEnterpriseBeans())
+         {
+            DeploymentUnit component = unit.addComponent(bean.getEjbName());
+            component.addAttachment(JBossEnterpriseBeanMetaData.class, bean);
+         }
+      }
+
+      public Class<JBossMetaData> getVisitorType()
+      {
+         return JBossMetaData.class;
+      }
+
+      public void undeploy(DeploymentUnit unit, JBossMetaData deployment)
+      {
+         for(JBossEnterpriseBeanMetaData bean : deployment.getEnterpriseBeans())
+         {
+            unit.removeComponent(bean.getEjbName());
+         }
+      }
+   }
+}

Added: projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/JBossEjbParsingDeployer.java
===================================================================
--- projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/JBossEjbParsingDeployer.java	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/JBossEjbParsingDeployer.java	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.embedded.deployers;
+
+import org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+
+/**
+ * A trimmed down jboss.xml parsing deployer.
+ * 
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class JBossEjbParsingDeployer extends SchemaResolverDeployer<JBossMetaData>
+{
+   public JBossEjbParsingDeployer()
+   {
+      super(JBossMetaData.class);
+      setName("jboss.xml");
+   }
+}

Copied: projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/MergedJBossMetaDataDeployer.java (from rev 78629, trunk/server/src/main/org/jboss/ejb/deployers/MergedJBossMetaDataDeployer.java)
===================================================================
--- projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/MergedJBossMetaDataDeployer.java	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/MergedJBossMetaDataDeployer.java	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,132 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * 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.embedded.deployers;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.ear.jboss.JBossAppMetaData;
+import org.jboss.metadata.ejb.jboss.JBoss50MetaData;
+import org.jboss.metadata.ejb.jboss.JBossAssemblyDescriptorMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.spec.EjbJarMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
+
+/**
+ * A deployer that merges annotation metadata, xml metadata, and jboss metadata
+ * into a merged JBossMetaData. It also incorporates ear level overrides from
+ * the top level JBossAppMetaData attachment.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
+ * @version $Revision$
+ */
+public class MergedJBossMetaDataDeployer extends AbstractDeployer
+{
+   public static final String EJB_MERGED_ATTACHMENT_NAME = "merged."+JBossMetaData.class.getName();
+
+   /**
+    * Create a new JBossEjbParsingDeployer.
+    */
+   public MergedJBossMetaDataDeployer()
+   {
+      setStage(DeploymentStages.POST_CLASSLOADER);
+      // ejb-jar.xml metadata
+      addInput(EjbJarMetaData.class);
+      // jboss.xml metadata
+      addInput(JBossMetaData.class);
+      // annotated metadata view
+      addInput(EjbAnnotationMetaDataDeployer.EJB_ANNOTATED_ATTACHMENT_NAME);
+      // Output is the merge JBossMetaData view
+      setOutput(JBossMetaData.class);
+      // 
+      addOutput(EJB_MERGED_ATTACHMENT_NAME);
+   }
+
+   public void deploy(DeploymentUnit unit) throws DeploymentException
+   {
+      EjbJarMetaData ejbJarMetaData = unit.getAttachment(EjbJarMetaData.class);
+      JBossMetaData metaData = unit.getAttachment(JBossMetaData.class);
+      // Check for an annotated view
+      String key = EjbAnnotationMetaDataDeployer.EJB_ANNOTATED_ATTACHMENT_NAME;
+      JBossMetaData annotatedMetaData = unit.getAttachment(key, JBossMetaData.class);
+      if(ejbJarMetaData == null && metaData == null && annotatedMetaData == null)
+         return;
+
+      JBossMetaData specMetaData = new JBoss50MetaData();
+      if(ejbJarMetaData != null)
+      {
+         specMetaData.merge(null, ejbJarMetaData);
+         if(annotatedMetaData != null)
+         {
+            JBossMetaData specMerged = new JBoss50MetaData();
+            specMerged.merge(specMetaData, annotatedMetaData);
+            specMetaData = specMerged;
+         }
+      }
+      else
+         specMetaData = annotatedMetaData;
+
+      
+      // Create a merged view
+      JBossMetaData mergedMetaData = new JBoss50MetaData();
+      mergedMetaData.merge(metaData, specMetaData);
+      // Incorporate any ear level overrides
+      DeploymentUnit topUnit = unit.getTopLevel();
+      if(topUnit != null && topUnit.getAttachment(JBossAppMetaData.class) != null)
+      {
+         JBossAppMetaData earMetaData = topUnit.getAttachment(JBossAppMetaData.class);
+         // Security domain
+         String securityDomain = earMetaData.getSecurityDomain();
+         if(securityDomain != null && mergedMetaData.getSecurityDomain() == null)
+            mergedMetaData.setSecurityDomain(securityDomain);
+         //Security Roles
+         SecurityRolesMetaData earSecurityRolesMetaData = earMetaData.getSecurityRoles();
+         if(earSecurityRolesMetaData != null)
+         {
+            JBossAssemblyDescriptorMetaData jadmd = mergedMetaData.getAssemblyDescriptor();
+            if( jadmd == null)
+            {
+               jadmd = new JBossAssemblyDescriptorMetaData();
+               mergedMetaData.setAssemblyDescriptor(jadmd); 
+            }
+            
+            SecurityRolesMetaData mergedSecurityRolesMetaData = jadmd.getSecurityRoles(); 
+            if(mergedSecurityRolesMetaData == null)
+               jadmd.setSecurityRoles(earSecurityRolesMetaData);
+            
+            //perform a merge to rebuild the principalVersusRolesMap
+            if(mergedSecurityRolesMetaData != null )
+            {
+                mergedSecurityRolesMetaData.merge(mergedSecurityRolesMetaData, 
+                     earSecurityRolesMetaData);
+            }
+        }
+      }
+
+      // Output the merged JBossMetaData
+      unit.getTransientManagedObjects().addAttachment(JBossMetaData.class, mergedMetaData);
+      unit.addAttachment(EJB_MERGED_ATTACHMENT_NAME, mergedMetaData, JBossMetaData.class);
+   }
+
+}

Added: projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/SimpleClassLoaderDeployer.java
===================================================================
--- projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/SimpleClassLoaderDeployer.java	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/SimpleClassLoaderDeployer.java	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.embedded.deployers;
+
+import org.jboss.deployers.spi.deployer.helpers.AbstractTopLevelClassLoaderDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class SimpleClassLoaderDeployer extends AbstractTopLevelClassLoaderDeployer
+{
+   @Override
+   protected ClassLoader createTopLevelClassLoader(DeploymentUnit unit) throws Exception
+   {
+      return Thread.currentThread().getContextClassLoader();
+   }
+}

Added: projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployment/EjbDeployment.java
===================================================================
--- projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployment/EjbDeployment.java	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployment/EjbDeployment.java	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.embedded.deployment;
+
+import javax.security.jacc.PolicyConfiguration;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.ejb3.DependencyPolicy;
+import org.jboss.ejb3.DeploymentScope;
+import org.jboss.ejb3.DeploymentUnit;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.javaee.JavaEEComponent;
+import org.jboss.ejb3.pool.PoolFactoryRegistry;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class EjbDeployment extends Ejb3Deployment
+{
+   /**
+    * @param deploymentUnit
+    * @param unit
+    * @param deploymentScope
+    * @param metaData
+    */
+   public EjbDeployment(org.jboss.deployers.structure.spi.DeploymentUnit deploymentUnit, DeploymentUnit unit,
+         DeploymentScope deploymentScope, JBossMetaData metaData)
+   {
+      super(deploymentUnit, unit, deploymentScope, metaData);
+   }
+
+   @Override
+   public void create() throws Exception
+   {
+      // make sure we don't invoke legacy stuff
+      System.err.println("******************");
+   }
+   
+   public DependencyPolicy createDependencyPolicy(JavaEEComponent component)
+   {
+      //throw new RuntimeException("NYI");
+      return null;
+   }
+
+   protected PolicyConfiguration createPolicyConfiguration() throws Exception
+   {
+      throw new RuntimeException("NYI");
+   }
+
+   @Override
+   public void destroy()
+   {
+      // make sure we don't invoke legacy stuff
+   }
+   
+   protected void putJaccInService(PolicyConfiguration pc, DeploymentUnit unit)
+   {
+      throw new RuntimeException("NYI");
+   }
+
+   @Inject
+   @Override
+   public void setPoolFactoryRegistry(PoolFactoryRegistry poolFactoryRegistry)
+   {
+      super.setPoolFactoryRegistry(poolFactoryRegistry);
+   }
+   
+   @Override
+   public void start() throws Exception
+   {
+      // make sure we don't invoke legacy stuff
+   }
+   
+   @Override
+   public void stop()
+   {
+      // make sure we don't invoke legacy stuff
+   }
+}

Added: projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployment/EmbeddedEjb3DeploymentUnit.java
===================================================================
--- projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployment/EmbeddedEjb3DeploymentUnit.java	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployment/EmbeddedEjb3DeploymentUnit.java	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,241 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.embedded.deployment;
+
+import java.net.URL;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.ejb3.DeploymentUnit;
+import org.jboss.ejb3.interceptor.InterceptorInfoRepository;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * A wrapper around the MC DeploymentUnit.
+ * 
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Deprecated
+public class EmbeddedEjb3DeploymentUnit implements DeploymentUnit
+{
+   private org.jboss.deployers.structure.spi.DeploymentUnit unit;
+
+   public EmbeddedEjb3DeploymentUnit(org.jboss.deployers.structure.spi.DeploymentUnit unit)
+   {
+      this.unit = unit;
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#addAttachment(java.lang.String, java.lang.Object)
+    */
+   public Object addAttachment(String name, Object attachment)
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getAttachment(java.lang.String)
+    */
+   public Object getAttachment(String name)
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getClassLoader()
+    */
+   public ClassLoader getClassLoader()
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getClasses()
+    */
+   public List<Class> getClasses()
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getDefaultEntityManagerName()
+    */
+   public String getDefaultEntityManagerName()
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getDefaultPersistenceProperties()
+    */
+   public Map getDefaultPersistenceProperties()
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getEjbJarXml()
+    */
+   public URL getEjbJarXml()
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getInterceptorInfoRepository()
+    */
+   public InterceptorInfoRepository getInterceptorInfoRepository()
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getJbossXml()
+    */
+   public URL getJbossXml()
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+   @SuppressWarnings("unchecked")
+   public Hashtable getJndiProperties()
+   {
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getMetaDataFile(java.lang.String)
+    */
+   public VirtualFile getMetaDataFile(String string)
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getPersistenceXml()
+    */
+   public URL getPersistenceXml()
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getRelativePath()
+    */
+   public String getRelativePath()
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getRelativeURL(java.lang.String)
+    */
+   public URL getRelativeURL(String path)
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getResourceLoader()
+    */
+   public ClassLoader getResourceLoader()
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getResources(org.jboss.virtual.VirtualFileFilter)
+    */
+   public List<VirtualFile> getResources(VirtualFileFilter filter)
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getRootFile()
+    */
+   public VirtualFile getRootFile()
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+   public String getShortName()
+   {
+      return unit.getSimpleName();
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#getUrl()
+    */
+   public URL getUrl()
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.DeploymentUnit#removeAttachment(java.lang.String)
+    */
+   public Object removeAttachment(String name)
+   {
+      // TODO Auto-generated method stub
+      //return null;
+      throw new RuntimeException("NYI");
+   }
+
+}

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

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

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

Copied: projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/service/SimpleTransactionService.java (from rev 78632, projects/ejb3/trunk/transactions/src/test/java/org/jboss/ejb3/test/tx/common/SimpleTransactionService.java)
===================================================================
--- projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/service/SimpleTransactionService.java	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/service/SimpleTransactionService.java	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.embedded.service;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import com.arjuna.ats.jta.utils.JNDIManager;
+
+/**
+ * Bind a JTA TransactionManager into JNDI.
+ * 
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class SimpleTransactionService
+{
+   public void start() throws Exception
+   {
+      JNDIManager.bindJTAImplementation();
+   }
+   
+   public void stop() throws NamingException
+   {
+      InitialContext ctx = new InitialContext();
+      ctx.unbind("java:/TransactionManager");
+   }
+}

Added: projects/ejb3/trunk/embedded/src/main/resources/META-INF/aop-beans.xml
===================================================================
--- projects/ejb3/trunk/embedded/src/main/resources/META-INF/aop-beans.xml	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/resources/META-INF/aop-beans.xml	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <bean name="AspectManager" class="org.jboss.aop.AspectManager">
+      <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
+   </bean>
+   
+   <bean name="AspectAppParsingDeployer" class="org.jboss.aop.deployers.AspectAppParsingDeployer"/>
+   <bean name="AspectDeployer" class="org.jboss.aop.deployers.AspectDeployer">
+      <property name="aspectManager"><inject bean="AspectManager"/></property>
+   </bean>
+</deployment>
\ No newline at end of file

Added: projects/ejb3/trunk/embedded/src/main/resources/META-INF/ejb-deployers-beans.xml
===================================================================
--- projects/ejb3/trunk/embedded/src/main/resources/META-INF/ejb-deployers-beans.xml	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/resources/META-INF/ejb-deployers-beans.xml	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <!-- TODO: move SchemaResolverConfig to a more general beans.xml -->
+   <bean name="SchemaResolverConfig" class="org.jboss.xb.binding.sunday.unmarshalling.SchemaResolverConfig">
+      <property name="bindingClassesByLocations">
+         <map keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry>
+               <key>ejb-jar_3_0.xsd</key>
+               <value>org.jboss.metadata.ejb.spec.EjbJar30MetaData</value>
+            </entry>
+            <entry>
+               <key>jboss_5_0.xsd</key>
+               <value>org.jboss.metadata.ejb.jboss.JBoss50MetaData</value>
+            </entry>
+            <entry>
+               <key>persistence_1_0.xsd</key>
+               <value>org.jboss.metadata.jpa.spec.PersistenceMetaData</value>
+            </entry>
+         </map>
+      </property>
+   </bean>
+   
+   <bean name="EjbParsingDeployer" class="org.jboss.ejb3.embedded.deployers.EjbParsingDeployer"/>
+   <bean name="JBossEjbParsingDeployer" class="org.jboss.ejb3.embedded.deployers.JBossEjbParsingDeployer"/>
+   <bean name="EjbAnnotationMetaDataDeployer" class="org.jboss.ejb3.embedded.deployers.EjbAnnotationMetaDataDeployer"/>
+   
+   <bean name="MergedJBossMetaDataDeployer" class="org.jboss.ejb3.embedded.deployers.MergedJBossMetaDataDeployer"/>
+   
+   <bean name="EjbMetadataJndiPolicyDecoratorDeployer" class="org.jboss.ejb3.embedded.deployers.EjbMetadataJndiPolicyDecoratorDeployer"/>
+   
+   <bean name="EjbModuleDeployer" class="org.jboss.ejb3.embedded.deployers.EjbModuleDeployer"/>
+   <bean name="EjbComponentDeployer" class="org.jboss.ejb3.embedded.deployers.EjbComponentDeployer"/>
+
+   <bean name="MessageDestinationReferenceResolver" class="org.jboss.ejb3.embedded.resolvers.EmbeddedMessageDestinationReferenceResolver"/>
+   
+   <!-- 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>
+   
+   <!-- SLSB JNDI Registrar -->
+   <bean name="org.jboss.ejb3.JndiRegistrar.Session.SLSBJndiRegistrar"
+      class="org.jboss.ejb3.proxy.jndiregistrar.JndiStatelessSessionRegistrar">
+      <constructor>
+         <parameter>
+            org.jboss.ejb3.proxy.objectfactory.session.stateless.StatelessSessionProxyObjectFactory
+         </parameter>
+      </constructor>
+   </bean>
+
+</deployment>
\ No newline at end of file

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

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

Added: projects/ejb3/trunk/embedded/src/main/resources/META-INF/namingserver-beans.xml
===================================================================
--- projects/ejb3/trunk/embedded/src/main/resources/META-INF/namingserver-beans.xml	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/resources/META-INF/namingserver-beans.xml	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <!-- JNDI -->
+   <bean name="NamingServer" class="org.jnp.server.SingletonNamingServer"/>
+   
+   <bean name="JavaCompInitializer" class="org.jboss.naming.JavaCompInitializer">
+      <depends>NamingServer</depends>
+   </bean>
+</deployment>
\ No newline at end of file

Added: projects/ejb3/trunk/embedded/src/main/resources/META-INF/services/org.jboss.ejb3.api.spi.EJBContainerProvider
===================================================================
--- projects/ejb3/trunk/embedded/src/main/resources/META-INF/services/org.jboss.ejb3.api.spi.EJBContainerProvider	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/resources/META-INF/services/org.jboss.ejb3.api.spi.EJBContainerProvider	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1 @@
+org.jboss.ejb3.embedded.JBossEJBContainerProvider
\ No newline at end of file

Added: projects/ejb3/trunk/embedded/src/main/resources/META-INF/transactionmanager-beans.xml
===================================================================
--- projects/ejb3/trunk/embedded/src/main/resources/META-INF/transactionmanager-beans.xml	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/resources/META-INF/transactionmanager-beans.xml	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <!-- JTA -->
+   <bean name="TransactionManager" class="org.jboss.ejb3.embedded.service.SimpleTransactionService">
+      <depends>NamingServer</depends>
+   </bean>
+</deployment>

Added: projects/ejb3/trunk/embedded/src/main/resources/jndi.properties
===================================================================
--- projects/ejb3/trunk/embedded/src/main/resources/jndi.properties	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/main/resources/jndi.properties	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,2 @@
+java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

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

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

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

Added: projects/ejb3/trunk/embedded/src/test/java/org/jboss/ejb3/embedded/test/stateless/unit/GreeterTestCase.java
===================================================================
--- projects/ejb3/trunk/embedded/src/test/java/org/jboss/ejb3/embedded/test/stateless/unit/GreeterTestCase.java	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/test/java/org/jboss/ejb3/embedded/test/stateless/unit/GreeterTestCase.java	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.embedded.test.stateless.unit;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URL;
+import java.util.Date;
+import java.util.Properties;
+
+import javax.ejb.EJBContainer;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.ejb3.embedded.test.stateless.Greeter;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class GreeterTestCase
+{
+   @AfterClass
+   public static void afterClass()
+   {
+      EJBContainer current = EJBContainer.getCurrentEJBContainer();
+      if(current != null)
+         current.close();
+   }
+   
+   @BeforeClass
+   public static void beforeClass()
+   {
+      Properties properties = new Properties();
+      String module = getURLToTestClasses();
+      EJBContainer.createEJBContainer(properties, module);
+   }
+   
+   private static String getURLToTestClasses()
+   {
+      String p = "org/jboss/ejb3/embedded/test";
+      URL url = Thread.currentThread().getContextClassLoader().getResource(p);
+      String s = url.toString();
+      return s.substring(0, s.length() - p.length());
+   }
+   
+   @Test
+   public void test1() throws NamingException
+   {
+      InitialContext ctx = new InitialContext();
+      Greeter greeter = (Greeter) ctx.lookup("GreeterBean/local");
+      String now = new Date().toString();
+      String actual = greeter.sayHi(now);
+      assertEquals("Hi " + now, actual);
+   }
+   
+   @Test
+   public void testGreeter2() throws NamingException
+   {
+      InitialContext ctx = new InitialContext();
+      Greeter greeter = (Greeter) ctx.lookup("Greeter2/local");
+      String now = new Date().toString();
+      String actual = greeter.sayHi(now);
+      assertEquals("Hi " + now, actual);
+   }
+}

Added: projects/ejb3/trunk/embedded/src/test/resources/META-INF/ejb-jar.xml
===================================================================
--- projects/ejb3/trunk/embedded/src/test/resources/META-INF/ejb-jar.xml	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/test/resources/META-INF/ejb-jar.xml	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar
+        xmlns="http://java.sun.com/xml/ns/javaee"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+                            http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+        version="3.0">
+   <display-name>test</display-name>
+   <enterprise-beans>
+      <session>
+         <ejb-name>Greeter2</ejb-name>
+         <business-local>org.jboss.ejb3.embedded.test.stateless.Greeter</business-local>
+         <ejb-class>org.jboss.ejb3.embedded.test.stateless.GreeterBean2</ejb-class>
+      </session>
+   </enterprise-beans>
+</ejb-jar>
\ No newline at end of file

Added: projects/ejb3/trunk/embedded/src/test/resources/log4j.xml
===================================================================
--- projects/ejb3/trunk/embedded/src/test/resources/log4j.xml	                        (rev 0)
+++ projects/ejb3/trunk/embedded/src/test/resources/log4j.xml	2008-09-17 17:39:55 UTC (rev 78652)
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 68671 2008-01-08 10:04:25Z wolfc $ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+  <!-- ================================= -->
+  <!-- Preserve messages in a local file -->
+  <!-- ================================= -->
+
+  <!-- A time/date based rolling appender -->
+  <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+    <param name="File" value="target/test.log"/>
+    <param name="Append" value="false"/>
+
+    <!-- Rollover at midnight each day -->
+    <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+    <!-- Rollover at the top of each hour
+    <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+    -->
+
+    <layout class="org.apache.log4j.PatternLayout">
+      <!-- The default pattern: Date Priority [Category] Message\n -->
+      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+
+      <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+      <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+       -->
+    </layout>	    
+  </appender>
+
+  <!-- A size based file rolling appender
+  <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+    <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
+    <param name="Append" value="false"/>
+    <param name="MaxFileSize" value="500KB"/>
+    <param name="MaxBackupIndex" value="1"/>
+
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+    </layout>	    
+  </appender>
+  -->
+
+  <!-- ============================== -->
+  <!-- Append messages to the console -->
+  <!-- ============================== -->
+
+  <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+    <param name="Target" value="System.out"/>
+    <param name="Threshold" value="INFO"/>
+
+    <layout class="org.apache.log4j.PatternLayout">
+      <!-- The default pattern: Date Priority [Category] Message\n -->
+      <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+    </layout>
+  </appender>
+
+
+  <!-- ================ -->
+  <!-- Limit categories -->
+  <!-- ================ -->
+
+  <!-- Limit JBoss categories to INFO
+  <category name="org.jboss">
+    <priority value="INFO" class="org.jboss.logging.XLevel"/>
+  </category>
+  -->
+
+  <!-- Increase the priority threshold for the DefaultDS category
+  <category name="DefaultDS">
+    <priority value="FATAL"/>
+  </category>
+  -->
+
+  <!-- Decrease the priority threshold for the org.jboss.varia category
+  <category name="org.jboss.varia">
+    <priority value="DEBUG"/>
+  </category>
+  -->
+
+  <!--
+     | An example of enabling the custom TRACE level priority that is used
+     | by the JBoss internals to diagnose low level details. This example
+     | turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
+     | subpackages. This will produce A LOT of logging output.
+  <category name="org.jboss.system">
+    <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+  </category>
+  -->
+
+  <category name="org.jboss.aop">
+    <priority value="WARN"/>
+  </category>
+  
+  <category name="org.jboss">
+    <priority value="DEBUG"/>
+  </category>
+  
+  <category name="org.jboss.xb">
+    <priority value="INFO"/>
+  </category>
+  
+  <!-- 
+  Unnecessary, EJB3 is exposed as DEBUG
+  <category name="org.jboss.ejb3.interceptors.aop.DomainClassLoader">
+    <priority value="DEBUG"/>
+  </category>   -->
+  
+  <category name="org.jboss.ejb3">
+    <priority value="ALL"/>
+  </category>
+  
+  <!-- ======================= -->
+  <!-- Setup the Root category -->
+  <!-- ======================= -->
+
+  <root>
+    <priority value="ALL" />
+    <appender-ref ref="CONSOLE"/>
+    <appender-ref ref="FILE"/>
+  </root>
+  
+</log4j:configuration>




More information about the jboss-cvs-commits mailing list