geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r950397 [3/4] - in /geronimo/server/trunk/plugins: activemq/ bval/geronimo-bval-builder/src/main/java/org/apache/geronimo/bval/deployment/ client/client/src/main/history/ client/geronimo-client-builder/src/main/java/org/apache/geronimo/clie...
Date Wed, 02 Jun 2010 07:35:26 GMT
Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java Wed Jun  2 07:35:24 2010
@@ -27,10 +27,8 @@ import java.util.Map;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
-
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.j2ee.annotation.Holder;
 import org.apache.geronimo.j2ee.annotation.LifecycleMethod;
 import org.apache.geronimo.j2ee.deployment.EARContext;
@@ -42,14 +40,17 @@ import org.apache.geronimo.kernel.config
 import org.apache.geronimo.xbeans.javaee6.FullyQualifiedClassType;
 import org.apache.geronimo.xbeans.javaee6.JavaIdentifierType;
 import org.apache.geronimo.xbeans.javaee6.LifecycleCallbackType;
-import org.apache.xbean.finder.ClassFinder;
+import org.apache.xbean.finder.AbstractFinder;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
 
 /**
  * @version $Rev$ $Date$
  */
+@GBean(j2eeType = NameFactory.MODULE_BUILDER)
 public class LifecycleMethodBuilder extends AbstractNamingBuilder {
+
+    @Override
     public void buildNaming(XmlObject specDD, XmlObject plan, Module module, Map<EARContext.Key, Object> sharedContext) throws DeploymentException {
         // skip ejb modules... they have already been processed
         //skip ears, they have no standalone components
@@ -57,7 +58,7 @@ public class LifecycleMethodBuilder exte
             return;
         }
 
-        ClassFinder classFinder = module.getClassFinder();
+        AbstractFinder classFinder = module.getClassFinder();
         AnnotatedApp annotatedApp = module.getAnnotatedApp();
         if (annotatedApp == null) {
             throw new NullPointerException("No AnnotatedApp supplied");
@@ -130,23 +131,14 @@ public class LifecycleMethodBuilder exte
         return map;
     }
 
+    @Override
     public QNameSet getSpecQNameSet() {
         return QNameSet.EMPTY;
     }
 
+    @Override
     public QNameSet getPlanQNameSet() {
         return QNameSet.EMPTY;
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(LifecycleMethodBuilder.class, NameFactory.MODULE_BUILDER);
-
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
 }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java Wed Jun  2 07:35:24 2010
@@ -57,7 +57,7 @@ import org.osgi.framework.BundleContext;
  * @version $Rev$ $Date$
  */
 public class EnvironmentEntryBuilderTest extends TestCase {
-    private Map componentContext = new HashMap();
+    private Map<EARContext.Key, Object> componentContext = new HashMap<EARContext.Key, Object>();
     private NamingBuilder environmentEntryBuilder = new EnvironmentEntryBuilder(new String[]{AbstractNamingBuilder.JEE_NAMESPACE});
 
     private static final String TEST = "<tmp xmlns=\"http://java.sun.com/xml/ns/javaee\">" +
@@ -195,7 +195,7 @@ public class EnvironmentEntryBuilderTest
         locations.put(null, artifact);
         BundleContext bundleContext = new MockBundleContext(getClass().getClassLoader(), "", null, locations);
         Artifact id = new Artifact("test", "test", "", "car");
-        module  = new ConnectorModule(false, new AbstractName(id, Collections.singletonMap("name", "test")), null, null, null, "foo", null, null, null, null);
+        module  = new ConnectorModule(false, new AbstractName(id, Collections.singletonMap("name", "test")), null, null, null, "foo", null, null, null, null, null, null);
         ConfigurationManager configurationManager = new MockConfigurationManager();
         EARContext earContext = new EARContext(new File("foo"),
             null,
@@ -235,7 +235,7 @@ public class EnvironmentEntryBuilderTest
             cursor.dispose();
         }
         environmentEntryBuilder.buildNaming(doc, null, module, componentContext);
-        Context context = EnterpriseNamingContext.livenReferences(NamingBuilder.JNDI_KEY.get(componentContext).get(JndiScope.comp), null, null, getClass().getClassLoader(), null, "comp/");
+        Context context = EnterpriseNamingContext.livenReferences(module.getJndiScope(JndiScope.comp), null, null, getClass().getClassLoader(), null, "comp/");
         Set actual = new HashSet();
         for (NamingEnumeration e = context.listBindings("comp/env"); e.hasMore();) {
             NameClassPair pair = (NameClassPair) e.next();
@@ -285,7 +285,7 @@ public class EnvironmentEntryBuilderTest
             cursor.dispose();
         }
         environmentEntryBuilder.buildNaming(doc, plan, module, componentContext);
-        Context context = EnterpriseNamingContext.livenReferences(NamingBuilder.JNDI_KEY.get(componentContext).get(JndiScope.comp), null, null, getClass().getClassLoader(), null, "comp/");
+        Context context = EnterpriseNamingContext.livenReferences(module.getJndiScope(JndiScope.comp), null, null, getClass().getClassLoader(), null, "comp/");
         Set actual = new HashSet();
         for (NamingEnumeration e = context.listBindings("comp/env"); e.hasMore();) {
             NameClassPair pair = (NameClassPair) e.next();
@@ -307,7 +307,7 @@ public class EnvironmentEntryBuilderTest
     }
 
     public void testEmptyEnvironment() throws NamingException {
-        Context context = EnterpriseNamingContext.livenReferences(NamingBuilder.JNDI_KEY.get(componentContext).get(JndiScope.comp), null, null, null, null, "comp/");
+        Context context = EnterpriseNamingContext.livenReferences(module.getJndiScope(JndiScope.comp), null, null, null, null, "comp/");
         Context env = (Context) context.lookup("comp/env");
         assertNotNull(env);
     }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java Wed Jun  2 07:35:24 2010
@@ -102,12 +102,17 @@ import org.apache.geronimo.xbeans.javaee
 import org.apache.geronimo.xbeans.javaee6.ServletType;
 import org.apache.geronimo.xbeans.javaee6.UrlPatternType;
 import org.apache.geronimo.xbeans.javaee6.WebAppType;
+import org.apache.xbean.finder.AbstractFinder;
+import org.apache.xbean.finder.BundleAnnotationFinder;
 import org.apache.xbean.finder.ClassFinder;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlDocumentProperties;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.SAXException;
@@ -198,6 +203,9 @@ public abstract class AbstractWebModuleB
 
     private static final QName SECURITY_QNAME = GerSecurityDocument.type.getDocumentElementName();
 
+    private final PackageAdmin packageAdmin;
+
+
     /**
      * Manifest classpath entries in a war configuration must be resolved relative to the war configuration, not the
      * enclosing ear configuration.  Resolving relative to he war configuration using this offset produces the same
@@ -207,13 +215,15 @@ public abstract class AbstractWebModuleB
     public static final String MESSAGE_LAYER = "HttpServlet";
 
     protected AbstractWebModuleBuilder(Kernel kernel, Collection<NamespaceDrivenBuilder> serviceBuilders, NamingBuilder namingBuilders, ResourceEnvironmentSetter resourceEnvironmentSetter,
-            Collection<WebServiceBuilder> webServiceBuilder, Collection<ModuleBuilderExtension> moduleBuilderExtensions) {
+            Collection<WebServiceBuilder> webServiceBuilder, Collection<ModuleBuilderExtension> moduleBuilderExtensions, BundleContext bundleContext) {
         this.kernel = kernel;
         this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders);
         this.namingBuilders = namingBuilders;
         this.resourceEnvironmentSetter = resourceEnvironmentSetter;
         this.webServiceBuilder = webServiceBuilder;
         this.moduleBuilderExtensions = moduleBuilderExtensions == null ? new ArrayList<ModuleBuilderExtension>() : moduleBuilderExtensions;
+        ServiceReference sr = bundleContext.getServiceReference(PackageAdmin.class.getName());
+        packageAdmin = (PackageAdmin) bundleContext.getService(sr);
     }
 
     static {
@@ -244,18 +254,24 @@ public abstract class AbstractWebModuleB
         }
     }
 
+    @Override
     public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         return createModule(plan, moduleFile, ".", null, null, null, null, naming, idBuilder);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming,
+    @Override
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, Module parentModule, Naming naming,
             ModuleIDBuilder idBuilder) throws DeploymentException {
-        return createModule(plan, moduleFile, targetPath, specDDUrl, environment, (String) moduleContextInfo, earName, naming, idBuilder);
+        return createModule(plan, moduleFile, targetPath, specDDUrl, environment, (String) moduleContextInfo, parentModule, naming, idBuilder);
     }
 
-    protected abstract Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment earEnvironment, String contextRoot, AbstractName earName, Naming naming,
+    protected abstract Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment earEnvironment, String contextRoot, Module parentModule, Naming naming,
             ModuleIDBuilder idBuilder) throws DeploymentException;
 
+    protected static Map<JndiKey, Map<String, Object>> shareJndi(Module parent) {
+        return Module.share(Module.APP, parent == null? null: parent.getJndiContext());
+    }
+
     /**
      * Some servlets will have multiple url patterns.  However, webservice servlets
      * will only have one, which is what this method is intended for.
@@ -617,68 +633,73 @@ public abstract class AbstractWebModuleB
         return true;
     }
 
-    protected ClassFinder createWebAppClassFinder(WebAppType webApp, WebModule webModule) throws DeploymentException {
+    protected AbstractFinder createWebAppClassFinder(WebAppType webApp, WebModule webModule) throws DeploymentException {
         // Get the classloader from the module's EARContext
         Bundle bundle = webModule.getEarContext().getDeploymentBundle();
-        return createWebAppClassFinder(webApp, bundle);
-    }
-
-    public static ClassFinder createWebAppClassFinder(WebAppType webApp, Bundle bundle) throws DeploymentException {
-        //------------------------------------------------------------------------------------
-        // Find the list of classes from the web.xml we want to search for annotations in
-        //------------------------------------------------------------------------------------
-        List<Class> classes = new ArrayList<Class>();
-        // Get all the servlets from the deployment descriptor
-        ServletType[] servlets = webApp.getServletArray();
-        for (ServletType servlet : servlets) {
-            FullyQualifiedClassType cls = servlet.getServletClass();
-            if (cls != null) { // Don't try this for JSPs
-                Class<?> clas;
-                try {
-                    clas = bundle.loadClass(cls.getStringValue());
-                } catch (ClassNotFoundException e) {
-                    throw new DeploymentException("AbstractWebModuleBuilder: Could not load servlet class: " + cls.getStringValue(), e);
-                }
-                addClass(classes, clas);
-            }
-        }
-        // Get all the listeners from the deployment descriptor
-        ListenerType[] listeners = webApp.getListenerArray();
-        for (ListenerType listener : listeners) {
-            FullyQualifiedClassType cls = listener.getListenerClass();
-            Class<?> clas;
-            try {
-                clas = bundle.loadClass(cls.getStringValue());
-            } catch (ClassNotFoundException e) {
-                throw new DeploymentException("AbstractWebModuleBuilder: Could not load listener class: " + cls.getStringValue(), e);
-            }
-            addClass(classes, clas);
-        }
-        // Get all the filters from the deployment descriptor
-        FilterType[] filters = webApp.getFilterArray();
-        for (FilterType filter : filters) {
-            FullyQualifiedClassType cls = filter.getFilterClass();
-            Class<?> clas;
-            try {
-                clas = bundle.loadClass(cls.getStringValue());
-            } catch (ClassNotFoundException e) {
-                throw new DeploymentException("AbstractWebModuleBuilder: Could not load filter class: " + cls.getStringValue(), e);
-            }
-            addClass(classes, clas);
-        }
-        // see https://issues.apache.org/jira/browse/GERONIMO-3421 .
-        // if the user has botched her classloader config (perhaps by
-        // not including a jar that her app needs) then ClassFinder
-        // will throw NoClassDefFoundError.  we want to indicate that
-        // it's the user's error and provide a little context to help
-        // her fix it.
+//        return createWebAppClassFinder(webApp, bundle);
         try {
-            return new ClassFinder(classes);
-        } catch (NoClassDefFoundError e) {
-            throw new DeploymentException("Classloader for " + webApp.getId() + "can't find " + e.getMessage(), e);
+            return new BundleAnnotationFinder(packageAdmin, bundle);
+        } catch (Exception e) {
+            throw new DeploymentException(e);
         }
     }
 
+//    public static ClassFinder createWebAppClassFinder(WebAppType webApp, Bundle bundle) throws DeploymentException {
+//        //------------------------------------------------------------------------------------
+//        // Find the list of classes from the web.xml we want to search for annotations in
+//        //------------------------------------------------------------------------------------
+//        List<Class> classes = new ArrayList<Class>();
+//        // Get all the servlets from the deployment descriptor
+//        ServletType[] servlets = webApp.getServletArray();
+//        for (ServletType servlet : servlets) {
+//            FullyQualifiedClassType cls = servlet.getServletClass();
+//            if (cls != null) { // Don't try this for JSPs
+//                Class<?> clas;
+//                try {
+//                    clas = bundle.loadClass(cls.getStringValue());
+//                } catch (ClassNotFoundException e) {
+//                    throw new DeploymentException("AbstractWebModuleBuilder: Could not load servlet class: " + cls.getStringValue(), e);
+//                }
+//                addClass(classes, clas);
+//            }
+//        }
+//        // Get all the listeners from the deployment descriptor
+//        ListenerType[] listeners = webApp.getListenerArray();
+//        for (ListenerType listener : listeners) {
+//            FullyQualifiedClassType cls = listener.getListenerClass();
+//            Class<?> clas;
+//            try {
+//                clas = bundle.loadClass(cls.getStringValue());
+//            } catch (ClassNotFoundException e) {
+//                throw new DeploymentException("AbstractWebModuleBuilder: Could not load listener class: " + cls.getStringValue(), e);
+//            }
+//            addClass(classes, clas);
+//        }
+//        // Get all the filters from the deployment descriptor
+//        FilterType[] filters = webApp.getFilterArray();
+//        for (FilterType filter : filters) {
+//            FullyQualifiedClassType cls = filter.getFilterClass();
+//            Class<?> clas;
+//            try {
+//                clas = bundle.loadClass(cls.getStringValue());
+//            } catch (ClassNotFoundException e) {
+//                throw new DeploymentException("AbstractWebModuleBuilder: Could not load filter class: " + cls.getStringValue(), e);
+//            }
+//            addClass(classes, clas);
+//        }
+//        // see https://issues.apache.org/jira/browse/GERONIMO-3421 .
+//        // if the user has botched her classloader config (perhaps by
+//        // not including a jar that her app needs) then ClassFinder
+//        // will throw NoClassDefFoundError.  we want to indicate that
+//        // it's the user's error and provide a little context to help
+//        // her fix it.
+//        try {
+//            return new ClassFinder(classes);
+//        } catch (NoClassDefFoundError e) {
+//            throw new DeploymentException("Classloader for " + webApp.getId() + "can't find " + e.getMessage(), e);
+//        }
+//    }
+
     private static void addClass(List<Class> classes, Class<?> clas) {
         while (clas != Object.class) {
             classes.add(clas);
@@ -690,10 +711,7 @@ public abstract class AbstractWebModuleB
             throws DeploymentException {
         Map<EARContext.Key, Object> buildingContext = new HashMap<EARContext.Key, Object>();
         buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, moduleContext.getModuleName());
-        //get partial jndi context from earContext.
-        Map<JndiKey, Map<String, Object>> jndiContext = new HashMap<JndiKey, Map<String, Object>>(NamingBuilder.JNDI_KEY.get(earContext.getGeneralData()));
-        getJndiContext(jndiContext, JndiScope.module).put("module/ModuleName", webModule.getName());
-        buildingContext.put(NamingBuilder.JNDI_KEY, jndiContext);
+        webModule.getJndiContext().get(JndiScope.module).put("module/ModuleName", webModule.getName());
         if (!webApp.getMetadataComplete()) {
             // Create a classfinder and populate it for the naming builder(s). The absence of a
             // classFinder in the module will convey whether metadata-complete is set (or not)
@@ -708,8 +726,8 @@ public abstract class AbstractWebModuleB
         AbstractName contextSourceName = moduleContext.getNaming().createChildName(webModuleData.getAbstractName(), "ContextSource", "ContextSource");
         GBeanData contextSourceData = new GBeanData(contextSourceName, WebContextSource.class);
 
-        contextSourceData.setAttribute("componentContext", jndiContext.get(JndiScope.comp));
-        contextSourceData.setAttribute("moduleContext", jndiContext.get(JndiScope.module));
+        contextSourceData.setAttribute("componentContext", webModule.getJndiContext().get(JndiScope.comp));
+        contextSourceData.setAttribute("moduleContext", webModule.getJndiContext().get(JndiScope.module));
         contextSourceData.setReferencePattern("ApplicationJndi", EARContext.APPLICATION_JNDI_NAME_KEY.get(earContext.getGeneralData()));
         contextSourceData.setReferencePattern("TransactionManager", moduleContext.getTransactionManagerName());
         try {
@@ -720,7 +738,6 @@ public abstract class AbstractWebModuleB
         webModuleData.setReferencePattern("ContextSource", contextSourceName);
         Holder holder = NamingBuilder.INJECTION_KEY.get(buildingContext);
         webModule.getSharedContext().put(WebModule.WEB_APP_DATA, webModuleData);
-        webModule.getSharedContext().put(NamingBuilder.JNDI_KEY, jndiContext);
         webModule.getSharedContext().put(NamingBuilder.INJECTION_KEY, holder);
         if (moduleContext.getServerName() != null) {
             webModuleData.setReferencePattern("J2EEServer", moduleContext.getServerName());

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java Wed Jun  2 07:35:24 2010
@@ -19,25 +19,13 @@ package org.apache.geronimo.web25.deploy
 
 import java.net.URL;
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
-import java.util.jar.JarFile;
 
-import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.deployment.ModuleIDBuilder;
-import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.j2ee.deployment.EARContext;
-import org.apache.geronimo.j2ee.deployment.Module;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.Naming;
-import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.schema.SchemaConversionUtils;
 import org.apache.geronimo.testsupport.XmlBeansTestSupport;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
-import org.osgi.framework.Bundle;
 
 /**
  * @version $Rev$ $Date$
@@ -46,7 +34,6 @@ public class SchemaConversionTest extend
 
     private ClassLoader classLoader = this.getClass().getClassLoader();
     private XmlOptions options = new XmlOptions();
-    private WebModuleBuilder webModuleBuilder = new WebModuleBuilder(null);
 
     public void testWeb25To30Transform() throws Exception {
         URL srcXml = classLoader.getResource("javaee_5schema/web-2-25.xml");
@@ -144,40 +131,4 @@ public class SchemaConversionTest extend
         SchemaConversionUtils.convertToServletSchema(xmlObject);
     }
 
-    private static class WebModuleBuilder extends AbstractWebModuleBuilder {
-
-        protected WebModuleBuilder(Kernel kernel) {
-            super(kernel, null, null, null, Collections.EMPTY_SET, null);
-        }
-
-        public Module createModule(Bundle bundle, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
-            return null;
-        }
-
-        protected Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment earEnvironment, String contextRoot, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
-            return null;
-        }
-
-        public void initContext(EARContext earContext, Module module, Bundle classLoader) throws DeploymentException {
-        }
-
-        public void addGBeans(EARContext earContext, Module module, Bundle classLoader, Collection repositories) throws DeploymentException {
-        }
-
-        public String getSchemaNamespace() {
-            return null;
-        }
-
-        @Override
-        protected void postInitContext(EARContext earContext, Module module, Bundle bundle) throws DeploymentException {
-            // TODO Auto-generated method stub
-        }
-
-        @Override
-        protected void preInitContext(EARContext earContext, Module module, Bundle bundle) throws DeploymentException {
-            // TODO Auto-generated method stub
-        }
-    }
-
-
 }

Modified: geronimo/server/trunk/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml Wed Jun  2 07:35:24 2010
@@ -27,8 +27,33 @@
         <type>jar</type>
     </dependency>
     <dependency>
+        <groupId>org.apache.geronimo.specs</groupId>
+        <artifactId>geronimo-osgi-registry</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
         <groupId>org.apache.servicemix.bundles</groupId>
         <artifactId>org.apache.servicemix.bundles.howl</artifactId>
         <type>jar</type>
     </dependency>
+    <dependency>
+        <groupId>org.apache.servicemix.bundles</groupId>
+        <artifactId>org.apache.servicemix.bundles.xpp3</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.xbean</groupId>
+        <artifactId>xbean-bundleutils</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.xbean</groupId>
+        <artifactId>xbean-finder</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.xbean</groupId>
+        <artifactId>xbean-reflect</artifactId>
+        <type>jar</type>
+    </dependency>
 </plugin-artifact>

Modified: geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java (original)
+++ geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java Wed Jun  2 07:35:24 2010
@@ -151,9 +151,6 @@ public class JspModuleBuilderExtension i
         Map<EARContext.Key, Object> buildingContext = new HashMap<EARContext.Key, Object>();
         buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, moduleName);
 
-        //use the same jndi context as the web app
-        Map compContext = NamingBuilder.JNDI_KEY.get(sharedContext);
-        buildingContext.put(NamingBuilder.JNDI_KEY, compContext);
 
         //use the same holder object as the web app.
         Holder holder = NamingBuilder.INJECTION_KEY.get(sharedContext);

Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java Wed Jun  2 07:35:24 2010
@@ -164,7 +164,7 @@ public abstract class JAXWSServiceRefBui
         Object ref = createService(serviceRef, gerServiceRef, module, bundle,
                                    serviceInterfaceClass, serviceQName,
                                    wsdlURI, serviceReferenceType, portComponentRefMap);
-        put(name, ref, getJndiContextMap(componentContext));
+        put(name, ref, module.getJndiContext());
     }
 
     public abstract Object createService(ServiceRefType serviceRef, GerServiceRefType gerServiceRef,

Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java Wed Jun  2 07:35:24 2010
@@ -132,6 +132,9 @@ import org.apache.xbean.osgi.bundle.util
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -199,8 +202,9 @@ public class JettyModuleBuilder extends 
                               @ParamReference(name="NamingBuilders", namingType=NameFactory.MODULE_BUILDER)NamingBuilder namingBuilders,
                               @ParamReference(name="ModuleBuilderExtensions", namingType=NameFactory.MODULE_BUILDER)Collection<ModuleBuilderExtension> moduleBuilderExtensions,
                               @ParamReference(name="ResourceEnvironmentSetter", namingType=NameFactory.MODULE_BUILDER)ResourceEnvironmentSetter resourceEnvironmentSetter,
-                              @ParamSpecial(type = SpecialAttributeType.kernel)Kernel kernel) throws GBeanNotFoundException {
-        super(kernel, serviceBuilders, namingBuilders, resourceEnvironmentSetter, webServiceBuilder, moduleBuilderExtensions);
+                              @ParamSpecial(type = SpecialAttributeType.kernel)Kernel kernel,
+                              @ParamSpecial(type = SpecialAttributeType.bundleContext) BundleContext bundleContext) throws GBeanNotFoundException {
+        super(kernel, serviceBuilders, namingBuilders, resourceEnvironmentSetter, webServiceBuilder, moduleBuilderExtensions, bundleContext);
         this.defaultEnvironment = defaultEnvironment;
         this.defaultSessionTimeoutSeconds = (defaultSessionTimeoutSeconds == null) ? 30 * 60 : defaultSessionTimeoutSeconds;
         this.jettyContainerObjectName = jettyContainerName;
@@ -214,6 +218,7 @@ public class JettyModuleBuilder extends 
         this.defaultWelcomeFiles = defaultWelcomeFiles == null ? new ArrayList<String>() : defaultWelcomeFiles;
         this.defaultLocaleEncodingMappings = defaultLocaleEncodingMappings == null ? new HashMap<String, String>() : defaultLocaleEncodingMappings;
         this.defaultMimeTypeMappings = defaultMimeTypeMappings == null ? new HashMap<String, String>() : defaultMimeTypeMappings;
+        ServiceReference sr = bundleContext.getServiceReference(PackageAdmin.class.getName());
     }
 
     public void doStart() throws Exception {
@@ -302,14 +307,14 @@ public class JettyModuleBuilder extends 
             name = bundle.getSymbolicName();
         }
 
-        WebModule module = new WebModule(standAlone, moduleName, name, environment, deployable, targetPath, webApp, jettyWebApp, specDD, contextPath, JETTY_NAMESPACE, annotatedWebApp);
+        WebModule module = new WebModule(standAlone, moduleName, name, environment, deployable, targetPath, webApp, jettyWebApp, specDD, contextPath, JETTY_NAMESPACE, annotatedWebApp, shareJndi(null), null);
         for (ModuleBuilderExtension mbe : moduleBuilderExtensions) {
             mbe.createModule(module, bundle, naming, idBuilder);
         }
         return module;
     }
 
-    protected Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment earEnvironment, String contextRoot, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+    protected Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment earEnvironment, String contextRoot, Module parentModule, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         assert moduleFile != null : "moduleFile is null";
         assert targetPath != null : "targetPath is null";
         assert !targetPath.endsWith("/") : "targetPath must not end with a '/'";
@@ -374,10 +379,12 @@ public class JettyModuleBuilder extends 
         idBuilder.resolve(environment, warName, "war");
 
         AbstractName moduleName;
-        if (earName == null) {
+        AbstractName earName;
+        if (parentModule == null) {
             earName = naming.createRootName(environment.getConfigId(), NameFactory.NULL, NameFactory.J2EE_APPLICATION);
             moduleName = naming.createChildName(earName, environment.getConfigId().toString(), NameFactory.WEB_MODULE);
         } else {
+            earName = parentModule.getModuleName();
             moduleName = naming.createChildName(earName, targetPath, NameFactory.WEB_MODULE);
         }
 
@@ -393,7 +400,7 @@ public class JettyModuleBuilder extends 
             }
         }
 
-        WebModule module = new WebModule(standAlone, moduleName, name, environment, deployable, targetPath, webApp, jettyWebApp, specDD, contextRoot, JETTY_NAMESPACE, annotatedWebApp);
+        WebModule module = new WebModule(standAlone, moduleName, name, environment, deployable, targetPath, webApp, jettyWebApp, specDD, contextRoot, JETTY_NAMESPACE, annotatedWebApp, shareJndi(parentModule), parentModule);
         for (ModuleBuilderExtension mbe : moduleBuilderExtensions) {
             mbe.createModule(module, plan, moduleFile, targetPath, specDDUrl, environment, contextRoot, earName, naming, idBuilder);
         }

Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilderTest.java?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilderTest.java (original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilderTest.java Wed Jun  2 07:35:24 2010
@@ -77,6 +77,9 @@ import org.apache.geronimo.transaction.w
 import org.apache.geronimo.xbeans.geronimo.j2ee.GerSecurityDocument;
 import org.apache.xmlbeans.impl.schema.SchemaTypeImpl;
 import org.osgi.framework.Bundle;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.service.packageadmin.RequiredBundle;
 
 /**
  * @version $Rev:385232 $ $Date$
@@ -285,6 +288,64 @@ public class JettyModuleBuilderTest exte
         defaultEnvironment.setConfigId(webModuleArtifact);
         Collection<ModuleBuilderExtension> moduleBuilderExtensions = new ArrayList<ModuleBuilderExtension>();
         GeronimoSecurityBuilderImpl securityBuilder = new GeronimoSecurityBuilderImpl(null, null, null);
+        MockBundleContext bundleContext = new MockBundleContext(getClass().getClassLoader(), "", null, null);
+        PackageAdmin packageAdmin = new PackageAdmin() {
+
+                @Override
+                public ExportedPackage[] getExportedPackages(Bundle bundle) {
+                    return new ExportedPackage[0];
+                }
+
+                @Override
+                public ExportedPackage[] getExportedPackages(String s) {
+                    return new ExportedPackage[0];
+                }
+
+                @Override
+                public ExportedPackage getExportedPackage(String s) {
+                    return null;
+                }
+
+                @Override
+                public void refreshPackages(Bundle[] bundles) {
+                }
+
+                @Override
+                public boolean resolveBundles(Bundle[] bundles) {
+                    return false;
+                }
+
+                @Override
+                public RequiredBundle[] getRequiredBundles(String s) {
+                    return new RequiredBundle[0];
+                }
+
+                @Override
+                public Bundle[] getBundles(String s, String s1) {
+                    return new Bundle[0];
+                }
+
+                @Override
+                public Bundle[] getFragments(Bundle bundle) {
+                    return new Bundle[0];
+                }
+
+                @Override
+                public Bundle[] getHosts(Bundle bundle) {
+                    return new Bundle[0];
+                }
+
+                @Override
+                public Bundle getBundle(Class aClass) {
+                    return null;
+                }
+
+                @Override
+                public int getBundleType(Bundle bundle) {
+                    return 0;
+                }
+            };
+        bundleContext.registerService(PackageAdmin.class.getName(), packageAdmin, null);
         builder = new JettyModuleBuilder(defaultEnvironment,
                 new Integer(1800),
                 Collections.EMPTY_LIST,
@@ -302,7 +363,8 @@ public class JettyModuleBuilderTest exte
                 new NamingBuilderCollection(null),
                 moduleBuilderExtensions,
                 new MockResourceEnvironmentSetter(),
-                kernel);
+                kernel,
+                bundleContext);
         builder.doStart();
 
         securityBuilder.doStart();

Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/PlanParsingTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/PlanParsingTest.java?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/PlanParsingTest.java (original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/PlanParsingTest.java Wed Jun  2 07:35:24 2010
@@ -39,6 +39,7 @@ import org.apache.geronimo.j2ee.deployme
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.osgi.MockBundleContext;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.util.JarUtils;
@@ -56,6 +57,10 @@ import org.apache.geronimo.xbeans.javaee
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
+import org.osgi.framework.Bundle;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.service.packageadmin.RequiredBundle;
 
 /**
  */
@@ -77,6 +82,64 @@ public class PlanParsingTest extends Xml
     protected void setUp() throws Exception {
         super.setUp();
         GeronimoSecurityBuilderImpl securityBuilder = new GeronimoSecurityBuilderImpl(null, null, null);
+        MockBundleContext bundleContext = new MockBundleContext(getClass().getClassLoader(), "", null, null);
+        PackageAdmin packageAdmin = new PackageAdmin() {
+
+                @Override
+                public ExportedPackage[] getExportedPackages(Bundle bundle) {
+                    return new ExportedPackage[0];
+                }
+
+                @Override
+                public ExportedPackage[] getExportedPackages(String s) {
+                    return new ExportedPackage[0];
+                }
+
+                @Override
+                public ExportedPackage getExportedPackage(String s) {
+                    return null;
+                }
+
+                @Override
+                public void refreshPackages(Bundle[] bundles) {
+                }
+
+                @Override
+                public boolean resolveBundles(Bundle[] bundles) {
+                    return false;
+                }
+
+                @Override
+                public RequiredBundle[] getRequiredBundles(String s) {
+                    return new RequiredBundle[0];
+                }
+
+                @Override
+                public Bundle[] getBundles(String s, String s1) {
+                    return new Bundle[0];
+                }
+
+                @Override
+                public Bundle[] getFragments(Bundle bundle) {
+                    return new Bundle[0];
+                }
+
+                @Override
+                public Bundle[] getHosts(Bundle bundle) {
+                    return new Bundle[0];
+                }
+
+                @Override
+                public Bundle getBundle(Class aClass) {
+                    return null;
+                }
+
+                @Override
+                public int getBundleType(Bundle bundle) {
+                    return 0;
+                }
+            };
+        bundleContext.registerService(PackageAdmin.class.getName(), packageAdmin, null);
         builder = new JettyModuleBuilder(defaultEnvironment,
                 new Integer(1800),
                 null,
@@ -93,7 +156,8 @@ public class PlanParsingTest extends Xml
                 new NamingBuilderCollection(null),
                 null,
                 new MockResourceEnvironmentSetter(),
-                null);
+                null,
+                bundleContext);
         builder.doStart();
         securityBuilder.doStart();
     }

Modified: geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java (original)
+++ geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java Wed Jun  2 07:35:24 2010
@@ -143,17 +143,12 @@ public class MyFacesModuleBuilderExtensi
         Map<EARContext.Key, Object> buildingContext = new HashMap<EARContext.Key, Object>();
         buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, moduleName);
 
