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

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


The following commit(s) were added to refs/heads/support/1.14 by this push:
     new 86b8d21  GEODE-9289: Configuration compatibile with pre-1.12.0 
versions.
86b8d21 is described below

commit 86b8d21e26c1b6bcf5680b5a1e335da28284b9c4
Author: Nabarun Nag <[email protected]>
AuthorDate: Tue Jun 8 16:45:27 2021 -0700

    GEODE-9289: Configuration compatibile with pre-1.12.0 versions.
    
                * 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 eea3b02..d6c3d68 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
@@ -1978,9 +1978,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,82
+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 b18c68e..dd107ac 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.KnownVersion;
 import org.apache.geode.internal.serialization.Version;
 import org.apache.geode.internal.serialization.Versioning;
@@ -50,7 +50,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;
@@ -159,6 +159,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);
@@ -175,6 +185,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);
@@ -235,4 +258,8 @@ public class Configuration implements DataSerializable {
         gemfireProperties, deployments);
   }
 
+  @Override
+  public KnownVersion[] getSerializationVersions() {
+    return new KnownVersion[] {KnownVersion.GEODE_1_12_0};
+  }
 }

Reply via email to