[jboss-cvs] JBossAS SVN: r89434 - in projects/reloaded/trunk: injection and 28 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 26 08:27:22 EDT 2009


Author: wolfc
Date: 2009-05-26 08:27:22 -0400 (Tue, 26 May 2009)
New Revision: 89434

Added:
   projects/reloaded/trunk/injection/
   projects/reloaded/trunk/injection/.classpath
   projects/reloaded/trunk/injection/.project
   projects/reloaded/trunk/injection/.settings/
   projects/reloaded/trunk/injection/.settings/org.eclipse.jdt.core.prefs
   projects/reloaded/trunk/injection/.settings/org.maven.ide.eclipse.prefs
   projects/reloaded/trunk/injection/pom.xml
   projects/reloaded/trunk/injection/src/
   projects/reloaded/trunk/injection/src/main/
   projects/reloaded/trunk/injection/src/main/java/
   projects/reloaded/trunk/injection/src/main/java/org/
   projects/reloaded/trunk/injection/src/main/java/org/jboss/
   projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/
   projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/
   projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/ManagedBeanFactory.java
   projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/ManagedBeanFactoryBuilder.java
   projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/ManagedBeanInstance.java
   projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/deployer/
   projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/deployer/ManagedBeanDeployer.java
   projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/deployer/ManagedBeanDeploymentDeployer.java
   projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/metadata/
   projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/metadata/ManagedBeanJarMetaData.java
   projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/metadata/ManagedBeanMetaData.java
   projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/naming/
   projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/naming/Binder.java
   projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/naming/ValueBinder.java
   projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/spi/
   projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/spi/PersistenceUnitDependencyResolver.java
   projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/spi/Resolver.java
   projects/reloaded/trunk/injection/src/main/resources/
   projects/reloaded/trunk/injection/src/test/
   projects/reloaded/trunk/injection/src/test/java/
   projects/reloaded/trunk/injection/src/test/java/org/
   projects/reloaded/trunk/injection/src/test/java/org/jboss/
   projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/
   projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/
   projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/
   projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/apache/
   projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/apache/InstanceManager.java
   projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/apache/MyServlet.java
   projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/apache/MySessionBean.java
   projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/apache/unit/
   projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/apache/unit/SimpleServletTestCase.java
   projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/common/
   projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/common/ManagedBean.java
   projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/simple/
   projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/simple/SimpleResourceBean.java
   projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/simple/unit/
   projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/simple/unit/SimpleResourceTestCase.java
   projects/reloaded/trunk/injection/src/test/resources/
   projects/reloaded/trunk/injection/src/test/resources/conf/
   projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap.xml
   projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/
   projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/classloader.xml
   projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/deployers.xml
   projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/mb-deployer.xml
   projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/naming.xml
   projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/pojo.xml
   projects/reloaded/trunk/injection/src/test/resources/jndi.properties
   projects/reloaded/trunk/injection/src/test/resources/log4j.xml
   projects/reloaded/trunk/injection/src/test/resources/simple/
   projects/reloaded/trunk/injection/src/test/resources/simple/jboss-mb.xml
Log:
RELOADED-8: initial draft code


Property changes on: projects/reloaded/trunk/injection
___________________________________________________________________
Name: svn:ignore
   + target
eclipse-target


Added: projects/reloaded/trunk/injection/.classpath
===================================================================
--- projects/reloaded/trunk/injection/.classpath	                        (rev 0)
+++ projects/reloaded/trunk/injection/.classpath	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,9 @@
+<classpath>
+  <classpathentry kind="src" path="src/test/java" output="eclipse-target/test-classes" including="**/*.java"/>
+  <classpathentry kind="src" path="src/test/resources" output="eclipse-target/test-classes" excluding="**/*.java"/>
+  <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
+  <classpathentry kind="src" path="src/main/resources" 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/reloaded/trunk/injection/.project
===================================================================
--- projects/reloaded/trunk/injection/.project	                        (rev 0)
+++ projects/reloaded/trunk/injection/.project	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,17 @@
+<projectDescription>
+  <name>jboss-reloaded-injection</name>
+  <comment>JSR-250 compliant injection on top of VDF</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/reloaded/trunk/injection/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/reloaded/trunk/injection/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ projects/reloaded/trunk/injection/.settings/org.eclipse.jdt.core.prefs	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,5 @@
+#Mon May 11 11:09:17 CEST 2009
+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/reloaded/trunk/injection/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/reloaded/trunk/injection/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ projects/reloaded/trunk/injection/.settings/org.maven.ide.eclipse.prefs	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,8 @@
+#Mon May 25 08:54:07 CEST 2009
+activeProfiles=eclipse
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=false
+resourceFilterGoals=process-resources resources\:testResources
+version=1

