You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by on...@apache.org on 2021/06/11 01:32:23 UTC

[geode] branch support/1.13 updated: GEODE-9289: Configuration compatibile with pre-1.12.0 versions. (#6593)

This is an automated email from the ASF dual-hosted git repository.

onichols pushed a commit to branch support/1.13
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/support/1.13 by this push:
     new 9ab1beb  GEODE-9289: Configuration compatibile with pre-1.12.0 versions. (#6593)
9ab1beb is described below

commit 9ab1beb2f7c0a3a717914245e7062348db731d2f
Author: Nabarun Nag <na...@users.noreply.github.com>
AuthorDate: Thu Jun 10 18:30:57 2021 -0700

    GEODE-9289: Configuration compatibile with pre-1.12.0 versions. (#6593)
    
    * This part of the commit was missed as a part of the original commit
    
        (cherry picked from commit c1e59b23a89d4eac89334f525cd4a8bfaebefe1d)
---
 .../codeAnalysis/sanctionedDataSerializables.txt   |  4 ++-
 .../configuration/domain/Configuration.java        | 31 ++++++++++++++++++++--
 2 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
index 16d0b42..18e3bc2 100644
--- a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
+++ b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
@@ -1962,9 +1962,11 @@ org/apache/geode/management/internal/ManagerStartupMessage,2
 fromData,17
 toData,17
 
-org/apache/geode/management/internal/configuration/domain/Configuration,2
+org/apache/geode/management/internal/configuration/domain/Configuration,4
 fromData,112
+fromDataPre_GEODE_1_12_0_0,71
 toData,79
+toDataPre_GEODE_1_12_0_0,63
 
 org/apache/geode/management/internal/configuration/domain/ConfigurationChangeResult,2
 fromData,31
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/domain/Configuration.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/domain/Configuration.java
index a06bd4c..ef2e049 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/domain/Configuration.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/domain/Configuration.java
@@ -37,8 +37,8 @@ import javax.xml.transform.TransformerException;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
-import org.apache.geode.DataSerializable;
 import org.apache.geode.DataSerializer;
+import org.apache.geode.internal.VersionedDataSerializable;
 import org.apache.geode.internal.serialization.Version;
 import org.apache.geode.internal.serialization.VersionOrdinal;
 import org.apache.geode.internal.serialization.Versioning;
@@ -49,7 +49,7 @@ import org.apache.geode.management.internal.configuration.utils.XmlUtils;
  * Domain object for all the configuration related data.
  *
  */
-public class Configuration implements DataSerializable {
+public class Configuration implements VersionedDataSerializable {
   private static final long serialVersionUID = 1L;
   private String configName;
   private String cacheXmlContent;
@@ -158,6 +158,16 @@ public class Configuration implements DataSerializable {
     return deployments.keySet();
   }
 
+  public void toDataPre_GEODE_1_12_0_0(DataOutput out) throws IOException {
+    DataSerializer.writeString(configName, out);
+    DataSerializer.writeString(cacheXmlFileName, out);
+    DataSerializer.writeString(cacheXmlContent, out);
+    DataSerializer.writeString(propertiesFileName, out);
+    DataSerializer.writeProperties(gemfireProperties, out);
+    HashSet<String> jarNames = new HashSet<>(deployments.keySet());
+    DataSerializer.writeHashSet(jarNames, out);
+  }
+
   @Override
   public void toData(DataOutput out) throws IOException {
     DataSerializer.writeString(configName, out);
@@ -174,6 +184,19 @@ public class Configuration implements DataSerializable {
     DataSerializer.writeHashMap(deployments, out);
   }
 
+  public void fromDataPre_GEODE_1_12_0_0(DataInput in) throws IOException, ClassNotFoundException {
+    this.configName = DataSerializer.readString(in);
+    this.cacheXmlFileName = DataSerializer.readString(in);
+    this.cacheXmlContent = DataSerializer.readString(in);
+    this.propertiesFileName = DataSerializer.readString(in);
+    this.gemfireProperties = DataSerializer.readProperties(in);
+    HashSet<String> jarNames = DataSerializer.readHashSet(in);
+    jarNames.stream()
+        .map(x -> new Deployment(x, null, null))
+        .forEach(deployment -> deployments.put(deployment.getFileName(),
+            deployment));
+  }
+
   @Override
   public void fromData(DataInput in) throws IOException, ClassNotFoundException {
     configName = DataSerializer.readString(in);
@@ -234,4 +257,8 @@ public class Configuration implements DataSerializable {
         gemfireProperties, deployments);
   }
 
+  @Override
+  public Version[] getSerializationVersions() {
+    return new Version[] {Version.GEODE_1_12_0};
+  }
 }