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/03/27 00:15:45 UTC
[geode] branch develop updated: GEODE-6384: Use consistent API to retrieve instances of ClusterManage… (#3359)
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 27e4db1 GEODE-6384: Use consistent API to retrieve instances of ClusterManage… (#3359)
27e4db1 is described below
commit 27e4db1444eb8a2240d80240a0e4de9e4bb2189e
Author: jinmeiliao <ji...@pivotal.io>
AuthorDate: Tue Mar 26 17:15:29 2019 -0700
GEODE-6384: Use consistent API to retrieve instances of ClusterManage… (#3359)
---
.../ClientClusterManagementServiceDunitTest.java | 3 +-
.../rest/GeodeClientClusterManagementSSLTest.java | 68 +++++++++++++++++
.../GeodeClientClusterManagementSecurityTest.java | 62 ++++++++++++++++
.../api/GeodeClusterManagementServiceFactory.java | 86 +++++++++++++++-------
.../api/LocatorClusterManagementService.java | 5 ++
.../internal/cli/domain/MemberInformation.java | 9 +++
.../functions/GetMemberInformationFunction.java | 3 +
...ClusterManagementServiceInfoRequestHandler.java | 11 +++
.../messages/ClusterManagementServiceInfo.java | 20 ++++-
.../org/apache/geode/security/AuthInitialize.java | 3 +-
.../sanctioned-geode-core-serializables.txt | 4 +-
.../management/api/ClusterManagementService.java | 8 ++
.../client/ClusterManagementServiceProvider.java | 19 +++--
13 files changed, 264 insertions(+), 37 deletions(-)
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 c3143bb..3af97a4 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
@@ -11,7 +11,6 @@ import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.management.api.ClusterManagementResult;
import org.apache.geode.management.api.ClusterManagementService;
import org.apache.geode.management.client.ClusterManagementServiceProvider;
-import org.apache.geode.management.internal.ClientClusterManagementService;
import org.apache.geode.test.dunit.rules.ClientVM;
import org.apache.geode.test.dunit.rules.ClusterStartupRule;
import org.apache.geode.test.dunit.rules.MemberVM;
@@ -80,7 +79,7 @@ public class ClientClusterManagementServiceDunitTest {
client.invoke(() -> {
ClusterManagementService service = ClusterManagementServiceProvider.getService();
- assertThat(((ClientClusterManagementService) service).isConnected()).isTrue();
+ assertThat(service.isConnected()).isTrue();
});
client.stop();
}
diff --git a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/GeodeClientClusterManagementSSLTest.java b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/GeodeClientClusterManagementSSLTest.java
new file mode 100644
index 0000000..55309c0
--- /dev/null
+++ b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/GeodeClientClusterManagementSSLTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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.internal.rest;
+
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_PASSWORD;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.File;
+import java.util.Properties;
+
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+import org.apache.geode.internal.security.SecurableCommunicationChannel;
+import org.apache.geode.management.client.ClusterManagementServiceProvider;
+import org.apache.geode.test.dunit.rules.ClusterStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.junit.rules.ClientCacheRule;
+
+public class GeodeClientClusterManagementSSLTest {
+ @ClassRule
+ public static ClusterStartupRule cluster = new ClusterStartupRule(1);
+
+ @ClassRule
+ public static ClientCacheRule client = new ClientCacheRule();
+
+ private static MemberVM locator;
+
+ @BeforeClass
+ public static void beforeClass() throws Exception {
+ File keyFile = new File(ClientClusterManagementSSLTest.class.getClassLoader()
+ .getResource("ssl/trusted.keystore").getFile());
+ Properties sslProps = new Properties();
+ sslProps.setProperty(SSL_KEYSTORE, keyFile.getCanonicalPath());
+ sslProps.setProperty(SSL_TRUSTSTORE, keyFile.getCanonicalPath());
+ sslProps.setProperty(SSL_KEYSTORE_PASSWORD, "password");
+ sslProps.setProperty(SSL_TRUSTSTORE_PASSWORD, "password");
+ sslProps.setProperty(SSL_ENABLED_COMPONENTS, SecurableCommunicationChannel.ALL.getConstant());
+
+ locator = cluster.startLocatorVM(0, l -> l.withHttpService().withProperties(sslProps));
+ client.withLocatorConnection(locator.getPort())
+ .withProperties(sslProps)
+ .createCache();
+ }
+
+ @Test
+ public void getServiceUseClientSSLConfig() throws Exception {
+ assertThat(ClusterManagementServiceProvider.getService().isConnected()).isTrue();
+ }
+}
diff --git a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/GeodeClientClusterManagementSecurityTest.java b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/GeodeClientClusterManagementSecurityTest.java
new file mode 100644
index 0000000..39ea14f
--- /dev/null
+++ b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/GeodeClientClusterManagementSecurityTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.internal.rest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+import org.apache.geode.examples.SimpleSecurityManager;
+import org.apache.geode.management.client.ClusterManagementServiceProvider;
+import org.apache.geode.test.dunit.rules.ClusterStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.junit.rules.ClientCacheRule;
+
+public class GeodeClientClusterManagementSecurityTest {
+ @ClassRule
+ public static ClusterStartupRule cluster = new ClusterStartupRule(1);
+
+ @ClassRule
+ public static ClientCacheRule client = new ClientCacheRule();
+
+ private static MemberVM locator;
+
+ @BeforeClass
+ public static void beforeClass() throws Exception {
+ locator = cluster.startLocatorVM(0, l -> l.withHttpService().withSecurityManager(
+ SimpleSecurityManager.class));
+ client.withLocatorConnection(locator.getPort()).withCredential("cluster", "cluster")
+ .createCache();
+ }
+
+ @Test
+ public void withClientConnectionCredential() throws Exception {
+ assertThat(ClusterManagementServiceProvider.getService().isConnected()).isTrue();
+ }
+
+ @Test
+ public void withDifferentCredentials() throws Exception {
+ assertThat(ClusterManagementServiceProvider.getService("test", "test").isConnected()).isTrue();
+ }
+
+ @Test
+ public void withInvalidCredential() throws Exception {
+ assertThat(ClusterManagementServiceProvider.getService("test", "wrong").isConnected())
+ .isFalse();
+ }
+}
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/api/GeodeClusterManagementServiceFactory.java b/geode-core/src/main/java/org/apache/geode/management/internal/api/GeodeClusterManagementServiceFactory.java
index b504ff8..4e72944 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/api/GeodeClusterManagementServiceFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/api/GeodeClusterManagementServiceFactory.java
@@ -17,6 +17,7 @@ package org.apache.geode.management.internal.api;
import java.net.InetSocketAddress;
import java.util.List;
+import java.util.Properties;
import java.util.Set;
import javax.net.ssl.HostnameVerifier;
@@ -34,6 +35,7 @@ import org.apache.geode.cache.client.ClientCacheFactory;
import org.apache.geode.cache.execute.FunctionException;
import org.apache.geode.cache.execute.FunctionService;
import org.apache.geode.cache.execute.ResultCollector;
+import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.distributed.internal.tcpserver.TcpClient;
@@ -51,6 +53,7 @@ import org.apache.geode.management.internal.cli.domain.MemberInformation;
import org.apache.geode.management.internal.cli.functions.GetMemberInformationFunction;
import org.apache.geode.management.internal.configuration.messages.ClusterManagementServiceInfo;
import org.apache.geode.management.internal.configuration.messages.ClusterManagementServiceInfoRequest;
+import org.apache.geode.security.AuthInitialize;
/**
* An implementation of {@link ClusterManagementServiceFactory} which can be used in any
@@ -103,24 +106,11 @@ public class GeodeClusterManagementServiceFactory
cache.getDistributionManager().getAllHostedLocatorsWithSharedConfiguration()
.keySet();
- MemberInformation memberInformation = getLocatorInformation(locatorsWithClusterConfig);
+ ClusterManagementServiceInfo cmsInfo =
+ getClusterManagementServiceInfo(locatorsWithClusterConfig);
- SSLContext sslContext = null;
- HostnameVerifier hostnameVerifier = null;
- if (memberInformation.isWebSSL()) {
- SSLConfig sslConfig = SSLConfigurationFactory.getSSLConfigForComponent(
- cache.getSystem().getConfig(), SecurableCommunicationChannel.WEB);
- if (!sslConfig.useDefaultSSLContext() && sslConfig.getTruststore() == null) {
- throw new IllegalStateException(
- "The server needs to have ssl-truststore or ssl-use-default-context specified in order to use cluster management service.");
- }
-
- sslContext = SSLUtil.createAndConfigureSSLContext(sslConfig, false);
- hostnameVerifier = new NoopHostnameVerifier();
- }
-
- return create(getHostName(memberInformation), memberInformation.getHttpServicePort(),
- sslContext, hostnameVerifier, username, password);
+ return createClusterManagementService(username, password, cache.getSystem().getConfig(),
+ cmsInfo);
}
private ClusterManagementService getClusterManagementServiceOnClient(String username,
@@ -132,7 +122,8 @@ public class GeodeClusterManagementServiceFactory
throw new IllegalStateException(
"the client needs to have a client pool connected with a locator.");
}
- TcpClient client = new TcpClient();
+ DistributionConfig config = ((GemFireCacheImpl) clientCache).getSystem().getConfig();
+ TcpClient client = new TcpClient(config);
ClusterManagementServiceInfo cmsInfo = null;
for (InetSocketAddress locator : locators) {
try {
@@ -145,7 +136,7 @@ public class GeodeClusterManagementServiceFactory
break;
}
} catch (Exception e) {
- logger.info(
+ logger.warn(
"unable to discover the ClusterManagementService on locator " + locator.toString());
}
}
@@ -156,13 +147,50 @@ public class GeodeClusterManagementServiceFactory
throw new IllegalStateException(
"Unable to discover a locator that has ClusterManagementService running.");
}
+ return createClusterManagementService(username, password, config, cmsInfo);
+
+ }
+
+ private ClusterManagementService createClusterManagementService(String username, String password,
+ DistributionConfig config,
+ ClusterManagementServiceInfo cmsInfo) {
+ // if user didn't pass in a username and the locator requires credentials, use the credentials
+ // user used to create the client cache
+ if (cmsInfo.isSecured() && username == null) {
+ Properties securityProps = config.getSecurityProps();
+ username = securityProps.getProperty(AuthInitialize.SECURITY_USERNAME);
+ password = securityProps.getProperty(AuthInitialize.SECURITY_PASSWORD);
+ if (StringUtils.isBlank(username)) {
+ String message = String.format("You will need to either call getService with username and "
+ + "password or specify security-username and security-password in the properties when "
+ + "starting this geode server/client.");
+ throw new IllegalStateException(message);
+ }
+ }
+
+ SSLContext sslContext = null;
+ HostnameVerifier hostnameVerifier = null;
+ if (cmsInfo.isSSL()) {
+ SSLConfig sslConfig = SSLConfigurationFactory.getSSLConfigForComponent(
+ config, SecurableCommunicationChannel.WEB);
+ if (!sslConfig.useDefaultSSLContext() && sslConfig.getTruststore() == null) {
+ throw new IllegalStateException(
+ "This server/client needs to have ssl-truststore or ssl-use-default-context specified in order to use cluster management service.");
+ }
- return create(cmsInfo.getHostName(), cmsInfo.getHttpPort(), null, new NoopHostnameVerifier(),
+ sslContext = SSLUtil.createAndConfigureSSLContext(sslConfig, false);
+ hostnameVerifier = new NoopHostnameVerifier();
+ }
+
+ return create(cmsInfo.getHostName(), cmsInfo.getHttpPort(), sslContext, hostnameVerifier,
username, password);
}
- private MemberInformation getLocatorInformation(Set<InternalDistributedMember> locators) {
+ private ClusterManagementServiceInfo getClusterManagementServiceInfo(
+ Set<InternalDistributedMember> locators) {
+ ClusterManagementServiceInfo info = new ClusterManagementServiceInfo();
+ MemberInformation memberInfo = null;
for (InternalDistributedMember locator : locators) {
try {
ResultCollector resultCollector =
@@ -173,16 +201,22 @@ public class GeodeClusterManagementServiceFactory
if (memberInformations.isEmpty()) {
continue;
}
-
- // return the first available one. Later for HA, we can return the entire list
- return memberInformations.get(0);
+ memberInfo = memberInformations.get(0);
+ break;
} catch (FunctionException e) {
logger.warn("Unable to execute GetMemberInformationFunction on " + locator.getId());
- throw new IllegalStateException(e);
}
}
- throw new IllegalStateException("Unable to determine ClusterManagementService endpoint");
+ if (memberInfo == null) {
+ throw new IllegalStateException("Unable to determine ClusterManagementService endpoint");
+ }
+
+ info.setHostName(getHostName(memberInfo));
+ info.setHttpPort(memberInfo.getHttpServicePort());
+ info.setSSL(memberInfo.isWebSSL());
+ info.setSecured(memberInfo.isSecured());
+ return info;
}
private String getHostName(MemberInformation memberInformation) {
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 3b855cd..d9abc02 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
@@ -147,6 +147,11 @@ public class LocatorClusterManagementService implements ClusterManagementService
throw new NotImplementedException("Not implemented");
}
+ @Override
+ public boolean isConnected() {
+ return true;
+ }
+
@VisibleForTesting
Set<DistributedMember> findMembers(String[] groups, String[] members) {
return CliUtil.findMembers(groups, members, distributionManager);
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/MemberInformation.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/MemberInformation.java
index 42dc2bf..80c4afe 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/MemberInformation.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/MemberInformation.java
@@ -51,6 +51,15 @@ public class MemberInformation implements Serializable {
private Set<String> hostedRegions;
private String offHeapMemorySize;
private boolean webSSL;
+ private boolean isSecured;
+
+ public boolean isSecured() {
+ return isSecured;
+ }
+
+ public void setSecured(boolean secured) {
+ isSecured = secured;
+ }
public String getName() {
return name;
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberInformationFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberInformationFunction.java
index bf42b4d..f0c3562 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberInformationFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberInformationFunction.java
@@ -21,6 +21,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.execute.FunctionContext;
@@ -93,6 +95,7 @@ public class GetMemberInformationFunction implements InternalFunction {
SSLConfig sslConfig = SSLConfigurationFactory.getSSLConfigForComponent(config,
SecurableCommunicationChannel.WEB);
memberInfo.setWebSSL(sslConfig.isEnabled());
+ memberInfo.setSecured(StringUtils.isNotBlank(config.getSecurityManager()));
memberInfo.setGroups(config.getGroups());
memberInfo.setLogFilePath(config.getLogFile().getCanonicalPath());
memberInfo.setStatArchiveFilePath(config.getStatisticArchiveFile().getCanonicalPath());
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/handlers/ClusterManagementServiceInfoRequestHandler.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/handlers/ClusterManagementServiceInfoRequestHandler.java
index 01a817a..e869010 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/handlers/ClusterManagementServiceInfoRequestHandler.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/handlers/ClusterManagementServiceInfoRequestHandler.java
@@ -26,6 +26,9 @@ import org.apache.geode.distributed.internal.InternalConfigurationPersistenceSer
import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.distributed.internal.tcpserver.TcpHandler;
import org.apache.geode.distributed.internal.tcpserver.TcpServer;
+import org.apache.geode.internal.admin.SSLConfig;
+import org.apache.geode.internal.net.SSLConfigurationFactory;
+import org.apache.geode.internal.security.SecurableCommunicationChannel;
import org.apache.geode.management.internal.configuration.messages.ClusterManagementServiceInfo;
import org.apache.geode.management.internal.configuration.messages.ClusterManagementServiceInfoRequest;
@@ -58,6 +61,14 @@ public class ClusterManagementServiceInfoRequestHandler implements TcpHandler {
info.setHostName(hostName);
+ if (StringUtils.isNotBlank(config.getSecurityManager())) {
+ info.setSecured(true);
+ }
+
+ SSLConfig sslConfig =
+ SSLConfigurationFactory.getSSLConfigForComponent(config, SecurableCommunicationChannel.WEB);
+ info.setSSL(sslConfig.isEnabled());
+
return info;
}
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ClusterManagementServiceInfo.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ClusterManagementServiceInfo.java
index 0cf008b..ac02bc7 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ClusterManagementServiceInfo.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ClusterManagementServiceInfo.java
@@ -21,7 +21,25 @@ public class ClusterManagementServiceInfo implements Serializable {
private String hostName;
// -1 indicates the service is not running
private int httpPort = -1;
- // TODO: add isSSL and isSecured information later
+
+ private boolean isSecured;
+ private boolean isSSL;
+
+ public boolean isSecured() {
+ return isSecured;
+ }
+
+ public void setSecured(boolean secured) {
+ isSecured = secured;
+ }
+
+ public boolean isSSL() {
+ return isSSL;
+ }
+
+ public void setSSL(boolean SSL) {
+ isSSL = SSL;
+ }
public int getHttpPort() {
return httpPort;
diff --git a/geode-core/src/main/java/org/apache/geode/security/AuthInitialize.java b/geode-core/src/main/java/org/apache/geode/security/AuthInitialize.java
index eda95f7..6f4da2d 100644
--- a/geode-core/src/main/java/org/apache/geode/security/AuthInitialize.java
+++ b/geode-core/src/main/java/org/apache/geode/security/AuthInitialize.java
@@ -80,7 +80,8 @@ public interface AuthInitialize extends CacheCallback {
* @throws AuthenticationFailedException in case of failure to obtain the credentials
*
* @return the credentials to be used for the given <code>server</code>
- * It needs to contain "security-username" and "security-password"
+ * It needs to contain "security-username" and "security-password" if you use
+ * username/password combination as credentials
* When using Integrated security, all members, peer/client will use the same credentials.
* but we still need to use these params to support the old authenticator
*/
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 4aca9cd..2004c5d 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
@@ -524,7 +524,7 @@ org/apache/geode/management/internal/cli/domain/FixedPartitionAttributesInfo,tru
org/apache/geode/management/internal/cli/domain/IndexDetails,true,-2198907141534201288,fromClause:java/lang/String,indexName:java/lang/String,indexStatisticsDetails:org/apache/geode/management/internal/cli/domain/IndexDetails$IndexStatisticsDetails,indexType:org/apache/geode/cache/query/IndexType,indexedExpression:java/lang/String,isValid:boolean,memberId:java/lang/String,memberName:java/lang/String,projectionAttributes:java/lang/String,regionName:java/lang/String,regionPath:java/lang/String
org/apache/geode/management/internal/cli/domain/IndexDetails$IndexStatisticsDetails,false,numberOfKeys:java/lang/Long,numberOfUpdates:java/lang/Long,numberOfValues:java/lang/Long,totalUpdateTime:java/lang/Long,totalUses:java/lang/Long
org/apache/geode/management/internal/cli/domain/MemberConfigurationInfo,false,cacheAttributes:java/util/Map,cacheServerAttributes:java/util/List,gfePropsRuntime:java/util/Map,gfePropsSetFromFile:java/util/Map,gfePropsSetUsingApi:java/util/Map,gfePropsSetWithDefaults:java/util/Map,jvmInputArguments:java/util/List,pdxAttributes:java/util/Map,systemProperties:java/util/Properties
-org/apache/geode/management/internal/cli/domain/MemberInformation,true,1,cacheServerList:java/util/List,cacheXmlFilePath:java/lang/String,clientCount:int,cpuUsage:double,groups:java/lang/String,heapUsage:java/lang/String,host:java/lang/String,hostedRegions:java/util/Set,httpServiceBindAddress:java/lang/String,httpServicePort:int,id:java/lang/String,initHeapSize:java/lang/String,isServer:boolean,locatorPort:int,locators:java/lang/String,logFilePath:java/lang/String,maxHeapSize:java/lang/S [...]
+org/apache/geode/management/internal/cli/domain/MemberInformation,true,1,cacheServerList:java/util/List,cacheXmlFilePath:java/lang/String,clientCount:int,cpuUsage:double,groups:java/lang/String,heapUsage:java/lang/String,host:java/lang/String,hostedRegions:java/util/Set,httpServiceBindAddress:java/lang/String,httpServicePort:int,id:java/lang/String,initHeapSize:java/lang/String,isSecured:boolean,isServer:boolean,locatorPort:int,locators:java/lang/String,logFilePath:java/lang/String,maxHe [...]
org/apache/geode/management/internal/cli/domain/PartitionAttributesInfo,true,1,colocatedWith:java/lang/String,fpaInfoList:java/util/List,localMaxMemory:int,nonDefaultAttributes:java/util/Map,partitionResolverName:java/lang/String,recoveryDelay:long,redundantCopies:int,startupRecoveryDelay:long,totalNumBuckets:int
org/apache/geode/management/internal/cli/domain/RegionAttributesInfo,true,336184564012988487,asyncEventQueueIDs:java/util/Set,cacheListenerClassNames:java/util/List,cacheLoaderClassName:java/lang/String,cacheWriterClassName:java/lang/String,cloningEnabled:boolean,compressorClassName:java/lang/String,concurrencyChecksEnabled:boolean,concurrencyLevel:int,customExpiryIdleTimeoutClass:java/lang/String,customExpiryTTLClass:java/lang/String,dataPolicy:org/apache/geode/cache/DataPolicy,diskStor [...]
org/apache/geode/management/internal/cli/domain/RegionDescription,true,6461449275798378332,cndEvictionAttributes:java/util/Map,cndPartitionAttributes:java/util/Map,cndRegionAttributes:java/util/Map,dataPolicy:org/apache/geode/cache/DataPolicy,isAccessor:boolean,isLocal:boolean,isPartition:boolean,isPersistent:boolean,isReplicate:boolean,name:java/lang/String,regionDescPerMemberMap:java/util/Map,scope:org/apache/geode/cache/Scope
@@ -621,7 +621,7 @@ org/apache/geode/management/internal/configuration/functions/DownloadJarFunction
org/apache/geode/management/internal/configuration/functions/GetClusterConfigurationFunction,false
org/apache/geode/management/internal/configuration/functions/GetRegionNamesFunction,false
org/apache/geode/management/internal/configuration/functions/RecreateCacheFunction,false
-org/apache/geode/management/internal/configuration/messages/ClusterManagementServiceInfo,false,hostName:java/lang/String,httpPort:int
+org/apache/geode/management/internal/configuration/messages/ClusterManagementServiceInfo,false,hostName:java/lang/String,httpPort:int,isSSL:boolean,isSecured:boolean
org/apache/geode/management/internal/configuration/messages/ClusterManagementServiceInfoRequest,true,1
org/apache/geode/management/internal/exceptions/EntityExistsException,false
org/apache/geode/management/internal/exceptions/EntityNotFoundException,false,statusOK:boolean
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 c1bece5..d6f8ffa 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
@@ -74,4 +74,12 @@ public interface ClusterManagementService {
return update(config, null);
}
+ /**
+ * Test to see if this instance of ClsuterManagmentService retrieved from the client side is
+ * properly connected to the locator or not
+ *
+ * @return true if connected
+ */
+ boolean isConnected();
+
}
diff --git a/geode-management/src/main/java/org/apache/geode/management/client/ClusterManagementServiceProvider.java b/geode-management/src/main/java/org/apache/geode/management/client/ClusterManagementServiceProvider.java
index ec2703a..44c18f4 100644
--- a/geode-management/src/main/java/org/apache/geode/management/client/ClusterManagementServiceProvider.java
+++ b/geode-management/src/main/java/org/apache/geode/management/client/ClusterManagementServiceProvider.java
@@ -70,15 +70,22 @@ public class ClusterManagementServiceProvider {
private static Map<String, ClusterManagementServiceFactory> serviceFactories = null;
/**
- * use this to get the ClusterManagementService from the locator, or from a server that connects
- * to a locator with no security manager.
+ * retrieve an instance of ClusterManagementService in Geode context (locator, server, geode cache
+ * client)
+ * Note: When connecting to the locator with security and/or SSL turned on, this call will use the
+ * security-username and security-password and/or ssl-* properties specified in the gemfire
+ * properties when starting the server or Geode client cache.
*/
public static ClusterManagementService getService() {
return getServiceFactory(GEODE_CONTEXT).create();
}
/**
- * use this retrieve a ClusterManagementService from a server that connects to a secured locator
+ * use this retrieve a ClusterManagementService in Geode context (locator, server, geode cache
+ * client)
+ * with explicitly specified username and password
+ * Note: this will use the ssl-* properties to make the connection if the locator has SSL turned
+ * on
*/
public static ClusterManagementService getService(String username, String password) {
return getServiceFactory(GEODE_CONTEXT).create(username, password);
@@ -86,7 +93,8 @@ public class ClusterManagementServiceProvider {
/**
* Retrieve a {@code ClusterManagementService} instance configured with an explicit service
- * endpoint. this is good for end point with no ssl nor security turned on.
+ * endpoint in plain java program context.
+ * this is good for end point with no ssl nor security turned on.
* <p/>
* For example:
*
@@ -102,7 +110,8 @@ public class ClusterManagementServiceProvider {
/**
* Retrieve a {@code ClusterManagementService} instance configured with an explicit service
- * endpoint. This service will allow you to connect to ssl enabled and security enabled end point
+ * endpoint in plain java program context.
+ * This service will allow you to connect to ssl enabled and security enabled end point
* with the specified sslContext and hostnameVerifier
*
* @param host the locator's host name