Added: projects/reloaded/trunk/injection/pom.xml
===================================================================
--- projects/reloaded/trunk/injection/pom.xml	                        (rev 0)
+++ projects/reloaded/trunk/injection/pom.xml	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,103 @@
+<!-- 
+  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.reloaded</groupId>
+    <artifactId>jboss-reloaded-build</artifactId>
+    <version>0.1.0-SNAPSHOT</version>
+    <relativePath>../build/pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>jboss-reloaded-injection</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>JBoss Reloaded Injection Framework</name>
+  <url>http://www.jboss.org</url>
+  <description>
+    JSR-250 compliant injection on top of VDF
+  </description>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>ch.elca.el4j.maven.plugins</groupId>
+        <artifactId>maven-depgraph-plugin</artifactId>
+        <version>1.7</version>
+        <configuration>
+          <drawOmitted>true</drawOmitted>
+          <drawScope>false</drawScope>
+          <outDir>${project.build.directory}</outDir>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-vfs</artifactId>
+      <version>2.2.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.bootstrap</groupId>
+      <artifactId>jboss-bootstrap-impl-mc</artifactId>
+      <version>0.1.2</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-impl</artifactId>
+      <version>2.2.0.M2</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-structure-spi</artifactId>
+      <version>2.2.0.M2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-vfs</artifactId>
+      <version>2.2.0.M2</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-spi</artifactId>
+      <version>2.2.0.M2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-vfs-spi</artifactId>
+      <version>2.2.0.M2</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.javaee</groupId>
+      <artifactId>jboss-servlet-api</artifactId>
+      <version>2.5.0.GA</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.metadata</groupId>
+      <artifactId>jboss-metadata</artifactId>
+      <version>1.0.1.GA</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.microcontainer</groupId>
+      <artifactId>jboss-kernel</artifactId>
+      <version>2.2.0.M2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.naming</groupId>
+      <artifactId>jnpserver</artifactId>
+      <version>5.0.1.GA</version>
+    </dependency>
+    <dependency>
+      <groupId>sun-jaxb</groupId>
+      <artifactId>jaxb-api</artifactId>
+      <version>2.1.4</version>
+    </dependency>
+  </dependencies>
+</project>

Added: projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/ManagedBeanFactory.java
===================================================================
--- projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/ManagedBeanFactory.java	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/ManagedBeanFactory.java	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.reloaded.injection;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.logging.Logger;
+import org.jboss.naming.ENCFactory;
+import org.jboss.reloaded.injection.naming.Binder;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class ManagedBeanFactory<T> implements InvocationHandler
+{
+   private static final Logger log = Logger.getLogger(ManagedBeanFactory.class);
+   
+   private String name;
+   private Map<String, Binder> binders = new HashMap<String, Binder>();
+
+   private Context enc;
+   
+   public ManagedBeanFactory(String name)
+   {
+      this.name = name;
+   }
+   
+   public ManagedBeanInstance<T> createBean()
+   {
+      throw new RuntimeException("NYI");
+   }
+   
+   public void destroyBean(ManagedBeanInstance<T> bean)
+   {
+      throw new RuntimeException("NYI");
+   }
+   
+   protected Map<String, Binder> getBinders()
+   {
+      return binders;
+   }
+   
+   public Object invoke(Object proxy, Method method, Object args[]) throws Throwable
+   {
+      ENCFactory.pushContextId(name);
+      try
+      {
+         return method.invoke(proxy, args);
+      }
+      finally
+      {
+         ENCFactory.popContextId();
+      }
+   }
+   
+   protected void setupComponentContext()
+   {
+      ENCFactory.pushContextId(name);
+      try
+      {
+         InitialContext ctx = new InitialContext();
+         enc = (Context) ctx.lookup("java:comp");
+         
+         for(Binder binder : binders.values())
+         {
+            binder.bind(enc);
+         }
+      }
+      catch(NamingException e)
+      {
+         throw new RuntimeException(e);
+      }
+      finally
+      {
+         ENCFactory.popContextId();
+      }
+   }
+   
+   public void stop()
+   {
+      log.info("Stopping " + this);
+   }
+   
+   public void start()
+   {
+      log.info("Starting " + this);
+      
+      setupComponentContext();
+   }
+   
+   public String toString()
+   {
+      return name;
+   }
+}

