You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ji...@apache.org on 2019/04/15 16:55:55 UTC
[geode] branch develop updated: Revert "GEODE-6612: move attributes that can not be configured in v2 … (#3461)
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 e1658a39 Revert "GEODE-6612: move attributes that can not be configured in v2 … (#3461)
e1658a39 is described below
commit e1658a39e343edee8dd51405ec80606171e38c7b
Author: jinmeiliao <ji...@pivotal.io>
AuthorDate: Mon Apr 15 09:55:36 2019 -0700
Revert "GEODE-6612: move attributes that can not be configured in v2 … (#3461)
This reverts commit 2402cac0
* document what's supported in management v2 api.
---
.../ManagementClientTestCreateRegion.java | 4 +-
...ateRegionWithDiskstoreAndSecurityDUnitTest.java | 24 +-
.../rest/ClientClusterManagementSSLTest.java | 8 +-
.../ClientClusterManagementServiceDunitTest.java | 10 +-
...ClusterManagementLocatorReconnectDunitTest.java | 4 +-
.../rest/ClusterManagementServiceOnServerTest.java | 6 +-
.../rest/ListRegionManagementDunitTest.java | 12 +-
.../rest/ManagementRequestLoggingDUnitTest.java | 4 +-
.../internal/rest/RegionManagementDunitTest.java | 8 +-
.../RegionManagementRestSecurityDUnitTest.java | 4 +-
.../integrationTest/resources/assembly_content.txt | 1 -
.../internal/CacheConfigDAODUnitTest.java | 6 +-
.../internal/api/RegionAPIDUnitTest.java | 10 +-
.../RegionConfigMutatorIntegrationTest.java | 6 +-
.../RegionConfigRealizerIntegrationTest.java | 6 +-
.../api/LocatorClusterManagementService.java | 4 +-
.../cli/functions/UpdateCacheFunction.java | 4 +-
.../mutators/RegionConfigManager.java | 13 +-
.../realizers/RegionConfigRealizer.java | 14 +-
.../validators/RegionConfigValidator.java | 10 +-
.../sanctioned-geode-core-serializables.txt | 1 -
.../cache/configuration/RegionConfigTest.java | 3 +-
.../api/LocatorClusterManagementServiceTest.java | 8 +-
.../validators/RegionConfigValidatorTest.java | 15 +-
.../cache/configuration/BasicRegionConfig.java | 280 -------------
.../geode/cache/configuration/CacheConfig.java | 4 -
.../geode/cache/configuration/RegionConfig.java | 442 +++++++++++++++++----
.../configuration/CacheElementJsonMappingTest.java | 10 +-
.../ClientClusterManagementServiceDUnitTest.java | 5 +-
.../rest/RegionManagementIntegrationTest.java | 18 +-
.../RegionManagementSecurityIntegrationTest.java | 6 +-
.../controllers/RegionManagementController.java | 8 +-
32 files changed, 471 insertions(+), 487 deletions(-)
diff --git a/geode-assembly/src/acceptanceTest/resources/ManagementClientTestCreateRegion.java b/geode-assembly/src/acceptanceTest/resources/ManagementClientTestCreateRegion.java
index a5e18fb..4892387 100644
--- a/geode-assembly/src/acceptanceTest/resources/ManagementClientTestCreateRegion.java
+++ b/geode-assembly/src/acceptanceTest/resources/ManagementClientTestCreateRegion.java
@@ -15,7 +15,7 @@
import javax.net.ssl.SSLContext;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.management.api.ClusterManagementResult;
import org.apache.geode.management.api.ClusterManagementService;
@@ -35,7 +35,7 @@ public class ManagementClientCreateRegion {
cms = ClusterManagementServiceProvider.getService("localhost", 7070);
}
- BasicRegionConfig config = new BasicRegionConfig();
+ RegionConfig config = new RegionConfig();
config.setName(regionName);
config.setType(RegionType.REPLICATE);
diff --git a/geode-assembly/src/distributedTest/java/org/apache/geode/management/client/CreateRegionWithDiskstoreAndSecurityDUnitTest.java b/geode-assembly/src/distributedTest/java/org/apache/geode/management/client/CreateRegionWithDiskstoreAndSecurityDUnitTest.java
index dba0586..7a77124 100644
--- a/geode-assembly/src/distributedTest/java/org/apache/geode/management/client/CreateRegionWithDiskstoreAndSecurityDUnitTest.java
+++ b/geode-assembly/src/distributedTest/java/org/apache/geode/management/client/CreateRegionWithDiskstoreAndSecurityDUnitTest.java
@@ -17,12 +17,15 @@ package org.apache.geode.management.client;
import static org.assertj.core.api.Assertions.assertThat;
+import java.io.File;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
import org.apache.geode.cache.configuration.RegionAttributesType;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.examples.SimpleSecurityManager;
import org.apache.geode.management.api.ClusterManagementResult;
@@ -39,6 +42,11 @@ public class CreateRegionWithDiskstoreAndSecurityDUnitTest {
@Rule
public GfshCommandRule gfsh = new GfshCommandRule();
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ private File diskStoreDir;
+
private MemberVM server;
private MemberVM locator;
@@ -53,14 +61,16 @@ public class CreateRegionWithDiskstoreAndSecurityDUnitTest {
gfsh.secureConnectAndVerify(locator.getPort(), GfshCommandRule.PortType.locator,
"data,cluster", "data,cluster");
+
+ diskStoreDir = temporaryFolder.newFolder();
}
@Test
public void createReplicateRegionWithDiskstoreWithoutDataManage() throws Exception {
gfsh.executeAndAssertThat(String.format("create disk-store --name=DISKSTORE --dir=%s",
- cluster.getWorkingDirRoot())).statusIsSuccess();
+ diskStoreDir.getAbsolutePath())).statusIsSuccess();
- BasicRegionConfig regionConfig = new BasicRegionConfig();
+ RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("REGION1");
regionConfig.setType(RegionType.REPLICATE_PERSISTENT);
@@ -80,9 +90,9 @@ public class CreateRegionWithDiskstoreAndSecurityDUnitTest {
@Test
public void createReplicateRegionWithDiskstoreWithoutClusterWrite() throws Exception {
gfsh.executeAndAssertThat(String.format("create disk-store --name=DISKSTORE --dir=%s",
- cluster.getWorkingDirRoot())).statusIsSuccess();
+ diskStoreDir.getAbsolutePath())).statusIsSuccess();
- BasicRegionConfig regionConfig = new BasicRegionConfig();
+ RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("REGION1");
regionConfig.setType(RegionType.REPLICATE_PERSISTENT);
@@ -102,9 +112,9 @@ public class CreateRegionWithDiskstoreAndSecurityDUnitTest {
@Test
public void createReplicateRegionWithDiskstoreSuccess() throws Exception {
gfsh.executeAndAssertThat(String.format("create disk-store --name=DISKSTORE --dir=%s",
- cluster.getWorkingDirRoot())).statusIsSuccess();
+ diskStoreDir.getAbsolutePath())).statusIsSuccess();
- BasicRegionConfig regionConfig = new BasicRegionConfig();
+ RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("REGION1");
regionConfig.setType(RegionType.REPLICATE_PERSISTENT);
diff --git a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClientClusterManagementSSLTest.java b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClientClusterManagementSSLTest.java
index c65435a..6ef47cf 100644
--- a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClientClusterManagementSSLTest.java
+++ b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClientClusterManagementSSLTest.java
@@ -37,9 +37,9 @@ import org.junit.Test;
import org.junit.contrib.java.lang.system.RestoreSystemProperties;
import org.springframework.web.client.ResourceAccessException;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
import org.apache.geode.cache.configuration.CacheConfig;
import org.apache.geode.cache.configuration.CacheElement;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.examples.SimpleSecurityManager;
import org.apache.geode.internal.security.SecurableCommunicationChannel;
import org.apache.geode.management.api.ClusterManagementResult;
@@ -55,7 +55,7 @@ public class ClientClusterManagementSSLTest {
private static MemberVM locator, server;
private ClusterManagementService cmsClient;
- private BasicRegionConfig region;
+ private RegionConfig region;
private static SSLContext sslContext;
private static HostnameVerifier hostnameVerifier;
@@ -92,7 +92,7 @@ public class ClientClusterManagementSSLTest {
@Before
public void before() throws Exception {
- region = new BasicRegionConfig();
+ region = new RegionConfig();
region.setName("customer");
}
@@ -163,7 +163,7 @@ public class ClientClusterManagementSSLTest {
// when getting the service from the server, we don't need to provide the host information
ClusterManagementService cmsClient =
ClusterManagementServiceProvider.getService("dataManage", "dataManage");
- BasicRegionConfig region = new BasicRegionConfig();
+ RegionConfig region = new RegionConfig();
region.setName("orders");
cmsClient.create(region);
diff --git a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClientClusterManagementServiceDunitTest.java b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClientClusterManagementServiceDunitTest.java
index f5cfcde..4b4da9a 100644
--- a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClientClusterManagementServiceDunitTest.java
+++ b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClientClusterManagementServiceDunitTest.java
@@ -7,9 +7,9 @@ import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
import org.apache.geode.cache.configuration.CacheConfig;
import org.apache.geode.cache.configuration.CacheElement;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.distributed.internal.InternalConfigurationPersistenceService;
import org.apache.geode.management.api.ClusterManagementResult;
import org.apache.geode.management.api.ClusterManagementService;
@@ -53,7 +53,7 @@ public class ClientClusterManagementServiceDunitTest {
@Test
public void createRegion() {
- BasicRegionConfig region = new BasicRegionConfig();
+ RegionConfig region = new RegionConfig();
region.setName("customer");
ClusterManagementResult result = cmsClient.create(region);
@@ -69,7 +69,7 @@ public class ClientClusterManagementServiceDunitTest {
@Test
public void createRegionWithNullGroup() {
- BasicRegionConfig region = new BasicRegionConfig();
+ RegionConfig region = new RegionConfig();
region.setName("orders");
ClusterManagementResult result = cmsClient.create(region);
@@ -82,7 +82,7 @@ public class ClientClusterManagementServiceDunitTest {
@Test
public void createRegionWithInvalidName() throws Exception {
- BasicRegionConfig region = new BasicRegionConfig();
+ RegionConfig region = new RegionConfig();
region.setName("__test");
ClusterManagementResult result = cmsClient.create(region);
@@ -93,7 +93,7 @@ public class ClientClusterManagementServiceDunitTest {
@Test
public void createRegionWithGroup() {
- BasicRegionConfig region = new BasicRegionConfig();
+ RegionConfig region = new RegionConfig();
region.setName("company");
region.setGroup(groupA);
diff --git a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClusterManagementLocatorReconnectDunitTest.java b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClusterManagementLocatorReconnectDunitTest.java
index 6ead606..4dea93a 100644
--- a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClusterManagementLocatorReconnectDunitTest.java
+++ b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClusterManagementLocatorReconnectDunitTest.java
@@ -25,9 +25,9 @@ import org.junit.Rule;
import org.junit.Test;
import org.apache.geode.cache.Region;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
import org.apache.geode.cache.configuration.CacheConfig;
import org.apache.geode.cache.configuration.CacheElement;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.management.api.ClusterManagementResult;
import org.apache.geode.test.dunit.IgnoredException;
@@ -67,7 +67,7 @@ public class ClusterManagementLocatorReconnectDunitTest {
}
private void makeRestCallAndVerifyResult(String regionName) throws Exception {
- BasicRegionConfig regionConfig = new BasicRegionConfig();
+ RegionConfig regionConfig = new RegionConfig();
regionConfig.setName(regionName);
regionConfig.setType(RegionType.REPLICATE);
ObjectMapper mapper = new ObjectMapper();
diff --git a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClusterManagementServiceOnServerTest.java b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClusterManagementServiceOnServerTest.java
index 5873aa3..95449a4 100644
--- a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClusterManagementServiceOnServerTest.java
+++ b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClusterManagementServiceOnServerTest.java
@@ -33,7 +33,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.springframework.web.client.ResourceAccessException;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.internal.security.SecurableCommunicationChannel;
import org.apache.geode.management.api.ClusterManagementResult;
import org.apache.geode.management.api.ClusterManagementService;
@@ -51,7 +51,7 @@ public class ClusterManagementServiceOnServerTest implements Serializable {
private MemberVM locator, server;
private Properties sslProps;
- private BasicRegionConfig regionConfig;
+ private RegionConfig regionConfig;
@Before
public void before() throws Exception {
@@ -62,7 +62,7 @@ public class ClusterManagementServiceOnServerTest implements Serializable {
sslProps.setProperty(SSL_TRUSTSTORE_PASSWORD, "password");
sslProps.setProperty(SSL_ENABLED_COMPONENTS, SecurableCommunicationChannel.WEB.getConstant());
- regionConfig = new BasicRegionConfig();
+ regionConfig = new RegionConfig();
regionConfig.setName("test");
}
diff --git a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ListRegionManagementDunitTest.java b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ListRegionManagementDunitTest.java
index 911c319..6dd1135 100644
--- a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ListRegionManagementDunitTest.java
+++ b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ListRegionManagementDunitTest.java
@@ -25,8 +25,8 @@ import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
import org.apache.geode.cache.configuration.CacheElement;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.management.api.ClusterManagementService;
import org.apache.geode.management.client.ClusterManagementServiceProvider;
import org.apache.geode.test.dunit.rules.ClusterStartupRule;
@@ -45,7 +45,7 @@ public class ListRegionManagementDunitTest {
@ClassRule
public static GfshCommandRule gfsh = new GfshCommandRule();
- private static BasicRegionConfig filter;
+ private static RegionConfig filter;
@BeforeClass
public static void beforeClass() throws Exception {
@@ -57,24 +57,24 @@ public class ListRegionManagementDunitTest {
gfsh.connect(locator);
// create regions
- BasicRegionConfig regionConfig = new BasicRegionConfig();
+ RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("customers1");
regionConfig.setGroup("group1");
client.create(regionConfig);
- regionConfig = new BasicRegionConfig();
+ regionConfig = new RegionConfig();
regionConfig.setName("customers2");
regionConfig.setGroup("group2");
client.create(regionConfig);
- regionConfig = new BasicRegionConfig();
+ regionConfig = new RegionConfig();
regionConfig.setName("customers");
client.create(regionConfig);
}
@Before
public void before() throws Exception {
- filter = new BasicRegionConfig();
+ filter = new RegionConfig();
}
@Test
diff --git a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ManagementRequestLoggingDUnitTest.java b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ManagementRequestLoggingDUnitTest.java
index 02d563b..8b2adcf 100644
--- a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ManagementRequestLoggingDUnitTest.java
+++ b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ManagementRequestLoggingDUnitTest.java
@@ -29,7 +29,7 @@ import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.management.api.ClusterManagementResult;
import org.apache.geode.management.api.ClusterManagementService;
@@ -60,7 +60,7 @@ public class ManagementRequestLoggingDUnitTest {
listAppender.start();
});
- BasicRegionConfig regionConfig = new BasicRegionConfig();
+ RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("customers");
regionConfig.setType(RegionType.REPLICATE);
diff --git a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/RegionManagementDunitTest.java b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/RegionManagementDunitTest.java
index 9594e32..60cdcc0 100644
--- a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/RegionManagementDunitTest.java
+++ b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/RegionManagementDunitTest.java
@@ -24,9 +24,9 @@ import org.junit.Test;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.Region;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
import org.apache.geode.cache.configuration.CacheConfig;
import org.apache.geode.cache.configuration.CacheElement;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.management.api.ClusterManagementResult;
import org.apache.geode.test.dunit.IgnoredException;
@@ -53,7 +53,7 @@ public class RegionManagementDunitTest {
@Test
public void createsRegion() throws Exception {
- BasicRegionConfig regionConfig = new BasicRegionConfig();
+ RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("customers");
regionConfig.setType(RegionType.REPLICATE);
ObjectMapper mapper = new ObjectMapper();
@@ -83,7 +83,7 @@ public class RegionManagementDunitTest {
@Test
public void createsRegionUsingClusterManagementClient() throws Exception {
- BasicRegionConfig regionConfig = new BasicRegionConfig();
+ RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("customers2");
regionConfig.setType(RegionType.REPLICATE);
ObjectMapper mapper = new ObjectMapper();
@@ -148,7 +148,7 @@ public class RegionManagementDunitTest {
CacheConfig cacheConfig =
ClusterStartupRule.getLocator().getConfigurationPersistenceService()
.getCacheConfig("cluster");
- BasicRegionConfig regionConfig = CacheElement.findElement(cacheConfig.getRegions(), regionName);
+ RegionConfig regionConfig = CacheElement.findElement(cacheConfig.getRegions(), regionName);
assertThat(regionConfig.getType()).isEqualTo(type);
}
diff --git a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/RegionManagementRestSecurityDUnitTest.java b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/RegionManagementRestSecurityDUnitTest.java
index 4c569cc..2b28cc0 100644
--- a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/RegionManagementRestSecurityDUnitTest.java
+++ b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/RegionManagementRestSecurityDUnitTest.java
@@ -23,7 +23,7 @@ import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.examples.SimpleSecurityManager;
import org.apache.geode.management.api.ClusterManagementResult;
@@ -56,7 +56,7 @@ public class RegionManagementRestSecurityDUnitTest {
restClient =
new GeodeDevRestClient("/geode-management/v2", "localhost", locator.getHttpPort(), false);
- BasicRegionConfig regionConfig = new BasicRegionConfig();
+ RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("customers");
regionConfig.setType(RegionType.REPLICATE);
ObjectMapper mapper = new ObjectMapper();
diff --git a/geode-assembly/src/integrationTest/resources/assembly_content.txt b/geode-assembly/src/integrationTest/resources/assembly_content.txt
index 217fa40..bb3200b 100644
--- a/geode-assembly/src/integrationTest/resources/assembly_content.txt
+++ b/geode-assembly/src/integrationTest/resources/assembly_content.txt
@@ -286,7 +286,6 @@ javadoc/org/apache/geode/cache/client/SubscriptionNotEnabledException.html
javadoc/org/apache/geode/cache/client/package-frame.html
javadoc/org/apache/geode/cache/client/package-summary.html
javadoc/org/apache/geode/cache/client/package-tree.html
-javadoc/org/apache/geode/cache/configuration/BasicRegionConfig.html
javadoc/org/apache/geode/cache/configuration/CacheConfig.AsyncEventQueue.html
javadoc/org/apache/geode/cache/configuration/CacheConfig.CacheServer.html
javadoc/org/apache/geode/cache/configuration/CacheConfig.GatewayHub.Gateway.GatewayEndpoint.html
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/CacheConfigDAODUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/CacheConfigDAODUnitTest.java
index 687249b..287737e 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/CacheConfigDAODUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/CacheConfigDAODUnitTest.java
@@ -22,7 +22,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Rule;
import org.junit.Test;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.distributed.ConfigurationPersistenceService;
import org.apache.geode.test.dunit.rules.ClusterStartupRule;
@@ -44,10 +44,10 @@ public class CacheConfigDAODUnitTest {
ConfigurationPersistenceService ccService =
ClusterStartupRule.getLocator().getConfigurationPersistenceService();
ccService.updateCacheConfig("cluster", cc -> {
- BasicRegionConfig regionConfig = new BasicRegionConfig();
+ RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("regionB");
regionConfig.setType(RegionType.REPLICATE);
- cc.addRegion(regionConfig);
+ cc.getRegions().add(regionConfig);
return cc;
});
});
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/api/RegionAPIDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/api/RegionAPIDUnitTest.java
index 34f8cc5..07f2941 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/api/RegionAPIDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/api/RegionAPIDUnitTest.java
@@ -25,9 +25,9 @@ import org.junit.rules.TestName;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.Region;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
import org.apache.geode.cache.configuration.CacheConfig;
import org.apache.geode.cache.configuration.CacheElement;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.management.api.ClusterManagementResult;
import org.apache.geode.test.dunit.rules.ClusterStartupRule;
@@ -61,7 +61,7 @@ public class RegionAPIDUnitTest {
public void createsPartitionedRegion() {
String regionName = testName.getMethodName();
locator.invoke(() -> {
- BasicRegionConfig config = new BasicRegionConfig();
+ RegionConfig config = new RegionConfig();
config.setName(regionName);
config.setType(RegionType.PARTITION);
ClusterManagementResult result = ClusterStartupRule.getLocator().getClusterManagementService()
@@ -86,7 +86,7 @@ public class RegionAPIDUnitTest {
public void createsReplicatedRegion() {
String regionName = testName.getMethodName();
locator.invoke(() -> {
- BasicRegionConfig config = new BasicRegionConfig();
+ RegionConfig config = new RegionConfig();
config.setName(regionName);
config.setType(RegionType.REPLICATE);
ClusterManagementResult result = ClusterStartupRule.getLocator().getClusterManagementService()
@@ -103,7 +103,7 @@ public class RegionAPIDUnitTest {
public void defaultTypeIsPartition() throws Exception {
String regionName = testName.getMethodName();
locator.invoke(() -> {
- BasicRegionConfig config = new BasicRegionConfig();
+ RegionConfig config = new RegionConfig();
config.setName(regionName);
ClusterManagementResult result = ClusterStartupRule.getLocator().getClusterManagementService()
.create(config);
@@ -118,7 +118,7 @@ public class RegionAPIDUnitTest {
CacheConfig cacheConfig =
ClusterStartupRule.getLocator().getConfigurationPersistenceService()
.getCacheConfig("cluster");
- BasicRegionConfig regionConfig = CacheElement.findElement(cacheConfig.getRegions(), regionName);
+ RegionConfig regionConfig = CacheElement.findElement(cacheConfig.getRegions(), regionName);
assertThat(regionConfig.getType()).isEqualTo(type);
}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/mutators/RegionConfigMutatorIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/mutators/RegionConfigMutatorIntegrationTest.java
index 80f1a15..30d4140 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/mutators/RegionConfigMutatorIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/mutators/RegionConfigMutatorIntegrationTest.java
@@ -20,9 +20,9 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
import org.apache.geode.cache.configuration.CacheConfig;
import org.apache.geode.cache.configuration.CacheElement;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.test.junit.rules.LocatorStarterRule;
@@ -32,11 +32,11 @@ public class RegionConfigMutatorIntegrationTest {
public LocatorStarterRule locator = new LocatorStarterRule().withAutoStart();
private RegionConfigManager mutator;
- private BasicRegionConfig config;
+ private RegionConfig config;
@Before
public void before() throws Exception {
- config = new BasicRegionConfig();
+ config = new RegionConfig();
mutator = new RegionConfigManager();
}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/realizers/RegionConfigRealizerIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/realizers/RegionConfigRealizerIntegrationTest.java
index 82e7003..26d6212 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/realizers/RegionConfigRealizerIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/realizers/RegionConfigRealizerIntegrationTest.java
@@ -23,7 +23,7 @@ import org.junit.Test;
import org.apache.geode.cache.DataPolicy;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.Scope;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.test.junit.rules.ServerStarterRule;
@@ -33,11 +33,11 @@ public class RegionConfigRealizerIntegrationTest {
public ServerStarterRule server = new ServerStarterRule().withAutoStart();
private RegionConfigRealizer realizer;
- private BasicRegionConfig config;
+ private RegionConfig config;
@Before
public void setup() {
- config = new BasicRegionConfig();
+ config = new RegionConfig();
realizer = new RegionConfigRealizer();
}
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 23db474..5d79e29 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
@@ -30,7 +30,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
import org.apache.geode.annotations.VisibleForTesting;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
import org.apache.geode.cache.configuration.CacheConfig;
import org.apache.geode.cache.configuration.CacheElement;
import org.apache.geode.cache.configuration.RegionConfig;
@@ -64,11 +63,10 @@ public class LocatorClusterManagementService implements ClusterManagementService
ConfigurationPersistenceService persistenceService) {
this(cache, persistenceService, new HashMap(), new HashMap());
// initialize the list of managers
- managers.put(BasicRegionConfig.class, new RegionConfigManager());
+ managers.put(RegionConfig.class, new RegionConfigManager());
managers.put(MemberConfig.class, new MemberConfigManager(cache));
// initialize the list of validators
- validators.put(BasicRegionConfig.class, new RegionConfigValidator(cache));
validators.put(RegionConfig.class, new RegionConfigValidator(cache));
}
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UpdateCacheFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UpdateCacheFunction.java
index 38d8c4e..9749732 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UpdateCacheFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UpdateCacheFunction.java
@@ -24,8 +24,8 @@ import org.apache.commons.collections.map.HashedMap;
import org.apache.geode.annotations.Immutable;
import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
import org.apache.geode.cache.configuration.CacheElement;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.management.cli.CliFunction;
import org.apache.geode.management.internal.configuration.realizers.ConfigurationRealizer;
@@ -35,7 +35,7 @@ public class UpdateCacheFunction extends CliFunction<List> {
@Immutable
private static final Map<Class, ConfigurationRealizer> realizers = new HashedMap();
static {
- realizers.put(BasicRegionConfig.class, new RegionConfigRealizer());
+ realizers.put(RegionConfig.class, new RegionConfigRealizer());
}
public enum CacheElementOperation {
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/mutators/RegionConfigManager.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/mutators/RegionConfigManager.java
index aea6af6..87e239e 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/mutators/RegionConfigManager.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/mutators/RegionConfigManager.java
@@ -23,31 +23,30 @@ import java.util.stream.Collectors;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.lang3.StringUtils;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
import org.apache.geode.cache.configuration.CacheConfig;
import org.apache.geode.cache.configuration.RegionConfig;
-public class RegionConfigManager implements ConfigurationManager<BasicRegionConfig> {
+public class RegionConfigManager implements ConfigurationManager<RegionConfig> {
public RegionConfigManager() {}
@Override
- public void add(BasicRegionConfig configElement, CacheConfig existingConfig) {
- existingConfig.addRegion(configElement);
+ public void add(RegionConfig configElement, CacheConfig existingConfig) {
+ existingConfig.getRegions().add(configElement);
}
@Override
- public void update(BasicRegionConfig config, CacheConfig existing) {
+ public void update(RegionConfig config, CacheConfig existing) {
throw new NotImplementedException("Not implemented yet");
}
@Override
- public void delete(BasicRegionConfig config, CacheConfig existing) {
+ public void delete(RegionConfig config, CacheConfig existing) {
throw new NotImplementedException("Not implemented yet");
}
@Override
- public List<RegionConfig> list(BasicRegionConfig filter, CacheConfig existing) {
+ public List<RegionConfig> list(RegionConfig filter, CacheConfig existing) {
if (StringUtils.isBlank(filter.getName())) {
return existing.getRegions();
}
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/RegionConfigRealizer.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/RegionConfigRealizer.java
index eb2b974..e1c6263 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/RegionConfigRealizer.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/RegionConfigRealizer.java
@@ -28,9 +28,9 @@ import org.apache.geode.cache.ExpirationAttributes;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionFactory;
import org.apache.geode.cache.Scope;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
import org.apache.geode.cache.configuration.DeclarableType;
import org.apache.geode.cache.configuration.RegionAttributesType;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.internal.cache.EvictionAttributesImpl;
import org.apache.geode.internal.cache.PartitionAttributesImpl;
import org.apache.geode.management.internal.cli.CliUtil;
@@ -38,7 +38,7 @@ import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.RegionPath;
import org.apache.geode.management.internal.configuration.domain.DeclarableTypeInstantiator;
-public class RegionConfigRealizer implements ConfigurationRealizer<BasicRegionConfig> {
+public class RegionConfigRealizer implements ConfigurationRealizer<RegionConfig> {
public RegionConfigRealizer() {}
/**
@@ -47,7 +47,7 @@ public class RegionConfigRealizer implements ConfigurationRealizer<BasicRegionCo
* @param regionConfig the name in the regionConfig can not contain sub-regions.
*/
@Override
- public void create(BasicRegionConfig regionConfig, Cache cache) {
+ public void create(RegionConfig regionConfig, Cache cache) {
RegionFactory factory = getRegionFactory(cache, regionConfig.getRegionAttributes());
factory.create(regionConfig.getName());
}
@@ -60,7 +60,7 @@ public class RegionConfigRealizer implements ConfigurationRealizer<BasicRegionCo
* @param regionConfig the name in regionConfig is ignored.
* @param regionPath this is the full path of the region
*/
- public void create(BasicRegionConfig regionConfig, String regionPath, Cache cache) {
+ public void create(RegionConfig regionConfig, String regionPath, Cache cache) {
RegionFactory factory = getRegionFactory(cache, regionConfig.getRegionAttributes());
RegionPath regionPathData = new RegionPath(regionPath);
String regionName = regionPathData.getName();
@@ -285,15 +285,15 @@ public class RegionConfigRealizer implements ConfigurationRealizer<BasicRegionCo
}
@Override
- public boolean exists(BasicRegionConfig config, Cache cache) {
+ public boolean exists(RegionConfig config, Cache cache) {
return false;
}
@Override
- public void update(BasicRegionConfig config, Cache cache) {}
+ public void update(RegionConfig config, Cache cache) {}
@Override
- public void delete(BasicRegionConfig config, Cache cache) {}
+ public void delete(RegionConfig config, Cache cache) {}
}
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/validators/RegionConfigValidator.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/validators/RegionConfigValidator.java
index cedce5f..79084fe 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/validators/RegionConfigValidator.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/validators/RegionConfigValidator.java
@@ -15,7 +15,6 @@
package org.apache.geode.management.internal.configuration.validators;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
import org.apache.geode.cache.configuration.CacheConfig;
import org.apache.geode.cache.configuration.CacheElement;
import org.apache.geode.cache.configuration.RegionConfig;
@@ -24,7 +23,7 @@ import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.RegionNameValidation;
import org.apache.geode.security.ResourcePermission;
-public class RegionConfigValidator implements ConfigurationValidator<BasicRegionConfig> {
+public class RegionConfigValidator implements ConfigurationValidator<RegionConfig> {
private InternalCache cache;
public RegionConfigValidator(InternalCache cache) {
@@ -32,11 +31,8 @@ public class RegionConfigValidator implements ConfigurationValidator<BasicRegion
}
@Override
- public void validate(BasicRegionConfig config)
+ public void validate(RegionConfig config)
throws IllegalArgumentException {
- if (config instanceof RegionConfig) {
- throw new IllegalArgumentException("Use BasicRegionConfig to configure your region.");
- }
if (config.getName() == null) {
throw new IllegalArgumentException("Name of the region has to be specified.");
@@ -75,7 +71,7 @@ public class RegionConfigValidator implements ConfigurationValidator<BasicRegion
}
@Override
- public boolean exists(BasicRegionConfig config, CacheConfig existing) {
+ public boolean exists(RegionConfig config, CacheConfig existing) {
return CacheElement.exists(existing.getRegions(), config.getId());
}
}
diff --git a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
index f0c4d90..c337fb3 100644
--- a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
+++ b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
@@ -120,7 +120,6 @@ org/apache/geode/cache/client/SubscriptionNotEnabledException,true,-821244673777
org/apache/geode/cache/client/internal/ContainsKeyOp$MODE,false
org/apache/geode/cache/client/internal/TXSynchronizationOp$CompletionType,false
org/apache/geode/cache/client/internal/pooling/ConnectionDestroyedException,true,-6918516787578041316
-org/apache/geode/cache/configuration/BasicRegionConfig,false,name:java/lang/String,refid:java/lang/String,regionAttributes:org/apache/geode/cache/configuration/RegionAttributesType
org/apache/geode/cache/configuration/CacheConfig$AsyncEventQueue,false,asyncEventListener:org/apache/geode/cache/configuration/DeclarableType,batchSize:java/lang/String,batchTimeInterval:java/lang/String,diskStoreName:java/lang/String,diskSynchronous:java/lang/Boolean,dispatcherThreads:java/lang/String,enableBatchConflation:java/lang/Boolean,forwardExpirationDestroy:java/lang/Boolean,gatewayEventFilters:java/util/List,gatewayEventSubstitutionFilter:org/apache/geode/cache/configuration/De [...]
org/apache/geode/cache/configuration/CacheElement,false,group:java/lang/String
org/apache/geode/cache/configuration/ClassNameType,false,className:java/lang/String
diff --git a/geode-core/src/test/java/org/apache/geode/cache/configuration/RegionConfigTest.java b/geode-core/src/test/java/org/apache/geode/cache/configuration/RegionConfigTest.java
index 99310b8..c04739f 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/configuration/RegionConfigTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/configuration/RegionConfigTest.java
@@ -68,8 +68,7 @@ public class RegionConfigTest {
RegionConfig config = new RegionConfig();
config.setType(shortcut.name());
config.setName(shortcut.name());
- RegionConfig masterRegion =
- CacheElement.findElement(master.getRegions(), shortcut.name());
+ RegionConfig masterRegion = CacheElement.findElement(master.getRegions(), shortcut.name());
assertThat(config).isEqualToComparingFieldByFieldRecursively(masterRegion);
}
}
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 9ffb352..ff5a79b 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
@@ -30,8 +30,8 @@ import java.util.List;
import org.junit.Before;
import org.junit.Test;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
import org.apache.geode.cache.configuration.CacheConfig;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.distributed.ConfigurationPersistenceService;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.internal.cache.InternalCache;
@@ -44,7 +44,7 @@ public class LocatorClusterManagementServiceTest {
private LocatorClusterManagementService service;
private InternalCache cache;
private ConfigurationPersistenceService persistenceService;
- private BasicRegionConfig regionConfig;
+ private RegionConfig regionConfig;
private ClusterManagementResult result;
@Before
@@ -52,7 +52,7 @@ public class LocatorClusterManagementServiceTest {
cache = mock(InternalCache.class);
persistenceService = mock(ConfigurationPersistenceService.class);
service = spy(new LocatorClusterManagementService(cache, persistenceService));
- regionConfig = new BasicRegionConfig();
+ regionConfig = new RegionConfig();
}
@Test
@@ -68,7 +68,7 @@ public class LocatorClusterManagementServiceTest {
public void elementAlreadyExist() throws Exception {
regionConfig.setName("test");
CacheConfig cacheConfig = new CacheConfig();
- cacheConfig.addRegion(regionConfig);
+ cacheConfig.getRegions().add(regionConfig);
when(persistenceService.getCacheConfig("cluster", true)).thenReturn(cacheConfig);
assertThatThrownBy(() -> service.create(regionConfig))
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/validators/RegionConfigValidatorTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/validators/RegionConfigValidatorTest.java
index 1eac798..8c70c00 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/validators/RegionConfigValidatorTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/validators/RegionConfigValidatorTest.java
@@ -28,7 +28,6 @@ import static org.mockito.Mockito.when;
import org.junit.Before;
import org.junit.Test;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.internal.cache.InternalCache;
@@ -38,7 +37,7 @@ import org.apache.geode.security.ResourcePermission;
public class RegionConfigValidatorTest {
private RegionConfigValidator validator;
- private BasicRegionConfig config;
+ private RegionConfig config;
private SecurityService securityService;
@Before
@@ -47,7 +46,7 @@ public class RegionConfigValidatorTest {
securityService = mock(SecurityService.class);
when(cache.getSecurityService()).thenReturn(securityService);
validator = new RegionConfigValidator(cache);
- config = new BasicRegionConfig();
+ config = new RegionConfig();
}
@Test
@@ -123,14 +122,4 @@ public class RegionConfigValidatorTest {
.hasMessageContaining(
"cluster is a reserved group name");
}
-
- @Test
- public void invalidObject() throws Exception {
- RegionConfig config = new RegionConfig();
- config.setName("test");
- assertThatThrownBy(() -> validator.validate(config)).isInstanceOf(
- IllegalArgumentException.class)
- .hasMessageContaining(
- "Use BasicRegionConfig to configure your region");
- }
}
diff --git a/geode-management/src/main/java/org/apache/geode/cache/configuration/BasicRegionConfig.java b/geode-management/src/main/java/org/apache/geode/cache/configuration/BasicRegionConfig.java
deleted file mode 100644
index 04c1b18..0000000
--- a/geode-management/src/main/java/org/apache/geode/cache/configuration/BasicRegionConfig.java
+++ /dev/null
@@ -1,280 +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.cache.configuration;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-import org.apache.geode.annotations.Experimental;
-import org.apache.geode.management.api.RestfulEndpoint;
-
-
-/**
- *
- * A "region" element describes a region (and its entries) in Geode distributed cache.
- * It may be used to create a new region or may be used to add new entries to an existing
- * region. Note that the "name" attribute specifies the simple name of the region; it
- * cannot contain a "/". If "refid" is set then it defines the default region attributes
- * to use for this region. A nested "region-attributes" element can override these defaults.
- * If the nested "region-attributes" element has its own "refid" then it will cause the
- * "refid" on the region to be ignored. "refid" can be set to the name of a RegionShortcut
- * or a ClientRegionShortcut (see the javadocs of those enum classes for their names).
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(propOrder = {"regionAttributes"})
-@Experimental
-public class BasicRegionConfig extends CacheElement implements RestfulEndpoint {
-
- public static final String REGION_CONFIG_ENDPOINT = "/regions";
-
- @XmlElement(name = "region-attributes", namespace = "http://geode.apache.org/schema/cache")
- protected RegionAttributesType regionAttributes;
-
- @XmlAttribute(name = "name", required = true)
- protected String name;
-
- @XmlAttribute(name = "refid")
- protected String type;
-
- public BasicRegionConfig() {}
-
- public BasicRegionConfig(String name, String refid) {
- this.name = name;
- this.type = refid;
- }
-
- @Override
- public String getEndpoint() {
- return REGION_CONFIG_ENDPOINT;
- }
-
- public RegionAttributesType getRegionAttributes() {
- return regionAttributes;
- }
-
- public void setRegionAttributes(RegionAttributesType regionAttributes) {
- this.regionAttributes = regionAttributes;
- }
-
- /**
- * Gets the value of the name property.
- *
- * possible object is {@link String }
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the value of the name property.
- *
- * allowed object is {@link String }
- */
- public void setName(String value) throws IllegalArgumentException {
- if (value == null) {
- return;
- }
-
- boolean regionPrefixedWithSlash = value.startsWith("/");
- String[] regionSplit = value.split("/");
-
- boolean hasSubRegions =
- regionPrefixedWithSlash ? regionSplit.length > 2 : regionSplit.length > 1;
- if (hasSubRegions) {
- throw new IllegalArgumentException("Sub-regions are unsupported");
- }
-
- this.name = regionPrefixedWithSlash ? regionSplit[1] : value;
- }
-
- /**
- * Gets the value of the type property.
- *
- * possible object is {@link String }
- */
- public String getType() {
- return type;
- }
-
- /**
- * Sets the value of the type property.
- *
- * allowed object is {@link String }
- */
- public void setType(RegionType regionType) {
- if (regionType != null) {
- setType(regionType.name());
- }
- }
-
- public void setType(String regionType) {
- if (regionType != null) {
- this.type = regionType.toUpperCase();
- setShortcutAttributes();
- }
- }
-
- private void setShortcutAttributes() {
- if (regionAttributes == null) {
- regionAttributes = new RegionAttributesType();
- }
-
- switch (type) {
- case "PARTITION": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
- break;
- }
- case "REPLICATE": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.REPLICATE);
- regionAttributes.setScope(RegionAttributesScope.DISTRIBUTED_ACK);
- break;
- }
- case "PARTITION_REDUNDANT": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
- regionAttributes.setRedundantCopy("1");
- break;
- }
- case "PARTITION_PERSISTENT": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_PARTITION);
- break;
- }
- case "PARTITION_REDUNDANT_PERSISTENT": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_PARTITION);
- regionAttributes.setRedundantCopy("1");
- break;
- }
- case "PARTITION_OVERFLOW": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
- regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
- break;
- }
- case "PARTITION_REDUNDANT_OVERFLOW": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
- regionAttributes.setRedundantCopy("1");
- regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
- break;
- }
- case "PARTITION_PERSISTENT_OVERFLOW": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_PARTITION);
- regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
- break;
- }
- case "PARTITION_REDUNDANT_PERSISTENT_OVERFLOW": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_PARTITION);
- regionAttributes.setRedundantCopy("1");
- regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
- break;
- }
- case "PARTITION_HEAP_LRU": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
- regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.LOCAL_DESTROY);
- break;
-
- }
- case "PARTITION_REDUNDANT_HEAP_LRU": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
- regionAttributes.setRedundantCopy("1");
- regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.LOCAL_DESTROY);
- break;
- }
-
- case "REPLICATE_PERSISTENT": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_REPLICATE);
- regionAttributes.setScope(RegionAttributesScope.DISTRIBUTED_ACK);
- break;
- }
- case "REPLICATE_OVERFLOW": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.REPLICATE);
- regionAttributes.setScope(RegionAttributesScope.DISTRIBUTED_ACK);
- regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
- break;
-
- }
- case "REPLICATE_PERSISTENT_OVERFLOW": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_REPLICATE);
- regionAttributes.setScope(RegionAttributesScope.DISTRIBUTED_ACK);
- regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
- break;
- }
- case "REPLICATE_HEAP_LRU": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PRELOADED);
- regionAttributes.setScope(RegionAttributesScope.DISTRIBUTED_ACK);
- regionAttributes.setInterestPolicy("all");
- regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.LOCAL_DESTROY);
- break;
- }
- case "LOCAL": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.NORMAL);
- regionAttributes.setScope(RegionAttributesScope.LOCAL);
- break;
- }
- case "LOCAL_PERSISTENT": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_REPLICATE);
- regionAttributes.setScope(RegionAttributesScope.LOCAL);
- break;
- }
- case "LOCAL_HEAP_LRU": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.NORMAL);
- regionAttributes.setScope(RegionAttributesScope.LOCAL);
- regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.LOCAL_DESTROY);
- break;
- }
- case "LOCAL_OVERFLOW": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.NORMAL);
- regionAttributes.setScope(RegionAttributesScope.LOCAL);
- regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
- break;
- }
- case "LOCAL_PERSISTENT_OVERFLOW": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_REPLICATE);
- regionAttributes.setScope(RegionAttributesScope.LOCAL);
- regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
- break;
- }
- case "PARTITION_PROXY": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
- regionAttributes.setLocalMaxMemory("0");
- break;
- }
- case "PARTITION_PROXY_REDUNDANT": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
- regionAttributes.setLocalMaxMemory("0");
- regionAttributes.setRedundantCopy("1");
- break;
- }
- case "REPLICATE_PROXY": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.EMPTY);
- regionAttributes.setScope(RegionAttributesScope.DISTRIBUTED_ACK);
- break;
- }
- default:
- throw new IllegalArgumentException("invalid type " + type);
- }
- }
-
- @Override
- @JsonIgnore
- public String getId() {
- return getName();
- }
-}
diff --git a/geode-management/src/main/java/org/apache/geode/cache/configuration/CacheConfig.java b/geode-management/src/main/java/org/apache/geode/cache/configuration/CacheConfig.java
index 4fb154b..dcacf5f 100644
--- a/geode-management/src/main/java/org/apache/geode/cache/configuration/CacheConfig.java
+++ b/geode-management/src/main/java/org/apache/geode/cache/configuration/CacheConfig.java
@@ -719,10 +719,6 @@ public class CacheConfig {
return this.regions;
}
- public void addRegion(BasicRegionConfig regionConfig) {
- getRegions().add(new RegionConfig(regionConfig));
- }
-
/**
* Gets the value of the functionService property.
*
diff --git a/geode-management/src/main/java/org/apache/geode/cache/configuration/RegionConfig.java b/geode-management/src/main/java/org/apache/geode/cache/configuration/RegionConfig.java
index 361710b..b3d43e4 100644
--- a/geode-management/src/main/java/org/apache/geode/cache/configuration/RegionConfig.java
+++ b/geode-management/src/main/java/org/apache/geode/cache/configuration/RegionConfig.java
@@ -29,41 +29,166 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
import org.apache.geode.annotations.Experimental;
+import org.apache.geode.management.api.RestfulEndpoint;
/**
*
- * this holds the attributes that belongs to region element in cache.xml, but can not be
- * configured through manage v2 API (yet)
+ * A "region" element describes a region (and its entries) in Geode distributed cache.
+ * It may be used to create a new region or may be used to add new entries to an existing
+ * region. Note that the "name" attribute specifies the simple name of the region; it
+ * cannot contain a "/". If "refid" is set then it defines the default region attributes
+ * to use for this region. A nested "region-attributes" element can override these defaults.
+ * If the nested "region-attributes" element has its own "refid" then it will cause the
+ * "refid" on the region to be ignored. "refid" can be set to the name of a RegionShortcut
+ * or a ClientRegionShortcut (see the javadocs of those enum classes for their names).
+ *
+ *
+ * <p>
+ * Java class for region-type complex type.
+ *
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="region-type">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="region-attributes" type="{http://geode.apache.org/schema/cache}region-attributes-type" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="index" maxOccurs="unbounded" minOccurs="0">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <choice minOccurs="0">
+ * <element name="functional">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="expression" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="from-clause" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="imports" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <element name="primary-key">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="field" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </choice>
+ * <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="expression" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="from-clause" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="imports" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="key-index" type="{http://www.w3.org/2001/XMLSchema}boolean" />
+ * <attribute name="type" default="range">
+ * <simpleType>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ * <enumeration value="range"/>
+ * <enumeration value="hash"/>
+ * </restriction>
+ * </simpleType>
+ * </attribute>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <element name="entry" maxOccurs="unbounded" minOccurs="0">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="key">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <choice>
+ * <element name="string" type="{http://geode.apache.org/schema/cache}string-type"/>
+ * <element name="declarable" type="{http://geode.apache.org/schema/cache}declarable-type"/>
+ * </choice>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <element name="value">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <choice>
+ * <element name="string" type="{http://geode.apache.org/schema/cache}string-type"/>
+ * <element name="declarable" type="{http://geode.apache.org/schema/cache}declarable-type"/>
+ * </choice>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="region" type="{http://geode.apache.org/schema/cache}region-type" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="refid" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "region-type", namespace = "http://geode.apache.org/schema/cache",
- propOrder = {"indexes", "regionElements", "entries", "regions"})
+ propOrder = {"regionAttributes", "indexes", "entries", "regionElements", "regions"})
@Experimental
-public class RegionConfig extends BasicRegionConfig {
+public class RegionConfig extends CacheElement implements RestfulEndpoint {
+
+ public static final String REGION_CONFIG_ENDPOINT = "/regions";
+
+ @XmlElement(name = "region-attributes", namespace = "http://geode.apache.org/schema/cache")
+ protected RegionAttributesType regionAttributes;
@XmlElement(name = "index", namespace = "http://geode.apache.org/schema/cache")
protected List<Index> indexes;
- @XmlAnyElement(lax = true)
- protected List<CacheElement> regionElements;
-
@XmlElement(name = "entry", namespace = "http://geode.apache.org/schema/cache")
protected List<Entry> entries;
-
+ @XmlAnyElement(lax = true)
+ protected List<CacheElement> regionElements;
@XmlElement(name = "region", namespace = "http://geode.apache.org/schema/cache")
protected List<RegionConfig> regions;
+ @XmlAttribute(name = "name", required = true)
+ protected String name;
+ @XmlAttribute(name = "refid")
+ protected String type;
public RegionConfig() {}
- public RegionConfig(String name, String type) {
- super(name, type);
+ public RegionConfig(String name, String refid) {
+ this.name = name;
+ this.type = refid;
+ }
+
+ @Override
+ public String getEndpoint() {
+ return REGION_CONFIG_ENDPOINT;
}
- // a convenience constructor to turn a BasicRegionConfig into RegionConfig
- public RegionConfig(BasicRegionConfig regionConfig) {
- this.name = regionConfig.getName();
- this.type = regionConfig.getType();
- this.regionAttributes = regionConfig.getRegionAttributes();
+ public RegionAttributesType getRegionAttributes() {
+ return regionAttributes;
+ }
+
+ public void setRegionAttributes(RegionAttributesType regionAttributes) {
+ this.regionAttributes = regionAttributes;
}
/**
@@ -81,6 +206,13 @@ public class RegionConfig extends BasicRegionConfig {
* <pre>
* getIndexes().add(newItem);
* </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link RegionConfig.Index }
+ *
+ *
*/
public List<Index> getIndexes() {
if (indexes == null) {
@@ -90,24 +222,21 @@ public class RegionConfig extends BasicRegionConfig {
}
/**
- * Gets the value of the any property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the any property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getCustomRegionElements().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
+ * Gets the value of the entry property.
+ * Currently, users can not create regions with initial entries using management v2 api.
+ * this entry list will be ignored when creating the region
+ */
+ public List<Entry> getEntries() {
+ if (entries == null) {
+ entries = new ArrayList<>();
+ }
+ return this.entries;
+ }
+
+ /**
+ * Gets the list of custom region elements
+ * Currently, users can not create regions with custom region elements using management v2 api.
+ * this cache element list will be ignored when creating the region
*/
public List<CacheElement> getCustomRegionElements() {
if (regionElements == null) {
@@ -116,67 +245,229 @@ public class RegionConfig extends BasicRegionConfig {
return this.regionElements;
}
+ /**
+ * Gets the list of the sub regions
+ * Currently, users can not create regions with sub regions using management v2 api.
+ * This sub region list will be ignored when creating the region.
+ */
+ public List<RegionConfig> getRegions() {
+ if (regions == null) {
+ regions = new ArrayList<>();
+ }
+ return this.regions;
+ }
/**
- * Gets the value of the entry property.
+ * Gets the value of the name property.
*
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the entry property.
+ * possible object is
+ * {@link String }
*
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getEntries().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link RegionConfig.Entry }
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
*
+ * allowed object is
+ * {@link String }
*
*/
- public List<Entry> getEntries() {
- if (entries == null) {
- entries = new ArrayList<Entry>();
+ public void setName(String value) throws IllegalArgumentException {
+ if (value == null) {
+ return;
}
- return this.entries;
+
+ boolean regionPrefixedWithSlash = value.startsWith("/");
+ String[] regionSplit = value.split("/");
+
+ boolean hasSubRegions =
+ regionPrefixedWithSlash ? regionSplit.length > 2 : regionSplit.length > 1;
+ if (hasSubRegions) {
+ throw new IllegalArgumentException("Sub-regions are unsupported");
+ }
+
+ this.name = regionPrefixedWithSlash ? regionSplit[1] : value;
}
/**
- * Gets the value of the region property.
+ * Gets the value of the type property.
*
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the region property.
- *
- * <p>
- * For example, to add a new item, do as follows:
+ * possible object is
+ * {@link String }
*
- * <pre>
- * getRegions().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link RegionConfig }
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Sets the value of the type property.
*
+ * allowed object is
+ * {@link String }
*
*/
- public List<RegionConfig> getRegions() {
- if (regions == null) {
- regions = new ArrayList<RegionConfig>();
+ public void setType(RegionType regionType) {
+ if (regionType != null) {
+ setType(regionType.name());
}
- return this.regions;
}
+ public void setType(String regionType) {
+ if (regionType != null) {
+ this.type = regionType.toUpperCase();
+ setShortcutAttributes();
+ }
+ }
+
+ private void setShortcutAttributes() {
+ if (regionAttributes == null) {
+ regionAttributes = new RegionAttributesType();
+ }
+
+ switch (type) {
+ case "PARTITION": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
+ break;
+ }
+ case "REPLICATE": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.REPLICATE);
+ regionAttributes.setScope(RegionAttributesScope.DISTRIBUTED_ACK);
+ break;
+ }
+ case "PARTITION_REDUNDANT": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
+ regionAttributes.setRedundantCopy("1");
+ break;
+ }
+ case "PARTITION_PERSISTENT": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_PARTITION);
+ break;
+ }
+ case "PARTITION_REDUNDANT_PERSISTENT": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_PARTITION);
+ regionAttributes.setRedundantCopy("1");
+ break;
+ }
+ case "PARTITION_OVERFLOW": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
+ regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
+ break;
+ }
+ case "PARTITION_REDUNDANT_OVERFLOW": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
+ regionAttributes.setRedundantCopy("1");
+ regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
+ break;
+ }
+ case "PARTITION_PERSISTENT_OVERFLOW": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_PARTITION);
+ regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
+ break;
+ }
+ case "PARTITION_REDUNDANT_PERSISTENT_OVERFLOW": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_PARTITION);
+ regionAttributes.setRedundantCopy("1");
+ regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
+ break;
+ }
+ case "PARTITION_HEAP_LRU": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
+ regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.LOCAL_DESTROY);
+ break;
+
+ }
+ case "PARTITION_REDUNDANT_HEAP_LRU": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
+ regionAttributes.setRedundantCopy("1");
+ regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.LOCAL_DESTROY);
+ break;
+ }
+
+ case "REPLICATE_PERSISTENT": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_REPLICATE);
+ regionAttributes.setScope(RegionAttributesScope.DISTRIBUTED_ACK);
+ break;
+ }
+ case "REPLICATE_OVERFLOW": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.REPLICATE);
+ regionAttributes.setScope(RegionAttributesScope.DISTRIBUTED_ACK);
+ regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
+ break;
+
+ }
+ case "REPLICATE_PERSISTENT_OVERFLOW": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_REPLICATE);
+ regionAttributes.setScope(RegionAttributesScope.DISTRIBUTED_ACK);
+ regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
+ break;
+ }
+ case "REPLICATE_HEAP_LRU": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PRELOADED);
+ regionAttributes.setScope(RegionAttributesScope.DISTRIBUTED_ACK);
+ regionAttributes.setInterestPolicy("all");
+ regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.LOCAL_DESTROY);
+ break;
+ }
+ case "LOCAL": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.NORMAL);
+ regionAttributes.setScope(RegionAttributesScope.LOCAL);
+ break;
+ }
+ case "LOCAL_PERSISTENT": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_REPLICATE);
+ regionAttributes.setScope(RegionAttributesScope.LOCAL);
+ break;
+ }
+ case "LOCAL_HEAP_LRU": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.NORMAL);
+ regionAttributes.setScope(RegionAttributesScope.LOCAL);
+ regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.LOCAL_DESTROY);
+ break;
+ }
+ case "LOCAL_OVERFLOW": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.NORMAL);
+ regionAttributes.setScope(RegionAttributesScope.LOCAL);
+ regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
+ break;
+ }
+ case "LOCAL_PERSISTENT_OVERFLOW": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_REPLICATE);
+ regionAttributes.setScope(RegionAttributesScope.LOCAL);
+ regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
+ break;
+ }
+ case "PARTITION_PROXY": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
+ regionAttributes.setLocalMaxMemory("0");
+ break;
+ }
+ case "PARTITION_PROXY_REDUNDANT": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
+ regionAttributes.setLocalMaxMemory("0");
+ regionAttributes.setRedundantCopy("1");
+ break;
+ }
+ case "REPLICATE_PROXY": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.EMPTY);
+ regionAttributes.setScope(RegionAttributesScope.DISTRIBUTED_ACK);
+ break;
+ }
+ default:
+ throw new IllegalArgumentException("invalid type " + type);
+ }
+ }
+
+ @Override
+ @JsonIgnore
+ public String getId() {
+ return getName();
+ }
+
+
/**
* <p>
* Java class for anonymous complex type.
@@ -508,4 +799,5 @@ public class RegionConfig extends BasicRegionConfig {
return getName();
}
}
+
}
diff --git a/geode-management/src/test/java/org/apache/geode/cache/configuration/CacheElementJsonMappingTest.java b/geode-management/src/test/java/org/apache/geode/cache/configuration/CacheElementJsonMappingTest.java
index 1aaf484..10f6c83 100644
--- a/geode-management/src/test/java/org/apache/geode/cache/configuration/CacheElementJsonMappingTest.java
+++ b/geode-management/src/test/java/org/apache/geode/cache/configuration/CacheElementJsonMappingTest.java
@@ -32,7 +32,7 @@ public class CacheElementJsonMappingTest {
private static ObjectMapper mapper = GeodeJsonMapper.getMapper();
private static MemberConfig member;
- private static BasicRegionConfig region;
+ private static RegionConfig region;
@BeforeClass
public static void beforeClass() throws Exception {
@@ -40,7 +40,7 @@ public class CacheElementJsonMappingTest {
member.setId("server");
member.setPid("123");
- region = new BasicRegionConfig();
+ region = new RegionConfig();
region.setName("test");
}
@@ -50,7 +50,7 @@ public class CacheElementJsonMappingTest {
System.out.println(json);
assertThat(json).contains("class").contains("\"name\":\"test\"");
- BasicRegionConfig config = mapper.readValue(json, BasicRegionConfig.class);
+ RegionConfig config = mapper.readValue(json, RegionConfig.class);
assertThat(config.getName()).isEqualTo(region.getName());
}
@@ -89,14 +89,14 @@ public class CacheElementJsonMappingTest {
ClusterManagementResult result1 = mapper.readValue(json, ClusterManagementResult.class);
assertThat(result1.getResult()).hasSize(2);
- assertThat(result1.getResult().get(0)).isInstanceOf(BasicRegionConfig.class);
+ assertThat(result1.getResult().get(0)).isInstanceOf(RegionConfig.class);
assertThat(result1.getResult().get(1)).isInstanceOf(MemberConfig.class);
}
@Test
public void deserializeWithoutTypeInfo() throws Exception {
String json = "{'name':'test'}";
- BasicRegionConfig config = mapper.readValue(json, BasicRegionConfig.class);
+ RegionConfig config = mapper.readValue(json, RegionConfig.class);
assertThat(config.getName()).isEqualTo("test");
}
diff --git a/geode-web-management/src/distributedTest/java/org/apache/geode/management/client/ClientClusterManagementServiceDUnitTest.java b/geode-web-management/src/distributedTest/java/org/apache/geode/management/client/ClientClusterManagementServiceDUnitTest.java
index 9891df4..c98b445 100644
--- a/geode-web-management/src/distributedTest/java/org/apache/geode/management/client/ClientClusterManagementServiceDUnitTest.java
+++ b/geode-web-management/src/distributedTest/java/org/apache/geode/management/client/ClientClusterManagementServiceDUnitTest.java
@@ -32,7 +32,6 @@ import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.context.WebApplicationContext;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
import org.apache.geode.cache.configuration.CacheElement;
import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.cache.configuration.RegionType;
@@ -70,7 +69,7 @@ public class ClientClusterManagementServiceDUnitTest {
@Test
@WithMockUser
public void createAndListRegion() {
- BasicRegionConfig region = new BasicRegionConfig();
+ RegionConfig region = new RegionConfig();
region.setName("customer");
region.setType(RegionType.REPLICATE);
@@ -81,7 +80,7 @@ public class ClientClusterManagementServiceDUnitTest {
ClusterManagementResult.StatusCode.ENTITY_EXISTS);
// list region when regions are not created in a group
- BasicRegionConfig noFilter = new BasicRegionConfig();
+ RegionConfig noFilter = new RegionConfig();
ClusterManagementResult list = client.list(noFilter);
List<CacheElement> regions = list.getResult();
assertThat(regions.size()).isEqualTo(1);
diff --git a/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/RegionManagementIntegrationTest.java b/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/RegionManagementIntegrationTest.java
index f6c341c..35c81d3 100644
--- a/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/RegionManagementIntegrationTest.java
+++ b/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/RegionManagementIntegrationTest.java
@@ -29,7 +29,6 @@ import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.context.WebApplicationContext;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.management.api.ClusterManagementResult;
@@ -59,7 +58,7 @@ public class RegionManagementIntegrationTest {
@Test
@WithMockUser
public void sanityCheck() throws Exception {
- BasicRegionConfig regionConfig = new BasicRegionConfig();
+ RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("customers");
regionConfig.setType(RegionType.REPLICATE);
@@ -72,7 +71,7 @@ public class RegionManagementIntegrationTest {
@Test
@WithMockUser
public void invalidType() throws Exception {
- BasicRegionConfig regionConfig = new BasicRegionConfig();
+ RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("customers");
regionConfig.setType("LOCAL");
@@ -84,7 +83,7 @@ public class RegionManagementIntegrationTest {
@Test
public void invalidGroup() throws Exception {
- BasicRegionConfig regionConfig = new BasicRegionConfig();
+ RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("customers");
regionConfig.setGroup("cluster");
@@ -95,17 +94,6 @@ public class RegionManagementIntegrationTest {
}
@Test
- public void invalidConfigObject() throws Exception {
- RegionConfig config = new RegionConfig();
- config.setName("customers");
- assertManagementResult(client.create(config))
- .failed()
- .hasStatusCode(ClusterManagementResult.StatusCode.ILLEGAL_ARGUMENT)
- .containsStatusMessage("Use BasicRegionConfig to configure your region");
- }
-
-
- @Test
@WithMockUser
public void ping() throws Exception {
context.perform(get("/v2/ping"))
diff --git a/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/RegionManagementSecurityIntegrationTest.java b/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/RegionManagementSecurityIntegrationTest.java
index caf9642..8e90922 100644
--- a/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/RegionManagementSecurityIntegrationTest.java
+++ b/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/RegionManagementSecurityIntegrationTest.java
@@ -32,7 +32,7 @@ import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.context.WebApplicationContext;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.cache.configuration.RegionType;
@RunWith(SpringRunner.class)
@@ -46,12 +46,12 @@ public class RegionManagementSecurityIntegrationTest {
private LocatorWebContext context;
- private BasicRegionConfig regionConfig;
+ private RegionConfig regionConfig;
private String json;
@Before
public void before() throws JsonProcessingException {
- regionConfig = new BasicRegionConfig();
+ regionConfig = new RegionConfig();
regionConfig.setName("customers");
regionConfig.setType(RegionType.REPLICATE);
ObjectMapper mapper = new ObjectMapper();
diff --git a/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/controllers/RegionManagementController.java b/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/controllers/RegionManagementController.java
index d1881f1..f8b4aca 100644
--- a/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/controllers/RegionManagementController.java
+++ b/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/controllers/RegionManagementController.java
@@ -15,7 +15,7 @@
package org.apache.geode.management.internal.rest.controllers;
-import static org.apache.geode.cache.configuration.BasicRegionConfig.REGION_CONFIG_ENDPOINT;
+import static org.apache.geode.cache.configuration.RegionConfig.REGION_CONFIG_ENDPOINT;
import static org.apache.geode.management.internal.rest.controllers.AbstractManagementController.MANAGEMENT_API_VERSION;
import io.swagger.annotations.ApiOperation;
@@ -31,7 +31,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
-import org.apache.geode.cache.configuration.BasicRegionConfig;
+import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.management.api.ClusterManagementResult;
@Controller("regionManagement")
@@ -47,7 +47,7 @@ public class RegionManagementController extends AbstractManagementController {
@PreAuthorize("@securityService.authorize('DATA', 'MANAGE')")
@RequestMapping(method = RequestMethod.POST, value = REGION_CONFIG_ENDPOINT)
public ResponseEntity<ClusterManagementResult> createRegion(
- @RequestBody BasicRegionConfig regionConfig) {
+ @RequestBody RegionConfig regionConfig) {
ClusterManagementResult result =
clusterManagementService.create(regionConfig);
return new ResponseEntity<>(result,
@@ -59,7 +59,7 @@ public class RegionManagementController extends AbstractManagementController {
public ResponseEntity<ClusterManagementResult> listRegion(
@RequestParam(required = false) String id,
@RequestParam(required = false) String group) {
- BasicRegionConfig filter = new BasicRegionConfig();
+ RegionConfig filter = new RegionConfig();
if (StringUtils.isNotBlank(id)) {
filter.setName(id);
}