geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r497672 - in /geronimo/server/trunk: configs/openejb/src/plan/ modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/deployment/ mod...
Date Fri, 19 Jan 2007 01:14:20 GMT
Author: dain
Date: Thu Jan 18 17:14:18 2007
New Revision: 497672

URL: http://svn.apache.org/viewvc?view=rev&rev=497672
Log:
Ejb deployment now work, but executing the beans has not been tested

Modified:
    geronimo/server/trunk/configs/openejb/src/plan/plan.xml
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilderTest.java
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbDeployment.java
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbModuleImplGBean.java
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
    geronimo/server/trunk/modules/geronimo-openejb/src/main/resources/META-INF/geronimo-dependency.xml
    geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceContextRefBuilder.java
    geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java

Modified: geronimo/server/trunk/configs/openejb/src/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/openejb/src/plan/plan.xml?view=diff&rev=497672&r1=497671&r2=497672
==============================================================================
--- geronimo/server/trunk/configs/openejb/src/plan/plan.xml (original)
+++ geronimo/server/trunk/configs/openejb/src/plan/plan.xml Thu Jan 18 17:14:18 2007
@@ -28,17 +28,36 @@
 
     <gbean name="DefaultStatelessContainer" class="org.apache.geronimo.openejb.EjbContainer">
         <attribute name="id">Default Stateless Container</attribute>
+        <reference name="OpenEjbSystem">
+            <name>OpenEjbSystem</name>
+        </reference>
     </gbean>
     <gbean name="DefaultStatefulContainer" class="org.apache.geronimo.openejb.EjbContainer">
         <attribute name="id">Default Stateful Container</attribute>
+        <reference name="OpenEjbSystem">
+            <name>OpenEjbSystem</name>
+        </reference>
     </gbean>
     <gbean name="DefaultBMPContainer" class="org.apache.geronimo.openejb.EjbContainer">
         <attribute name="id">Default BMP Container</attribute>
+        <reference name="OpenEjbSystem">
+            <name>OpenEjbSystem</name>
+        </reference>
     </gbean>
     <gbean name="DefaultCMPContainer" class="org.apache.geronimo.openejb.EjbContainer">
         <attribute name="id">Default CMP Container</attribute>
+        <reference name="OpenEjbSystem">
+            <name>OpenEjbSystem</name>
+        </reference>
     </gbean>
     
+    <gbean name="DefaultMDBContainer" class="org.apache.geronimo.openejb.EjbContainer">
+        <attribute name="id">Default MDB Container</attribute>
+        <reference name="OpenEjbSystem">
+            <name>OpenEjbSystem</name>
+        </reference>
+    </gbean>
+
 <!--
     <gbean name="StatelessEjbContainer" class="org.apache.openejb.slsb.DefaultStatelessEjbContainerGBean">
         <reference name="TransactionManager">

Modified: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java?view=diff&rev=497672&r1=497671&r2=497672
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
Thu Jan 18 17:14:18 2007
@@ -47,11 +47,10 @@
 import org.apache.openejb.jee.EnterpriseBean;
 import org.apache.openejb.jee.RemoteBean;
 import org.apache.openejb.jee.SecurityIdentity;
-import org.apache.openejb.jee.StatefulBean;
 import org.apache.openejb.jee.StatelessBean;
 import org.apache.openejb.jee.MessageDrivenBean;
 import org.apache.openejb.jee.EntityBean;
-import org.apache.openejb.spi.ContainerSystem;
+import org.apache.openejb.jee.SessionBean;
 import org.apache.openejb.alt.config.ejb.EjbDeployment;
 import org.apache.geronimo.openejb.deployment.ejbref.LocalEjbRefBuilder;
 import org.apache.geronimo.openejb.deployment.ejbref.RemoteEjbRefBuilder;
@@ -59,6 +58,7 @@
 import org.apache.geronimo.openejb.StatefulDeploymentGBean;
 import org.apache.geronimo.openejb.EntityDeploymentGBean;
 import org.apache.geronimo.openejb.MessageDrivenDeploymentGBean;
+import org.apache.geronimo.openejb.OpenEjbSystem;
 import org.apache.geronimo.connector.outbound.connectiontracking.TrackedConnectionAssociator;
 import org.apache.xmlbeans.XmlObject;
 