Added: projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/ManagedBeanFactoryBuilder.java
===================================================================
--- projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/ManagedBeanFactoryBuilder.java	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/ManagedBeanFactoryBuilder.java	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,279 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.reloaded.injection;
+
+import java.util.Collection;
+
+import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.javaee.spec.AbstractEJBReferenceMetaData;
+import org.jboss.metadata.javaee.spec.Environment;
+import org.jboss.metadata.javaee.spec.EnvironmentEntriesMetaData;
+import org.jboss.metadata.javaee.spec.EnvironmentEntryMetaData;
+import org.jboss.metadata.javaee.spec.MessageDestinationReferencesMetaData;
+import org.jboss.metadata.javaee.spec.PersistenceContextReferenceMetaData;
+import org.jboss.metadata.javaee.spec.PersistenceContextReferencesMetaData;
+import org.jboss.metadata.javaee.spec.PersistenceUnitReferencesMetaData;
+import org.jboss.metadata.javaee.spec.RemoteEnvironment;
+import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferencesMetaData;
+import org.jboss.metadata.javaee.spec.ResourceInjectionTargetMetaData;
+import org.jboss.metadata.javaee.spec.ResourceReferencesMetaData;
+import org.jboss.reloaded.injection.naming.Binder;
+import org.jboss.reloaded.injection.naming.ValueBinder;
+import org.jboss.reloaded.injection.spi.PersistenceUnitDependencyResolver;
+import org.jboss.reloaded.injection.spi.Resolver;
+
+/**
+ * Build BeanMetaData out of an injection Environment.
+ * 
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class ManagedBeanFactoryBuilder
+{
+   private Resolver<AbstractEJBReferenceMetaData> ejbReferenceResolver;
+   private PersistenceUnitDependencyResolver persistenceUnitDependencyResolver;
+   
+   public BeanMetaData createManagedObjectFactoryMetaData(String name, DeploymentUnit deploymentUnit, RemoteEnvironment env)
+   {
+      BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder(name, ManagedBeanFactory.class.getName());
+      
+      ManagedBeanFactory<?> container = new ManagedBeanFactory<Object>(name);
+      builder.setConstructorValue(container);
+      
+      if(env == null)
+         return builder.getBeanMetaData();
+      
+      if(env instanceof Environment)
+         process(builder, container, deploymentUnit, (Environment) env);
+      
+      process(builder, container, deploymentUnit, env.getAnnotatedEjbReferences());
+      process(builder, container, deploymentUnit, env.getEjbReferences());
+      process(builder, container, deploymentUnit, env.getEnvironmentEntries());
+      process(builder, container, deploymentUnit, env.getMessageDestinationReferences());
+      process(builder, container, deploymentUnit, env.getPersistenceUnitRefs());
+      process(builder, container, deploymentUnit, env.getResourceEnvironmentReferences());
+      process(builder, container, deploymentUnit, env.getResourceReferences());
+      
+      // TODO: JBoss specific stuff
+      
+      // TODO: lifecycle
+      //process(builder, container, deploymentUnit, env.getPostConstructs());
+      //process(builder, container, deploymentUnit, env.getPreDestroys());
+      
+      return builder.getBeanMetaData();
+   }
+
+   private static final Object coerce(String cls, String value)
+   {
+      Class<?> type;
+      ClassLoader cl = Thread.currentThread().getContextClassLoader();
+      try
+      {
+         type = cl.loadClass(cls);
+      }
+      catch(ClassNotFoundException e)
+      {
+         throw new IllegalArgumentException("Can't find class " + cls + " on " + cl);
+      }
+      if (type == String.class)
+      {
+         return value;
+      }
+      else if (type == Integer.class)
+      {
+         return new Integer(value);
+      }
+      else if (type == Long.class)
+      {
+         return new Long(value);
+      }
+      else if (type == Double.class)
+      {
+         return new Double(value);
+      }
+      else if (type == Float.class)
+      {
+         return new Float(value);
+      }
+      else if (type == Byte.class)
+      {
+         return new Byte(value);
+      }
+      else if (type == Character.class)
+      {
+         String input = value;
+         if (input == null || input.length() == 0)
+         {
+            return new Character((char) 0);
+         }
+         else
+         {
+            if (input.length() > 1)
+               throw new IllegalArgumentException("Can't coerce value '" + value + "' into a Character");
+            return new Character(input.charAt(0));
+         }
+      }
+      else if (type == Short.class)
+      {
+         return new Short(value);
+      }
+      else if (type == Boolean.class)
+      {
+         return new Boolean(value);
+      }
+      else
+      {
+         return value;
+      }
+   }
+   
+   protected void injectionTargets(Collection<ResourceInjectionTargetMetaData> targets)
+   {
+      if(targets == null)
+         return;
+      
+      throw new RuntimeException("NYI");
+   }
+   
+   private static final boolean isEmpty(String s)
+   {
+      // can't use s.isEmpty, that's Java 6
+      return s == null || s.length() == 0;
+   }
+   
+   protected void process(BeanMetaDataBuilder builder, ManagedBeanFactory<?> container, DeploymentUnit deploymentUnit, Collection<? extends AbstractEJBReferenceMetaData> ejbReferences)
+   {
+      if(ejbReferences == null)
+         return;
+      
+      if(ejbReferenceResolver == null)
+         throw new IllegalStateException("Found EJB references " + ejbReferences + ", but no EJB reference resolver has been set");
+      
+      for(AbstractEJBReferenceMetaData reference : ejbReferences)
+      {
+         Resolver.Result result = ejbReferenceResolver.resolve(deploymentUnit, reference);
+         throw new RuntimeException("NYI");
+      }
+   }
+   
+   protected void process(BeanMetaDataBuilder builder, ManagedBeanFactory<?> container, DeploymentUnit deploymentUnit, Environment env)
+   {
+      process(builder, container, deploymentUnit, env.getEjbLocalReferences());
+      process(builder, container, deploymentUnit, env.getPersistenceContextRefs());
+   }
+
+   protected void process(BeanMetaDataBuilder builder, ManagedBeanFactory<?> container, DeploymentUnit deploymentUnit, EnvironmentEntriesMetaData environmentEntries)
+   {
+      if(environmentEntries == null)
+         return;
+      
+      for(EnvironmentEntryMetaData envEntry : environmentEntries)
+      {
+         String value = envEntry.getValue();
+         String mappedName = null;
+         if(isEmpty(value))
+         {
+            mappedName = envEntry.getMappedName();
+            if(isEmpty(mappedName))
+            {
+               mappedName = envEntry.getJndiName();
+               // TODO: JavaEE 5 5.4.1.3: if no value is specified there will be no injection (or an entry in JNDI)
+               if(isEmpty(mappedName))
+                  throw new IllegalStateException("Env entry " + envEntry + " has neither a value nor a mapped name");
+            }
+            throw new RuntimeException("NYI");
+         }
+         else
+         {
+            String encName = "env/" + envEntry.getName();
+            
+            injectionTargets(envEntry.getInjectionTargets());
+            
+            if(container.getBinders().containsKey(encName))
+               continue;
+            
+            String type = envEntry.getType();
+            Object obj = coerce(type, value);
+            
+            Binder binder = new ValueBinder(encName, obj);
+            container.getBinders().put(encName, binder);
+         }
+      }
+   }
+
+   protected void process(BeanMetaDataBuilder builder, ManagedBeanFactory<?> container, DeploymentUnit deploymentUnit, MessageDestinationReferencesMetaData messageDestinationReferences)
+   {
+      if(messageDestinationReferences == null)
+         return;
+      
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
+
+   protected void process(BeanMetaDataBuilder builder, ManagedBeanFactory<?> container, DeploymentUnit deploymentUnit, PersistenceContextReferencesMetaData persistenceContextRefs)
+   {
+      if(persistenceContextRefs == null)
+         return;
+      
+      if(persistenceUnitDependencyResolver == null)
+         throw new IllegalStateException("Found persistence context references " + persistenceContextRefs + ", but no persistence unit dependency resolver has been set");
+      
+      for(PersistenceContextReferenceMetaData persistenceContextRef : persistenceContextRefs)
+      {
+         // TODO: persistence unit injection is something weird
+         String beanName = persistenceUnitDependencyResolver.resolvePersistenceUnitSupplier(deploymentUnit, persistenceContextRef.getPersistenceUnitName());
+         throw new RuntimeException("NYI");
+      }
+   }
+   
+   protected void process(BeanMetaDataBuilder builder, ManagedBeanFactory<?> container, DeploymentUnit deploymentUnit, PersistenceUnitReferencesMetaData persistenceUnitRefs)
+   {
+      if(persistenceUnitRefs == null)
+         return;
+      
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
+
+   protected void process(BeanMetaDataBuilder builder, ManagedBeanFactory<?> container, DeploymentUnit deploymentUnit, ResourceEnvironmentReferencesMetaData resourceEnvironmentReferences)
+   {
+      if(resourceEnvironmentReferences == null)
+         return;
+      
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
+
+   protected void process(BeanMetaDataBuilder builder, ManagedBeanFactory<?> container, DeploymentUnit deploymentUnit, ResourceReferencesMetaData resourceReferences)
+   {
+      if(resourceReferences == null)
+         return;
+      
+      // TODO Auto-generated method stub
+      throw new RuntimeException("NYI");
+   }
+
+   
+}

Added: projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/ManagedBeanInstance.java
===================================================================
--- projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/ManagedBeanInstance.java	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/ManagedBeanInstance.java	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.reloaded.injection;
+
+/**
+ * A managed bean instance consists of an instance of the bean class itself
+ * and associated classes.
+ * 
+ * For example for EJB3 interceptor instances.
+ * 
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface ManagedBeanInstance<T>
+{
+   T getBean();
+}

Added: projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/deployer/ManagedBeanDeployer.java
===================================================================
--- projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/deployer/ManagedBeanDeployer.java	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/deployer/ManagedBeanDeployer.java	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.reloaded.injection.deployer;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.reloaded.injection.ManagedBeanFactoryBuilder;
+import org.jboss.reloaded.injection.metadata.ManagedBeanMetaData;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class ManagedBeanDeployer extends AbstractSimpleRealDeployer<ManagedBeanMetaData>
+{
+   private ManagedBeanFactoryBuilder builder;
+
+   public ManagedBeanDeployer()
+   {
+      super(ManagedBeanMetaData.class);
+      setComponentsOnly(true);
+      setOutput(BeanMetaData.class);
+   }
+   
+   @Override
+   public void deploy(DeploymentUnit unit, ManagedBeanMetaData deployment) throws DeploymentException
+   {
+      log.info("Deploying " + deployment);
+      
+      String name = "jboss:service=ManagedBean,name=" + deployment.getName();
+      unit.getParent().addAttachment(BeanMetaData.class.getName() + "." + name, builder.createManagedObjectFactoryMetaData(name, unit, deployment.getEnvironment()), BeanMetaData.class);
+   }
+   
+   @Inject
+   public void setManagedBeanFactoryBuilder(ManagedBeanFactoryBuilder builder)
+   {
+      this.builder = builder;
+   }
+}

Added: projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/deployer/ManagedBeanDeploymentDeployer.java
===================================================================
--- projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/deployer/ManagedBeanDeploymentDeployer.java	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/deployer/ManagedBeanDeploymentDeployer.java	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.reloaded.injection.deployer;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeploymentVisitor;
+import org.jboss.reloaded.injection.metadata.ManagedBeanJarMetaData;
+import org.jboss.reloaded.injection.metadata.ManagedBeanMetaData;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class ManagedBeanDeploymentDeployer extends AbstractComponentDeployer<ManagedBeanJarMetaData, ManagedBeanMetaData>
+{
+   public ManagedBeanDeploymentDeployer()
+   {
+      setComponentVisitor(new ComponentVisitor());      
+      setDeploymentVisitor(new ManagedBeanDeploymentVisitor());
+   }
+   
+   protected class ComponentVisitor extends AbstractDeploymentVisitor<ManagedBeanMetaData, ManagedBeanMetaData>
+   {
+      protected Class<ManagedBeanMetaData> getComponentType()
+      {
+         return ManagedBeanMetaData.class;
+      }
+
+      protected List<ManagedBeanMetaData> getComponents(ManagedBeanMetaData deployment)
+      {
+         return Collections.singletonList(deployment);
+      }
+
+      protected String getComponentName(ManagedBeanMetaData attachment)
+      {
+         return ManagedBeanMetaData.class.getName() + "." + attachment.getName();
+      }
+
+      public Class<ManagedBeanMetaData> getVisitorType()
+      {
+         return ManagedBeanMetaData.class;
+      }
+   }
+   
+   protected class ManagedBeanDeploymentVisitor extends AbstractDeploymentVisitor<ManagedBeanMetaData, ManagedBeanJarMetaData>
+   {
+      protected Class<ManagedBeanMetaData> getComponentType()
+      {
+         return ManagedBeanMetaData.class;      }
+
+      protected List<ManagedBeanMetaData> getComponents(ManagedBeanJarMetaData deployment)
+      {
+         return deployment.getManagedBeans();
+      }
+
+      protected String getComponentName(ManagedBeanMetaData attachment)
+      {
+         return ManagedBeanMetaData.class.getName() + "." + attachment.getName();
+      }
+
+      public Class<ManagedBeanJarMetaData> getVisitorType()
+      {
+         return ManagedBeanJarMetaData.class;
+      }
+   }
+}

Added: projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/metadata/ManagedBeanJarMetaData.java
===================================================================
--- projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/metadata/ManagedBeanJarMetaData.java	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/metadata/ManagedBeanJarMetaData.java	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.reloaded.injection.metadata;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.metadata.javaee.spec.JavaEEMetaDataConstants;
+import org.jboss.metadata.javaee.support.IdMetaDataImplWithDescriptionGroup;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at JBossXmlSchema(
+      xmlns={@XmlNs(namespaceURI = JavaEEMetaDataConstants.JAVAEE_NS, prefix = "jee")},
+      ignoreUnresolvedFieldOrClass=false,
+      namespace=JavaEEMetaDataConstants.JBOSS_NS,
+      elementFormDefault=XmlNsForm.QUALIFIED,
+      normalizeSpace=true)
+ at XmlRootElement(name="jboss-mb", namespace=JavaEEMetaDataConstants.JBOSS_NS)
+ at XmlType(namespace=JavaEEMetaDataConstants.JBOSS_NS, propOrder={ "descriptionGroup", "managedBeans" })
+public class ManagedBeanJarMetaData extends IdMetaDataImplWithDescriptionGroup
+{
+   private static final long serialVersionUID = 1L;
+   
+   private List<ManagedBeanMetaData> managedBeans;
+   
+   public List<ManagedBeanMetaData> getManagedBeans()
+   {
+      return managedBeans;
+   }
+   
+   @XmlElement(name="managed-bean")
+   @XmlElementWrapper(name="managed-beans")
+   public void setManagedBeans(List<ManagedBeanMetaData> managedBeans)
+   {
+      this.managedBeans = managedBeans;
+   }
+}

Added: projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/metadata/ManagedBeanMetaData.java
===================================================================
--- projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/metadata/ManagedBeanMetaData.java	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/metadata/ManagedBeanMetaData.java	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.reloaded.injection.metadata;
+
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.metadata.javaee.spec.Environment;
+import org.jboss.metadata.javaee.spec.EnvironmentRefsGroupMetaData;
+import org.jboss.metadata.javaee.support.NamedMetaDataWithDescriptionGroup;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+//@XmlRootElement(name="managed-bean")
+ at XmlType(propOrder={ "descriptionGroup", "name", "beanClass", "jndiEnvironmentRefsGroup" })
+public class ManagedBeanMetaData extends NamedMetaDataWithDescriptionGroup
+{
+   private static final long serialVersionUID = 1L;
+
+   private String beanClass;
+
+   private EnvironmentRefsGroupMetaData environment;
+   
+   public String getBeanClass()
+   {
+      return beanClass;
+   }
+   
+   @XmlTransient
+   public Environment getEnvironment()
+   {
+      return environment;
+   }
+   
+   public EnvironmentRefsGroupMetaData getJndiEnvironmentRefsGroup()
+   {
+      return environment;
+   }
+   
+   public void setBeanClass(String beanClass)
+   {
+      this.beanClass = beanClass;
+   }
+   
+   public void setJndiEnvironmentRefsGroup(EnvironmentRefsGroupMetaData env)
+   {
+      this.environment = env;
+   }
+}

Added: projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/naming/Binder.java
===================================================================
--- projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/naming/Binder.java	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/naming/Binder.java	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.reloaded.injection.naming;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+/**
+ * Bind something into a JNDI context.
+ * 
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface Binder
+{
+   void bind(Context ctx) throws NamingException;
+}

Added: projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/naming/ValueBinder.java
===================================================================
--- projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/naming/ValueBinder.java	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/main/java/org/jboss/reloaded/injection/naming/ValueBinder.java	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.reloaded.injection.naming;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.jboss.util.naming.Util;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class ValueBinder implements Binder
+{
+   private String name;
+   private Object value;
+
+   public ValueBinder(String name, Object value)
+   {
+      this.name = name;
+      this.value = value;
+   }
+   
+   public void bind(Context ctx) throws NamingException
+   {
+      Util.rebind(ctx, name, value);
+   }
+}

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

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

Added: projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/apache/InstanceManager.java
===================================================================
--- projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/apache/InstanceManager.java	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/apache/InstanceManager.java	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.reloaded.injection.test.apache;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.naming.NamingException;
+
+/**
+ * A duplicate of the same interface in Tomcat, to test integration.
+ * 
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface InstanceManager {
+
+   public Object newInstance(String className)
+       throws IllegalAccessException, InvocationTargetException, NamingException, 
+           InstantiationException, ClassNotFoundException;
+
+   public Object newInstance(String fqcn, ClassLoader classLoader) 
+       throws IllegalAccessException, InvocationTargetException, NamingException, 
+           InstantiationException, ClassNotFoundException;
+
+   public void newInstance(Object o) 
+       throws IllegalAccessException, InvocationTargetException, NamingException;
+
+   public void destroyInstance(Object o)
+       throws IllegalAccessException, InvocationTargetException;
+}
\ No newline at end of file

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

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

Added: projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/apache/unit/SimpleServletTestCase.java
===================================================================
--- projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/apache/unit/SimpleServletTestCase.java	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/apache/unit/SimpleServletTestCase.java	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.reloaded.injection.test.apache.unit;
+
+import java.lang.reflect.AnnotatedElement;
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.jboss.metadata.annotation.creator.web.Web25MetaDataCreator;
+import org.jboss.metadata.annotation.finder.AnnotationFinder;
+import org.jboss.metadata.annotation.finder.DefaultAnnotationFinder;
+import org.jboss.metadata.web.spec.Web25MetaData;
+import org.jboss.reloaded.injection.test.apache.InstanceManager;
+import org.jboss.reloaded.injection.test.apache.MyServlet;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class SimpleServletTestCase
+{
+   @Test
+   public void test1() throws Exception
+   {
+      AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+      Web25MetaDataCreator creator = new Web25MetaDataCreator(finder);
+      Collection<Class<?>> classes = new HashSet<Class<?>>();
+      classes.add(MyServlet.class);
+      Web25MetaData metaData = creator.create(classes);
+      System.out.println(metaData.getAnnotatedEjbReferences());
+      
+      InstanceManager im = null;
+      //MyServlet servlet = (MyServlet) im.newInstance(MyServlet.class.getName());
+   }
+}

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

Added: projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/simple/SimpleResourceBean.java
===================================================================
--- projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/simple/SimpleResourceBean.java	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/simple/SimpleResourceBean.java	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.reloaded.injection.test.simple;
+
+import javax.annotation.Resource;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.reloaded.injection.test.common.ManagedBean;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at ManagedBean
+public class SimpleResourceBean
+{
+   @Resource(name="test")
+   private int test;
+   
+   public Object getCompEntry(String name) throws NamingException
+   {
+      InitialContext ctx = new InitialContext();
+      return ctx.lookup("java:comp/" + name);
+   }
+}

Added: projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/simple/unit/SimpleResourceTestCase.java
===================================================================
--- projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/simple/unit/SimpleResourceTestCase.java	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/test/java/org/jboss/reloaded/injection/test/simple/unit/SimpleResourceTestCase.java	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,202 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.reloaded.injection.test.simple.unit;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.URL;
+
+import org.jboss.bootstrap.spi.lifecycle.LifecycleState;
+import org.jboss.bootstrap.spi.mc.config.MCServerConfig;
+import org.jboss.bootstrap.spi.mc.config.MCServerConfigFactory;
+import org.jboss.bootstrap.spi.mc.server.MCServer;
+import org.jboss.bootstrap.spi.mc.server.MCServerFactory;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.reloaded.injection.ManagedBeanFactory;
+import org.jboss.reloaded.injection.metadata.ManagedBeanJarMetaData;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+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 SimpleResourceTestCase
+{
+   private static MCServer server;
+   private static MainDeployer mainDeployer;
+   
+   @AfterClass
+   public static void afterClass() throws Exception
+   {
+      if(server != null && server.getState() == LifecycleState.STARTED)
+         server.shutdown();
+      server = null;
+   }
+   
+   @BeforeClass
+   public static void beforeClass() throws Exception
+   {
+      VFS.init();
+      // TODO: use jboss-cl
+      ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+      MCServerConfig config = MCServerConfigFactory.createServerConfig(classLoader);
+      config.bootstrapHome("file:src/test/resources/conf");
+      server = MCServerFactory.createServer(classLoader);
+      server.setConfiguration(config);
+      server.initialize();
+      ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+      Thread.currentThread().setContextClassLoader(classLoader);
+      try
+      {
+         server.start();
+         
+         mainDeployer = getBean("MainDeployer", ControllerState.INSTALLED, MainDeployer.class);
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(oldClassLoader);
+      }
+   }
+   
+   private static <T> Deployment deployment(String name, Class<T> attachmentType, T attachment)
+   {
+      try
+      {
+         URL url = new URL("vfsmemory", name, "");
+         VirtualFile root = VFS.getRoot(url);
+         VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(root);
+         MutableAttachments attachments = (MutableAttachments) deployment.getPredeterminedManagedObjects();
+         attachments.addAttachment(attachmentType, attachment);
+         return deployment;
+      }
+      catch(IOException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+   
+   /**
+    * 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 static 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 static <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 static KernelControllerContext getControllerContext(final Object name, final ControllerState state) throws IllegalStateException
+   {
+      KernelController controller = server.getKernel().getController();
+      KernelControllerContext context = (KernelControllerContext) controller.getContext(name, state);
+      if (context == null)
+         throw new IllegalStateException("Bean not found " + name + " at state " + state + " in controller " + controller);
+      return context;
+   }
+
+   @Test
+   public void test1() throws Throwable
+   {
+//      ManagedBeanJarMetaData jar = new ManagedBeanJarMetaData();
+//      List<ManagedBeanMetaData> managedBeans = new ArrayList<ManagedBeanMetaData>();
+//      jar.setManagedBeans(managedBeans);
+//      ManagedBeanMetaData managedBeanMetaData = new ManagedBeanMetaData();
+//      managedBeanMetaData.setName(SimpleResourceBean.class.getSimpleName());
+//      managedBeanMetaData.setBeanClass(SimpleResourceBean.class.getName());
+//      managedBeans.add(managedBeanMetaData);
+      
+      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+      unmarshaller.setSchemaValidation(false);
+      unmarshaller.setValidation(false);
+      ManagedBeanJarMetaData jar;
+      BufferedReader reader = new BufferedReader(new FileReader("src/test/resources/simple/jboss-mb.xml"));
+      try
+      {
+         DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+         resolver.addClassBinding("http://www.jboss.com/xml/ns/javaee", ManagedBeanJarMetaData.class);
+         jar = (ManagedBeanJarMetaData) unmarshaller.unmarshal(reader, resolver);
+      }
+      finally
+      {
+         reader.close();
+      }
+      
+      Deployment deployment = deployment("test1", ManagedBeanJarMetaData.class, jar);
+      mainDeployer.deploy(deployment);
+      
+      ManagedBeanFactory<?> container = getBean("jboss:service=ManagedBean,name=SimpleResourceBean", ControllerState.INSTALLED, ManagedBeanFactory.class);
+      
+      /*
+      ManagedBeanInstance<?> bean = container.createBean();
+      
+      Method method = SimpleResourceBean.class.getMethod("getCompEntry", String.class);
+      Object args[] = { "env/test" };
+      container.invoke(bean, method, args);
+      */
+   }
+}

