geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinmeil...@apache.org
Subject [geode] branch develop updated: GEODE-7076: remove "group" for pdx configuration (#4035)
Date Wed, 11 Sep 2019 13:43:44 GMT
This is an automated email from the ASF dual-hosted git repository.

jinmeiliao pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new eabefac  GEODE-7076: remove "group" for pdx configuration (#4035)
eabefac is described below

commit eabefacd3a8f14af3da4bc6d859ef9d982be7f83
Author: Darrel Schneider <dschneider@pivotal.io>
AuthorDate: Wed Sep 11 06:43:07 2019 -0700

    GEODE-7076: remove "group" for pdx configuration (#4035)
    
    Co-authored-by: Darrel Schneider <dschneider@pivotal.io>
    
    * moved RestfulEndpoint up to AbstractConfiguration
    * moved CorrespondsWith to AbstractConfiguration
---
 .../integrationTest/resources/assembly_content.txt |   3 +-
 .../api/LocatorClusterManagementService.java       |  60 +++++++----
 .../cli/functions/CacheRealizationFunction.java    |   4 +-
 .../realizers/ConfigurationRealizer.java           |   3 +-
 .../sanctioned-geode-management-serializables.txt  |   3 +-
 .../api/LocatorClusterManagementServiceTest.java   |  12 +++
 .../validators/MemberValidatorTest.java            |   4 +-
 .../ClusterManagementListResultAssert.java         |   5 +-
 .../api/ClusterManagementListResult.java           |   2 +-
 .../management/api/ClusterManagementService.java   |  23 ++---
 .../geode/management/api/ConfigurationResult.java  |   2 +-
 .../geode/management/api/CorrespondWith.java       |  76 --------------
 .../geode/management/api/RestfulEndpoint.java      |  83 ----------------
 .../configuration/AbstractConfiguration.java       | 110 +++++++++++++++++++--
 .../management/configuration/GatewayReceiver.java  |  10 +-
 .../configuration/GroupableConfiguration.java      |  37 +++++++
 .../geode/management/configuration/Index.java      |  10 +-
 .../management/configuration/MemberConfig.java     |   8 +-
 .../apache/geode/management/configuration/Pdx.java |  14 +--
 .../geode/management/configuration/Region.java     |   8 +-
 .../internal/ClientClusterManagementService.java   |  41 +++-----
 .../configuration/AbstractConfigurationTest.java   |  33 +------
 ...onTest.java => GroupableConfigurationTest.java} |  18 +---
 .../geode/cache/configuration/PdxTypeTest.java     |  12 +--
 .../configuration/GatewayReceiverTest.java         |   7 +-
 .../geode/management/configuration/IndexTest.java  |   7 --
 .../management/configuration/MemberConfigTest.java |   4 +-
 .../geode/management/configuration/RegionTest.java |  10 +-
 28 files changed, 268 insertions(+), 341 deletions(-)

diff --git a/geode-assembly/src/integrationTest/resources/assembly_content.txt b/geode-assembly/src/integrationTest/resources/assembly_content.txt
index b53e054..b717dc0 100644
--- a/geode-assembly/src/integrationTest/resources/assembly_content.txt
+++ b/geode-assembly/src/integrationTest/resources/assembly_content.txt
@@ -687,10 +687,8 @@ javadoc/org/apache/geode/management/api/ClusterManagementResult.StatusCode.html
 javadoc/org/apache/geode/management/api/ClusterManagementResult.html
 javadoc/org/apache/geode/management/api/ClusterManagementService.html
 javadoc/org/apache/geode/management/api/ConfigurationResult.html
-javadoc/org/apache/geode/management/api/CorrespondWith.html
 javadoc/org/apache/geode/management/api/JsonSerializable.html
 javadoc/org/apache/geode/management/api/RealizationResult.html
-javadoc/org/apache/geode/management/api/RestfulEndpoint.html
 javadoc/org/apache/geode/management/api/package-frame.html
 javadoc/org/apache/geode/management/api/package-summary.html
 javadoc/org/apache/geode/management/api/package-tree.html
@@ -726,6 +724,7 @@ javadoc/org/apache/geode/management/client/package-tree.html
 javadoc/org/apache/geode/management/configuration/AbstractConfiguration.html
 javadoc/org/apache/geode/management/configuration/ClassName.html
 javadoc/org/apache/geode/management/configuration/GatewayReceiver.html
+javadoc/org/apache/geode/management/configuration/GroupableConfiguration.html
 javadoc/org/apache/geode/management/configuration/Index.html
 javadoc/org/apache/geode/management/configuration/MemberConfig.html
 javadoc/org/apache/geode/management/configuration/Pdx.html
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java b/geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java
index e301906..c01a27c 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java
@@ -18,9 +18,9 @@
 package org.apache.geode.management.internal.api;
 
 
-import static org.apache.geode.management.configuration.AbstractConfiguration.CLUSTER;
-import static org.apache.geode.management.configuration.AbstractConfiguration.isCluster;
 
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -58,11 +58,10 @@ import org.apache.geode.management.api.ClusterManagementResult;
 import org.apache.geode.management.api.ClusterManagementResult.StatusCode;
 import org.apache.geode.management.api.ClusterManagementService;
 import org.apache.geode.management.api.ConfigurationResult;
-import org.apache.geode.management.api.CorrespondWith;
 import org.apache.geode.management.api.RealizationResult;
-import org.apache.geode.management.api.RestfulEndpoint;
 import org.apache.geode.management.configuration.AbstractConfiguration;
 import org.apache.geode.management.configuration.GatewayReceiver;
+import org.apache.geode.management.configuration.GroupableConfiguration;
 import org.apache.geode.management.configuration.Index;
 import org.apache.geode.management.configuration.MemberConfig;
 import org.apache.geode.management.configuration.Pdx;
@@ -129,7 +128,7 @@ public class LocatorClusterManagementService implements ClusterManagementService
   }
 
   @Override
-  public <T extends AbstractConfiguration> ClusterManagementRealizationResult create(T config) {
+  public <T extends AbstractConfiguration<?>> ClusterManagementRealizationResult create(T config) {
     // validate that user used the correct config object type
     ConfigurationManager configurationManager = getConfigurationManager(config);
 
@@ -140,7 +139,7 @@ public class LocatorClusterManagementService implements ClusterManagementService
 
     String group = config.getGroup();
     final String groupName =
-        isCluster(group) ? CLUSTER : group;
+        AbstractConfiguration.isCluster(group) ? AbstractConfiguration.CLUSTER : group;
     try {
       // first validate common attributes of all configuration object
       commonValidator.validate(CacheElementOperation.CREATE, config);
@@ -191,14 +190,14 @@ public class LocatorClusterManagementService implements ClusterManagementService
     });
 
     // add the config object which includes the HATEOAS information of the element created
-    if (result.isSuccessful() && config instanceof RestfulEndpoint) {
-      result.setUri(((RestfulEndpoint) config).getUri());
+    if (result.isSuccessful()) {
+      result.setUri(config.getUri());
     }
     return assertSuccessful(result);
   }
 
   @Override
-  public <T extends AbstractConfiguration> ClusterManagementRealizationResult delete(
+  public <T extends AbstractConfiguration<?>> ClusterManagementRealizationResult delete(
       T config) {
     // validate that user used the correct config object type
     ConfigurationManager configurationManager = getConfigurationManager(config);
@@ -271,13 +270,13 @@ public class LocatorClusterManagementService implements ClusterManagementService
   }
 
   @Override
-  public <T extends AbstractConfiguration> ClusterManagementRealizationResult update(
+  public <T extends AbstractConfiguration<?>> ClusterManagementRealizationResult update(
       T config) {
     throw new NotImplementedException("Not implemented");
   }
 
   @Override
-  public <T extends AbstractConfiguration & CorrespondWith<R>, R extends RuntimeInfo> ClusterManagementListResult<T, R> list(
+  public <T extends AbstractConfiguration<R>, R extends RuntimeInfo> ClusterManagementListResult<T, R> list(
       T filter) {
     ClusterManagementListResult<T, R> result = new ClusterManagementListResult<>();
 
@@ -301,10 +300,16 @@ public class LocatorClusterManagementService implements ClusterManagementService
 
       for (String group : groups) {
         CacheConfig currentPersistedConfig =
-            persistenceService.getCacheConfig(isCluster(group) ? CLUSTER : group, true);
+            persistenceService.getCacheConfig(
+                AbstractConfiguration.isCluster(group) ? AbstractConfiguration.CLUSTER : group,
+                true);
         List<T> listInGroup = manager.list(filter, currentPersistedConfig);
-        if (!isCluster(group)) {
-          listInGroup.forEach(t -> t.setGroup(group));
+        if (!AbstractConfiguration.isCluster(group)) {
+          listInGroup.forEach(t -> {
+            if (t instanceof GroupableConfiguration) {
+              ((GroupableConfiguration<?>) t).setGroup(group);
+            }
+          });
         }
         resultList.addAll(listInGroup);
       }
@@ -312,7 +317,7 @@ public class LocatorClusterManagementService implements ClusterManagementService
 
     // gather the runtime info for each configuration objects
     List<ConfigurationResult<T, R>> responses = new ArrayList<>();
-    boolean hasRuntimeInfo = filter.hasRuntimeInfo();
+    boolean hasRuntimeInfo = hasRuntimeInfo(filter.getClass());
 
     for (T element : resultList) {
       ConfigurationResult<T, R> response = new ConfigurationResult<>(element);
@@ -354,7 +359,7 @@ public class LocatorClusterManagementService implements ClusterManagementService
   }
 
   @Override
-  public <T extends AbstractConfiguration & CorrespondWith<R>, R extends RuntimeInfo> ClusterManagementListResult<T, R> get(
+  public <T extends AbstractConfiguration<R>, R extends RuntimeInfo> ClusterManagementListResult<T, R> get(
       T config) {
     ClusterManagementListResult<T, R> list = list(config);
     List<ConfigurationResult<T, R>> result = list.getResult();
@@ -423,7 +428,7 @@ public class LocatorClusterManagementService implements ClusterManagementService
     ClusterManagementOperationResult<V> result = new ClusterManagementOperationResult<>(status,
         operationInstance.getFutureResult(), operationInstance.getOperationStart(),
         operationInstance.getFutureOperationEnded(), operationInstance.getOperator());
-    result.setUri(RestfulEndpoint.URI_CONTEXT + RestfulEndpoint.URI_VERSION
+    result.setUri(AbstractConfiguration.URI_CONTEXT + AbstractConfiguration.URI_VERSION
         + operationInstance.getOperation().getEndpoint() + "/" + operationInstance.getId());
     return result;
   }
@@ -518,4 +523,25 @@ public class LocatorClusterManagementService implements ClusterManagementService
 
     return (List<R>) rc.getResult();
   }
+
+
+  /**
+   * for internal use only
+   */
+  @VisibleForTesting
+  Class<?> getRuntimeClass(Class<?> configClass) {
+    Type genericSuperclass = configClass.getGenericSuperclass();
+
+    if (genericSuperclass instanceof ParameterizedType) {
+      return (Class<?>) ((ParameterizedType) genericSuperclass).getActualTypeArguments()[0];
+    }
+
+    return null;
+  }
+
+  @VisibleForTesting
+  boolean hasRuntimeInfo(Class<?> configClass) {
+    return !RuntimeInfo.class.equals(getRuntimeClass(configClass));
+  }
+
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CacheRealizationFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CacheRealizationFunction.java
index 35cb8fa..0fad5e7 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CacheRealizationFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CacheRealizationFunction.java
@@ -28,7 +28,6 @@ import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.execute.InternalFunction;
 import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.management.api.CorrespondWith;
 import org.apache.geode.management.api.RealizationResult;
 import org.apache.geode.management.configuration.AbstractConfiguration;
 import org.apache.geode.management.configuration.GatewayReceiver;
@@ -89,8 +88,7 @@ public class CacheRealizationFunction implements InternalFunction<List> {
     RuntimeInfo runtimeInfo = realizer.get(cacheElement, cache);
 
     // set the membername if this is not a global runtime
-    if (cacheElement instanceof CorrespondWith
-        && !((CorrespondWith) cacheElement).isGlobalRuntime()) {
+    if (!cacheElement.isGlobalRuntime()) {
       runtimeInfo.setMemberName(context.getMemberName());
     }
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/ConfigurationRealizer.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/ConfigurationRealizer.java
index d8dfecb..b4e6148 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/ConfigurationRealizer.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/ConfigurationRealizer.java
@@ -18,7 +18,6 @@ package org.apache.geode.management.internal.configuration.realizers;
 
 import org.apache.geode.annotations.Experimental;
 import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.management.api.CorrespondWith;
 import org.apache.geode.management.api.RealizationResult;
 import org.apache.geode.management.configuration.AbstractConfiguration;
 import org.apache.geode.management.runtime.RuntimeInfo;
@@ -29,7 +28,7 @@ import org.apache.geode.management.runtime.RuntimeInfo;
  * configuration change.
  */
 @Experimental
-public interface ConfigurationRealizer<T extends AbstractConfiguration & CorrespondWith<R>, R extends RuntimeInfo> {
+public interface ConfigurationRealizer<T extends AbstractConfiguration<R>, R extends RuntimeInfo> {
   RealizationResult create(T config, InternalCache cache);
 
   default boolean exists(T config, InternalCache cache) {
diff --git a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-management-serializables.txt b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-management-serializables.txt
index 9ff1833..0398c59 100644
--- a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-management-serializables.txt
+++ b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-management-serializables.txt
@@ -1,8 +1,9 @@
 org/apache/geode/management/api/ClusterManagementResult$StatusCode,false
 org/apache/geode/management/api/RealizationResult,false,memberName:java/lang/String,message:java/lang/String,success:boolean
-org/apache/geode/management/configuration/AbstractConfiguration,false,group:java/lang/String
+org/apache/geode/management/configuration/AbstractConfiguration,false
 org/apache/geode/management/configuration/ClassName,true,1,className:java/lang/String,initProperties:java/util/Properties
 org/apache/geode/management/configuration/GatewayReceiver,false,endPort:java/lang/Integer,gatewayTransportFilters:java/util/List,manualStart:java/lang/Boolean,maximumTimeBetweenPings:java/lang/Integer,socketBufferSize:java/lang/Integer,startPort:java/lang/Integer
+org/apache/geode/management/configuration/GroupableConfiguration,false,group:java/lang/String
 org/apache/geode/management/configuration/Index,false,expression:java/lang/String,keyIndex:java/lang/Boolean,name:java/lang/String,regionPath:java/lang/String
 org/apache/geode/management/configuration/MemberConfig,false,id:java/lang/String
 org/apache/geode/management/configuration/Pdx,false,diskStoreName:java/lang/String,ignoreUnreadFields:java/lang/Boolean,pdxSerializer:org/apache/geode/management/configuration/ClassName,persistent:java/lang/Boolean,readSerialized:java/lang/Boolean
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/api/LocatorClusterManagementServiceTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/api/LocatorClusterManagementServiceTest.java
index 6721323..bbebeea 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/api/LocatorClusterManagementServiceTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/api/LocatorClusterManagementServiceTest.java
@@ -58,6 +58,7 @@ import org.apache.geode.management.api.ClusterManagementOperationResult;
 import org.apache.geode.management.api.ClusterManagementRealizationResult;
 import org.apache.geode.management.api.ClusterManagementResult;
 import org.apache.geode.management.api.RealizationResult;
+import org.apache.geode.management.configuration.Index;
 import org.apache.geode.management.configuration.MemberConfig;
 import org.apache.geode.management.configuration.Region;
 import org.apache.geode.management.configuration.RegionType;
@@ -73,6 +74,8 @@ import org.apache.geode.management.internal.configuration.validators.RegionConfi
 import org.apache.geode.management.internal.operation.OperationHistoryManager.OperationInstance;
 import org.apache.geode.management.internal.operation.OperationManager;
 import org.apache.geode.management.runtime.OperationResult;
+import org.apache.geode.management.runtime.RuntimeInfo;
+import org.apache.geode.management.runtime.RuntimeRegionInfo;
 
 public class LocatorClusterManagementServiceTest {
 
@@ -380,4 +383,13 @@ public class LocatorClusterManagementServiceTest {
     result = service.checkStatus("456");
     assertThat(result.getStatusCode()).isEqualTo(ClusterManagementResult.StatusCode.OK);
   }
+
+  @Test
+  public void getRuntimeClass() throws Exception {
+    assertThat(service.getRuntimeClass(Region.class)).isEqualTo(RuntimeRegionInfo.class);
+    assertThat(service.hasRuntimeInfo(Region.class)).isTrue();
+    assertThat(service.getRuntimeClass(Index.class)).isEqualTo(RuntimeInfo.class);
+    assertThat(service.hasRuntimeInfo(Index.class)).isFalse();
+  }
+
 }
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/validators/MemberValidatorTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/validators/MemberValidatorTest.java
index 053893b..5c324f2 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/validators/MemberValidatorTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/validators/MemberValidatorTest.java
@@ -116,7 +116,7 @@ public class MemberValidatorTest {
 
   @Test
   public void findMembers() throws Exception {
-    assertThat(validator.findMembers(null, null)).flatExtracting(DistributedMember::getName)
+    assertThat(validator.findMembers(null)).flatExtracting(DistributedMember::getName)
         .containsExactlyInAnyOrder("member1", "member2", "member3", "member4", "member5");
 
     assertThat(validator.findMembers(null, new String[] {}))
@@ -138,7 +138,7 @@ public class MemberValidatorTest {
         .flatExtracting(DistributedMember::getName)
         .containsExactlyInAnyOrder("member1", "member2", "member3", "member4", "member5");
 
-    assertThat(validator.findMembers("member1", null)).flatExtracting(DistributedMember::getName)
+    assertThat(validator.findMembers("member1")).flatExtracting(DistributedMember::getName)
         .containsExactlyInAnyOrder("member1");
 
     assertThat(validator.findMembers("member1", "group1"))
diff --git a/geode-junit/src/main/java/org/apache/geode/test/junit/assertions/ClusterManagementListResultAssert.java b/geode-junit/src/main/java/org/apache/geode/test/junit/assertions/ClusterManagementListResultAssert.java
index b519b02..281b2a3 100644
--- a/geode-junit/src/main/java/org/apache/geode/test/junit/assertions/ClusterManagementListResultAssert.java
+++ b/geode-junit/src/main/java/org/apache/geode/test/junit/assertions/ClusterManagementListResultAssert.java
@@ -25,11 +25,10 @@ import org.assertj.core.api.ListAssert;
 import org.apache.geode.management.api.ClusterManagementListResult;
 import org.apache.geode.management.api.ClusterManagementResult;
 import org.apache.geode.management.api.ConfigurationResult;
-import org.apache.geode.management.api.CorrespondWith;
 import org.apache.geode.management.configuration.AbstractConfiguration;
 import org.apache.geode.management.runtime.RuntimeInfo;
 
-public class ClusterManagementListResultAssert<T extends AbstractConfiguration & CorrespondWith<R>, R extends RuntimeInfo>
+public class ClusterManagementListResultAssert<T extends AbstractConfiguration<R>, R extends RuntimeInfo>
     extends
     AbstractAssert<ClusterManagementListResultAssert<T, R>, ClusterManagementListResult<T, R>> {
   public ClusterManagementListResultAssert(
@@ -70,7 +69,7 @@ public class ClusterManagementListResultAssert<T extends AbstractConfiguration &
     return assertThat(getActual().getRuntimeResult());
   }
 
-  public static <T extends AbstractConfiguration & CorrespondWith<R>, R extends RuntimeInfo> ClusterManagementListResultAssert<T, R> assertManagementListResult(
+  public static <T extends AbstractConfiguration<R>, R extends RuntimeInfo> ClusterManagementListResultAssert<T, R> assertManagementListResult(
       ClusterManagementListResult<T, R> result) {
     return new ClusterManagementListResultAssert<>(result, ClusterManagementListResultAssert.class);
   }
diff --git a/geode-management/src/main/java/org/apache/geode/management/api/ClusterManagementListResult.java b/geode-management/src/main/java/org/apache/geode/management/api/ClusterManagementListResult.java
index 47a2bf0..9aa4a42 100644
--- a/geode-management/src/main/java/org/apache/geode/management/api/ClusterManagementListResult.java
+++ b/geode-management/src/main/java/org/apache/geode/management/api/ClusterManagementListResult.java
@@ -32,7 +32,7 @@ import org.apache.geode.management.runtime.RuntimeInfo;
  * @param <R> the type of the corresponding runtime information, e.g. RuntimeRegionInfo
  */
 @Experimental
-public class ClusterManagementListResult<T extends AbstractConfiguration & CorrespondWith<R>, R extends RuntimeInfo>
+public class ClusterManagementListResult<T extends AbstractConfiguration<R>, R extends RuntimeInfo>
     extends ClusterManagementResult {
   /**
    * for internal use only
diff --git a/geode-management/src/main/java/org/apache/geode/management/api/ClusterManagementService.java b/geode-management/src/main/java/org/apache/geode/management/api/ClusterManagementService.java
index 78e697b..1fa51a4 100644
--- a/geode-management/src/main/java/org/apache/geode/management/api/ClusterManagementService.java
+++ b/geode-management/src/main/java/org/apache/geode/management/api/ClusterManagementService.java
@@ -37,7 +37,7 @@ public interface ClusterManagementService extends AutoCloseable {
    * @return a {@link ClusterManagementRealizationResult} indicating the success of the creation
    * @throws ClusterManagementRealizationException if unsuccessful
    */
-  <T extends AbstractConfiguration> ClusterManagementRealizationResult create(T config);
+  <T extends AbstractConfiguration<?>> ClusterManagementRealizationResult create(T config);
 
   /**
    * This method will delete the element on all the applicable members in the cluster and update the
@@ -48,7 +48,7 @@ public interface ClusterManagementService extends AutoCloseable {
    * @return a {@link ClusterManagementRealizationResult} indicating the success of the deletion
    * @throws ClusterManagementRealizationException if unsuccessful
    */
-  <T extends AbstractConfiguration> ClusterManagementRealizationResult delete(T config);
+  <T extends AbstractConfiguration<?>> ClusterManagementRealizationResult delete(T config);
 
   /**
    * This method will update the element on all the applicable members in the cluster and persist
@@ -59,34 +59,35 @@ public interface ClusterManagementService extends AutoCloseable {
    * @return a {@link ClusterManagementRealizationResult} indicating the success of the update
    * @throws ClusterManagementRealizationException if unsuccessful
    */
-  <T extends AbstractConfiguration> ClusterManagementRealizationResult update(T config);
+  <T extends AbstractConfiguration<?>> ClusterManagementRealizationResult update(T config);
 
   /**
    * This method will list instances of the element type in the cluster configuration, along with
    * additional runtime information from cluster members
    *
-   * @param config this may be used to filter the search results by id or group (check documentation
-   *        for individual element types to see if they support filtering by addition attributes)
+   * @param filter the filterable attributes are used to identify the elements to list. Any
+   *        non-filterable attributes will be ignored.
    * @return a {@link ClusterManagementListResult} holding a list of matching instances in
    *         {@link ClusterManagementListResult#getResult()}
    * @throws ClusterManagementException if unsuccessful
    */
-  <T extends AbstractConfiguration & CorrespondWith<R>, R extends RuntimeInfo> ClusterManagementListResult<T, R> list(
-      T config);
+  <T extends AbstractConfiguration<R>, R extends RuntimeInfo> ClusterManagementListResult<T, R> list(
+      T filter);
 
   /**
    * This method will list a single instance of the element type in the cluster configuration, along
    * with additional runtime information from cluster members
    *
-   * @param config this must be used to filter the search results to a single result, generally by
-   *        supplying the name (id) of the desired config element
+   * @param filter the filterable attributes are used to identify the element to return. Any
+   *        non-filterable attributes will be ignored. It is an error if the filter matches
+   *        more than one element.
    * @return a {@link ClusterManagementListResult} holding a single element in
    *         {@link ClusterManagementListResult#getResult()}
    * @throws ClusterManagementException if unsuccessful or, no matching element is found, or
    *         multiple matches are found
    */
-  <T extends AbstractConfiguration & CorrespondWith<R>, R extends RuntimeInfo> ClusterManagementListResult<T, R> get(
-      T config);
+  <T extends AbstractConfiguration<R>, R extends RuntimeInfo> ClusterManagementListResult<T, R> get(
+      T filter);
 
   /**
    * This method will launch a cluster management operation asynchronously.
diff --git a/geode-management/src/main/java/org/apache/geode/management/api/ConfigurationResult.java b/geode-management/src/main/java/org/apache/geode/management/api/ConfigurationResult.java
index fc40347..8cb9591 100644
--- a/geode-management/src/main/java/org/apache/geode/management/api/ConfigurationResult.java
+++ b/geode-management/src/main/java/org/apache/geode/management/api/ConfigurationResult.java
@@ -30,7 +30,7 @@ import org.apache.geode.management.runtime.RuntimeInfo;
  * @param <R> the runtimeInfo type
  */
 @Experimental
-public class ConfigurationResult<T extends AbstractConfiguration & CorrespondWith<R>, R extends RuntimeInfo> {
+public class ConfigurationResult<T extends AbstractConfiguration<R>, R extends RuntimeInfo> {
   private T configuration;
   private List<R> runtimeInfo = new ArrayList<>();
 
diff --git a/geode-management/src/main/java/org/apache/geode/management/api/CorrespondWith.java b/geode-management/src/main/java/org/apache/geode/management/api/CorrespondWith.java
deleted file mode 100644
index 9d7e486..0000000
--- a/geode-management/src/main/java/org/apache/geode/management/api/CorrespondWith.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.geode.management.api;
-
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.Arrays;
-
-import javax.xml.bind.annotation.XmlTransient;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-import org.apache.geode.annotations.Experimental;
-import org.apache.geode.management.runtime.RuntimeInfo;
-
-/**
- * provides correlation to the additional object that would be returned with the configuration
- * to indicate runtime information.
- * If a cache element has no additional runtime info (yet), it should be declared as
- * implement CorrespondWith<RuntimeInfo>
- */
-@Experimental
-public interface CorrespondWith<R extends RuntimeInfo> {
-  /**
-   * for internal use only
-   */
-  @XmlTransient
-  @JsonIgnore
-  default Class<R> getRuntimeClass() {
-    Type[] genericInterfaces = getClass().getGenericInterfaces();
-
-    ParameterizedType type =
-        Arrays.stream(genericInterfaces).filter(ParameterizedType.class::isInstance)
-            .map(ParameterizedType.class::cast)
-            .findFirst().orElse(null);
-
-    if (type == null) {
-      return null;
-    }
-
-    @SuppressWarnings("unchecked")
-    final Class<R> actualTypeArgument = (Class<R>) type.getActualTypeArguments()[0];
-    return actualTypeArgument;
-  }
-
-  /**
-   * for internal use only
-   */
-  default boolean hasRuntimeInfo() {
-    return !RuntimeInfo.class.equals(getRuntimeClass());
-  }
-
-  /**
-   * this is to indicate when we need to go gather runtime information for this configuration,
-   * should we go to all members in the group, or just any member in the group
-   */
-  @XmlTransient
-  @JsonIgnore
-  default boolean isGlobalRuntime() {
-    return false;
-  }
-
-}
diff --git a/geode-management/src/main/java/org/apache/geode/management/api/RestfulEndpoint.java b/geode-management/src/main/java/org/apache/geode/management/api/RestfulEndpoint.java
deleted file mode 100644
index 696a221..0000000
--- a/geode-management/src/main/java/org/apache/geode/management/api/RestfulEndpoint.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.geode.management.api;
-
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.apache.commons.lang3.StringUtils;
-
-import org.apache.geode.annotations.Experimental;
-import org.apache.geode.lang.Identifiable;
-
-/**
- * a restful service request just needs:
- * 1. an endpoint to list all instances (e.g. "/regions")
- * 2. an id mechanism to distinguish instance (e.g. "{id}")
- * 3. an endpoint to update or delete an individual instance (e.g. "/regions/{id}")
- */
-@Experimental
-public interface RestfulEndpoint extends Identifiable<String> {
-  String URI_CONTEXT = "/management";
-  String URI_VERSION = "/experimental";
-
-  /**
-   * this returns the URI that display the list of entries.
-   * it should return URI the part after /experimental
-   *
-   * @return e.g. /regions
-   */
-  @JsonIgnore
-  String getEndpoint();
-
-  /**
-   * return the uri that points to a single entity. If the id is not available for the object,
-   * this will return null
-   *
-   * it should return the URI part after /experimental
-   *
-   * @return e.g. /regions/regionA
-   */
-  @JsonIgnore
-  default String getIdentityEndPoint() {
-    String id = getId();
-    if (StringUtils.isBlank(id))
-      return null;
-    else {
-      String endpoint = getEndpoint();
-      if (StringUtils.isBlank(endpoint))
-        return null;
-      else
-        return getEndpoint() + "/" + getId();
-    }
-  }
-
-  /**
-   * return the full uri path that points to a single entity. If the id is not available for the
-   * object, this will return null
-   *
-   * it should return the URI part after http://hostname:port
-   *
-   * @return e.g. /management/experimental/regions/regionA
-   */
-  @JsonProperty(access = JsonProperty.Access.READ_ONLY)
-  default String getUri() {
-    if (getIdentityEndPoint() == null) {
-      return null;
-    }
-    return URI_CONTEXT + URI_VERSION + getIdentityEndPoint();
-  }
-}
diff --git a/geode-management/src/main/java/org/apache/geode/management/configuration/AbstractConfiguration.java b/geode-management/src/main/java/org/apache/geode/management/configuration/AbstractConfiguration.java
index 9e4ab13..5939c76 100644
--- a/geode-management/src/main/java/org/apache/geode/management/configuration/AbstractConfiguration.java
+++ b/geode-management/src/main/java/org/apache/geode/management/configuration/AbstractConfiguration.java
@@ -17,15 +17,38 @@ package org.apache.geode.management.configuration;
 
 import static org.apache.commons.lang3.StringUtils.isBlank;
 
-import java.io.Serializable;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.commons.lang3.StringUtils;
 
 import org.apache.geode.annotations.Experimental;
 import org.apache.geode.lang.Identifiable;
+import org.apache.geode.management.api.ClusterManagementService;
 import org.apache.geode.management.api.JsonSerializable;
+import org.apache.geode.management.runtime.RuntimeInfo;
 
+/**
+ * This class represents either a configuration or a filter.
+ * <p>
+ * As a configuration of a managed entity it can be used to
+ * either {@linkplain ClusterManagementService#create(AbstractConfiguration) create},
+ * {@linkplain ClusterManagementService#update(AbstractConfiguration) update},
+ * or {@linkplain ClusterManagementService#delete(AbstractConfiguration) delete} it,
+ * or to describe it in the result of
+ * {@linkplain ClusterManagementService#list(AbstractConfiguration) list}
+ * or {@linkplain ClusterManagementService#get(AbstractConfiguration) get}.
+ * <p>
+ * As a filter as input to {@linkplain ClusterManagementService#list(AbstractConfiguration) list}
+ * or {@linkplain ClusterManagementService#get(AbstractConfiguration) get}
+ * it can be used to specify what entities to return.
+ *
+ * @param <R> the RuntimeInfo that corresponds to this configuration. Each non-abstract subclass
+ *        needs to supply this when it extends this class.
+ */
 @Experimental
-public abstract class AbstractConfiguration
-    implements Identifiable<String>, Serializable, JsonSerializable {
+public abstract class AbstractConfiguration<R extends RuntimeInfo>
+    implements Identifiable<String>, JsonSerializable {
+
   /**
    * The reserved group name that represents the predefined "cluster" group.
    * Every member of a cluster automatically belongs to this group.
@@ -44,13 +67,84 @@ public abstract class AbstractConfiguration
     return isBlank(groupName) || groupName.equalsIgnoreCase(CLUSTER);
   }
 
-  private String group;
-
+  @JsonIgnore
   public String getGroup() {
-    return group;
+    return null;
+  }
+
+  /**
+   * Returns the portion of the URI that uniquely, in the scope of {@link #getEndpoint()},
+   * identifies this instance.
+   * Some implementations of this class require that some other attribute be set
+   * (for example {@link Region#setName(String)}) before this method will return
+   * a non-null value. Refer to the javadocs on subclasses for details.
+   */
+  @Override
+  public abstract String getId();
+
+  public static final String URI_CONTEXT = "/management";
+  public static final String URI_VERSION = "/experimental";
+
+  /**
+   * Returns the portion of the URI, after {@link #URI_VERSION}, that specifies the type of this
+   * instance.
+   * It is possible that more than once instance of this type can exist.
+   *
+   * @return the portion of the URI that identifies the type of this instance
+   */
+  @JsonIgnore
+  public abstract String getEndpoint();
+
+  /**
+   * Returns the portion of the URI, after {@link #URI_VERSION}, that specifies the type and id of
+   * this instance.
+   * This result will uniquely identify a single instance.
+   * If the id is null, then null is returned.
+   *
+   * <p>
+   * Note that the result does not include the prefix: <code>http://hostname:port</code>
+   * it should return the URI part after /experimental
+   *
+   * @return {@link #getEndpoint()} + "/" + {@link #getId()}
+   */
+  @JsonIgnore
+  public String getIdentityEndPoint() {
+    String id = getId();
+    if (StringUtils.isBlank(id))
+      return null;
+    else {
+      String endpoint = getEndpoint();
+      if (StringUtils.isBlank(endpoint))
+        return null;
+      else
+        return getEndpoint() + "/" + getId();
+    }
   }
 
-  public void setGroup(String group) {
-    this.group = group;
+  /**
+   * Returns the full URI path that uniquely identifies this instance.
+   * If the id is null, then null is returned.
+   *
+   * <p>
+   * Note that the result does not include the prefix: <code>http://hostname:port</code>
+   *
+   * @return {@link #URI_CONTEXT} + {@link #URI_VERSION} + {@link #getIdentityEndPoint()}
+   */
+  @JsonProperty(access = JsonProperty.Access.READ_ONLY)
+  public String getUri() {
+    if (getIdentityEndPoint() == null) {
+      return null;
+    }
+    return URI_CONTEXT + URI_VERSION + getIdentityEndPoint();
   }
+
+  /**
+   * Returns true if the RuntimeInfo will be the same on all members;
+   * false if each member can have different RuntimeInfo.
+   */
+  @JsonIgnore
+  public boolean isGlobalRuntime() {
+    return false;
+  }
+
 }
diff --git a/geode-management/src/main/java/org/apache/geode/management/configuration/GatewayReceiver.java b/geode-management/src/main/java/org/apache/geode/management/configuration/GatewayReceiver.java
index aed16ed..9d490c2 100644
--- a/geode-management/src/main/java/org/apache/geode/management/configuration/GatewayReceiver.java
+++ b/geode-management/src/main/java/org/apache/geode/management/configuration/GatewayReceiver.java
@@ -19,8 +19,6 @@ import java.util.List;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
-import org.apache.geode.management.api.CorrespondWith;
-import org.apache.geode.management.api.RestfulEndpoint;
 import org.apache.geode.management.runtime.GatewayReceiverInfo;
 
 
@@ -30,14 +28,16 @@ import org.apache.geode.management.runtime.GatewayReceiverInfo;
  * setting the bindAddress and hostname for clients are not supported by this api.
  */
 
-public class GatewayReceiver extends AbstractConfiguration implements RestfulEndpoint,
-    CorrespondWith<GatewayReceiverInfo> {
+public class GatewayReceiver extends GroupableConfiguration<GatewayReceiverInfo> {
+  /**
+   * Returns {@link #getGroup()} or {@link AbstractConfiguration#CLUSTER} if group is null.
+   */
   @Override
   @JsonIgnore
   public String getId() {
     String id = getGroup();
     if (isCluster(id)) {
-      id = AbstractConfiguration.CLUSTER;
+      id = CLUSTER;
     }
     return id;
   }
diff --git a/geode-management/src/main/java/org/apache/geode/management/configuration/GroupableConfiguration.java b/geode-management/src/main/java/org/apache/geode/management/configuration/GroupableConfiguration.java
new file mode 100644
index 0000000..cb242a1
--- /dev/null
+++ b/geode-management/src/main/java/org/apache/geode/management/configuration/GroupableConfiguration.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geode.management.configuration;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import org.apache.geode.management.runtime.RuntimeInfo;
+
+public abstract class GroupableConfiguration<R extends RuntimeInfo>
+    extends AbstractConfiguration<R> {
+
+  @JsonProperty
+  private String group;
+
+  @Override
+  public String getGroup() {
+    return group;
+  }
+
+  public void setGroup(String group) {
+    this.group = group;
+  }
+}
diff --git a/geode-management/src/main/java/org/apache/geode/management/configuration/Index.java b/geode-management/src/main/java/org/apache/geode/management/configuration/Index.java
index 4f119dd..d5fba98 100644
--- a/geode-management/src/main/java/org/apache/geode/management/configuration/Index.java
+++ b/geode-management/src/main/java/org/apache/geode/management/configuration/Index.java
@@ -19,12 +19,9 @@ package org.apache.geode.management.configuration;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import org.apache.commons.lang3.StringUtils;
 
-import org.apache.geode.management.api.CorrespondWith;
-import org.apache.geode.management.api.RestfulEndpoint;
 import org.apache.geode.management.runtime.RuntimeInfo;
 
-public class Index extends AbstractConfiguration
-    implements RestfulEndpoint, CorrespondWith<RuntimeInfo> {
+public class Index extends GroupableConfiguration<RuntimeInfo> {
 
   private String name;
   private String expression;
@@ -58,6 +55,8 @@ public class Index extends AbstractConfiguration
    * 3. /regionName alias
    * 4. /regionName.entrySet()
    * 5. /regionName.fieldName.entrySet() alias
+   * <P>
+   * Note: only the regionName portion of the path is used when filtering.
    */
   public void setRegionPath(String regionPath) {
     this.regionPath = regionPath;
@@ -90,6 +89,9 @@ public class Index extends AbstractConfiguration
     return regionName;
   }
 
+  /**
+   * Returns {@link #getName()}.
+   */
   @Override
   @JsonIgnore
   public String getId() {
diff --git a/geode-management/src/main/java/org/apache/geode/management/configuration/MemberConfig.java b/geode-management/src/main/java/org/apache/geode/management/configuration/MemberConfig.java
index 569cfdb..c5ec6cf 100644
--- a/geode-management/src/main/java/org/apache/geode/management/configuration/MemberConfig.java
+++ b/geode-management/src/main/java/org/apache/geode/management/configuration/MemberConfig.java
@@ -17,13 +17,10 @@ package org.apache.geode.management.configuration;
 
 
 import org.apache.geode.annotations.Experimental;
-import org.apache.geode.management.api.CorrespondWith;
-import org.apache.geode.management.api.RestfulEndpoint;
 import org.apache.geode.management.runtime.MemberInformation;
 
 @Experimental
-public class MemberConfig extends AbstractConfiguration implements RestfulEndpoint,
-    CorrespondWith<MemberInformation> {
+public class MemberConfig extends GroupableConfiguration<MemberInformation> {
 
   public static final String MEMBER_CONFIG_ENDPOINT = "/members";
 
@@ -33,6 +30,9 @@ public class MemberConfig extends AbstractConfiguration implements RestfulEndpoi
     this.id = id;
   }
 
+  /**
+   * Returns the value set by {@link #setId(String)}.
+   */
   @Override
   public String getId() {
     return id;
diff --git a/geode-management/src/main/java/org/apache/geode/management/configuration/Pdx.java b/geode-management/src/main/java/org/apache/geode/management/configuration/Pdx.java
index 8f72b79..27d1a84 100644
--- a/geode-management/src/main/java/org/apache/geode/management/configuration/Pdx.java
+++ b/geode-management/src/main/java/org/apache/geode/management/configuration/Pdx.java
@@ -19,16 +19,13 @@ package org.apache.geode.management.configuration;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
 import org.apache.geode.annotations.Experimental;
-import org.apache.geode.management.api.CorrespondWith;
-import org.apache.geode.management.api.RestfulEndpoint;
 import org.apache.geode.management.runtime.RuntimeInfo;
 
 /**
  * Configuration Objects for Pdx in the cache
  */
 @Experimental
-public class Pdx extends AbstractConfiguration
-    implements RestfulEndpoint, CorrespondWith<RuntimeInfo> {
+public class Pdx extends AbstractConfiguration<RuntimeInfo> {
   public static final String PDX_ID = "PDX";
   public static final String PDX_ENDPOINT = "/configurations/pdx";
 
@@ -38,6 +35,9 @@ public class Pdx extends AbstractConfiguration
   private Boolean persistent;
   private String diskStoreName;
 
+  /**
+   * Returns {@link #PDX_ID}
+   */
   @Override
   @JsonIgnore
   public String getId() {
@@ -54,12 +54,6 @@ public class Pdx extends AbstractConfiguration
     return PDX_ENDPOINT;
   }
 
-  public void setGroup(String group) {
-    if (!isCluster(group)) {
-      throw new IllegalArgumentException("Pdx can only be configured in cluster level.");
-    }
-  }
-
   public Boolean isReadSerialized() {
     return readSerialized;
   }
diff --git a/geode-management/src/main/java/org/apache/geode/management/configuration/Region.java b/geode-management/src/main/java/org/apache/geode/management/configuration/Region.java
index 57eb1ec..8faf974 100644
--- a/geode-management/src/main/java/org/apache/geode/management/configuration/Region.java
+++ b/geode-management/src/main/java/org/apache/geode/management/configuration/Region.java
@@ -19,8 +19,6 @@ import java.util.Objects;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
-import org.apache.geode.management.api.CorrespondWith;
-import org.apache.geode.management.api.RestfulEndpoint;
 import org.apache.geode.management.runtime.RuntimeRegionInfo;
 
 /**
@@ -29,8 +27,7 @@ import org.apache.geode.management.runtime.RuntimeRegionInfo;
  * for regions created using gfsh but listed using management rest api, the attributes not supported
  * by management rest api won't be shown.
  */
-public class Region extends AbstractConfiguration implements RestfulEndpoint,
-    CorrespondWith<RuntimeRegionInfo> {
+public class Region extends GroupableConfiguration<RuntimeRegionInfo> {
   public static final String REGION_CONFIG_ENDPOINT = "/regions";
 
   private String name;
@@ -54,6 +51,9 @@ public class Region extends AbstractConfiguration implements RestfulEndpoint,
     return REGION_CONFIG_ENDPOINT;
   }
 
+  /**
+   * Returns {@link #getName()}.
+   */
   @Override
   @JsonIgnore
   public String getId() {
diff --git a/geode-management/src/main/java/org/apache/geode/management/internal/ClientClusterManagementService.java b/geode-management/src/main/java/org/apache/geode/management/internal/ClientClusterManagementService.java
index 46eb193..7087eec 100644
--- a/geode-management/src/main/java/org/apache/geode/management/internal/ClientClusterManagementService.java
+++ b/geode-management/src/main/java/org/apache/geode/management/internal/ClientClusterManagementService.java
@@ -34,8 +34,6 @@ import org.apache.geode.management.api.ClusterManagementOperationResult;
 import org.apache.geode.management.api.ClusterManagementRealizationResult;
 import org.apache.geode.management.api.ClusterManagementResult;
 import org.apache.geode.management.api.ClusterManagementService;
-import org.apache.geode.management.api.CorrespondWith;
-import org.apache.geode.management.api.RestfulEndpoint;
 import org.apache.geode.management.configuration.AbstractConfiguration;
 import org.apache.geode.management.runtime.OperationResult;
 import org.apache.geode.management.runtime.RuntimeInfo;
@@ -70,7 +68,7 @@ public class ClientClusterManagementService implements ClusterManagementService
 
   @Override
   @SuppressWarnings("unchecked")
-  public <T extends AbstractConfiguration> ClusterManagementRealizationResult create(T config) {
+  public <T extends AbstractConfiguration<?>> ClusterManagementRealizationResult create(T config) {
     String endPoint = getEndpoint(config);
     // the response status code info is represented by the ClusterManagementResult.errorCode already
     return assertSuccessful(restTemplate
@@ -80,7 +78,7 @@ public class ClientClusterManagementService implements ClusterManagementService
 
   @Override
   @SuppressWarnings("unchecked")
-  public <T extends AbstractConfiguration> ClusterManagementRealizationResult delete(
+  public <T extends AbstractConfiguration<?>> ClusterManagementRealizationResult delete(
       T config) {
     String uri = getIdentityEndPoint(config);
     return assertSuccessful(restTemplate
@@ -93,14 +91,14 @@ public class ClientClusterManagementService implements ClusterManagementService
   }
 
   @Override
-  public <T extends AbstractConfiguration> ClusterManagementRealizationResult update(
+  public <T extends AbstractConfiguration<?>> ClusterManagementRealizationResult update(
       T config) {
     throw new NotImplementedException("Not Implemented");
   }
 
   @Override
   @SuppressWarnings("unchecked")
-  public <T extends AbstractConfiguration & CorrespondWith<R>, R extends RuntimeInfo> ClusterManagementListResult<T, R> list(
+  public <T extends AbstractConfiguration<R>, R extends RuntimeInfo> ClusterManagementListResult<T, R> list(
       T config) {
     String endPoint = getEndpoint(config);
     return assertSuccessful(restTemplate
@@ -111,7 +109,7 @@ public class ClientClusterManagementService implements ClusterManagementService
 
   @Override
   @SuppressWarnings("unchecked")
-  public <T extends AbstractConfiguration & CorrespondWith<R>, R extends RuntimeInfo> ClusterManagementListResult<T, R> get(
+  public <T extends AbstractConfiguration<R>, R extends RuntimeInfo> ClusterManagementListResult<T, R> get(
       T config) {
 
     return assertSuccessful(restTemplate
@@ -127,8 +125,9 @@ public class ClientClusterManagementService implements ClusterManagementService
 
     // make the REST call to start the operation
     result =
-        assertSuccessful(restTemplate.postForEntity(RestfulEndpoint.URI_VERSION + op.getEndpoint(),
-            op, ClusterManagementOperationResult.class).getBody());
+        assertSuccessful(
+            restTemplate.postForEntity(AbstractConfiguration.URI_VERSION + op.getEndpoint(),
+                op, ClusterManagementOperationResult.class).getBody());
 
     // our restTemplate requires the url to be modified to start from "/experimental"
     return reAnimate(result);
@@ -136,7 +135,7 @@ public class ClientClusterManagementService implements ClusterManagementService
 
   private <V extends OperationResult> ClusterManagementOperationResult<V> reAnimate(
       ClusterManagementOperationResult<V> result) {
-    String uri = stripPrefix(RestfulEndpoint.URI_CONTEXT, result.getUri());
+    String uri = stripPrefix(AbstractConfiguration.URI_CONTEXT, result.getUri());
 
     // complete the future by polling the check-status REST endpoint
     CompletableFuture<Date> futureOperationEnded = new CompletableFuture<>();
@@ -156,7 +155,7 @@ public class ClientClusterManagementService implements ClusterManagementService
 
     // make the REST call to list in-progress operations
     result = assertSuccessful(
-        restTemplate.getForEntity(RestfulEndpoint.URI_VERSION + opType.getEndpoint(),
+        restTemplate.getForEntity(AbstractConfiguration.URI_VERSION + opType.getEndpoint(),
             ClusterManagementListOperationsResult.class).getBody());
 
     return new ClusterManagementListOperationsResult<>(
@@ -171,31 +170,21 @@ public class ClientClusterManagementService implements ClusterManagementService
   }
 
   private String getEndpoint(AbstractConfiguration config) {
-    checkIsRestful(config);
-    String endpoint = ((RestfulEndpoint) config).getEndpoint();
+    String endpoint = config.getEndpoint();
     if (endpoint == null) {
       throw new IllegalArgumentException(
           "unable to construct the uri with the current configuration.");
     }
-    return RestfulEndpoint.URI_VERSION + endpoint;
+    return AbstractConfiguration.URI_VERSION + endpoint;
   }
 
   private String getIdentityEndPoint(AbstractConfiguration config) {
-    checkIsRestful(config);
-    String uri = ((RestfulEndpoint) config).getIdentityEndPoint();
+    String uri = config.getIdentityEndPoint();
     if (uri == null) {
       throw new IllegalArgumentException(
           "unable to construct the uri with the current configuration.");
     }
-    return RestfulEndpoint.URI_VERSION + uri;
-  }
-
-  private void checkIsRestful(AbstractConfiguration config) {
-    if (!(config instanceof RestfulEndpoint)) {
-      throw new IllegalArgumentException(
-          String.format("The config type %s does not have a RESTful endpoint defined",
-              config.getClass().getName()));
-    }
+    return AbstractConfiguration.URI_VERSION + uri;
   }
 
   private <T extends ClusterManagementResult> T assertSuccessful(T result) {
@@ -207,7 +196,7 @@ public class ClientClusterManagementService implements ClusterManagementService
 
   public boolean isConnected() {
     try {
-      return restTemplate.getForEntity(RestfulEndpoint.URI_VERSION + "/ping", String.class)
+      return restTemplate.getForEntity(AbstractConfiguration.URI_VERSION + "/ping", String.class)
           .getBody().equals("pong");
     } catch (Exception e) {
       return false;
diff --git a/geode-management/src/test/java/org/apache/geode/cache/configuration/AbstractConfigurationTest.java b/geode-management/src/test/java/org/apache/geode/cache/configuration/AbstractConfigurationTest.java
index 33f53bc..6b577e5 100644
--- a/geode-management/src/test/java/org/apache/geode/cache/configuration/AbstractConfigurationTest.java
+++ b/geode-management/src/test/java/org/apache/geode/cache/configuration/AbstractConfigurationTest.java
@@ -23,12 +23,12 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 
 import org.apache.geode.management.configuration.AbstractConfiguration;
-import org.apache.geode.management.configuration.Region;
+import org.apache.geode.management.configuration.Pdx;
 import org.apache.geode.util.internal.GeodeJsonMapper;
 
 public class AbstractConfigurationTest {
 
-  private AbstractConfiguration element;
+  private AbstractConfiguration<?> element;
 
   private static ObjectMapper mapper;
   private String json;
@@ -40,11 +40,11 @@ public class AbstractConfigurationTest {
 
   @Before
   public void before() throws Exception {
-    element = new Region();
+    element = new Pdx();
   }
 
   @Test
-  public void plainRegionConfig() throws Exception {
+  public void plainPdxConfig() throws Exception {
     assertThat(element.getGroup()).isNull();
     json = mapper.writeValueAsString(element);
     System.out.println(json);
@@ -52,31 +52,6 @@ public class AbstractConfigurationTest {
   }
 
   @Test
-  public void setterRegionConfigGroup() throws Exception {
-    element.setGroup("group1");
-    assertThat(element.getGroup()).isEqualTo("group1");
-    json = mapper.writeValueAsString(element);
-    System.out.println(json);
-    assertThat(json).contains("\"group\":\"group1\"");
-  }
-
-  @Test
-  public void setGroup() throws Exception {
-    element.setGroup("group1");
-    assertThat(element.getGroup()).isEqualTo("group1");
-    element.setGroup(null);
-    assertThat(element.getGroup()).isNull();
-    element.setGroup("");
-    assertThat(element.getGroup()).isEqualTo("");
-    element.setGroup("CLUSTER");
-    assertThat(element.getGroup()).isEqualTo("CLUSTER");
-    element.setGroup("cluster");
-    assertThat(element.getGroup()).isEqualTo("cluster");
-    element.setGroup("ClUsTeR");
-    assertThat(element.getGroup()).isEqualTo("ClUsTeR");
-  }
-
-  @Test
   public void isCluster() {
     assertThat(AbstractConfiguration.isCluster("foo")).isFalse();
     assertThat(AbstractConfiguration.isCluster(null)).isTrue();
diff --git a/geode-management/src/test/java/org/apache/geode/cache/configuration/AbstractConfigurationTest.java b/geode-management/src/test/java/org/apache/geode/cache/configuration/GroupableConfigurationTest.java
similarity index 78%
copy from geode-management/src/test/java/org/apache/geode/cache/configuration/AbstractConfigurationTest.java
copy to geode-management/src/test/java/org/apache/geode/cache/configuration/GroupableConfigurationTest.java
index 33f53bc..7d81d15 100644
--- a/geode-management/src/test/java/org/apache/geode/cache/configuration/AbstractConfigurationTest.java
+++ b/geode-management/src/test/java/org/apache/geode/cache/configuration/GroupableConfigurationTest.java
@@ -22,13 +22,13 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import org.apache.geode.management.configuration.AbstractConfiguration;
+import org.apache.geode.management.configuration.GroupableConfiguration;
 import org.apache.geode.management.configuration.Region;
 import org.apache.geode.util.internal.GeodeJsonMapper;
 
-public class AbstractConfigurationTest {
+public class GroupableConfigurationTest {
 
-  private AbstractConfiguration element;
+  private GroupableConfiguration<?> element;
 
   private static ObjectMapper mapper;
   private String json;
@@ -75,16 +75,4 @@ public class AbstractConfigurationTest {
     element.setGroup("ClUsTeR");
     assertThat(element.getGroup()).isEqualTo("ClUsTeR");
   }
-
-  @Test
-  public void isCluster() {
-    assertThat(AbstractConfiguration.isCluster("foo")).isFalse();
-    assertThat(AbstractConfiguration.isCluster(null)).isTrue();
-    assertThat(AbstractConfiguration.isCluster("")).isTrue();
-    assertThat(AbstractConfiguration.isCluster(AbstractConfiguration.CLUSTER)).isTrue();
-    assertThat(AbstractConfiguration.isCluster(AbstractConfiguration.CLUSTER.toLowerCase()))
-        .isTrue();
-    assertThat(AbstractConfiguration.isCluster(AbstractConfiguration.CLUSTER.toUpperCase()))
-        .isTrue();
-  }
 }
diff --git a/geode-management/src/test/java/org/apache/geode/cache/configuration/PdxTypeTest.java b/geode-management/src/test/java/org/apache/geode/cache/configuration/PdxTypeTest.java
index 570f1d4..b61df84 100644
--- a/geode-management/src/test/java/org/apache/geode/cache/configuration/PdxTypeTest.java
+++ b/geode-management/src/test/java/org/apache/geode/cache/configuration/PdxTypeTest.java
@@ -16,29 +16,21 @@
 package org.apache.geode.cache.configuration;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import org.junit.Test;
 
-import org.apache.geode.management.api.RestfulEndpoint;
+import org.apache.geode.management.configuration.AbstractConfiguration;
 import org.apache.geode.management.configuration.Pdx;
 
 public class PdxTypeTest {
 
   @Test
-  public void setGroup() throws Exception {
-    Pdx type = new Pdx();
-    assertThatThrownBy(() -> type.setGroup("test"))
-        .isInstanceOf(IllegalArgumentException.class);
-  }
-
-  @Test
   public void getUri() {
     Pdx config = new Pdx();
     assertThat(config.getEndpoint())
         .isEqualTo("/configurations/pdx");
     assertThat(config.getUri())
-        .isEqualTo(RestfulEndpoint.URI_CONTEXT + "/experimental/configurations/pdx");
+        .isEqualTo(AbstractConfiguration.URI_CONTEXT + "/experimental/configurations/pdx");
   }
 
 }
diff --git a/geode-management/src/test/java/org/apache/geode/management/configuration/GatewayReceiverTest.java b/geode-management/src/test/java/org/apache/geode/management/configuration/GatewayReceiverTest.java
index 60e4e95..843036f 100644
--- a/geode-management/src/test/java/org/apache/geode/management/configuration/GatewayReceiverTest.java
+++ b/geode-management/src/test/java/org/apache/geode/management/configuration/GatewayReceiverTest.java
@@ -20,9 +20,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.geode.management.api.RestfulEndpoint;
-
-
 public class GatewayReceiverTest {
   private GatewayReceiver receiver;
 
@@ -42,10 +39,10 @@ public class GatewayReceiverTest {
   @Test
   public void getUri() {
     assertThat(receiver.getUri())
-        .isEqualTo(RestfulEndpoint.URI_CONTEXT + "/experimental/gateways/receivers/cluster");
+        .isEqualTo(AbstractConfiguration.URI_CONTEXT + "/experimental/gateways/receivers/cluster");
 
     receiver.setGroup("group");
     assertThat(receiver.getUri())
-        .isEqualTo(RestfulEndpoint.URI_CONTEXT + "/experimental/gateways/receivers/group");
+        .isEqualTo(AbstractConfiguration.URI_CONTEXT + "/experimental/gateways/receivers/group");
   }
 }
diff --git a/geode-management/src/test/java/org/apache/geode/management/configuration/IndexTest.java b/geode-management/src/test/java/org/apache/geode/management/configuration/IndexTest.java
index 42d7698..3fba89f 100644
--- a/geode-management/src/test/java/org/apache/geode/management/configuration/IndexTest.java
+++ b/geode-management/src/test/java/org/apache/geode/management/configuration/IndexTest.java
@@ -20,7 +20,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.geode.management.runtime.RuntimeInfo;
 
 public class IndexTest {
   private Index index;
@@ -31,12 +30,6 @@ public class IndexTest {
   }
 
   @Test
-  public void getIndexRuntimeClass() throws Exception {
-    assertThat(index.getRuntimeClass()).isEqualTo(RuntimeInfo.class);
-    assertThat(index.hasRuntimeInfo()).isFalse();
-  }
-
-  @Test
   public void getRegionName() throws Exception {
     index.setRegionPath(null);
     assertThat(index.getRegionName()).isNull();
diff --git a/geode-management/src/test/java/org/apache/geode/management/configuration/MemberConfigTest.java b/geode-management/src/test/java/org/apache/geode/management/configuration/MemberConfigTest.java
index 17665ae..aa54b27 100644
--- a/geode-management/src/test/java/org/apache/geode/management/configuration/MemberConfigTest.java
+++ b/geode-management/src/test/java/org/apache/geode/management/configuration/MemberConfigTest.java
@@ -20,8 +20,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 import org.junit.Test;
 
-import org.apache.geode.management.api.RestfulEndpoint;
-
 public class MemberConfigTest {
 
   @Test
@@ -30,6 +28,6 @@ public class MemberConfigTest {
     config.setId("memberA");
     assertThat(config.getEndpoint()).isEqualTo("/members");
     assertThat(config.getUri())
-        .isEqualTo(RestfulEndpoint.URI_CONTEXT + "/experimental/members/memberA");
+        .isEqualTo(AbstractConfiguration.URI_CONTEXT + "/experimental/members/memberA");
   }
 }
diff --git a/geode-management/src/test/java/org/apache/geode/management/configuration/RegionTest.java b/geode-management/src/test/java/org/apache/geode/management/configuration/RegionTest.java
index 049c884..5ff0ab1 100644
--- a/geode-management/src/test/java/org/apache/geode/management/configuration/RegionTest.java
+++ b/geode-management/src/test/java/org/apache/geode/management/configuration/RegionTest.java
@@ -22,8 +22,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.geode.management.api.RestfulEndpoint;
-import org.apache.geode.management.runtime.RuntimeRegionInfo;
 import org.apache.geode.util.internal.GeodeJsonMapper;
 
 public class RegionTest {
@@ -69,13 +67,7 @@ public class RegionTest {
     assertThat(regionConfig.getEndpoint()).isEqualTo("/regions");
 
     assertThat(regionConfig.getUri())
-        .isEqualTo(RestfulEndpoint.URI_CONTEXT + "/experimental/regions/regionA");
-  }
-
-  @Test
-  public void getRuntimeClass() throws Exception {
-    assertThat(regionConfig.getRuntimeClass()).isEqualTo(RuntimeRegionInfo.class);
-    assertThat(regionConfig.hasRuntimeInfo()).isTrue();
+        .isEqualTo(AbstractConfiguration.URI_CONTEXT + "/experimental/regions/regionA");
   }
 
   @Test


Mime
View raw message