geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ja...@apache.org
Subject svn commit: r596403 - in /geronimo/server/trunk/framework/modules/geronimo-system/src: main/java/org/apache/geronimo/system/configuration/ test/java/org/apache/geronimo/system/configuration/
Date Mon, 19 Nov 2007 19:21:59 GMT
Author: jaydm
Date: Mon Nov 19 11:21:58 2007
New Revision: 596403

URL: http://svn.apache.org/viewvc?rev=596403&view=rev
Log:
Some forward steps in having comments at all levels of config.xml:
Added a default 'top level' comment to the test.
Re-added a default comment to the top level of the config.xml that is generated.
Minor cleanup (added a getter and setter for comment) to the GBeanOverride.

Modified:
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/GBeanOverride.java
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/ServerOverride.java
    geronimo/server/trunk/framework/modules/geronimo-system/src/test/java/org/apache/geronimo/system/configuration/LocalAttributeManagerReadWriteTest.java

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/GBeanOverride.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/GBeanOverride.java?rev=596403&r1=596402&r2=596403&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/GBeanOverride.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/GBeanOverride.java
Mon Nov 19 11:21:58 2007
@@ -104,7 +104,7 @@
         }
         this.name = name;
         this.load = original.load;
-        this.comment = original.comment;
+        this.comment = original.getComment();
         this.attributes.putAll(original.attributes);
         this.references.putAll(original.references);
         this.clearAttributes.addAll(original.clearAttributes);
@@ -242,6 +242,14 @@
 
     public String getGBeanInfo() {
         return gbeanInfo;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
     }
 
     public boolean isLoad() {

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/ServerOverride.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/ServerOverride.java?rev=596403&r1=596402&r2=596403&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/ServerOverride.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/ServerOverride.java
Mon Nov 19 11:21:58 2007
@@ -32,6 +32,7 @@
  */
 class ServerOverride {
     private final Map<Artifact, ConfigurationOverride> configurations = new LinkedHashMap<Artifact,
ConfigurationOverride>();
+    private String comment;
 
     public ServerOverride() {
     }
@@ -46,6 +47,7 @@
             ConfigurationOverride module = new ConfigurationOverride(moduleType, expressionParser);
             addConfiguration(module);
         }
+        this.comment = attributes.getComment();
     }
 
     public ConfigurationOverride getConfiguration(Artifact configurationName) {
@@ -83,8 +85,36 @@
         return list.toArray(new Artifact[list.size()]);
     }
 
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+
     public AttributesType writeXml() {
         AttributesType attributes = new AttributesType();
+        if (comment != null) {
+            attributes.setComment(comment);
+        } else {
+            // by default, include the comment that the file is regenerated
+            // and that only one comment is allowable at any level
+            StringBuilder cmnt = new StringBuilder();
+
+            cmnt.append("\n");
+            cmnt.append("==================================================================\n");
+            cmnt.append("Warning - This XML file is regenerated by Geronimo whenever\n");
+            cmnt.append("changes are made to Geronimo's configuration.\n");
+            cmnt.append("\n");
+            cmnt.append("If you want to include comments, create a single comment element\n");
+            cmnt.append("element.  They are allowable at any level of the configuration.\n");
+            cmnt.append("\n");
+            cmnt.append("!!!! Do not edit this file while Geronimo is running !!!!\n");
+            cmnt.append("==================================================================");
+
+            attributes.setComment(cmnt.toString());
+        }
         for (ConfigurationOverride module: configurations.values()) {
             ModuleType moduleType = module.writeXml();
             attributes.getModule().add(moduleType);

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/test/java/org/apache/geronimo/system/configuration/LocalAttributeManagerReadWriteTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/test/java/org/apache/geronimo/system/configuration/LocalAttributeManagerReadWriteTest.java?rev=596403&r1=596402&r2=596403&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/test/java/org/apache/geronimo/system/configuration/LocalAttributeManagerReadWriteTest.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/test/java/org/apache/geronimo/system/configuration/LocalAttributeManagerReadWriteTest.java
Mon Nov 19 11:21:58 2007
@@ -28,13 +28,14 @@
 import org.apache.geronimo.system.configuration.condition.JexlExpressionParser;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public class LocalAttributeManagerReadWriteTest extends TestCase {
 
     private static final String CONFIG =
             "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
                     "<ns2:attributes xmlns:ns2=\"http://geronimo.apache.org/xml/ns/attributes-1.2\"
xmlns=\"http://geronimo.apache.org/xml/ns/plugins-1.3\">\n" +
+                    "    <ns2:comment>This is a test comment.  Without it, a default
warning comment will be created</ns2:comment>\n" +
                     "    <ns2:module name=\"org.apache.geronimo.configs/ca-helper-jetty/2.1-SNAPSHOT/car\"/>\n"
+
                     "    <ns2:module name=\"org.apache.geronimo.configs/jasper/2.1-SNAPSHOT/car\"/>\n"
+
                     "    <ns2:module name=\"org.apache.geronimo.configs/j2ee-server/2.1-SNAPSHOT/car\"/>\n"
+



Mime
View raw message