-        //use the same jndi context as the web app
-        Map<JndiKey, Map<String, Object>> compContext = NamingBuilder.JNDI_KEY.get(module.getSharedContext());
-        buildingContext.put(NamingBuilder.JNDI_KEY, compContext);
-
         //use the same holder object as the web app.
         Holder holder = NamingBuilder.INJECTION_KEY.get(sharedContext);
         buildingContext.put(NamingBuilder.INJECTION_KEY, holder);
 
         XmlObject jettyWebApp = webModule.getVendorDD();
 
-//        Configuration earConfiguration = earContext.getConfiguration();
 
         ClassFinder classFinder = createMyFacesClassFinder(webApp, webModule);
         webModule.setClassFinder(classFinder);
@@ -279,6 +274,7 @@ public class MyFacesModuleBuilderExtensi
                 try {
                     clas = bundle.loadClass(className);
                     classes.add(clas);
+                    //TODO do we need superclasses?
                 }
                 catch (ClassNotFoundException e) {
                     log.warn("MyFacesModuleBuilderExtension: Could not load managed bean class: " + className  + " mentioned in faces-config.xml file at " + url.toString());

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java (original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java Wed Jun  2 07:35:24 2010
@@ -37,11 +37,12 @@ import org.apache.geronimo.gbean.Abstrac
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.j2ee.deployment.EARContext;
+import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.NamingBuilder;
+import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
 import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedEjbJar;
-import org.apache.geronimo.j2ee.jndi.JndiKey;
-import org.apache.geronimo.j2ee.jndi.JndiScope;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.jndi.JndiScope;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.naming.deployment.AbstractNamingBuilder;
 import org.apache.geronimo.naming.deployment.GBeanResourceEnvironmentBuilder;
@@ -375,29 +376,31 @@ public class EjbDeploymentBuilder {
         if (!ejbJarType.getMetadataComplete()) {
             // Create a classfinder and populate it for the naming builder(s). The absence of a
             // classFinder in the module will convey whether metadata-complete is set (or not)
-            ejbModule.setClassFinder(createEjbJarClassFinder(ejbModule));
+//            ejbModule.setClassFinder(createEjbJarClassFinder(ejbModule));
         }
 
-        Map<JndiKey, Map<String, Object>> moduleJndiContext = NamingBuilder.JNDI_KEY.get(ejbModule.getSharedContext());
         EnterpriseBeansType enterpriseBeans = ejbJarType.getEnterpriseBeans();
         if (enterpriseBeans != null) {
             for (SessionBeanType xmlbeansEjb : enterpriseBeans.getSessionArray()) {
                 String ejbName = xmlbeansEjb.getEjbName().getStringValue().trim();
+                String beanClass = xmlbeansEjb.getEjbClass().getStringValue().trim();
                 GBeanData gbean = getEjbGBean(ejbName);
                 ResourceRefType[] resourceRefs = xmlbeansEjb.getResourceRefArray();
-                addEnc(gbean, xmlbeansEjb, resourceRefs, moduleJndiContext);
+                addEnc(gbean, beanClass, xmlbeansEjb, resourceRefs);
             }
             for (MessageDrivenBeanType xmlbeansEjb : enterpriseBeans.getMessageDrivenArray()) {
                 String ejbName = xmlbeansEjb.getEjbName().getStringValue().trim();
+                String beanClass = xmlbeansEjb.getEjbClass().getStringValue().trim();
                 GBeanData gbean = getEjbGBean(ejbName);
                 ResourceRefType[] resourceRefs = xmlbeansEjb.getResourceRefArray();
-                addEnc(gbean, xmlbeansEjb, resourceRefs, moduleJndiContext);
+                addEnc(gbean, beanClass, xmlbeansEjb, resourceRefs);
             }
             for (EntityBeanType xmlbeansEjb : enterpriseBeans.getEntityArray()) {
                 String ejbName = xmlbeansEjb.getEjbName().getStringValue().trim();
+                String beanClass = xmlbeansEjb.getEjbClass().getStringValue().trim();
                 GBeanData gbean = getEjbGBean(ejbName);
                 ResourceRefType[] resourceRefs = xmlbeansEjb.getResourceRefArray();
-                addEnc(gbean, xmlbeansEjb, resourceRefs, moduleJndiContext);
+                addEnc(gbean, beanClass, xmlbeansEjb, resourceRefs);
             }
 
         }
@@ -408,28 +411,40 @@ public class EjbDeploymentBuilder {
         }
     }
 
-    private void addEnc(GBeanData gbean, XmlObject xmlbeansEjb, ResourceRefType[] resourceRefs, Map<JndiKey, Map<String, Object>> moduleJndiContext) throws DeploymentException {
+    private void addEnc(GBeanData gbean, String beanClass, XmlObject xmlbeansEjb, ResourceRefType[] resourceRefs) throws DeploymentException {
         OpenejbGeronimoEjbJarType geronimoOpenejb = ejbModule.getVendorDD();
 
         //
         // Build ENC
         //
-
-        // Geronimo uses a map to pass data to the naming build and for the results data
         Map<EARContext.Key, Object> buildingContext = new HashMap<EARContext.Key, Object>();
-        Map<JndiKey, Map<String, Object>> jndiContext = new HashMap<JndiKey, Map<String, Object>>();
-        buildingContext.put(NamingBuilder.JNDI_KEY, jndiContext);
         buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, gbean.getAbstractName());
-        ((AnnotatedEjbJar) ejbModule.getAnnotatedApp()).setBean(xmlbeansEjb);
+        Class ejbClass;
+        try {
+            ejbClass = ejbModule.getEarContext().getDeploymentBundle().loadClass(beanClass);
+        } catch (ClassNotFoundException e) {
+            throw new DeploymentException("Could not load ejb class", e);
+        }
+        List<Class> classes = new ArrayList<Class>();
+        while (ejbClass != null && !ejbClass.equals(Object.class)) {
+            classes.add(ejbClass);
+            ejbClass = ejbClass.getSuperclass();
+        }
+
+        ClassFinder finder = new ClassFinder(classes);
+        AnnotatedApp annotatedApp = AnnotatedEjbJar.getAnnotatedApp(xmlbeansEjb); 
+
 
+        Module module = ejbModule.newEJb(finder, annotatedApp);
         namingBuilder.buildNaming(xmlbeansEjb,
                 geronimoOpenejb,
-                ejbModule, buildingContext);
+                module,
+                buildingContext);
 
         AbstractName applicationJndiName = (AbstractName)earContext.getGeneralData().get(EARContext.APPLICATION_JNDI_NAME_KEY);
         gbean.setReferencePattern("ApplicationJndi", applicationJndiName);
-        gbean.setAttribute("moduleContextMap", jndiContext.get(JndiScope.module));
-        gbean.setAttribute("componentContextMap", jndiContext.get(JndiScope.comp));
+        gbean.setAttribute("moduleContextMap", module.getJndiScope(JndiScope.module));
+        gbean.setAttribute("componentContextMap", module.getJndiScope(JndiScope.comp));
 
         //
         // Process resource refs
@@ -444,26 +459,26 @@ public class EjbDeploymentBuilder {
         resourceEnvironmentSetter.setResourceEnvironment(refBuilder, resourceRefs, gerResourceRefs);
     }
 
-    private ClassFinder createEjbJarClassFinder(EjbModule ejbModule) throws DeploymentException {
-
-        try {
-            // Get the classloader from the module's EARContext
-            Bundle bundle = ejbModule.getEarContext().getDeploymentBundle();
-
-            //----------------------------------------------------------------------------------------
-            // Find the list of classes from the ejb-jar.xml we want to search for annotations in
-            //----------------------------------------------------------------------------------------
-            List<Class> classes = new ArrayList<Class>();
-
-            for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
-                classes.add(bundle.loadClass(bean.getEjbClass()));
-            }
-
-            return new ClassFinder(classes);
-        } catch (ClassNotFoundException e) {
-            throw new DeploymentException("Unable to load bean class.", e);
-        }
-    }
+//    private ClassFinder createEjbJarClassFinder(EjbModule ejbModule) throws DeploymentException {
+//
+//        try {
+//            // Get the classloader from the module's EARContext
+//            Bundle bundle = ejbModule.getEarContext().getDeploymentBundle();
+//
+//            //----------------------------------------------------------------------------------------
+//            // Find the list of classes from the ejb-jar.xml we want to search for annotations in
+//            //----------------------------------------------------------------------------------------
+//            List<Class> classes = new ArrayList<Class>();
+//
+//            for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
+//                classes.add(bundle.loadClass(bean.getEjbClass()));
+//            }
+//
+//            return new ClassFinder(classes);
+//        } catch (ClassNotFoundException e) {
+//            throw new DeploymentException("Unable to load bean class.", e);
+//        }
+//    }
 
     private GBeanData getEjbGBean(String ejbName) throws DeploymentException {
         GBeanData gbean = gbeans.get(ejbName);

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java (original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java Wed Jun  2 07:35:24 2010
@@ -16,17 +16,24 @@
  */
 package org.apache.geronimo.openejb.deployment;
 
+import java.util.Map;
 import java.util.jar.JarFile;
 
+import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.j2ee.deployment.EJBModule;
+import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
+import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedEjbJar;
+import org.apache.geronimo.j2ee.jndi.JndiKey;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.openejb.xbeans.ejbjar.OpenejbGeronimoEjbJarType;
 import org.apache.openejb.assembler.classic.EjbJarInfo;
 import org.apache.openejb.config.ConfigurationFactory;
 import org.apache.openejb.jee.EjbJar;
 import org.apache.openejb.jee.oejb3.OpenejbJar;
+import org.apache.xbean.finder.ClassFinder;
 import org.apache.xmlbeans.XmlObject;
 
 /**
@@ -40,21 +47,25 @@ public class EjbModule extends EJBModule
     private OpenejbGeronimoEjbJarType vendorDD;
     private final org.apache.openejb.config.EjbModule ejbModule;
     private final ConfigurationFactory.Chain preAutoConfigDeployer;
+    private final boolean shareJndi;
 
-    public EjbModule(org.apache.openejb.config.EjbModule ejbModule, 
-                     boolean standAlone, 
-                     AbstractName moduleName, 
-                     String name, 
-                     Environment environment, 
-                     JarFile moduleFile, 
-                     String targetPath, 
-                     String ejbJarXml, 
-                     AnnotatedApp annoatedApp) {
-        super(standAlone, moduleName, name, environment, moduleFile, 
-              targetPath, null, null, ejbJarXml, annoatedApp);
+    public EjbModule(org.apache.openejb.config.EjbModule ejbModule,
+                     boolean standAlone,
+                     AbstractName moduleName,
+                     String name,
+                     Environment environment,
+                     JarFile moduleFile,
+                     String targetPath,
+                     String ejbJarXml,
+                     AnnotatedApp annoatedApp,
+                     Map<JndiKey, Map<String, Object>> jndiContext,
+                     Module parentModule, boolean shareJndi) {
+        super(standAlone, moduleName, name, environment, moduleFile,
+                targetPath, null, null, ejbJarXml, annoatedApp, jndiContext, parentModule);
         this.ejbModule = ejbModule;
-        
+
         preAutoConfigDeployer = new ConfigurationFactory.Chain();
+        this.shareJndi = shareJndi;
     }
 
     @Override
@@ -118,9 +129,39 @@ public class EjbModule extends EJBModule
 
     public void setClassLoader(ClassLoader classLoader) {
         ejbModule.setClassLoader(classLoader);
+        ejbModule.getClientModule().setClassLoader(classLoader);
     }
 
     public ConfigurationFactory.Chain getPreAutoConfigDeployer() {
         return preAutoConfigDeployer;
     }
+
+    public Map<JndiKey, Map<String, Object>> getEjbJndiContext() {
+        if (shareJndi) {
+            return getJndiContext();
+        } else {
+            return Module.share(Module.MODULE, getJndiContext());
+        }
+    }
+
+    Module newEJb(ClassFinder finder, AnnotatedApp aa) throws DeploymentException {
+        Ejb ejb = new Ejb(isStandAlone(), getModuleName(), getName(), getEnvironment(), getModuleFile(), getTargetPath(),
+                getSpecDD(), getVendorDD(), getOriginalSpecDD(), getNamespace(), aa,
+                getEjbJndiContext(), this);
+        ejb.setEarContext(getEarContext());
+        ejb.setRootEarContext(getRootEarContext());
+        ejb.setClassFinder(finder);
+        return ejb;
+    }
+
+    class Ejb extends Module {
+        protected Ejb(boolean standAlone, AbstractName moduleName, String name, Environment environment, JarFile moduleFile, String targetPath, Object specDD, Object vendorDD, String originalSpecDD, String namespace, AnnotatedApp annotatedApp, Map<JndiKey, Map<String, Object>> jndiContext, Module<?, ?> parentModule) {
+            super(standAlone, moduleName, name, environment, moduleFile, targetPath, specDD, vendorDD, originalSpecDD, namespace, annotatedApp, jndiContext, parentModule);
+        }
+
+        @Override
+        public ConfigurationModuleType getType() {
+            return null;
+        }
+    }
 }

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java Wed Jun  2 07:35:24 2010
@@ -51,8 +51,6 @@ import org.apache.geronimo.deployment.xm
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.gbean.annotation.GBean;
@@ -70,7 +68,6 @@ import org.apache.geronimo.j2ee.jndi.Jnd
 import org.apache.geronimo.j2ee.jndi.JndiScope;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Naming;
-import org.apache.geronimo.kernel.classloader.TemporaryClassLoader;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Artifact;
@@ -235,12 +232,12 @@ public class EjbModuleBuilder implements
     
     @Override
     public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
-        return createModule(plan, moduleFile, "ejb.jar", null, null, null, naming, idBuilder);
+        return createModule(plan, moduleFile, "ejb.jar", null, null, null, naming, idBuilder, "META-INF/", false);
     }
 
     @Override
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
-        return createModule(plan, moduleFile, targetPath, specDDUrl, environment, earName, naming, idBuilder);
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, Module parentModule, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+        return createModule(plan, moduleFile, targetPath, specDDUrl, environment, parentModule, naming, idBuilder, "META-INF/", false);
     }
 
     //ModuleBuilderExtension entry points
@@ -263,23 +260,24 @@ public class EjbModuleBuilder implements
         //check for web module
         if (module instanceof WebModule) {
             //check for WEB-INF/ejb-jar.xml
-            Module ejbModule = createModule(null, moduleFile, targetPath, null, environment, earName, naming, idBuilder);
+            Module ejbModule = createModule(null, moduleFile, targetPath, null, environment, module, naming, idBuilder, "WEB-INF/", true);
             if (ejbModule != null) {
                 module.getModules().add(ejbModule);
                 //???
                 module.getModuleLocations().add(targetPath);
+                ejbModule.getSharedContext().putAll(module.getSharedContext());
             }
         }
 
     }
 
-    private Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment earEnvironment, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+    private Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment earEnvironment, Module parentModule, Naming naming, ModuleIDBuilder idBuilder, String ddDir, boolean subModule) throws DeploymentException {
         if (moduleFile == null) throw new NullPointerException("moduleFile is null");
         if (targetPath == null) throw new NullPointerException("targetPath is null");
         if (targetPath.endsWith("/")) throw new IllegalArgumentException("targetPath must not end with a '/'");
 
         // Load the module file
-        DeploymentLoader loader = new DeploymentLoader();
+        DeploymentLoader loader = new DeploymentLoader(ddDir);
         AppModule appModule;
         try {
             appModule = loader.load(new File(moduleFile.getName()));
@@ -368,12 +366,12 @@ public class EjbModuleBuilder implements
 
 
         AbstractName moduleName;
-        if (earName == null) {
-            earName = naming.createRootName(environment.getConfigId(), NameFactory.NULL, NameFactory.J2EE_APPLICATION);
+        if (parentModule == null || ".".equals(targetPath)) {
+            AbstractName earName = naming.createRootName(environment.getConfigId(), NameFactory.NULL, NameFactory.J2EE_APPLICATION);
             moduleName = naming.createChildName(earName, environment.getConfigId().toString(), NameFactory.EJB_MODULE);
             ejbModule.setModuleId(environment.getConfigId().getArtifactId());
         } else {
-            moduleName = naming.createChildName(earName, targetPath, NameFactory.EJB_MODULE);
+            moduleName = naming.createChildName(parentModule.getModuleName(), targetPath, NameFactory.EJB_MODULE);
             ejbModule.setModuleId(targetPath);
         }
 
@@ -382,20 +380,29 @@ public class EjbModuleBuilder implements
         EjbJarType ejbJarType = XmlUtil.convertToXmlbeans(ejbJar);
         AnnotatedEjbJar annotatedEjbJar = new AnnotatedEjbJar(ejbJarType);
 
-        String name = null;
-        if (ejbJarType.isSetModuleName()) {
+        String name;
+        if (subModule) {
+            name = parentModule.getName();
+        } else if (ejbJarType.isSetModuleName()) {
             name = ejbJarType.getModuleName().getStringValue().trim();
         } else if (standAlone) {
             name = FileUtils.removeExtension(new File(moduleFile.getName()).getName(), ".jar");
         } else {
             name = FileUtils.removeExtension(targetPath, ".jar");
         }
-                
-        EjbModule module = new EjbModule(ejbModule, standAlone, moduleName, name, environment, moduleFile, targetPath, "", annotatedEjbJar);
+
+        Map<JndiKey, Map<String, Object>> context = null;
+        if (subModule) {
+            context = parentModule.getJndiContext();
+        } else if (parentModule != null) {
+            context = Module.share(Module.APP, parentModule.getJndiContext());
+        }
+        EjbModule module = new EjbModule(ejbModule, standAlone, moduleName, name, environment, moduleFile, targetPath, "", annotatedEjbJar, context, parentModule, subModule);
 
         for (ModuleBuilderExtension builder : moduleBuilderExtensions) {
             try {
-                builder.createModule(module, plan, moduleFile, targetPath, specDDUrl, environment, null, earName, naming, idBuilder);
+                builder.createModule(module, plan, moduleFile, targetPath, specDDUrl, environment, null, parentModule == null? null: parentModule.getModuleName(), naming, idBuilder);
+
             } catch (Throwable t) {
                 String builderName = builder.getClass().getSimpleName();
                 log.error(builderName + ".createModule() failed: " + t.getMessage(), t);
@@ -522,19 +529,17 @@ public class EjbModuleBuilder implements
             LinkedHashSet<Module<?,?>> modules = module.getModules();
             for (Module<?,?> subModule: modules) {
                 if (subModule instanceof EjbModule)  {
-                    installModule(earFile, earContext, subModule, configurationStores, targetConfigurationStore, repository);
+                    subModule.setEarContext(module.getEarContext());
+                    subModule.setRootEarContext(module.getRootEarContext());
+                    //don't copy, module is already in classloader
+                    registerModule(subModule, earContext);
                 }
             }
         }
     }
 
     private void installModule(Module module, EARContext earContext) throws DeploymentException {
-        EarData earData = EarData.KEY.get(earContext.getGeneralData());
-        if (earData == null) {
-            earData = new EarData();
-            earContext.getGeneralData().put(EarData.KEY, earData);
-        }
-        earData.addEjbModule((EjbModule) module);
+        registerModule(module, earContext);
 
         JarFile moduleFile = module.getModuleFile();
         try {
@@ -545,6 +550,15 @@ public class EjbModuleBuilder implements
         }
     }
 
+    private void registerModule(Module module, EARContext earContext) {
+        EarData earData = EarData.KEY.get(earContext.getGeneralData());
+        if (earData == null) {
+            earData = new EarData();
+            earContext.getGeneralData().put(EarData.KEY, earData);
+        }
+        earData.addEjbModule((EjbModule) module);
+    }
+
     private static final String LINE_SEP = System.getProperty("line.separator");
 
     private boolean cleanupConfigurationDir(File configurationDir) {
@@ -573,7 +587,7 @@ public class EjbModuleBuilder implements
 
             // update the original spec dd with the metadata complete dd
             EjbJar ejbJar = ejbModule.getEjbJar();
-            ejbModule.setOriginalSpecDD(XmlUtil.marshal(ejbModule.getEjbJar()));
+            ejbModule.setOriginalSpecDD(XmlUtil.marshal(ejbJar));
 
             // Get the geronimo-openejb plan
             GeronimoEjbJarType geronimoEjbJarType = (GeronimoEjbJarType) ejbModule.getEjbModule().getAltDDs().get("geronimo-openejb.xml");
@@ -638,12 +652,12 @@ public class EjbModuleBuilder implements
             ClassLoader bundleLoader = new BundleClassLoader(bundle);
 
             // temporary classloader is used for processing ejb annotations and byte code manipulation during ejb load
-            TemporaryClassLoader temporaryClassLoader = new TemporaryClassLoader(new URL[0], bundleLoader);
+//            TemporaryClassLoader temporaryClassLoader = new TemporaryClassLoader(new URL[0], bundleLoader);
 
             // create an openejb app module for the ear containing all ejb modules
             AppModule appModule = new AppModule(bundleLoader, earContext.getConfigID().toString());
-            for (EjbModule module : earData.getEjbModuels()) {
-                module.setClassLoader(temporaryClassLoader);
+            for (EjbModule module : earData.getEjbModules()) {
+                module.setClassLoader(bundleLoader);
                 appModule.getEjbModules().add(module.getEjbModule());
             }
 
@@ -857,11 +871,8 @@ public class EjbModuleBuilder implements
         EjbDeploymentBuilder ejbDeploymentBuilder = ejbModule.getEjbBuilder();
 
         // add enc
-        Map<JndiKey, Map<String, Object>> jndiContext = NamingBuilder.JNDI_KEY.get(earContext.getGeneralData());
-        getJndiContext(jndiContext, JndiScope.module).put("module/ModuleName", module.getName());        
-        ejbModule.getSharedContext().put(NamingBuilder.JNDI_KEY, jndiContext);
+        module.getJndiScope(JndiScope.module).put("module/ModuleName", module.getName());
         ejbDeploymentBuilder.buildEnc();
-        Map<String, Object> moduleContext = jndiContext.remove(JndiScope.module);
 
         Set<GBeanData> gBeanDatas = earContext.getConfiguration().findGBeanDatas(Collections.singleton(new AbstractNameQuery(PersistenceUnitGBean.class.getName())));
         LinkResolver<String> linkResolver = new UniqueDefaultLinkResolver<String>();
@@ -887,10 +898,11 @@ public class EjbModuleBuilder implements
         // Add JSR77 EJBModule GBean
         GBeanData ejbModuleGBeanData = new GBeanData(ejbModule.getModuleName(), EjbModuleImpl.class);
         try {
-            ejbModuleGBeanData.setReferencePattern("J2EEServer", earContext.getServerName());
-            if (!ejbModule.isStandAlone()) {
-                ejbModuleGBeanData.setReferencePattern("J2EEApplication", earContext.getModuleName());
-            }
+            ejbModuleGBeanData.setReferencePattern("J2EEServer", module.getRootEarContext().getServerName());
+            //TODO nested modules figure out when this makes sense
+//            if (!ejbModule.isShared()) {
+//                ejbModuleGBeanData.setReferencePattern("J2EEApplication", module.getRootEarContext().getModuleName());
+//            }
 
             ejbModuleGBeanData.setAttribute("deploymentDescriptor", ejbModule.getOriginalSpecDD());
 
@@ -902,7 +914,7 @@ public class EjbModuleBuilder implements
             ejbModuleGBeanData.setReferencePattern("OpenEjbSystem", new AbstractNameQuery(null, Collections.EMPTY_MAP, OpenEjbSystem.class.getName()));
             ejbModuleGBeanData.setAttribute("ejbJarInfo", ejbModule.getEjbJarInfo());
             ejbModuleGBeanData.setAttribute("modulePath", ejbModule.getTargetPath());
-            ejbModuleGBeanData.setAttribute("moduleContext", moduleContext);
+            ejbModuleGBeanData.setAttribute("moduleContext", module.getJndiScope(JndiScope.module));
             earContext.addGBean(ejbModuleGBeanData);
         } catch (Exception e) {
             throw new DeploymentException("Unable to initialize EJBModule GBean " + ejbModuleGBeanData.getAbstractName(), e);
@@ -926,15 +938,6 @@ public class EjbModuleBuilder implements
             }
         }
     }
-
-    private static Map<String, Object> getJndiContext(Map<JndiKey, Map<String, Object>> contexts, JndiScope scope) {
-        Map<String, Object> context = contexts.get(scope);
-        if (context == null) {
-            context = new HashMap<String, Object>();
-            contexts.put(scope, context);
-        }
-        return context;
-    }
     
     private void setMdbContainerIds(EARContext earContext, EjbModule ejbModule, GBeanData ejbModuleGBeanData) throws DeploymentException {
         Object altDD = ejbModule.getEjbModule().getAltDDs().get("openejb-jar.xml");
@@ -1052,7 +1055,7 @@ public class EjbModuleBuilder implements
             return ejbModule;
         }
 
-        public Collection<EjbModule> getEjbModuels() {
+        public Collection<EjbModule> getEjbModules() {
             return ejbModules.values();
         }
 

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java Wed Jun  2 07:35:24 2010
@@ -175,7 +175,7 @@ public class EjbRefBuilder extends Abstr
                     value = createClientRef(value);
                 }
                 if (value instanceof Serializable) {
-                    put(name, value, getJndiContextMap(sharedContext));
+                    put(name, value, module.getJndiContext());
                 }
             }
         }

Modified: geronimo/server/trunk/plugins/openejb/openejb/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/openejb/src/main/history/dependencies.xml?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/openejb/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/openejb/openejb/src/main/history/dependencies.xml Wed Jun  2 07:35:24 2010
@@ -122,6 +122,11 @@
         <type>jar</type>
     </dependency>
     <dependency>
+        <groupId>org.apache.xbean</groupId>
+        <artifactId>xbean-bundleutils</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
         <groupId>org.apache.yoko</groupId>
         <artifactId>yoko-spec-corba</artifactId>
         <type>jar</type>

Modified: geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceContextRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceContextRefBuilder.java?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceContextRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceContextRefBuilder.java Wed Jun  2 07:35:24 2010
@@ -144,7 +144,7 @@ public class PersistenceContextRefBuilde
 
                 PersistenceContextReference reference = new PersistenceContextReference(module.getConfigId(), persistenceUnitNameQuery, transactionScoped, properties);
 
-                put(persistenceContextRefName, reference, NamingBuilder.JNDI_KEY.get(componentContext));
+                put(persistenceContextRefName, reference, module.getJndiContext());
             } catch (DeploymentException e) {
                 problems.add(e);
             }
@@ -166,7 +166,7 @@ public class PersistenceContextRefBuilde
 
                 PersistenceContextReference reference = new PersistenceContextReference(module.getConfigId(), persistenceUnitNameQuery, transactionScoped, properties);
 
-                put(persistenceContextRefName, reference, NamingBuilder.JNDI_KEY.get(componentContext));
+                put(persistenceContextRefName, reference, module.getJndiContext());
             } catch (DeploymentException e) {
                 problems.add(e);
             }

Modified: geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitRefBuilder.java?rev=950397&r1=950396&r2=950397&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitRefBuilder.java Wed Jun  2 07:35:24 2010
@@ -130,7 +130,7 @@ public class PersistenceUnitRefBuilder e
 
                 PersistenceUnitReference reference = new PersistenceUnitReference(module.getConfigId(), persistenceUnitNameQuery);
 
-                put(persistenceUnitRefName, reference, NamingBuilder.JNDI_KEY.get(componentContext));
+                put(persistenceUnitRefName, reference, module.getJndiContext());
             } catch (DeploymentException e) {
                 problems.add(e);
             }
@@ -148,7 +148,7 @@ public class PersistenceUnitRefBuilder e
 
                 PersistenceUnitReference reference = new PersistenceUnitReference(module.getConfigId(), persistenceUnitNameQuery);
 
-                put(PersistenceUnitRefName, reference, NamingBuilder.JNDI_KEY.get(componentContext));
+                put(PersistenceUnitRefName, reference, module.getJndiContext());
             } catch (DeploymentException e) {
                 problems.add(e);
             }



Mime
View raw message