Added: projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/classloader.xml
===================================================================
--- projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/classloader.xml	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/classloader.xml	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Minimalistic classloader deployer
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <!--
+      The classloader implementation
+   -->
+   <bean name="ClassLoaderSystem" class="org.jboss.classloader.spi.ClassLoaderSystem">
+      <classloader><null/></classloader>
+      <constructor factoryClass="org.jboss.classloader.spi.ClassLoaderSystem" factoryMethod="getInstance"/>
+   </bean>
+
+   <!-- 
+      ClassLoader management and resolution
+   -->
+   <bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
+      <classloader><null/></classloader>
+      <incallback method="addModule" state="Configured"/>
+      <uncallback method="removeModule" state="Configured"/>
+   </bean>
+   
+   <bean name="ClassLoadingMetaDataParser" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
+      <constructor>
+         <parameter>org.jboss.classloading.spi.metadata.ClassLoadingMetaData</parameter>
+      </constructor>
+      <property name="name">jboss-classloading.xml</property>
+      <property name="buildManagedObject">true</property>
+   </bean>
+   <bean name="ClassLoadingDefaultDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer">
+      <property name="defaultMetaData">
+         <classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true"/>
+      </property>
+   </bean>
+   <bean name="InMemoryClassesDeployer" class="org.jboss.deployers.vfs.plugins.classloader.InMemoryClassesDeployer"/>
+   <bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer"/>
+   <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
+      <property name="classLoading"><inject bean="ClassLoading"/></property>
+   </bean>
+   <bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
+      <property name="classLoading"><inject bean="ClassLoading"/></property>
+      <property name="system"><inject bean="ClassLoaderSystem"/></property>
+   </bean>
+</deployment>

