tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r502411 - /incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/
Date Fri, 02 Feb 2007 00:25:31 GMT
Author: dblevins
Date: Thu Feb  1 16:25:31 2007
New Revision: 502411

URL: http://svn.apache.org/viewvc?view=rev&rev=502411
Log:
Add an altDD map to each deployment module

Added:
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/WebModule.java
Modified:
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppModule.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ClientModule.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentModule.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbModule.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/OpenEjb2CmpConversion.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ResourceModule.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/VmDeploymentManager.java

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppModule.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppModule.java?view=diff&rev=502411&r1=502410&r2=502411
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppModule.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppModule.java
Thu Feb  1 16:25:31 2007
@@ -19,6 +19,8 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
 
 import org.apache.openejb.jee.jpa.EntityMappings;
 
@@ -27,18 +29,25 @@
  */
 public class AppModule implements DeploymentModule {
     private final List<URL> additionalLibraries = new ArrayList<URL>();
+    private final List<ResourceModule> resourceModules = new ArrayList<ResourceModule>();
+    private final List<WebModule> webModules = new ArrayList<WebModule>();
     private final List<ClientModule> clientModules = new ArrayList<ClientModule>();
     private final List<EjbModule> ejbModules = new ArrayList<EjbModule>();
     private final List<PersistenceModule> persistenceModules = new ArrayList<PersistenceModule>();;
     private final String jarLocation;
     private final ClassLoader classLoader;
     private EntityMappings cmpMappings;
+    private final Map<String,Object> altDDs = new HashMap<String,Object>();
 
     public AppModule(ClassLoader classLoader, String jarLocation) {
         this.classLoader = classLoader;
         this.jarLocation = jarLocation;
     }
 
+    public Map<String, Object> getAltDDs() {
+        return altDDs;
+    }
+
     public ClassLoader getClassLoader() {
         return classLoader;
     }
@@ -69,5 +78,13 @@
 
     public void setCmpMappings(EntityMappings cmpMappings) {
         this.cmpMappings = cmpMappings;
+    }
+
+    public List<ResourceModule> getResourceModules() {
+        return resourceModules;
+    }
+
+    public List<WebModule> getWebModules() {
+        return webModules;
     }
 }

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ClientModule.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ClientModule.java?view=diff&rev=502411&r1=502410&r2=502411
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ClientModule.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ClientModule.java
Thu Feb  1 16:25:31 2007
@@ -18,6 +18,9 @@
 
 import org.apache.openejb.jee.ApplicationClient;
 
+import java.util.Map;
+import java.util.HashMap;
+
 /**
  * @version $Rev$ $Date$
  */
@@ -26,12 +29,17 @@
     private String jarLocation;
     private ClassLoader classLoader;
     private String mainClass;
