geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r544932 - /geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors.cmp/src/org/apache/geronimo/j2g/descriptors/comp/CMPDescriptorTool.java
Date Wed, 06 Jun 2007 20:04:25 GMT
Author: dwoods
Date: Wed Jun  6 13:04:23 2007
New Revision: 544932

URL: http://svn.apache.org/viewvc?view=rev&rev=544932
Log:
GERONIMO-3217 - J2G Conversion Tool: Descriptors subtool appends to the openejb-jar.xml file
instead of overwriting.

Modified:
    geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors.cmp/src/org/apache/geronimo/j2g/descriptors/comp/CMPDescriptorTool.java

Modified: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors.cmp/src/org/apache/geronimo/j2g/descriptors/comp/CMPDescriptorTool.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors.cmp/src/org/apache/geronimo/j2g/descriptors/comp/CMPDescriptorTool.java?view=diff&rev=544932&r1=544931&r2=544932
==============================================================================
--- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors.cmp/src/org/apache/geronimo/j2g/descriptors/comp/CMPDescriptorTool.java
(original)
+++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors.cmp/src/org/apache/geronimo/j2g/descriptors/comp/CMPDescriptorTool.java
Wed Jun  6 13:04:23 2007
@@ -68,16 +68,20 @@
                 + jbossFileName);
 
         if (jbossFileName.equals(Constants.JBOSS_JBOSS_CMP_JDBC_XML_FILE)) {
-            out.info("Converting Jbosscmp-jdbc.xml file in " + directoryName);
+            out.info("Converting file " + file.getAbsolutePath() + ".");
             try {
                 // check whether the jbosscmp-jdbc.xml file is present and
                 // if so load it and process it.
+                String geronimoOpenEjbJarFileName = directoryName + File.separator
+                + Constants.GERONIMO_OPEN_EJB_XML_FILE;
+                File tempFile = new File(geronimoOpenEjbJarFileName);
+                if (tempFile.exists()) {
+                	System.out.println("Deleting the pre-existing openejb-jar.xml file");
+                	tempFile.delete();
+                }
                 Document jbossDocument = XMLConversionHelper.getDocument(file);
-                Document geronimoDocument = XMLConversionHelper
-                        .getOpenEJBJarDocument(directoryName);
+                Document geronimoDocument = XMLConversionHelper.getOpenEJBJarDocument(directoryName);
                 migrate(jbossDocument.getRootElement(), geronimoDocument.getRootElement());
-                String geronimoOpenEjbJarFileName = directoryName + File.separator
-                        + Constants.GERONIMO_OPEN_EJB_XML_FILE;
                 XMLConversionHelper.saveOpenEJBDocument(geronimoOpenEjbJarFileName,
                         geronimoDocument);
                 migrated = true;
@@ -86,7 +90,7 @@
             } catch (DocumentException e) {
             	out.error("Errors occurs while reading xml descriptor "
 						+ file.getAbsolutePath()
-						+ ". It is possible that the migrator cannot download an xml schema or xml file has
a wrong syntax. Nested exception:"
+						+ ". It is possible that the migrator cannot download the xml schema or the xml file
has incorrect syntax. Nested exception:"
 						+ e.getMessage());
             } catch (IOException e) {
                 out.error("IO exception " + e.getMessage());



Mime
View raw message