Added: projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/deployers.xml
===================================================================
--- projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/deployers.xml	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/deployers.xml	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   A very minimalistic MainDeployer setup. 
+  -->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <!-- The MainDeployer -->
+   <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
+      <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
+      <property name="deployers"><inject bean="Deployers"/></property>
+      <!-- 
+      <property name="mgtDeploymentCreator"><inject bean="ManagedDeploymentCreator"/></property>
+      <property name="comparator"><inject bean="topContextComparator"/></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"/>
+   
+   <!-- JAR Structure -->
+   <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure"/>
+</deployment>
\ No newline at end of file

Added: projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/mb-deployer.xml
===================================================================
--- projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/mb-deployer.xml	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/mb-deployer.xml	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <bean name="ManagedBeanFactoryBuilder" class="org.jboss.reloaded.injection.ManagedBeanFactoryBuilder"/>
+   
+   <bean name="ManagedBeanDeploymentDeployer" class="org.jboss.reloaded.injection.deployer.ManagedBeanDeploymentDeployer"/>
+   
+   <bean name="ManagedBeanDeployer" class="org.jboss.reloaded.injection.deployer.ManagedBeanDeployer"/>
+</deployment>
\ No newline at end of file

Added: projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/naming.xml
===================================================================
--- projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/naming.xml	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/naming.xml	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <!-- JNDI -->
+   <bean name="NameServer" class="org.jnp.server.SingletonNamingServer"/>
+
+   <bean name="JavaCompInitializer" class="org.jboss.naming.JavaCompInitializer">
+      <depends>NameServer</depends>
+   </bean>
+</deployment>
\ No newline at end of file