+    private final Map<String,Object> altDDs = new HashMap<String,Object>();
 
     public ClientModule(ApplicationClient applicationClient, ClassLoader classLoader, String
jarLocation, String mainClass) {
         this.applicationClient = applicationClient;
         this.classLoader = classLoader;
         this.jarLocation = jarLocation;
         this.mainClass = mainClass;
+    }
+
+    public Map<String, Object> getAltDDs() {
+        return altDDs;
     }
 
     public ApplicationClient getApplicationClient() {

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentModule.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentModule.java?view=diff&rev=502411&r1=502410&r2=502411
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentModule.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentModule.java
Thu Feb  1 16:25:31 2007
@@ -16,10 +16,13 @@
  */
 package org.apache.openejb.config;
 
+import java.util.Map;
+
 /**
  * @version $Rev$ $Date$
  */
 public interface DeploymentModule {
     public ClassLoader getClassLoader();
     public String getJarLocation();
+    public Map<String,Object> getAltDDs();
 }

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbModule.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbModule.java?view=diff&rev=502411&r1=502410&r2=502411
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbModule.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbModule.java
Thu Feb  1 16:25:31 2007
@@ -21,6 +21,8 @@
 import org.apache.openejb.jee.oejb3.OpenejbJar;
 
 import java.io.File;
+import java.util.Map;
+import java.util.HashMap;
 
 /**
  * Class is to remain "dumb" and should not have deployment logic added to it.
@@ -34,6 +36,7 @@
     private EjbJar ejbJar;
     private OpenejbJar openejbJar;
     private String moduleId;
+    private final Map<String,Object> altDDs = new HashMap<String,Object>();
 
     public EjbModule(ClassLoader classLoader, String jarURI, EjbJar ejbJar, OpenejbJar openejbJar)
{
         if (classLoader == null) {
@@ -47,6 +50,10 @@
         moduleId = file.getName().replaceFirst(".jar$","");
     }
 
+    public Map<String, Object> getAltDDs() {
+        return altDDs;
+    }
+
     public ClassLoader getClassLoader() {
         return classLoader;
     }
@@ -74,7 +81,7 @@
     public String getJarLocation() {
         return getJarURI();
     }
-    
+
     public String getModuleId() {
         return moduleId;
     }

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/OpenEjb2CmpConversion.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/OpenEjb2CmpConversion.java?view=diff&rev=502411&r1=502410&r2=502411
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/OpenEjb2CmpConversion.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/OpenEjb2CmpConversion.java
Thu Feb  1 16:25:31 2007
@@ -21,6 +21,8 @@
 import java.util.Map;
 import java.util.TreeMap;
 import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
 
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.jee.jpa.Attributes;
@@ -43,6 +45,7 @@
 import org.apache.openejb.jee.oejb2.EntityBeanType;
 import org.apache.openejb.jee.oejb2.JaxbOpenejbJar2;
 import org.apache.openejb.jee.oejb2.OpenejbJarType;
+import org.apache.openejb.jee.oejb2.GeronimoEjbJarType;
 
 public class OpenEjb2CmpConversion implements DynamicDeployer {
     public AppModule deploy(AppModule appModule) throws OpenEJBException {
@@ -51,11 +54,35 @@
             OpenejbJarType openejbJarType = loadOpenEjbJar(classLoader);
             if (openejbJarType != null) {
                 mergeEntityMappings(appModule.getCmpMappings(), openejbJarType);
+                OpenejbJarType o2 = (OpenejbJarType) openejbJarType;
+
+//                String result = createGeronimoOpenejb(o2);
             }
         }
         return appModule;
     }
 
+    private String createGeronimoOpenejb(OpenejbJarType o2) throws JAXBException {
+        GeronimoEjbJarType g2 = new GeronimoEjbJarType();
+
+        g2.setEnvironment(o2.getEnvironment());
+        g2.setSecurity(o2.getSecurity());
+        g2.getService().addAll(o2.getService());
+        g2.getMessageDestination().addAll(o2.getMessageDestination());
+
+        for (EnterpriseBean bean : o2.getEnterpriseBeans()) {
+            g2.getAbstractNamingEntry().addAll(bean.getAbstractNamingEntry());
+            g2.getEjbLocalRef().addAll(bean.getEjbLocalRef());
+            g2.getEjbRef().addAll(bean.getEjbRef());
+            g2.getResourceEnvRef().addAll(bean.getResourceEnvRef());
+            g2.getResourceRef().addAll(bean.getResourceRef());
+            g2.getServiceRef().addAll(bean.getServiceRef());
+        }
+
+        JAXBElement root = new JAXBElement(new QName("http://geronimo.apache.org/xml/ns/j2ee/ejb/openejb-2.0","ejb-jar"),
GeronimoEjbJarType.class, g2);
+        return JaxbOpenejbJar2.marshal(GeronimoEjbJarType.class, root);
+    }
+
     public OpenejbJarType loadOpenEjbJar(ClassLoader classLoader) {
         InputStream in = classLoader.getResourceAsStream("META-INF/openejb-jar.xml");
         if (in == null) {
@@ -70,6 +97,7 @@
         }
         return (OpenejbJarType) element.getValue();
     }
+
 
 
     public void mergeEntityMappings(EntityMappings entityMappings, OpenejbJarType openejbJarType)
{

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ResourceModule.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ResourceModule.java?view=diff&rev=502411&r1=502410&r2=502411
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ResourceModule.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ResourceModule.java
Thu Feb  1 16:25:31 2007
@@ -16,10 +16,17 @@
  */
 package org.apache.openejb.config;
 
+import java.util.Map;
+
 /**
  * @version $Rev$ $Date$
  */
 public class ResourceModule implements DeploymentModule {
+
+    public Map<String, Object> getAltDDs() {
+        throw new UnsupportedOperationException();
+    }
+
     public ClassLoader getClassLoader() {
         throw new UnsupportedOperationException();
     }
@@ -27,4 +34,5 @@
     public String getJarLocation() {
         throw new UnsupportedOperationException();
     }
+
 }

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/VmDeploymentManager.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/VmDeploymentManager.java?view=diff&rev=502411&r1=502410&r2=502411
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/VmDeploymentManager.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/VmDeploymentManager.java
Thu Feb  1 16:25:31 2007
@@ -335,16 +335,16 @@
             return;
         }
         
-        for (Iterator<Map.Entry<TargetModuleID, Properties>> iterator = moduleIdList.entrySet().iterator();
iterator.hasNext();) {
-            Map.Entry<TargetModuleID, Properties> entry = iterator.next();
-            TargetModuleID module = entry.getKey();
-            Properties properties =  entry.getValue();
-            String fileName = new File(properties.getProperty(FILENAME)).getName();
-            File destination = new File(beansDir, fileName);
-            destination.delete();
-            File unpackedDir = new File(appsDir, fileName.substring(0, fileName.lastIndexOf('.')));
-            recursiveDelete(unpackedDir);
-        }
+//        for (Iterator<Map.Entry<TargetModuleID, Properties>> iterator = moduleIdList.entrySet().iterator();
iterator.hasNext();) {
+//            Map.Entry<TargetModuleID, Properties> entry = iterator.next();
+//            TargetModuleID module = entry.getKey();
+//            Properties properties =  entry.getValue();
+//            String fileName = new File(properties.getProperty(FILENAME)).getName();
+//            File destination = new File(beansDir, fileName);
+//            destination.delete();
+//            File unpackedDir = new File(appsDir, fileName.substring(0, fileName.lastIndexOf('.')));
+//            recursiveDelete(unpackedDir);
+//        }
     }
 
     public boolean isRedeploySupported() {

Added: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/WebModule.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/WebModule.java?view=auto&rev=502411
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/WebModule.java
(added)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/WebModule.java
Thu Feb  1 16:25:31 2007
@@ -0,0 +1,37 @@
+/**
+ * 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.openejb.config;
+
+import java.util.Map;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebModule implements DeploymentModule {
+
+    public Map<String, Object> getAltDDs() {
+        throw new UnsupportedOperationException();
+    }
+
+    public ClassLoader getClassLoader() {
+        throw new UnsupportedOperationException();
+    }
+
+    public String getJarLocation() {
+        throw new UnsupportedOperationException();
+    }
+}



Mime
View raw message