geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r985297 - in /geronimo/server/trunk/plugins/openejb: geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ geronimo-openejb/src/main/java/org/apache/geronimo/openejb/
Date Fri, 13 Aug 2010 17:40:56 GMT
Author: gawor
Date: Fri Aug 13 17:40:55 2010
New Revision: 985297

URL: http://svn.apache.org/viewvc?rev=985297&view=rev
Log:
Make sure the app and global jndi information generated at deploy time is used at runtime.
Otherwise, some ejbs might be be fully injected

Added:
    geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoEjbInfo.java
  (with props)
Modified:
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbModuleImpl.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/MEJBGBean.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystem.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java

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=985297&r1=985296&r2=985297&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
Fri Aug 13 17:40:55 2010
@@ -390,7 +390,7 @@ public class EjbDeploymentBuilder {
         }
         //TODO well, what is the appName?
         String appName = null;
-        EjbJarInfo ejbJarInfo = ejbModule.getEjbJarInfo();
+        EjbJarInfo ejbJarInfo = ejbModule.getEjbInfo().getEjbJarInfo();
         for (EnterpriseBean bean : ejbJar.getEnterpriseBeans()) {
             String ejbName = bean.getEjbName();
             String deploymentId = getDeploymentId(ejbName, ejbJarInfo);

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=985297&r1=985296&r2=985297&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
Fri Aug 13 17:40:55 2010
@@ -26,8 +26,8 @@ import org.apache.geronimo.j2ee.deployme
 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.GeronimoEjbInfo;
 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.EnterpriseBean;
@@ -39,7 +39,7 @@ import org.apache.xmlbeans.XmlObject;
  * @version $Rev$ $Date$
  */
 public class EjbModule extends EJBModule<OpenejbGeronimoEjbJarType> {
-    private EjbJarInfo ejbJarInfo;
+    private GeronimoEjbInfo ejbInfo;
     private EjbDeploymentBuilder ejbDeploymentBuilder;
     private final org.apache.openejb.config.EjbModule ejbModule;
     private final ConfigurationFactory.Chain preAutoConfigDeployer;
@@ -75,12 +75,12 @@ public class EjbModule extends EJBModule
         return ejbModule;
     }
 
-    public EjbJarInfo getEjbJarInfo() {
-        return ejbJarInfo;
+    public GeronimoEjbInfo getEjbInfo() {
+        return ejbInfo;
     }
 
-    public void setEjbJarInfo(EjbJarInfo ejbJarInfo) {
-        this.ejbJarInfo = ejbJarInfo;
+    public void setEjbInfo(GeronimoEjbInfo ejbInfo) {
+        this.ejbInfo = ejbInfo;
     }
 
     public EjbDeploymentBuilder getEjbBuilder() {

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=985297&r1=985296&r2=985297&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
Fri Aug 13 17:40:55 2010
@@ -75,6 +75,7 @@ import org.apache.geronimo.naming.deploy
 import org.apache.geronimo.openejb.EjbContainer;
 import org.apache.geronimo.openejb.EjbDeployment;
 import org.apache.geronimo.openejb.EjbModuleImpl;
+import org.apache.geronimo.openejb.GeronimoEjbInfo;
 import org.apache.geronimo.openejb.OpenEjbSystem;
 import org.apache.geronimo.openejb.xbeans.ejbjar.OpenejbGeronimoEjbJarType;
 import org.apache.geronimo.persistence.PersistenceUnitGBean;
@@ -610,9 +611,9 @@ public class EjbModuleBuilder implements
     private void doInitContext(EARContext earContext, Module module, Bundle bundle) throws
DeploymentException {
         EjbModule ejbModule = (EjbModule) module;
 
-        EjbJarInfo ejbJarInfo = getEjbJarInfo(earContext, ejbModule, bundle);
+        GeronimoEjbInfo ejbInfo = getEjbInfo(earContext, ejbModule, bundle);
 
-        ejbModule.setEjbJarInfo(ejbJarInfo);
+        ejbModule.setEjbInfo(ejbInfo);
 
         // update the original spec dd with the metadata complete dd
         EjbJar ejbJar = ejbModule.getEjbJar();
@@ -669,9 +670,9 @@ public class EjbModuleBuilder implements
         }
     }
 
-    private EjbJarInfo getEjbJarInfo(EARContext earContext, EjbModule ejbModule, Bundle bundle)
throws DeploymentException {
+    private GeronimoEjbInfo getEjbInfo(EARContext earContext, EjbModule ejbModule, Bundle
bundle) throws DeploymentException {
         EarData earData = EarData.KEY.get(earContext.getGeneralData());
-        if (earData.getEjbJars().isEmpty()) {
+        if (earData.getEjbInfos().isEmpty()) {
 
             ClassLoader bundleLoader = new BundleClassLoader(bundle);
 
@@ -710,7 +711,8 @@ public class EjbModuleBuilder implements
 
             // add all of the modules to the ear data
             for (EjbJarInfo ejbJar : appInfo.ejbJars) {
-                earData.addEjbJar(ejbJar);
+                GeronimoEjbInfo ejbInfo = new GeronimoEjbInfo(ejbJar, appInfo.globalJndiEnc,
appInfo.appJndiEnc);
+                earData.addEjbInfo(ejbInfo);
             }
 
             // add the cmp jar
@@ -736,8 +738,8 @@ public class EjbModuleBuilder implements
         }
 
         // find our module
-        EjbJarInfo ejbJarInfo = earData.getEjbJar(ejbModule.getEjbModule().getModuleId());
-        return ejbJarInfo;
+        GeronimoEjbInfo ejbInfo = earData.getEjbInfo(ejbModule.getEjbModule().getModuleId());
+        return ejbInfo;
     }
 
     private AppInfo configureApplication(AppModule appModule, EjbModule ejbModule, Configuration
configuration)
@@ -750,10 +752,11 @@ public class EjbModuleBuilder implements
         ConfigurationFactory.Chain chain = new ConfigurationFactory.Chain();
         ConfigurationFactory configurationFactory = new ConfigurationFactory(offline, chain,
openEjbConfiguration);
         buildChain(offline,
-                ejbModule.getPreAutoConfigDeployer(),
-                SystemInstance.get().getOptions(),
-                configurationFactory,
-                chain);
+                   ejbModule.getPreAutoConfigDeployer(),
+                   SystemInstance.get().getOptions(),
+                   configurationFactory,
+                   chain);
+
         ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(appModule.getClassLoader());
         try {
@@ -770,6 +773,7 @@ public class EjbModuleBuilder implements
     private static final String DEBUGGABLE_VM_HACKERY_PROPERTY = "openejb.debuggable-vm-hackery";
     private static final String VALIDATION_SKIP_PROPERTY = "openejb.validation.skip";
     private static final String WEBSERVICES_ENABLED = "openejb.webservices.enabled";
+    
     private static ConfigurationFactory.Chain buildChain(boolean offline, DynamicDeployer
preAutoConfigDeployer, Options options, ConfigurationFactory configurationFactory, ConfigurationFactory.Chain
chain) {
         chain.add(new GeneratedClientModules.Add());
 
@@ -842,7 +846,6 @@ public class EjbModuleBuilder implements
         return chain;
     }
 
-
     private void addContainerInfos(Configuration configuration, ContainerSystemInfo containerSystem,
ConfigurationFactory configurationFactory) throws OpenEJBException {
         LinkedHashSet<GBeanData> containerDatas = configuration.findGBeanDatas(Collections.singleton(new
AbstractNameQuery(EjbContainer.class.getName())));
         for (GBeanData containerData : containerDatas) {
@@ -988,7 +991,7 @@ public class EjbModuleBuilder implements
             linkResolver.add(rootUrl, name, id);
         }
 
-        EjbJarInfo ejbJarInfo = ejbModule.getEjbJarInfo();
+        EjbJarInfo ejbJarInfo = ejbModule.getEjbInfo().getEjbJarInfo();
         for (EnterpriseBeanInfo beanInfo : ejbJarInfo.enterpriseBeans) {
             if (beanInfo instanceof StatefulBeanInfo) {
                 StatefulBeanInfo statefulBeanInfo = (StatefulBeanInfo) beanInfo;
@@ -1017,7 +1020,7 @@ public class EjbModuleBuilder implements
                             EjbDeployment.class.getName())));
 
             ejbModuleGBeanData.setReferencePattern("OpenEjbSystem", new AbstractNameQuery(null,
Collections.EMPTY_MAP, OpenEjbSystem.class.getName()));
-            ejbModuleGBeanData.setAttribute("ejbJarInfo", ejbModule.getEjbJarInfo());
+            ejbModuleGBeanData.setAttribute("ejbInfo", ejbModule.getEjbInfo());
             ejbModuleGBeanData.setAttribute("modulePath", ejbModule.getTargetPath());
             ejbModuleGBeanData.setAttribute("moduleContext", module.getJndiScope(JndiScope.module));
         } catch (Exception e) {
@@ -1029,7 +1032,7 @@ public class EjbModuleBuilder implements
 
         // add the Jacc permissions to the ear
         ComponentPermissions componentPermissions = ejbDeploymentBuilder.buildComponentPermissions();
-        earContext.addSecurityContext(ejbModule.getEjbJarInfo().moduleId, componentPermissions);
+        earContext.addSecurityContext(ejbModule.getEjbInfo().getEjbJarInfo().moduleId, componentPermissions);
 
         setMdbContainerIds(earContext, ejbModule, ejbModuleGBeanData);
 
@@ -1049,7 +1052,7 @@ public class EjbModuleBuilder implements
             return;
         }
         OpenejbJarType openejbJarType = (OpenejbJarType) altDD;
-        EjbJarInfo ejbJarInfo = ejbModule.getEjbJarInfo();
+        EjbJarInfo ejbJarInfo = ejbModule.getEjbInfo().getEjbJarInfo();
 
         Map<String, MessageDrivenBeanInfo> mdbs = new TreeMap<String, MessageDrivenBeanInfo>();
         for (EnterpriseBeanInfo enterpriseBean : ejbJarInfo.enterpriseBeans) {
@@ -1145,7 +1148,7 @@ public class EjbModuleBuilder implements
         };
 
         private final Map<String, EjbModule> ejbModules = new TreeMap<String, EjbModule>();
-        private final Map<String, EjbJarInfo> ejbJars = new TreeMap<String, EjbJarInfo>();
+        private final Map<String, GeronimoEjbInfo> ejbJars = new TreeMap<String,
GeronimoEjbInfo>();
 
         public void addEjbModule(EjbModule ejbModule) {
             ejbModules.put(ejbModule.getEjbModule().getModuleId(), ejbModule);
@@ -1163,23 +1166,22 @@ public class EjbModuleBuilder implements
             return ejbModules.values();
         }
 
-        public void addEjbJar(EjbJarInfo ejbJarInfo) {
-            ejbJars.put(ejbJarInfo.moduleId, ejbJarInfo);
+        public void addEjbInfo(GeronimoEjbInfo ejbInfo) {
+            ejbJars.put(ejbInfo.getEjbJarInfo().moduleId, ejbInfo);
         }
 
-        public EjbJarInfo getEjbJar(String moduleId) throws DeploymentException {
-            EjbJarInfo ejbJarInfo = ejbJars.get(moduleId);
-            if (ejbJarInfo == null) {
+        public GeronimoEjbInfo getEjbInfo(String moduleId) throws DeploymentException {
+            GeronimoEjbInfo ejbInfo = ejbJars.get(moduleId);
+            if (ejbInfo == null) {
                 throw new DeploymentException("Ejb jar configuration passed but expected
module " +
                         moduleId + " was not found in configured module list " + ejbJars.keySet());
             }
-            return ejbJarInfo;
+            return ejbInfo;
         }
 
-        public Collection<EjbJarInfo> getEjbJars() {
+        public Collection<GeronimoEjbInfo> getEjbInfos() {
             return ejbJars.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=985297&r1=985296&r2=985297&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
Fri Aug 13 17:40:55 2010
@@ -38,6 +38,7 @@ import org.apache.geronimo.j2ee.j2eeobje
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.naming.deployment.AbstractNamingBuilder;
 import org.apache.geronimo.openejb.ClientEjbReference;
+import org.apache.geronimo.openejb.GeronimoEjbInfo;
 import org.apache.geronimo.xbeans.geronimo.naming.GerEjbLocalRefDocument;
 import org.apache.geronimo.xbeans.geronimo.naming.GerEjbLocalRefType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerEjbRefDocument;
@@ -111,25 +112,24 @@ public class EjbRefBuilder extends Abstr
 
         Map<String, List<InjectionTarget>> injectionsMap = new HashMap<String,
List<InjectionTarget>>();
         for (Map.Entry<String, EjbRef> entry: specDD.getEjbRefMap().entrySet()) {
-            if (!entry.getValue().getInjectionTarget().isEmpty()) {
-                injectionsMap.put(entry.getKey(), entry.getValue().getInjectionTarget());
-            }
+            injectionsMap.put(entry.getKey(), entry.getValue().getInjectionTarget());   
        
         }
         for (Map.Entry<String, EjbLocalRef> entry: specDD.getEjbLocalRefMap().entrySet())
{
-            if (!entry.getValue().getInjectionTarget().isEmpty()) {
-                injectionsMap.put(entry.getKey(), entry.getValue().getInjectionTarget());
-            }
+            injectionsMap.put(entry.getKey(), entry.getValue().getInjectionTarget());
         }
+        
         Map<String, Object> map = null;
         try {
             EjbModuleBuilder.EarData earData = EjbModuleBuilder.EarData.KEY.get(module.getRootEarContext().getGeneralData());
-            Collection<EjbJarInfo> ejbJars = Collections.emptySet();
+            Collection<GeronimoEjbInfo> ejbInfos = Collections.emptySet();
             if (earData != null) {
-                ejbJars = earData.getEjbJars();
+                ejbInfos = earData.getEjbInfos();
             }
 
             AppInfo appInfo = new AppInfo();
-            appInfo.ejbJars.addAll(ejbJars);
+            for (GeronimoEjbInfo ejbInfo : ejbInfos) {
+                appInfo.ejbJars.add(ejbInfo.getEjbJarInfo());
+            }
 
             JndiEncInfoBuilder jndiEncInfoBuilder = new JndiEncInfoBuilder(appInfo);
             JndiEncInfo moduleJndi = new JndiEncInfo();

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbModuleImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbModuleImpl.java?rev=985297&r1=985296&r2=985297&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbModuleImpl.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbModuleImpl.java
Fri Aug 13 17:40:55 2010
@@ -45,7 +45,7 @@ import org.apache.geronimo.management.J2
 import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.NoSuchApplicationException;
 import org.apache.openejb.UndeployException;
-import org.apache.openejb.assembler.classic.EjbJarInfo;
+import org.apache.openejb.assembler.classic.AppInfo;
 import org.apache.openejb.core.CoreDeploymentInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -65,7 +65,7 @@ public class EjbModuleImpl implements EJ
     private final ClassLoader classLoader;
 
     private final OpenEjbSystem openEjbSystem;
-    private final EjbJarInfo ejbJarInfo;
+    private final AppInfo appInfo;
 
     public EjbModuleImpl(@ParamSpecial(type = SpecialAttributeType.objectName) String objectName,
                          @ParamReference(name = "J2EEServer", namingType = NameFactory.J2EE_SERVER)
J2EEServer server,
@@ -75,7 +75,7 @@ public class EjbModuleImpl implements EJ
                          @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader
classLoader,
                          @ParamSpecial(type = SpecialAttributeType.kernel) Kernel kernel,
                          @ParamReference(name = "OpenEjbSystem") OpenEjbSystem openEjbSystem,
-                         @ParamAttribute(name = "ejbJarInfo") EjbJarInfo ejbJarInfo) throws
NamingException {
+                         @ParamAttribute(name = "ejbInfo") GeronimoEjbInfo ejbInfo) throws
NamingException {
         this.objectName = objectName;
         ObjectName myObjectName = ObjectNameUtil.getObjectName(objectName);
         verifyObjectName(myObjectName);
@@ -102,9 +102,10 @@ public class EjbModuleImpl implements EJ
         this.classLoader = classLoader;
 
         this.openEjbSystem = openEjbSystem;
-        this.ejbJarInfo = ejbJarInfo;
+        
+        this.appInfo = ejbInfo.createAppInfo();
     }
-
+    
     private void removeEjb(EjbDeployment ejb) {
         GeronimoThreadContextListener.get().removeEjb(ejb.getDeploymentId());
         ejbs.remove(ejb.getDeploymentId());
@@ -168,7 +169,7 @@ public class EjbModuleImpl implements EJ
     }
 
     public void doStart() throws Exception {
-        openEjbSystem.createEjbJar(ejbJarInfo, classLoader);
+        openEjbSystem.createApplication(appInfo, classLoader);
         for (String deploymentId: ejbs.keySet()) {
             DeploymentInfo deploymentInfo = openEjbSystem.getDeploymentInfo(deploymentId);
             GeronimoThreadContextListener.get().getEjbDeployment((CoreDeploymentInfo) deploymentInfo);
@@ -177,7 +178,7 @@ public class EjbModuleImpl implements EJ
 
     public void doStop() {
         try {
-            openEjbSystem.removeEjbJar(ejbJarInfo, classLoader);
+            openEjbSystem.removeApplication(appInfo, classLoader);
         } catch (NoSuchApplicationException e) {
             log.error("Module does not exist.", e);
         } catch (UndeployException e) {

Added: geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoEjbInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoEjbInfo.java?rev=985297&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoEjbInfo.java
(added)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoEjbInfo.java
Fri Aug 13 17:40:55 2010
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.openejb;
+
+import java.io.Serializable;
+
+import org.apache.openejb.assembler.classic.AppInfo;
+import org.apache.openejb.assembler.classic.EjbJarInfo;
+import org.apache.openejb.assembler.classic.JndiEncInfo;
+
+public class GeronimoEjbInfo implements Serializable {
+	
+    private final EjbJarInfo ejbJarInfo;
+    private final JndiEncInfo globalJndiEnc;
+    private final JndiEncInfo appJndiEnc;
+    
+    public GeronimoEjbInfo(EjbJarInfo ejbJarInfo) {
+        this(ejbJarInfo, new JndiEncInfo(), new JndiEncInfo());
+    }
+    
+    public GeronimoEjbInfo(EjbJarInfo ejbJarInfo, JndiEncInfo globalJndiEnc, JndiEncInfo
appJndiEnc) {
+        this.ejbJarInfo = ejbJarInfo;
+        this.globalJndiEnc = globalJndiEnc;
+        this.appJndiEnc = appJndiEnc;
+    }
+    
+    public EjbJarInfo getEjbJarInfo() {
+        return ejbJarInfo;
+    }
+    
+    public AppInfo createAppInfo() {
+        AppInfo appInfo = new AppInfo();
+        appInfo.jarPath = ejbJarInfo.jarPath;
+        appInfo.ejbJars.add(ejbJarInfo);
+        merge(appInfo.appJndiEnc, appJndiEnc);
+        merge(appInfo.globalJndiEnc, globalJndiEnc);
+        return appInfo;
+    }
+    
+    private static void merge(JndiEncInfo dest, JndiEncInfo source) {
+        dest.envEntries.addAll(source.envEntries);
+        dest.resourceRefs.addAll(source.resourceRefs);
+        dest.resourceEnvRefs.addAll(source.resourceEnvRefs);
+        dest.persistenceContextRefs.addAll(source.persistenceContextRefs);
+        dest.persistenceUnitRefs.addAll(source.persistenceUnitRefs);
+        dest.serviceRefs.addAll(source.serviceRefs);
+        dest.ejbLocalReferences.addAll(source.ejbLocalReferences);
+        dest.ejbReferences.addAll(source.ejbReferences);
+    }
+}

Propchange: geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoEjbInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoEjbInfo.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoEjbInfo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/MEJBGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/MEJBGBean.java?rev=985297&r1=985296&r2=985297&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/MEJBGBean.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/MEJBGBean.java
Fri Aug 13 17:40:55 2010
@@ -47,7 +47,8 @@ public class MEJBGBean implements GBeanL
         OpenEjbSystem openEjbSystem = ejbContainer.getOpenEjbSystem();
         //A dummy URL MEJBGBean.class.getResource( "" ).toString() to avoid the "java.net.MalformedURLException:
no protocol: MEJBGBean" when startup
         EjbJarInfo ejbJarInfo = openEjbSystem.configureApplication(new EjbModule(cl, getClass().getSimpleName(),
MEJBGBean.class.getResource( "" ).toString(), ejbJar, null));
-        openEjbSystem.createEjbJar(ejbJarInfo, cl);
+        GeronimoEjbInfo ejbInfo = new GeronimoEjbInfo(ejbJarInfo);
+        openEjbSystem.createApplication(ejbInfo.createAppInfo(), cl);
 	}
 
     static {

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystem.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystem.java?rev=985297&r1=985296&r2=985297&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystem.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystem.java
Fri Aug 13 17:40:55 2010
@@ -53,12 +53,12 @@ public interface OpenEjbSystem {
 
     void createClient(ClientInfo clientInfo, ClassLoader classLoader) throws NamingException,
IOException, OpenEJBException;
 
-    void createEjbJar(EjbJarInfo ejbJarInfo, ClassLoader classLoader) throws NamingException,
IOException, OpenEJBException;
-
     DeploymentInfo getDeploymentInfo(String deploymentId);
 
-    void removeEjbJar(EjbJarInfo ejbJarInfo, ClassLoader classLoader) throws UndeployException,
NoSuchApplicationException;
-
+    void createApplication(AppInfo appInfo, ClassLoader classLoader) throws NamingException,
IOException, OpenEJBException;
+    
+    void removeApplication(AppInfo appInfo, ClassLoader classLoader) throws UndeployException,
NoSuchApplicationException;
+    
     AppInfo configureApplication(AppModule appModule) throws OpenEJBException;
 
     void setORBContext(ORB orb, HandleDelegate handleDelegate);

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java?rev=985297&r1=985296&r2=985297&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
Fri Aug 13 17:40:55 2010
@@ -415,7 +415,7 @@ public class OpenEjbSystemGBean implemen
         }
     }
 
-    public void createEjbJar(EjbJarInfo ejbJarInfo, ClassLoader classLoader) throws NamingException,
IOException, OpenEJBException {
+    public void createApplication(AppInfo appInfo, ClassLoader classLoader) throws NamingException,
IOException, OpenEJBException {
         Set<AbstractName> names = kernel.listGBeans(new AbstractNameQuery(ResourceAdapterWrapper.class.getName()));
         for (AbstractName name : names) {
             try {
@@ -428,16 +428,16 @@ public class OpenEjbSystemGBean implemen
         ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(classLoader);
         try {
-            assembler.createEjbJar(ejbJarInfo, classLoader);
+            assembler.createApplication(appInfo, classLoader);
         } finally {
             Thread.currentThread().setContextClassLoader(oldClassLoader);
         }
     }
 
-    public void removeEjbJar(EjbJarInfo ejbJarInfo, ClassLoader classLoader) throws UndeployException,
NoSuchApplicationException {
-        assembler.destroyApplication(ejbJarInfo.jarPath);
+    public void removeApplication(AppInfo appInfo, ClassLoader classLoader) throws UndeployException,
NoSuchApplicationException {
+        assembler.destroyApplication(appInfo.jarPath);
     }
-
+    
     public DeploymentInfo getDeploymentInfo(String deploymentId) {
         return getContainerSystem().getDeploymentInfo(deploymentId);
     }



Mime
View raw message