Added: projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/pojo.xml
===================================================================
--- projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/pojo.xml	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap/pojo.xml	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <!-- 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 class="org.jboss.kernel.Kernel"><inject bean="jboss.kernel:service=Kernel"/></parameter></constructor>
+   </bean>
+</deployment>
\ No newline at end of file

Added: projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap.xml
===================================================================
--- projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap.xml	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/test/resources/conf/bootstrap.xml	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   The list of URLs for mc beans to load during bootstrap.
+-->
+<bootstrap xmlns="urn:jboss:bootstrap:1.0">
+   <!-- 
+   <url>bootstrap/logging.xml</url>
+   <url>bootstrap/vfs.xml</url>
+   <url>bootstrap/classloader.xml</url>
+   <url>bootstrap/aop-6.xml</url>
+   <url>bootstrap/jmx.xml</url>
+   <url>bootstrap/deployers.xml</url>
+   <url>bootstrap/bindings.xml</url>
+   <url>bootstrap/profile-6.xml</url>
+   -->
+   <url>bootstrap/classloader.xml</url>
+   <url>bootstrap/deployers.xml</url>
+   <url>bootstrap/pojo.xml</url>
+   <url>bootstrap/mb-deployer.xml</url>
+   <url>bootstrap/naming.xml</url>
+</bootstrap>

