tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r1239421 - in /openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config: AnnotationDeployer.java OutputGeneratedDescriptors.java
Date Thu, 02 Feb 2012 00:32:29 GMT
Author: dblevins
Date: Thu Feb  2 00:32:29 2012
New Revision: 1239421

URL: http://svn.apache.org/viewvc?rev=1239421&view=rev
Log:
Moving changes 1239405, 1239415 to branch so we can discuss
http://svn.apache.org/repos/asf/openejb/branches/generated-descriptors/

Modified:
    openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
    openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/OutputGeneratedDescriptors.java

Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java?rev=1239421&r1=1239420&r2=1239421&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
(original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
Thu Feb  2 00:32:29 2012
@@ -62,7 +62,6 @@ import org.apache.openejb.jee.Intercepto
 import org.apache.openejb.jee.InterceptorBinding;
 import org.apache.openejb.jee.Invokable;
 import org.apache.openejb.jee.IsolationLevel;
-import org.apache.openejb.jee.JaxbJavaee;
 import org.apache.openejb.jee.JndiConsumer;
 import org.apache.openejb.jee.JndiReference;
 import org.apache.openejb.jee.License;
@@ -112,7 +111,6 @@ import org.apache.openejb.jee.Transactio
 import org.apache.openejb.jee.WebApp;
 import org.apache.openejb.jee.WebserviceDescription;
 import org.apache.openejb.jee.oejb3.OpenejbJar;
-import org.apache.openejb.loader.IO;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.util.AnnotationUtil;
 import org.apache.openejb.util.Join;
@@ -204,7 +202,6 @@ import java.beans.BeanInfo;
 import java.beans.Introspector;
 import java.beans.PropertyDescriptor;
 import java.io.File;
-import java.io.FileOutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
@@ -240,25 +237,6 @@ public class AnnotationDeployer implemen
     public static final Logger startupLogger = Logger.getInstance(LogCategory.OPENEJB_STARTUP_CONFIG,
"org.apache.openejb.util.resources");
     private static final ThreadLocal<DeploymentModule> currentModule = new ThreadLocal<DeploymentModule>();
     private static final Set<String> lookupMissing = new HashSet<String>(2);
-    public static final String OPENEJB_USE_DESCRIPTOR_GENERATED = "openejb.use.descriptor.generated";
-    public static final String OPENEJB_DUMPED_DD_PATH = "openejb.dumped.dd.path";
-    private static final String DUMPED_DD_BASE;
-
-    static {
-        String dumpedBase = System.getProperty(OPENEJB_DUMPED_DD_PATH, "temp");
-        File file = new File(SystemInstance.get().getBase().getDirectory(), dumpedBase);
-        if (!file.exists()) {
-            file = new File(dumpedBase);
-            if (!file.exists()) { // ignore this
-                System.setProperty(OPENEJB_USE_DESCRIPTOR_GENERATED, "false");
-            } else {
-                dumpedBase = file.getAbsolutePath();
-            }
-        } else {
-            dumpedBase = file.getAbsolutePath();
-        }
-        DUMPED_DD_BASE = dumpedBase;
-    }
 
     public static final Set<String> knownResourceEnvTypes = new TreeSet<String>(asList(
             "javax.ejb.EJBContext",
@@ -328,7 +306,6 @@ public class AnnotationDeployer implemen
 
     public WebModule deploy(WebModule webModule) throws OpenEJBException {
         setModule(webModule);
-
         try {
             webModule = discoverAnnotatedBeans.deploy(webModule);
             webModule = envEntriesPropertiesDeployer.deploy(webModule);
@@ -986,24 +963,7 @@ public class AnnotationDeployer implemen
 
         public WebModule deploy(WebModule webModule) throws OpenEJBException {
             WebApp webApp = webModule.getWebApp();
-            if (readDumpedDD()) {
-                final File dumpedWeb = getDumpWeb(webModule.getModuleId());
-                if (!dumpedWeb.exists()) {
-                    FileOutputStream fos = null;
-                    try {
-                        webModule.setWebApp(ReadDescriptors.readWebApp(dumpedWeb.toURI().toURL()));
-                        logger.info("read web.xml for module " + webModule.getModuleId()
+ " at " + dumpedWeb.getAbsolutePath());
-                        return webModule;
-                    } catch (Exception ignored) {
-                        logger.warning("can't read web.xml");
-                    } finally {
-                        IO.close(fos);
-                    }
-                }
-            }
-            if (webApp != null && (webApp.isMetadataComplete())) {
-                return webModule;
-            }
+            if (webApp != null && (webApp.isMetadataComplete())) return webModule;
 
             try {
                 if (webModule.getFinder() == null) {
@@ -1078,20 +1038,8 @@ public class AnnotationDeployer implemen
         }
 
         public EjbModule deploy(EjbModule ejbModule) throws OpenEJBException {
-            if (readDumpedDD()) {
-                final File dumpedEjbJar = getDumpEjbJar(ejbModule.getModuleId());
-                if (dumpedEjbJar.exists()) {
-                    try {
-                        ejbModule.setEjbJar(ReadDescriptors.readEjbJar(dumpedEjbJar.toURI().toURL()));
-                        logger.info("using ejb-jar " + dumpedEjbJar.getAbsolutePath() + "
for module " + ejbModule.getModuleId());
-                    } catch (MalformedURLException ignored) {
-                        logger.warning("can't read dumped ejb-jar");
-                    }
-                }
-            }
-            if (ejbModule.getEjbJar() != null && ejbModule.getEjbJar().isMetadataComplete())
{
-                return ejbModule;
-            }
+            if (ejbModule.getEjbJar() != null && ejbModule.getEjbJar().isMetadataComplete())
return ejbModule;
+
 
             try {
                 if (ejbModule.getFinder() == null) {
@@ -1922,23 +1870,6 @@ public class AnnotationDeployer implemen
 
             processWebServiceClientHandlers(webApp, classLoader);
 
-            if (readDumpedDD()) {
-                final File dumpedWeb = getDumpWeb(webModule.getModuleId());
-                if (!dumpedWeb.exists()) {
-                    FileOutputStream fos = null;
-                    try {
-                        fos = new FileOutputStream(dumpedWeb);
-                        webModule.getWebApp().setMetadataComplete(true);
-                        JaxbJavaee.marshal(WebApp.class, webModule.getWebApp(), fos);
-                        logger.info("dumped web.xml for module " + webModule.getModuleId()
+ " at " + dumpedWeb.getAbsolutePath());
-                    } catch (Exception e) {
-                        logger.warning("can't dump web.xml", e);
-                    } finally {
-                        IO.close(fos);
-                    }
-                }
-            }
-
             return webModule;
         }
 
@@ -2444,23 +2375,6 @@ public class AnnotationDeployer implemen
                 }
             }
 
-            if (readDumpedDD()) {
-                final File dumpedEjbJar = getDumpEjbJar(ejbModule.getModuleId());
-                if (!dumpedEjbJar.exists()) {
-                    FileOutputStream fos = null;
-                    try {
-                        fos = new FileOutputStream(dumpedEjbJar);
-                        ejbModule.getEjbJar().setMetadataComplete(true);
-                        JaxbJavaee.marshal(EjbJar.class, ejbModule.getEjbJar(), fos);
-                        logger.info("dumped ejb-jar for module " + ejbModule.getModuleId()
+ " at " + dumpedEjbJar.getAbsolutePath());
-                    } catch (Exception e) {
-                        logger.warning("can't dump ejb-jar", e);
-                    } finally {
-                        IO.close(fos);
-                    }
-                }
-            }
-
             return ejbModule;
         }
 
@@ -4975,16 +4889,4 @@ public class AnnotationDeployer implemen
         }
         return rawClassName;
     }
-
-    private static boolean readDumpedDD() {
-        return Boolean.getBoolean(OPENEJB_USE_DESCRIPTOR_GENERATED);
-    }
-
-    private static File getDumpEjbJar(final String moduleId) {
-        return new File(DUMPED_DD_BASE, "ejb-jar-" + Math.abs(moduleId.hashCode()) + ".xml");
-    }
-
-    private static File getDumpWeb(final String moduleId) {
-        return new File(DUMPED_DD_BASE, "web-" + Math.abs(moduleId.hashCode()) + ".xml");
-    }
 }

Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/OutputGeneratedDescriptors.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/OutputGeneratedDescriptors.java?rev=1239421&r1=1239420&r2=1239421&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/OutputGeneratedDescriptors.java
(original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/OutputGeneratedDescriptors.java
Thu Feb  2 00:32:29 2012
@@ -173,28 +173,18 @@ public class OutputGeneratedDescriptors 
 
     private void writeEjbJar(EjbModule ejbModule) {
         try {
-            final File tempFile = tempFile("ejb-jar-", ejbModule.getModuleId() + ".xml");
-            writeEjbJar(tempFile, ejbModule);
-            logger.info("Dumping Generated ejb-jar.xml to: " + tempFile.getAbsolutePath());
-        } catch (IOException e) {
-            // no-op
-        }
-    }
-
-    public static void writeEjbJar(final File output, final EjbModule ejbModule) {
-        try {
             EjbJar ejbJar = ejbModule.getEjbJar();
-            FileOutputStream fout = new FileOutputStream(output);
+            File tempFile = tempFile("ejb-jar-", ejbModule.getModuleId() + ".xml");
+            FileOutputStream fout = new FileOutputStream(tempFile);
             BufferedOutputStream out = new BufferedOutputStream(fout);
             try {
                 JaxbJavaee.marshal(EjbJar.class, ejbJar, out);
-            } catch (JAXBException ignored) {
-                // no-op
+                logger.info("Dumping Generated ejb-jar.xml to: " + tempFile.getAbsolutePath());
+            } catch (JAXBException e) {
             } finally {
                 out.close();
             }
         } catch (Exception e) {
-            // no-op
         }
     }
 }



Mime
View raw message