@@ -82,17 +82,24 @@
     public void initContext() throws DeploymentException {
         for (EnterpriseBean enterpriseBean : ejbModule.getEjbJar().getEnterpriseBeans())
{
             AbstractName abstractName = createEjbName(enterpriseBean);
-            GBeanData gbean;
-            if (enterpriseBean instanceof StatelessBean) {
-                gbean = new GBeanData(abstractName, StatelessDeploymentGBean.GBEAN_INFO);
-            } else if (enterpriseBean instanceof StatefulBean) {
-                gbean = new GBeanData(abstractName, StatefulDeploymentGBean.GBEAN_INFO);
+            GBeanData gbean = null;
+            if (enterpriseBean instanceof SessionBean) {
+                SessionBean sessionBean = (SessionBean) enterpriseBean;
+                switch (sessionBean.getSessionType()) {
+                    case STATELESS:
+                        gbean = new GBeanData(abstractName, StatelessDeploymentGBean.GBEAN_INFO);
+                        break;
+                    case STATEFUL:
+                        gbean = new GBeanData(abstractName, StatefulDeploymentGBean.GBEAN_INFO);
+                        break;
+                }
             } else if (enterpriseBean instanceof EntityBean) {
                 gbean = new GBeanData(abstractName, EntityDeploymentGBean.GBEAN_INFO);
             } else if (enterpriseBean instanceof MessageDrivenBean) {
                 gbean = new GBeanData(abstractName, MessageDrivenDeploymentGBean.GBEAN_INFO);
-            } else {
-                throw new DeploymentException("Unknown enterprise bean type " + enterpriseBean.getClass().getTypeParameters());
+            }
+            if (gbean == null) {
+                throw new DeploymentException("Unknown enterprise bean type " + enterpriseBean.getClass().getName());
             }
 
             String ejbName = enterpriseBean.getEjbName();
@@ -138,7 +145,7 @@
 
             // set reference patterns
             gbean.setReferencePattern("TrackedConnectionAssociator", new AbstractNameQuery(null,
Collections.EMPTY_MAP, TrackedConnectionAssociator.class.getName()));
-            gbean.setReferencePattern("ContainerSystem", new AbstractNameQuery(null, Collections.EMPTY_MAP,
ContainerSystem.class.getName()));
+            gbean.setReferencePattern("OpenEjbSystem", new AbstractNameQuery(null, Collections.EMPTY_MAP,
OpenEjbSystem.class.getName()));
 
             try {
                 earContext.addGBean(gbean);
@@ -150,6 +157,12 @@
     }
 
 
+    public void addEjbModuleDependency(AbstractName ejbModuleName) {
+        for (GBeanData gbean : gbeans.values()) {
+            gbean.addDependency(ejbModuleName);
+        }
+    }
+
     public ComponentPermissions buildComponentPermissions() throws DeploymentException {
         ComponentPermissions componentPermissions = new ComponentPermissions(new Permissions(),
new Permissions(), new HashMap());
         for (EnterpriseBean enterpriseBean : ejbModule.getEjbJar().getEnterpriseBeans())
{
@@ -208,7 +221,7 @@
         //
         // XMLBeans types must be use because Geronimo naming building is coupled via XMLBeans
objects
         //
-        EjbJarType ejbJarType = (EjbJarType) ejbModule.getVendorDD();
+        EjbJarType ejbJarType = (EjbJarType) ejbModule.getSpecDD();
         EnterpriseBeansType enterpriseBeans = ejbJarType.getEnterpriseBeans();
         if (enterpriseBeans != null) {
             for (SessionBeanType xmlbeansEjb : enterpriseBeans.getSessionArray()) {
@@ -252,7 +265,7 @@
                 ejbModule, buildingContext);
 
         Map compContext = (Map) buildingContext.get(NamingBuilder.JNDI_KEY);
-        gbean.setAttribute("componentContext", compContext);
+        gbean.setAttribute("componentContextMap", compContext);
 
         //
         // Process resource refs
@@ -276,14 +289,23 @@
     private AbstractName createEjbName(EnterpriseBean enterpriseBean) {
         String ejbName = enterpriseBean.getEjbName();
         String type = null;
-        if (enterpriseBean instanceof StatelessBean) {
-            type = NameFactory.STATELESS_SESSION_BEAN;
-        } else if (enterpriseBean instanceof StatefulBean) {
-            type = NameFactory.STATEFUL_SESSION_BEAN;
+        if (enterpriseBean instanceof SessionBean) {
+            SessionBean sessionBean = (SessionBean) enterpriseBean;
+            switch (sessionBean.getSessionType()) {
+                case STATELESS:
+                    type = NameFactory.STATELESS_SESSION_BEAN;
+                    break;
+                case STATEFUL:
+                    type = NameFactory.STATEFUL_SESSION_BEAN;
+                    break;
+            }
         } else if (enterpriseBean instanceof EntityBean) {
             type = NameFactory.ENTITY_BEAN;
         } else if (enterpriseBean instanceof MessageDrivenBean) {
             type = NameFactory.MESSAGE_DRIVEN_BEAN;
+        }
+        if (type == null) {
+            throw new IllegalArgumentException("Unknown enterprise bean type XXX " + enterpriseBean.getClass().getName());
         }
         return earContext.getNaming().createChildName(ejbModule.getModuleName(), ejbName,
type);
     }

Modified: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java?view=diff&rev=497672&r1=497671&r2=497672
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java
(original)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java
Thu Jan 18 17:14:18 2007
@@ -16,17 +16,17 @@
  */
 package org.apache.geronimo.openejb.deployment;
 
-import org.apache.geronimo.j2ee.deployment.EJBModule;
+import java.util.Map;
+import java.util.jar.JarFile;
+
 import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.j2ee.deployment.EJBModule;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.openejb.xbeans.ejbjar.OpenejbGeronimoEjbJarType;
-import org.apache.openejb.jee.EjbJar;
 import org.apache.openejb.alt.config.ejb.OpenejbJar;
 import org.apache.openejb.assembler.classic.EjbJarInfo;
+import org.apache.openejb.jee.EjbJar;
 import org.apache.xmlbeans.XmlObject;
-
-import java.util.jar.JarFile;
-import java.util.Map;
 
 /**
  * @version $Rev$ $Date$

Modified: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java?view=diff&rev=497672&r1=497671&r2=497672
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
Thu Jan 18 17:14:18 2007
@@ -27,6 +27,9 @@
 import java.util.Map;
 import java.util.jar.JarFile;
 
+import javax.ejb.SessionContext;
+import javax.ejb.EntityContext;
+
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
@@ -165,13 +168,10 @@
             idBuilder.resolve(environment, new File(moduleFile.getName()).getName(), "jar");
         }
 
-        // create a xmlbeans version of the ejb-jar.xml file, because the jndi code is coupled
based on xmlbeans objects
-        EjbJarType ejbJarType = XmlUtil.convertToXmlbeans(ejbJar);
-
-
         // todo THIS WILL NOT WORK WITH ANNOTATIONS... move this to initContext when naming
is fixed
         // since assembly descriptor will only be valid once metadata complete
         // which is only available once a class loader has been constructed in the init phase
+        EjbJarType ejbJarType = XmlUtil.convertToXmlbeans(ejbJar);
         if (ejbJar.getAssemblyDescriptor() != null) {
             AssemblyDescriptorType assemblyDescriptor = ejbJarType.getAssemblyDescriptor();
             namingBuilder.buildEnvironment(assemblyDescriptor, geronimoOpenejb, environment);
@@ -246,6 +246,44 @@
         }
     }
 
+    protected static void unmapReferences(EjbJar ejbJar) {
+        for (EnterpriseBean enterpriseBean : ejbJar.getEnterpriseBeans()) {
+            enterpriseBean.getEjbRef().clear();
+            for (EjbRef ref : enterpriseBean.getEjbRef()) {
+                ref.setMappedName(null);
+            }
+            for (EjbLocalRef ref : enterpriseBean.getEjbLocalRef()) {
+                ref.setMappedName(null);
+            }
+            for (MessageDestinationRef ref : enterpriseBean.getMessageDestinationRef()) {
+                ref.setMappedName(null);
+            }
+            for (PersistenceContextRef ref : enterpriseBean.getPersistenceContextRef()) {
+                ref.setMappedName(null);
+            }
+            for (PersistenceUnitRef ref : enterpriseBean.getPersistenceUnitRef()) {
+                ref.setMappedName(null);
+            }
+            for (ResourceRef ref : enterpriseBean.getResourceRef()) {
+                ref.setMappedName(null);
+            }
+            for (Iterator<ResourceEnvRef> iterator = enterpriseBean.getResourceEnvRef().iterator();
iterator.hasNext();) {
+                ResourceEnvRef ref = iterator.next();
+                if (ref.getType().equals(SessionContext.class.getName())) {
+                    iterator.remove();
+                } else if (ref.getType().equals(EntityContext.class.getName())) {
+                    iterator.remove();
+                } else {
+                    ref.setMappedName(null);
+                }
+
+            }
+            for (ServiceRef ref : enterpriseBean.getServiceRef()) {
+                ref.setMappedName(null);
+            }
+        }
+    }
+
 
     public void installModule(JarFile earFile, EARContext earContext, Module module, Collection
configurationStores, ConfigurationStore targetConfigurationStore, Collection repository) throws
DeploymentException {
         installModule(module, earContext);
@@ -282,6 +320,9 @@
         EjbJar ejbJar = ejbModule.getEjbJar();
         ejbModule.setOriginalSpecDD(XmlUtil.marshal(ejbModule.getEjbJar()));
 
+        // We must set all mapped name references back to null or Geronimo will blow up
+        unmapReferences(ejbJar);
+
         // create a xmlbeans version of the ejb-jar.xml file, because the jndi code is coupled
based on xmlbeans objects
         EjbJarType ejbJarType = XmlUtil.convertToXmlbeans(ejbJar);
         ejbModule.setSpecDD(ejbJarType);
@@ -316,6 +357,7 @@
      */
     public void addGBeans(EARContext earContext, Module module, ClassLoader cl, Collection
repositories) throws DeploymentException {
         EjbModule ejbModule = (EjbModule) module;
+        EjbDeploymentBuilder ejbDeploymentBuilder = ejbModule.getEjbBuilder();
 
         // Add JSR77 EJBModule GBean
         GBeanData ejbModuleGBeanData = new GBeanData(ejbModule.getModuleName(), EjbModuleImplGBean.GBEAN_INFO);
@@ -340,14 +382,15 @@
             throw new DeploymentException("Unable to initialize EJBModule GBean " + ejbModuleGBeanData.getAbstractName(),
e);
         }
 
+        // add a depdendency on the ejb module object
+        ejbDeploymentBuilder.addEjbModuleDependency(ejbModuleGBeanData.getAbstractName());
+
         // add enc
-        EjbDeploymentBuilder ejbDeploymentBuilder = ejbModule.getEjbBuilder();
         ejbDeploymentBuilder.buildEnc();
 
         // add the Jacc permissions to the ear
         ComponentPermissions componentPermissions = ejbDeploymentBuilder.buildComponentPermissions();
         earContext.addSecurityContext(ejbModule.getEjbJarInfo().moduleId, componentPermissions);
-
     }
 
 

Modified: geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilderTest.java?view=diff&rev=497672&r1=497671&r2=497672
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilderTest.java
(original)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilderTest.java
Thu Jan 18 17:14:18 2007
@@ -65,8 +65,8 @@
         EjbModule ejbModule = new EjbModule(classLoader, moduleFile.getName(), ejbJar, openejbJar);
         EjbModuleBuilder.mapReferences(ejbModule.getEjbJar());
         // configure the application
-//        EjbJarInfo ejbJarInfo = openEjbSystem.configureApplication(ejbModule);
-//        openEjbSystem.createEjbJar(ejbJarInfo, classLoader);
+        EjbJarInfo ejbJarInfo = openEjbSystem.configureApplication(ejbModule);
+        openEjbSystem.createEjbJar(ejbJarInfo, classLoader);
     }
 
     private void addEjbContainer(OpenEjbSystem openEjbSystem, String id) throws Exception
{

Modified: geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbDeployment.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbDeployment.java?view=diff&rev=497672&r1=497671&r2=497672
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbDeployment.java
(original)
+++ geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbDeployment.java
Thu Jan 18 17:14:18 2007
@@ -177,15 +177,17 @@
 
     protected void start() throws Exception {
         deploymentInfo = (CoreDeploymentInfo) openEjbSystem.getDeploymentInfo(deploymentId);
-        deploymentInfo.getJndiEnc().bind("geronimo", componentContext);
         if (deploymentInfo == null) {
             throw new IllegalStateException("Ejb does not exist " + deploymentId);
         }
+        deploymentInfo.getJndiEnc().bind("geronimo", componentContext);
         deploymentInfo.set(EjbDeployment.class, this);
     }
 
     protected void stop() {
-        deploymentInfo.set(EjbDeployment.class, null);
-        deploymentInfo = null;
+        if (deploymentInfo != null) {
+            deploymentInfo.set(EjbDeployment.class, null);
+            deploymentInfo = null;
+        }
     }
 }

Modified: geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbModuleImplGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbModuleImplGBean.java?view=diff&rev=497672&r1=497671&r2=497672
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbModuleImplGBean.java
(original)
+++ geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbModuleImplGBean.java
Thu Jan 18 17:14:18 2007
@@ -50,7 +50,7 @@
     public static final GBeanInfo GBEAN_INFO;
 
     static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(EjbModuleImpl.class,
NameFactory.EJB_MODULE);
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(EjbModuleImplGBean.class,
NameFactory.EJB_MODULE);
         infoBuilder.addReference("J2EEServer", J2EEServer.class);
         infoBuilder.addReference("J2EEApplication", J2EEApplication.class);
 
@@ -58,7 +58,7 @@
 
         infoBuilder.addReference("EJBCollection", EJB.class);
 
-        infoBuilder.addAttribute("classloader", ClassLoader.class, false);
+        infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
 
         infoBuilder.addReference("OpenEjbSystem", OpenEjbSystem.class);
         infoBuilder.addAttribute("ejbJarInfo", EjbJarInfo.class, true);
@@ -69,7 +69,7 @@
                 "J2EEApplication",
                 "deploymentDescriptor",
                 "EJBCollection",
-                "classloader",
+                "classLoader",
                 "OpenEjbSystem",
                 "ejbJarInfo"
         });

Modified: geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java?view=diff&rev=497672&r1=497671&r2=497672
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
(original)
+++ geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
Thu Jan 18 17:14:18 2007
@@ -23,10 +23,13 @@
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.openejb.Container;
 import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.OpenEJBException;
-import org.apache.openejb.loader.SystemInstance;
+import org.apache.openejb.util.proxy.Jdk13ProxyFactory;
 import org.apache.openejb.alt.config.ClientModule;
 import org.apache.openejb.alt.config.ConfigurationFactory;
 import org.apache.openejb.alt.config.EjbModule;
@@ -35,6 +38,7 @@
 import org.apache.openejb.assembler.classic.ContainerInfo;
 import org.apache.openejb.assembler.classic.EjbJarInfo;
 import org.apache.openejb.assembler.classic.TransactionServiceInfo;
+import org.apache.openejb.assembler.classic.ProxyFactoryInfo;
 import org.apache.openejb.assembler.dynamic.PassthroughFactory;
 import org.apache.openejb.spi.ContainerSystem;
 
@@ -46,6 +50,9 @@
     private final Assembler assembler;
 
     public OpenEjbSystemGBean(TransactionManager transactionManager) throws Exception {
+        this(transactionManager, null);
+    }
+    public OpenEjbSystemGBean(TransactionManager transactionManager, Kernel kernel) throws
Exception {
         System.setProperty("duct tape","");
         if (transactionManager == null) {
             throw new NullPointerException("transactionManager is null");
@@ -55,6 +62,9 @@
         configurationFactory = new ConfigurationFactory(offline);
         assembler = new Assembler();
 
+
+        // install transaction manager
+        transactionManager = getRawService(kernel, transactionManager);
         TransactionServiceInfo transactionServiceInfo = new TransactionServiceInfo();
         PassthroughFactory.add(transactionServiceInfo, transactionManager);
         try {
@@ -64,9 +74,35 @@
         } finally {
             PassthroughFactory.remove(transactionServiceInfo);
         }
+
+        // install proxy factory
+        ProxyFactoryInfo proxyFactoryInfo = new ProxyFactoryInfo();
+        proxyFactoryInfo.id = "Default JDK 1.3 ProxyFactory";
+        proxyFactoryInfo.serviceType = "ProxyFactory";
+        proxyFactoryInfo.className = Jdk13ProxyFactory.class.getName();
+        proxyFactoryInfo.properties = new Properties();
+        assembler.createProxyFactory(proxyFactoryInfo);
+
+        // add our thread context listener
         GeronimoThreadContextListener.init();
     }
 
+    @SuppressWarnings({"unchecked"})
+    private static <T> T getRawService(Kernel kernel, T proxy) {
+        if (kernel == null) return proxy;
+
+        AbstractName abstractName = kernel.getAbstractNameFor(proxy);
+        if (abstractName == null) return proxy;
+
+        try {
+            Object service = kernel.getGBean(abstractName);
+            return (T) service;
+        } catch (GBeanNotFoundException e) {
+        }
+
+        return proxy;
+    }
+
     public ContainerSystem getContainerSystem() {
         return assembler.getContainerSystem();
     }
@@ -127,8 +163,10 @@
     static {
         GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(OpenEjbSystemGBean.class);
         infoBuilder.addReference("TransactionManager", TransactionManager.class);
+        infoBuilder.addAttribute("kernel", Kernel.class, false);
         infoBuilder.setConstructor(new String[] {
                 "TransactionManager",
+                "kernel",
         });
         GBEAN_INFO = infoBuilder.getBeanInfo();
     }

Modified: geronimo/server/trunk/modules/geronimo-openejb/src/main/resources/META-INF/geronimo-dependency.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb/src/main/resources/META-INF/geronimo-dependency.xml?view=diff&rev=497672&r1=497671&r2=497672
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb/src/main/resources/META-INF/geronimo-dependency.xml
(original)
+++ geronimo/server/trunk/modules/geronimo-openejb/src/main/resources/META-INF/geronimo-dependency.xml
Thu Jan 18 17:14:18 2007
@@ -38,10 +38,6 @@
       <artifactId>openejb-persistence</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.codehaus.castor</groupId>
-      <artifactId>castor</artifactId>
-    </dependency>
-    <dependency>
       <groupId>org.apache.geronimo.specs</groupId>
       <artifactId>geronimo-annotation_1.0_spec</artifactId>
     </dependency>
@@ -85,6 +81,11 @@
       <groupId>stax</groupId>
       <artifactId>stax-api</artifactId>
     </dependency>
+    <!-- castor -->
+    <dependency>
+      <groupId>org.codehaus.castor</groupId>
+      <artifactId>castor</artifactId>
+    </dependency>
     <dependency>
       <groupId>xerces</groupId>
       <artifactId>xercesImpl</artifactId>
@@ -93,4 +94,15 @@
       <groupId>oro</groupId>
       <artifactId>oro</artifactId>
     </dependency>
+    <!-- end castor -->
+    <!-- activemq -->
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-ra</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-core</artifactId>
+    </dependency>
+    <!-- end activemq -->
 </service>

Modified: geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceContextRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceContextRefBuilder.java?view=diff&rev=497672&r1=497671&r2=497672
==============================================================================
--- geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceContextRefBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceContextRefBuilder.java
Thu Jan 18 17:14:18 2007
@@ -45,6 +45,7 @@
 import org.apache.geronimo.xbeans.geronimo.naming.GerPropertyType;
 import org.apache.geronimo.xbeans.javaee.PersistenceContextRefType;
 import org.apache.geronimo.xbeans.javaee.PropertyType;
+import org.apache.geronimo.xbeans.javaee.PersistenceContextTypeType;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
 
@@ -74,7 +75,8 @@
         for (PersistenceContextRefType persistenceContextRef : specPersistenceContextRefsUntyped)
{
             String persistenceContextRefName = persistenceContextRef.getPersistenceContextRefName().getStringValue().trim();
 
-            boolean transactionScoped = !persistenceContextRef.getPersistenceContextType().getStringValue().equals("extended");
+            PersistenceContextTypeType persistenceContextType = persistenceContextRef.getPersistenceContextType();
+            boolean transactionScoped = persistenceContextType == null || !persistenceContextType.getStringValue().equalsIgnoreCase("extended");
 
             PropertyType[] propertyTypes = persistenceContextRef.getPersistencePropertyArray();
             Map properties = new HashMap();

Modified: geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java?view=diff&rev=497672&r1=497671&r2=497672
==============================================================================
--- geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
Thu Jan 18 17:14:18 2007
@@ -29,8 +29,6 @@
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
-import org.apache.geronimo.deployment.xbeans.ServiceDocument;
-import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
@@ -138,7 +136,7 @@
                 if (persistenceUnit.isSetExcludeUnlistedClasses()) {
                     gbeanData.setAttribute("excludeUnlistedClasses", persistenceUnit.getExcludeUnlistedClasses());
                 } else {
-                    gbeanData.setAttribute("excludeUnlistedClassesValue", false);
+                    gbeanData.setAttribute("excludeUnlistedClasses", false);
                 }
 
                 Properties properties = new Properties();



Mime
View raw message