Added: projects/reloaded/trunk/injection/src/test/resources/jndi.properties
===================================================================
--- projects/reloaded/trunk/injection/src/test/resources/jndi.properties	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/test/resources/jndi.properties	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,2 @@
+java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file

Added: projects/reloaded/trunk/injection/src/test/resources/log4j.xml
===================================================================
--- projects/reloaded/trunk/injection/src/test/resources/log4j.xml	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/test/resources/log4j.xml	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,123 @@
+<?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="ALL"/>
+
+    <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">
+    <priority value="INFO"/>
+  </category>
+  
+  <category name="org.jboss.reloaded">
+    <priority value="ALL"/>
+  </category>
+  
+  <!-- ======================= -->
+  <!-- Setup the Root category -->
+  <!-- ======================= -->
+
+  <root>
+    <priority value="WARN" />
+    <appender-ref ref="CONSOLE"/>
+    <appender-ref ref="FILE"/>
+  </root>
+  
+</log4j:configuration>

Added: projects/reloaded/trunk/injection/src/test/resources/simple/jboss-mb.xml
===================================================================
--- projects/reloaded/trunk/injection/src/test/resources/simple/jboss-mb.xml	                        (rev 0)
+++ projects/reloaded/trunk/injection/src/test/resources/simple/jboss-mb.xml	2009-05-26 12:27:22 UTC (rev 89434)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-mb xmlns="http://www.jboss.com/xml/ns/javaee"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee
+                            http://www.jboss.org/j2ee/schema/jboss_mb_0_1.xsd"
+        version="0.1">
+   <managed-beans>
+      <managed-bean>
+        <name>SimpleResourceBean</name>
+        <bean-class>org.jboss.reloaded.injection.test.simple.SimpleResourceBean</bean-class>
+        <env-entry>
+           <env-entry-name>test</env-entry-name>
+           <env-entry-type>java.lang.Integer</env-entry-type>
+           <env-entry-value>42</env-entry-value>
+        </env-entry>
+      </managed-bean>
+   </managed-beans>
+</jboss-mb>
\ No newline at end of file




More information about the jboss-cvs-commits mailing list