geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r394239 - /geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java
Date Sat, 15 Apr 2006 01:08:50 GMT
Author: djencks
Date: Fri Apr 14 18:08:47 2006
New Revision: 394239

URL: http://svn.apache.org/viewcvs?rev=394239&view=rev
Log:
deal with suppressDefaultEnvironment

Modified:
    geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java

Modified: geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java?rev=394239&r1=394238&r2=394239&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java
(original)
+++ geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java
Fri Apr 14 18:08:47 2006
@@ -91,15 +91,16 @@
                 Artifact parentId = extractArtifact("parentId", cursor);
                 Artifact clientConfigId = extractArtifact("clientConfigId", cursor);
                 Artifact clientParentId = extractArtifact("clientParentId", cursor);
+                boolean suppressDefaultEnvironment = extractSuppressDefaultEnvironment(cursor);
                 if (clientConfigId != null) {
 
-                    insertEnvironment(clientConfigId, clientParentId, cursor, CLIENT_ENVIRONMENT_QNAME);
+                    insertEnvironment(clientConfigId, clientParentId, cursor, CLIENT_ENVIRONMENT_QNAME,
suppressDefaultEnvironment);
 
-                    insertEnvironment(configId, parentId, cursor, SERVER_ENVIRONMENT_QNAME);
+                    insertEnvironment(configId, parentId, cursor, SERVER_ENVIRONMENT_QNAME,
false);
 
                 } else if (configId != null) {
 
-                    insertEnvironment(configId, parentId, cursor, ENVIRONMENT_QNAME);
+                    insertEnvironment(configId, parentId, cursor, ENVIRONMENT_QNAME, suppressDefaultEnvironment);
                 }
             }
         }
@@ -110,13 +111,14 @@
 
     }
 
-    private static void insertEnvironment(Artifact configId, Artifact parentId, XmlCursor
cursor, QName environmentQname) {
+    private static void insertEnvironment(Artifact configId, Artifact parentId, XmlCursor
cursor, QName environmentQname, boolean suppressDefaultEnvironment) {
         positionEnvironment(cursor);
         Environment environment = new Environment();
         environment.setConfigId(configId);
         if (parentId != null ) {
             environment.addDependency(parentId, ImportType.ALL);
         }
+        environment.setSuppressDefaultEnvironment(suppressDefaultEnvironment);
         EnvironmentType environmentType = EnvironmentBuilder.buildEnvironmentType(environment);
         cursor.beginElement(environmentQname);
         XmlCursor element = environmentType.newCursor();
@@ -146,6 +148,16 @@
             }
         }
         return null;
+    }
+
+    private static boolean extractSuppressDefaultEnvironment(XmlCursor cursor) {
+        String attrValue;
+        QName attrQName = new QName(null, "suppressDefaultParentId");
+        if ((attrValue = cursor.getAttributeText(attrQName)) != null) {
+            cursor.removeAttribute(attrQName);
+                return true;
+        }
+        return false;
     }
 
     public static XmlObject parse(InputStream is) throws IOException, XmlException {



Mime
View raw message