You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ud...@apache.org on 2016/09/13 19:11:54 UTC
[07/50] [abbrv] incubator-geode git commit: GEODE-1792: Changed
protocols and ciphers to be comma separated Make ssl-ciphers and
ssl-protocols comma separated properties. The legacy *-ssl-ciphers and
*-ssl-protocols still use space separated.
GEODE-1792: Changed protocols and ciphers to be comma separated
Make ssl-ciphers and ssl-protocols comma separated properties. The legacy *-ssl-ciphers and
*-ssl-protocols still use space separated.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/80731e54
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/80731e54
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/80731e54
Branch: refs/heads/develop
Commit: 80731e5404b32d84f630c46f5cf76f7c2684718f
Parents: daf025c
Author: Udo Kohlmeyer <uk...@pivotal.io>
Authored: Thu Aug 18 12:04:54 2016 +1000
Committer: Udo Kohlmeyer <uk...@pivotal.io>
Committed: Thu Aug 18 12:04:54 2016 +1000
----------------------------------------------------------------------
.../gemfire/admin/DistributedSystemConfig.java | 8 +-
.../internal/DistributedSystemConfigImpl.java | 211 +++++++---------
.../EnabledManagedEntityController.java | 247 +++++++++----------
.../ManagedEntityConfigXmlGenerator.java | 149 +++++------
.../internal/ManagedEntityConfigXmlParser.java | 174 ++++++-------
.../internal/AdminDistributedSystemJmxImpl.java | 8 +-
.../admin/jmx/internal/AgentConfigImpl.java | 21 +-
.../gemfire/admin/jmx/internal/AgentImpl.java | 8 +-
.../distributed/ConfigurationProperties.java | 2 +-
.../internal/DistributionConfig.java | 84 +++----
.../internal/DistributionConfigImpl.java | 103 ++++----
.../gemfire/internal/admin/SSLConfig.java | 25 +-
.../internal/net/SSLConfigurationFactory.java | 5 +-
.../gemfire/internal/net/SocketCreator.java | 10 +-
.../gemfire/management/GemFireProperties.java | 80 +++---
.../management/internal/JettyHelper.java | 7 +-
.../gemfire/management/internal/SSLUtil.java | 37 ++-
.../internal/cli/commands/ShellCommands.java | 2 +-
.../internal/DistributionConfigJUnitTest.java | 65 ++++-
.../net/SSLConfigurationFactoryTest.java | 5 +-
gradle/java.gradle | 42 ++--
21 files changed, 655 insertions(+), 638 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/admin/DistributedSystemConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/admin/DistributedSystemConfig.java b/geode-core/src/main/java/com/gemstone/gemfire/admin/DistributedSystemConfig.java
index 17600bc..89ef390 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/admin/DistributedSystemConfig.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/admin/DistributedSystemConfig.java
@@ -450,16 +450,16 @@ public interface DistributedSystemConfig extends Cloneable {
public void setSSLEnabled(boolean enabled);
/** Returns the value of the "ssl-protocols" property. */
- public String getSSLProtocols();
+ public String[] getSSLProtocols();
/** Sets the value of the "ssl-protocols" property. */
- public void setSSLProtocols(String protocols);
+ public void setSSLProtocols(String[] protocols);
/** Returns the value of the "ssl-ciphers" property. */
- public String getSSLCiphers();
+ public String[] getSSLCiphers();
/** Sets the value of the "ssl-ciphers" property. */
- public void setSSLCiphers(String ciphers);
+ public void setSSLCiphers(String[] ciphers);
/** Returns the value of the "ssl-require-authentication" property. */
public boolean isSSLAuthenticationRequired();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/DistributedSystemConfigImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/DistributedSystemConfigImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/DistributedSystemConfigImpl.java
index 37cd139..2198e69 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/DistributedSystemConfigImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/DistributedSystemConfigImpl.java
@@ -16,7 +16,28 @@
*/
package com.gemstone.gemfire.admin.internal;
-import com.gemstone.gemfire.admin.*;
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.admin.AdminXmlException;
+import com.gemstone.gemfire.admin.CacheServerConfig;
+import com.gemstone.gemfire.admin.CacheVmConfig;
+import com.gemstone.gemfire.admin.DistributedSystemConfig;
+import com.gemstone.gemfire.admin.DistributionLocator;
+import com.gemstone.gemfire.admin.DistributionLocatorConfig;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
@@ -24,15 +45,6 @@ import com.gemstone.gemfire.internal.logging.InternalLogWriter;
import com.gemstone.gemfire.internal.logging.LogConfig;
import com.gemstone.gemfire.internal.logging.LogService;
import com.gemstone.gemfire.internal.logging.LogWriterImpl;
-import org.apache.logging.log4j.Logger;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.*;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
/**
* An implementation of the configuration object for an
@@ -43,11 +55,9 @@ import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
* distribution locators) are "passed through" to the
* <code>AdminDistributedSystem</code> associated with this
* configuration object.
- *
* @since GemFire 3.5
*/
-public class DistributedSystemConfigImpl
- implements DistributedSystemConfig {
+public class DistributedSystemConfigImpl implements DistributedSystemConfig {
private static final Logger logger = LogService.getLogger();
@@ -99,8 +109,8 @@ public class DistributedSystemConfigImpl
/**
* The admin distributed system object that is configured by this
* config object.
- *
- * @since GemFire 4.0 */
+ * @since GemFire 4.0
+ */
private AdminDistributedSystemImpl system;
/**
@@ -114,21 +124,14 @@ public class DistributedSystemConfigImpl
* Filters out all properties that are unique to the admin
* <code>DistributedSystemConfig</code> that are not present in the
* internal <code>DistributionConfig</code>.
- *
* @since GemFire 4.0
*/
- private static Properties
- filterOutAdminProperties(Properties props) {
+ private static Properties filterOutAdminProperties(Properties props) {
Properties props2 = new Properties();
- for (Enumeration names = props.propertyNames();
- names.hasMoreElements(); ) {
+ for (Enumeration names = props.propertyNames(); names.hasMoreElements(); ) {
String name = (String) names.nextElement();
- if (!(ENTITY_CONFIG_XML_FILE_NAME.equals(name) ||
- REFRESH_INTERVAL_NAME.equals(name) ||
- REMOTE_COMMAND_NAME.equals(name)
- )
- ) {
+ if (!(ENTITY_CONFIG_XML_FILE_NAME.equals(name) || REFRESH_INTERVAL_NAME.equals(name) || REMOTE_COMMAND_NAME.equals(name))) {
String value = props.getProperty(name);
if ((name != null) && (value != null)) {
props2.setProperty(name, value);
@@ -146,8 +149,7 @@ public class DistributedSystemConfigImpl
* the configuration stored in a <code>DistributedSystem</code>'s
* <code>DistributionConfig</code>.
*/
- public DistributedSystemConfigImpl(DistributionConfig distConfig,
- String remoteCommand) {
+ public DistributedSystemConfigImpl(DistributionConfig distConfig, String remoteCommand) {
if (distConfig == null) {
throw new IllegalArgumentException(LocalizedStrings.DistributedSystemConfigImpl_DISTRIBUTIONCONFIG_MUST_NOT_BE_NULL.toLocalizedString());
}
@@ -155,8 +157,7 @@ public class DistributedSystemConfigImpl
this.mcastAddress = InetAddressUtil.toString(distConfig.getMcastAddress());
this.mcastPort = distConfig.getMcastPort();
this.locators = distConfig.getLocators();
- this.membershipPortRange =
- getMembershipPortRangeString(distConfig.getMembershipPortRange());
+ this.membershipPortRange = getMembershipPortRangeString(distConfig.getMembershipPortRange());
this.systemName = distConfig.getName();
@@ -166,8 +167,7 @@ public class DistributedSystemConfigImpl
this.sslAuthenticationRequired = distConfig.getClusterSSLRequireAuthentication();
this.logFile = distConfig.getLogFile().getPath();
- this.logLevel =
- LogWriterImpl.levelToString(distConfig.getLogLevel());
+ this.logLevel = LogWriterImpl.levelToString(distConfig.getLogLevel());
this.logDiskSpaceLimit = distConfig.getLogDiskSpaceLimit();
this.logFileSizeLimit = distConfig.getLogFileSizeLimit();
@@ -186,7 +186,6 @@ public class DistributedSystemConfigImpl
/**
* Zero-argument constructor to be used only by subclasses.
- *
* @since GemFire 4.0
*/
protected DistributedSystemConfigImpl() {
@@ -205,39 +204,32 @@ public class DistributedSystemConfigImpl
/**
* Creates a new <code>DistributedSystemConifgImpl</code> whose configuration
* is specified by the given <code>Properties</code> object.
- *
- * @param props
- * The configuration properties specified by the caller
- * @param ignoreGemFirePropsFile
- * whether to skip loading distributed system properties from
- * gemfire.properties file
- *
+ * @param props The configuration properties specified by the caller
+ * @param ignoreGemFirePropsFile whether to skip loading distributed system properties from
+ * gemfire.properties file
+ *
* @since GemFire 6.5
*/
- protected DistributedSystemConfigImpl(Properties props,
- boolean ignoreGemFirePropsFile) {
- this(new DistributionConfigImpl(
- filterOutAdminProperties(props), ignoreGemFirePropsFile),
- DEFAULT_REMOTE_COMMAND);
+ protected DistributedSystemConfigImpl(Properties props, boolean ignoreGemFirePropsFile) {
+ this(new DistributionConfigImpl(filterOutAdminProperties(props), ignoreGemFirePropsFile), DEFAULT_REMOTE_COMMAND);
String remoteCommand = props.getProperty(REMOTE_COMMAND_NAME);
if (remoteCommand != null) {
this.remoteCommand = remoteCommand;
}
- String entityConfigXMLFile =
- props.getProperty(ENTITY_CONFIG_XML_FILE_NAME);
+ String entityConfigXMLFile = props.getProperty(ENTITY_CONFIG_XML_FILE_NAME);
if (entityConfigXMLFile != null) {
this.entityConfigXMLFile = entityConfigXMLFile;
}
- String refreshInterval =
- props.getProperty(REFRESH_INTERVAL_NAME);
+ String refreshInterval = props.getProperty(REFRESH_INTERVAL_NAME);
if (refreshInterval != null) {
try {
this.refreshInterval = Integer.parseInt(refreshInterval);
} catch (NumberFormatException nfEx) {
- throw new IllegalArgumentException(
- LocalizedStrings.DistributedSystemConfigImpl_0_IS_NOT_A_VALID_INTEGER_1.toLocalizedString(new Object[] { refreshInterval, REFRESH_INTERVAL_NAME }));
+ throw new IllegalArgumentException(LocalizedStrings.DistributedSystemConfigImpl_0_IS_NOT_A_VALID_INTEGER_1.toLocalizedString(new Object[] {
+ refreshInterval, REFRESH_INTERVAL_NAME
+ }));
}
}
}
@@ -248,7 +240,6 @@ public class DistributedSystemConfigImpl
* Returns the <code>LogWriterI18n</code> to be used when administering
* the distributed system. Returns null if nothing has been provided via
* <code>setInternalLogWriter</code>.
- *
* @since GemFire 4.0
*/
public InternalLogWriter getInternalLogWriter() {
@@ -307,7 +298,6 @@ public class DistributedSystemConfigImpl
* Marks this config object as "read only". Attempts to modify a
* config object will result in a {@link IllegalStateException}
* being thrown.
- *
* @since GemFire 4.0
*/
void setDistributedSystem(AdminDistributedSystemImpl system) {
@@ -317,14 +307,12 @@ public class DistributedSystemConfigImpl
/**
* Checks to see if this config object is "read only". If it is,
* then an {@link IllegalStateException} is thrown.
- *
* @since GemFire 4.0
*/
protected void checkReadOnly() {
if (this.system != null) {
- throw new IllegalStateException(
- LocalizedStrings.DistributedSystemConfigImpl_A_DISTRIBUTEDSYSTEMCONFIG_OBJECT_CANNOT_BE_MODIFIED_AFTER_IT_HAS_BEEN_USED_TO_CREATE_AN_ADMINDISTRIBUTEDSYSTEM
- .toLocalizedString());
+ throw new IllegalStateException(LocalizedStrings.DistributedSystemConfigImpl_A_DISTRIBUTEDSYSTEMCONFIG_OBJECT_CANNOT_BE_MODIFIED_AFTER_IT_HAS_BEEN_USED_TO_CREATE_AN_ADMINDISTRIBUTEDSYSTEM
+ .toLocalizedString());
}
}
@@ -341,7 +329,6 @@ public class DistributedSystemConfigImpl
/**
* Parses the XML configuration file that describes managed
* entities.
- *
* @throws AdminXmlException If a problem is encountered while parsing the XML file.
*/
private void parseEntityConfigXMLFile() {
@@ -443,7 +430,6 @@ public class DistributedSystemConfigImpl
/**
* Returns the value for membership-port-range
- *
* @return the value for the Distributed System property membership-port-range
*/
public String getMembershipPortRange() {
@@ -452,9 +438,8 @@ public class DistributedSystemConfigImpl
/**
* Sets the Distributed System property membership-port-range
- *
* @param membershipPortRangeStr the value for membership-port-range given as two numbers separated
- * by a minus sign.
+ * by a minus sign.
*/
public void setMembershipPortRange(String membershipPortRangeStr) {
/*
@@ -472,10 +457,9 @@ public class DistributedSystemConfigImpl
if (validateMembershipRange(membershipPortRangeStr)) {
this.membershipPortRange = membershipPortRangeStr;
} else {
- throw new IllegalArgumentException(
- LocalizedStrings.DistributedSystemConfigImpl_INVALID_VALUE_FOR_MEMBERSHIP_PORT_RANGE
- .toLocalizedString(new Object[] { membershipPortRangeStr,
- MEMBERSHIP_PORT_RANGE_NAME }));
+ throw new IllegalArgumentException(LocalizedStrings.DistributedSystemConfigImpl_INVALID_VALUE_FOR_MEMBERSHIP_PORT_RANGE.toLocalizedString(new Object[] {
+ membershipPortRangeStr, MEMBERSHIP_PORT_RANGE_NAME
+ }));
}
} catch (Exception e) {
if (logger.isDebugEnabled()) {
@@ -499,9 +483,9 @@ public class DistributedSystemConfigImpl
* Validates the given string - which is expected in the format as two numbers
* separated by a minus sign - in to an integer array of length 2 with first
* element as lower end & second element as upper end of the range.
- *
* @param membershipPortRange membership-port-range given as two numbers separated by a minus
- * sign.
+ * sign.
+ *
* @return true if the membership-port-range string is valid, false otherwise
*/
private boolean validateMembershipRange(String membershipPortRange) {
@@ -513,8 +497,7 @@ public class DistributedSystemConfigImpl
range[1] = Integer.parseInt(splitted[1].trim());
//NumberFormatException if any could be thrown
- if (range[0] < 0 || range[0] >= range[1] ||
- range[1] < 0 || range[1] > 65535) {
+ if (range[0] < 0 || range[0] >= range[1] || range[1] < 0 || range[1] > 65535) {
range = null;
}
}
@@ -527,10 +510,8 @@ public class DistributedSystemConfigImpl
*/
private static String getMembershipPortRangeString(int[] membershipPortRange) {
String membershipPortRangeString = "";
- if (membershipPortRange != null &&
- membershipPortRange.length == 2) {
- membershipPortRangeString = membershipPortRange[0] + "-" +
- membershipPortRange[1];
+ if (membershipPortRange != null && membershipPortRange.length == 2) {
+ membershipPortRangeString = membershipPortRange[0] + "-" + membershipPortRange[1];
}
return membershipPortRangeString;
@@ -694,12 +675,10 @@ public class DistributedSystemConfigImpl
/**
* Returns an array of configurations for statically known
* CacheServers
- *
* @since GemFire 4.0
- */
+ */
public CacheServerConfig[] getCacheServerConfigs() {
- return (CacheServerConfig[]) this.cacheServerConfigs.toArray(
- new CacheServerConfig[this.cacheServerConfigs.size()]);
+ return (CacheServerConfig[]) this.cacheServerConfigs.toArray(new CacheServerConfig[this.cacheServerConfigs.size()]);
}
public CacheVmConfig[] getCacheVmConfigs() {
@@ -708,7 +687,6 @@ public class DistributedSystemConfigImpl
/**
* Creates the configuration for a CacheServer
- *
* @since GemFire 4.0
*/
public CacheServerConfig createCacheServerConfig() {
@@ -723,14 +701,14 @@ public class DistributedSystemConfigImpl
/**
* Adds the configuration for a CacheServer
- *
* @since GemFire 4.0
*/
private void addCacheServerConfig(CacheServerConfig managerConfig) {
checkReadOnly();
- if (managerConfig == null)
+ if (managerConfig == null) {
return;
+ }
for (Iterator iter = this.cacheServerConfigs.iterator(); iter.hasNext(); ) {
CacheServerConfigImpl impl = (CacheServerConfigImpl) iter.next();
if (impl.equals(managerConfig)) {
@@ -743,7 +721,6 @@ public class DistributedSystemConfigImpl
/**
* Removes the configuration for a CacheServer
- *
* @since GemFire 4.0
*/
public void removeCacheServerConfig(CacheServerConfig managerConfig) {
@@ -761,18 +738,15 @@ public class DistributedSystemConfigImpl
*/
public DistributionLocatorConfig[] getDistributionLocatorConfigs() {
if (this.system != null) {
- DistributionLocator[] locators =
- this.system.getDistributionLocators();
- DistributionLocatorConfig[] configs =
- new DistributionLocatorConfig[locators.length];
+ DistributionLocator[] locators = this.system.getDistributionLocators();
+ DistributionLocatorConfig[] configs = new DistributionLocatorConfig[locators.length];
for (int i = 0; i < locators.length; i++) {
configs[i] = locators[i].getConfig();
}
return configs;
} else {
- Object[] array =
- new DistributionLocatorConfig[this.locatorConfigs.size()];
+ Object[] array = new DistributionLocatorConfig[this.locatorConfigs.size()];
return (DistributionLocatorConfig[]) this.locatorConfigs.toArray(array);
}
}
@@ -809,22 +783,22 @@ public class DistributedSystemConfigImpl
* Validates the bind address. The address may be a host name or IP address,
* but it must not be empty and must be usable for creating an InetAddress.
* Cannot have a leading '/' (which InetAddress.toString() produces).
- *
* @param bindAddress host name or IP address to validate
*/
public static boolean validateBindAddress(String bindAddress) {
- if (bindAddress == null || bindAddress.length() == 0)
+ if (bindAddress == null || bindAddress.length() == 0) {
return true;
- if (InetAddressUtil.validateHost(bindAddress) == null)
+ }
+ if (InetAddressUtil.validateHost(bindAddress) == null) {
return false;
+ }
return true;
}
public synchronized void configChanged() {
ConfigListener[] clients = null;
synchronized (this.listeners) {
- clients = (ConfigListener[])
- listeners.toArray(new ConfigListener[this.listeners.size()]);
+ clients = (ConfigListener[]) listeners.toArray(new ConfigListener[this.listeners.size()]);
}
for (int i = 0; i < clients.length; i++) {
try {
@@ -856,14 +830,10 @@ public class DistributedSystemConfigImpl
// -------------------------------------------------------------------------
// SSL support...
// -------------------------------------------------------------------------
- private boolean sslEnabled =
- DistributionConfig.DEFAULT_SSL_ENABLED;
- private String sslProtocols =
- DistributionConfig.DEFAULT_SSL_PROTOCOLS;
- private String sslCiphers =
- DistributionConfig.DEFAULT_SSL_CIPHERS;
- private boolean sslAuthenticationRequired =
- DistributionConfig.DEFAULT_SSL_REQUIRE_AUTHENTICATION;
+ private boolean sslEnabled = DistributionConfig.DEFAULT_SSL_ENABLED;
+ private String[] sslProtocols = new String[] { DistributionConfig.DEFAULT_SSL_PROTOCOLS };
+ private String[] sslCiphers = new String[] { DistributionConfig.DEFAULT_SSL_CIPHERS };
+ private boolean sslAuthenticationRequired = DistributionConfig.DEFAULT_SSL_REQUIRE_AUTHENTICATION;
private Properties sslProperties = new Properties();
public boolean isSSLEnabled() {
@@ -876,21 +846,21 @@ public class DistributedSystemConfigImpl
configChanged();
}
- public String getSSLProtocols() {
+ public String[] getSSLProtocols() {
return this.sslProtocols;
}
- public void setSSLProtocols(String protocols) {
+ public void setSSLProtocols(final String[] protocols) {
checkReadOnly();
this.sslProtocols = protocols;
configChanged();
}
- public String getSSLCiphers() {
+ public String[] getSSLCiphers() {
return this.sslCiphers;
}
- public void setSSLCiphers(String ciphers) {
+ public void setSSLCiphers(String[] ciphers) {
checkReadOnly();
this.sslCiphers = ciphers;
configChanged();
@@ -933,6 +903,7 @@ public class DistributedSystemConfigImpl
/**
* @return the gfSecurityProperties
+ *
* @since GemFire 6.6.3
*/
public Properties getGfSecurityProperties() {
@@ -998,14 +969,13 @@ public class DistributedSystemConfigImpl
/**
* Makes sure that the mcast port and locators are correct and
* consistent.
- *
* @throws IllegalArgumentException If configuration is not valid
*/
public void validate() {
- if (this.getMcastPort() < MIN_MCAST_PORT ||
- this.getMcastPort() > MAX_MCAST_PORT) {
- throw new IllegalArgumentException(LocalizedStrings.DistributedSystemConfigImpl_MCASTPORT_MUST_BE_AN_INTEGER_INCLUSIVELY_BETWEEN_0_AND_1
- .toLocalizedString(new Object[] { Integer.valueOf(MIN_MCAST_PORT), Integer.valueOf(MAX_MCAST_PORT) }));
+ if (this.getMcastPort() < MIN_MCAST_PORT || this.getMcastPort() > MAX_MCAST_PORT) {
+ throw new IllegalArgumentException(LocalizedStrings.DistributedSystemConfigImpl_MCASTPORT_MUST_BE_AN_INTEGER_INCLUSIVELY_BETWEEN_0_AND_1.toLocalizedString(new Object[] {
+ Integer.valueOf(MIN_MCAST_PORT), Integer.valueOf(MAX_MCAST_PORT)
+ }));
}
// disabled in 5.1 - multicast and locators can be used together
@@ -1017,16 +987,16 @@ public class DistributedSystemConfigImpl
LogWriterImpl.levelNameToCode(this.logLevel);
- if (this.logFileSizeLimit < MIN_LOG_FILE_SIZE_LIMIT ||
- this.logFileSizeLimit > MAX_LOG_FILE_SIZE_LIMIT) {
- throw new IllegalArgumentException(LocalizedStrings.DistributedSystemConfigImpl_LOGFILESIZELIMIT_MUST_BE_AN_INTEGER_BETWEEN_0_AND_1
- .toLocalizedString(new Object[] { Integer.valueOf(MIN_LOG_FILE_SIZE_LIMIT), Integer.valueOf(MAX_LOG_FILE_SIZE_LIMIT) }));
+ if (this.logFileSizeLimit < MIN_LOG_FILE_SIZE_LIMIT || this.logFileSizeLimit > MAX_LOG_FILE_SIZE_LIMIT) {
+ throw new IllegalArgumentException(LocalizedStrings.DistributedSystemConfigImpl_LOGFILESIZELIMIT_MUST_BE_AN_INTEGER_BETWEEN_0_AND_1.toLocalizedString(new Object[] {
+ Integer.valueOf(MIN_LOG_FILE_SIZE_LIMIT), Integer.valueOf(MAX_LOG_FILE_SIZE_LIMIT)
+ }));
}
- if (this.logDiskSpaceLimit < MIN_LOG_DISK_SPACE_LIMIT ||
- this.logDiskSpaceLimit > MAX_LOG_DISK_SPACE_LIMIT) {
- throw new IllegalArgumentException(LocalizedStrings.DistributedSystemConfigImpl_LOGDISKSPACELIMIT_MUST_BE_AN_INTEGER_BETWEEN_0_AND_1
- .toLocalizedString(new Object[] { Integer.valueOf(MIN_LOG_DISK_SPACE_LIMIT), Integer.valueOf(MAX_LOG_DISK_SPACE_LIMIT) }));
+ if (this.logDiskSpaceLimit < MIN_LOG_DISK_SPACE_LIMIT || this.logDiskSpaceLimit > MAX_LOG_DISK_SPACE_LIMIT) {
+ throw new IllegalArgumentException(LocalizedStrings.DistributedSystemConfigImpl_LOGDISKSPACELIMIT_MUST_BE_AN_INTEGER_BETWEEN_0_AND_1.toLocalizedString(new Object[] {
+ Integer.valueOf(MIN_LOG_DISK_SPACE_LIMIT), Integer.valueOf(MAX_LOG_DISK_SPACE_LIMIT)
+ }));
}
parseEntityConfigXMLFile();
@@ -1037,14 +1007,12 @@ public class DistributedSystemConfigImpl
*/
@Override
public Object clone() throws CloneNotSupportedException {
- DistributedSystemConfigImpl other =
- (DistributedSystemConfigImpl) super.clone();
+ DistributedSystemConfigImpl other = (DistributedSystemConfigImpl) super.clone();
other.system = null;
other.cacheServerConfigs = new HashSet();
other.locatorConfigs = new HashSet();
- DistributionLocatorConfig[] myLocators =
- this.getDistributionLocatorConfigs();
+ DistributionLocatorConfig[] myLocators = this.getDistributionLocatorConfigs();
for (int i = 0; i < myLocators.length; i++) {
DistributionLocatorConfig locator = myLocators[i];
other.addDistributionLocatorConfig((DistributionLocatorConfig) locator.clone());
@@ -1063,8 +1031,9 @@ public class DistributedSystemConfigImpl
public String toString() {
StringBuffer buf = new StringBuffer(1000);
String lf = System.getProperty("line.separator");
- if (lf == null)
+ if (lf == null) {
lf = ",";
+ }
buf.append("DistributedSystemConfig(");
buf.append(lf);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/EnabledManagedEntityController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/EnabledManagedEntityController.java b/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/EnabledManagedEntityController.java
index 465d7ae..8fee07e 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/EnabledManagedEntityController.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/EnabledManagedEntityController.java
@@ -16,6 +16,14 @@
*/
package com.gemstone.gemfire.admin.internal;
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.Properties;
+
+import org.apache.logging.log4j.Logger;
+
import com.gemstone.gemfire.admin.AdminDistributedSystem;
import com.gemstone.gemfire.admin.DistributedSystemConfig;
import com.gemstone.gemfire.admin.ManagedEntity;
@@ -26,13 +34,7 @@ import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
import com.gemstone.gemfire.internal.logging.LogService;
import com.gemstone.gemfire.internal.logging.LoggingThreadGroup;
import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
-import org.apache.logging.log4j.Logger;
-
-import java.io.File;
-import java.util.Iterator;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import com.gemstone.gemfire.management.internal.SSLUtil;
/**
* Implements the actual administration (starting, stopping, etc.) of
@@ -41,43 +43,49 @@ import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
* by the {@link InternalManagedEntity} object. Note that it does not
* use <code>SystemAdmin</code> to manage "local" entities; it always
* execs the scripts.
- *
- * <P>
- *
+ * <p>
+ * <p>
+ * <p>
* This class is a refactoring of <code>Systemcontroller</code>,
* <code>RemoteCommand</code>, and <code>LocatorRemoteCommand</code>.
- *
* @since GemFire 4.0
*/
class EnabledManagedEntityController implements ManagedEntityController {
+
private static final Logger logger = LogService.getLogger();
-// /** A lock to ensure that only entity is managed at a time. See bug
-// * 31374. */
-// private static Object startStopLock = new Object();
+ // /** A lock to ensure that only entity is managed at a time. See bug
+ // * 31374. */
+ // private static Object startStopLock = new Object();
- /** Known strings found in output indicating error. */
+ /**
+ * Known strings found in output indicating error.
+ */
private static final String[] ERROR_OUTPUTS = new String[] {
- "No such file or directory",
- "The system cannot find the file specified.",
- "Access is denied.",
- "cannot open",
- "ERROR"
+ "No such file or directory", "The system cannot find the file specified.", "Access is denied.", "cannot open", "ERROR"
};
- /** Token in command prefix to be replaced with actual HOST */
+ /**
+ * Token in command prefix to be replaced with actual HOST
+ */
private static final String HOST = "{HOST}";
- /** Token in command prefix to be replaced with actual execution CMD */
+ /**
+ * Token in command prefix to be replaced with actual execution CMD
+ */
private static final String CMD = "{CMD}";
////////////////////// Instance Fields //////////////////////
- /** The thread group in which threads launched by this system
- * controller reside. */
+ /**
+ * The thread group in which threads launched by this system
+ * controller reside.
+ */
private final ThreadGroup threadGroup;
- /** System to which the managed entities belong */
+ /**
+ * System to which the managed entities belong
+ */
private final AdminDistributedSystem system;
/////////////////////// Constructors ///////////////////////
@@ -88,8 +96,7 @@ class EnabledManagedEntityController implements ManagedEntityController {
*/
EnabledManagedEntityController(AdminDistributedSystem system) {
this.system = system;
- this.threadGroup =
- LoggingThreadGroup.createThreadGroup("ManagedEntityController threads", logger);
+ this.threadGroup = LoggingThreadGroup.createThreadGroup("ManagedEntityController threads", logger);
}
///////////////////// Instance Methods /////////////////////
@@ -99,39 +106,41 @@ class EnabledManagedEntityController implements ManagedEntityController {
* contains a known error message.
*/
private boolean outputIsError(String output) {
- if (output == null) return false;
+ if (output == null) {
+ return false;
+ }
boolean error = false;
for (int i = 0; i < ERROR_OUTPUTS.length; i++) {
error = output.indexOf(ERROR_OUTPUTS[i]) > -1;
- if (error) return error;
+ if (error) {
+ return error;
+ }
}
return error;
}
/**
* Executes a command using {@link Runtime#exec(java.lang.String)}.
- *
- * @param command
- * The full command to remotely execute
+ * @param command The full command to remotely execute
*
* @return Output from the command that was executed or
- * <code>null</code> if the executing the command failed.
+ * <code>null</code> if the executing the command failed.
*/
- protected String execute(String command,
- InternalManagedEntity entity) {
+ protected String execute(String command, InternalManagedEntity entity) {
/* TODO: this is getting ugly... clients of this method really need to
have the ability to do their own parsing/checking of 'output' */
if (command == null || command.length() == 0) {
throw new IllegalArgumentException(LocalizedStrings.ManagedEntityController_EXECUTION_COMMAND_IS_EMPTY.toLocalizedString());
}
- File workingDir =
- new File(entity.getEntityConfig().getWorkingDirectory());
- logger.info(LocalizedMessage.create(LocalizedStrings.ManagedEntityController_EXECUTING_REMOTE_COMMAND_0_IN_DIRECTORY_1, new Object[] {command, workingDir}));
+ File workingDir = new File(entity.getEntityConfig().getWorkingDirectory());
+ logger.info(LocalizedMessage.create(LocalizedStrings.ManagedEntityController_EXECUTING_REMOTE_COMMAND_0_IN_DIRECTORY_1, new Object[] {
+ command,
+ workingDir
+ }));
Process p = null;
try {
- p = Runtime.getRuntime().exec(command, null /* env */,
- workingDir);
+ p = Runtime.getRuntime().exec(command, null /* env */, workingDir);
} catch (java.io.IOException e) {
logger.fatal(LocalizedMessage.create(LocalizedStrings.ManagedEntityController_WHILE_EXECUTING_0, command), e);
@@ -141,8 +150,11 @@ class EnabledManagedEntityController implements ManagedEntityController {
final ProcessOutputReader pos = new ProcessOutputReader(p);
int retCode = pos.getExitCode();
final String output = pos.getOutput();
- logger.info(LocalizedMessage.create(LocalizedStrings.ManagedEntityController_RESULT_OF_EXECUTING_0_IS_1, new Object[] {command, Integer.valueOf(retCode)}));
- logger.info(LocalizedMessage.create(LocalizedStrings.ManagedEntityController_OUTPUT_OF_0_IS_1, new Object[] {command, output}));
+ logger.info(LocalizedMessage.create(LocalizedStrings.ManagedEntityController_RESULT_OF_EXECUTING_0_IS_1, new Object[] {
+ command,
+ Integer.valueOf(retCode)
+ }));
+ logger.info(LocalizedMessage.create(LocalizedStrings.ManagedEntityController_OUTPUT_OF_0_IS_1, new Object[] { command, output }));
if (retCode != 0 || outputIsError(output)) {
logger.warn(LocalizedMessage.create(LocalizedStrings.ManagedEntityController_REMOTE_EXECUTION_OF_0_FAILED, command));
@@ -152,12 +164,16 @@ class EnabledManagedEntityController implements ManagedEntityController {
return output;
}
- /** Returns true if the path ends with a path separator. */
+ /**
+ * Returns true if the path ends with a path separator.
+ */
private boolean endsWithSeparator(String path) {
return path.endsWith("/") || path.endsWith("\\");
}
- /** Translates the path between Windows and UNIX. */
+ /**
+ * Translates the path between Windows and UNIX.
+ */
private String getOSPath(String path) {
if (pathIsWindows(path)) {
return path.replace('/', '\\');
@@ -166,16 +182,17 @@ class EnabledManagedEntityController implements ManagedEntityController {
}
}
-// /** Returns true if the path is on Windows. */
-// private boolean pathIsWindows(File path) {
-// return pathIsWindows(path.toString());
-// }
+ // /** Returns true if the path is on Windows. */
+ // private boolean pathIsWindows(File path) {
+ // return pathIsWindows(path.toString());
+ // }
- /** Returns true if the path is on Windows. */
+ /**
+ * Returns true if the path is on Windows.
+ */
private boolean pathIsWindows(String path) {
if (path != null && path.length() > 1) {
- return (Character.isLetter(path.charAt(0)) && path.charAt(1) == ':') ||
- (path.startsWith("//") || path.startsWith("\\\\"));
+ return (Character.isLetter(path.charAt(0)) && path.charAt(1) == ':') || (path.startsWith("//") || path.startsWith("\\\\"));
}
return false;
}
@@ -183,13 +200,10 @@ class EnabledManagedEntityController implements ManagedEntityController {
/**
* If the managed entity resides on a remote host, then
* <code>command</code> is munged to take the remote command into account.
- *
- * @throws IllegalStateException
- * If a remote command is required, but one has not been
- * specified.
+ * @throws IllegalStateException If a remote command is required, but one has not been
+ * specified.
*/
- private String arrangeRemoteCommand(InternalManagedEntity entity,
- String cmd) {
+ private String arrangeRemoteCommand(InternalManagedEntity entity, String cmd) {
String host = entity.getEntityConfig().getHost();
if (InetAddressUtil.isLocalHost(host)) {
@@ -203,8 +217,7 @@ class EnabledManagedEntityController implements ManagedEntityController {
}
if (prefix == null || prefix.length() <= 0) {
- throw new IllegalStateException(LocalizedStrings.ManagedEntityController_A_REMOTE_COMMAND_MUST_BE_SPECIFIED_TO_OPERATE_ON_A_MANAGED_ENTITY_ON_HOST_0
- .toLocalizedString(host));
+ throw new IllegalStateException(LocalizedStrings.ManagedEntityController_A_REMOTE_COMMAND_MUST_BE_SPECIFIED_TO_OPERATE_ON_A_MANAGED_ENTITY_ON_HOST_0.toLocalizedString(host));
}
int hostIdx = prefix.indexOf(HOST);
@@ -243,23 +256,19 @@ class EnabledManagedEntityController implements ManagedEntityController {
* <code>$GEMFIRE/bin</code> taking into account the {@linkplain
* ManagedEntityConfig#getProductDirectory product directory} and the
* platform's file separator.
- *
- * <P>
- *
+ * <p>
+ * <p>
+ * <p>
* Note: we should probably do a better job of determine whether or
* not the machine on which the entity runs is Windows or Linux.
- *
- * @param executable
- * The name of the executable that resides in
- * <code>$GEMFIRE/bin</code>.
+ * @param executable The name of the executable that resides in
+ * <code>$GEMFIRE/bin</code>.
*/
- public String getProductExecutable(InternalManagedEntity entity,
- String executable) {
- String productDirectory =
- entity.getEntityConfig().getProductDirectory();
+ public String getProductExecutable(InternalManagedEntity entity, String executable) {
+ String productDirectory = entity.getEntityConfig().getProductDirectory();
String path = null;
File productDir = new File(productDirectory);
-// if (productDir != null) (cannot be null)
+ // if (productDir != null) (cannot be null)
{
path = productDir.getPath();
if (!endsWithSeparator(path)) {
@@ -267,9 +276,9 @@ class EnabledManagedEntityController implements ManagedEntityController {
}
path += "bin" + File.separator;
}
-// else {
-// path = "";
-// }
+ // else {
+ // path = "";
+ // }
String bat = "";
if (pathIsWindows(path)) {
@@ -284,10 +293,12 @@ class EnabledManagedEntityController implements ManagedEntityController {
*/
public String buildSSLArguments(DistributedSystemConfig config) {
Properties sslProps = buildSSLProperties(config, true);
- if (sslProps == null) return null;
+ if (sslProps == null) {
+ return null;
+ }
StringBuffer sb = new StringBuffer();
- for (Iterator iter = sslProps.keySet().iterator(); iter.hasNext();) {
+ for (Iterator iter = sslProps.keySet().iterator(); iter.hasNext(); ) {
String key = (String) iter.next();
String value = sslProps.getProperty(key);
sb.append(" -J-D" + key + "=" + value);
@@ -299,36 +310,27 @@ class EnabledManagedEntityController implements ManagedEntityController {
/**
* Builds optional SSL properties for DistributionLocator. Returns null if SSL
* is not enabled for the distributed system.
- *
- * @param forCommandLine
- * true indicates that
- * {@link DistributionConfig#GEMFIRE_PREFIX} should be
- * prepended so the argument will become -Dgemfire.xxxx
+ * @param forCommandLine true indicates that
+ * {@link DistributionConfig#GEMFIRE_PREFIX} should be
+ * prepended so the argument will become -Dgemfire.xxxx
*/
- private Properties buildSSLProperties(DistributedSystemConfig config,
- boolean forCommandLine) {
- if (!config.isSSLEnabled()) return null;
+ private Properties buildSSLProperties(DistributedSystemConfig config, boolean forCommandLine) {
+ if (!config.isSSLEnabled()) {
+ return null;
+ }
String prefix = "";
- if (forCommandLine) prefix = DistributionConfig.GEMFIRE_PREFIX;
+ if (forCommandLine) {
+ prefix = DistributionConfig.GEMFIRE_PREFIX;
+ }
Properties sslProps = (Properties) config.getSSLProperties().clone();
// add ssl-enabled, etc...
- sslProps.setProperty(prefix +
- MCAST_PORT,
- "0");
- sslProps.setProperty(prefix +
- CLUSTER_SSL_ENABLED,
- String.valueOf(config.isSSLEnabled()));
- sslProps.setProperty(prefix +
- CLUSTER_SSL_CIPHERS,
- config.getSSLCiphers());
- sslProps.setProperty(prefix +
- CLUSTER_SSL_PROTOCOLS,
- config.getSSLProtocols());
- sslProps.setProperty(prefix +
- CLUSTER_SSL_REQUIRE_AUTHENTICATION,
- String.valueOf(config.isSSLAuthenticationRequired()));
+ sslProps.setProperty(prefix + MCAST_PORT, "0");
+ sslProps.setProperty(prefix + CLUSTER_SSL_ENABLED, String.valueOf(config.isSSLEnabled()));
+ sslProps.setProperty(prefix + CLUSTER_SSL_CIPHERS, SSLUtil.arrayToSpaceDelimitedString(config.getSSLCiphers()));
+ sslProps.setProperty(prefix + CLUSTER_SSL_PROTOCOLS, SSLUtil.arrayToSpaceDelimitedString(config.getSSLProtocols()));
+ sslProps.setProperty(prefix + CLUSTER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(config.isSSLAuthenticationRequired()));
return sslProps;
}
@@ -337,13 +339,12 @@ class EnabledManagedEntityController implements ManagedEntityController {
* Starts a managed entity.
*/
public void start(final InternalManagedEntity entity) {
- final String command =
- arrangeRemoteCommand(entity, entity.getStartCommand());
+ final String command = arrangeRemoteCommand(entity, entity.getStartCommand());
Thread start = new Thread(this.threadGroup, new Runnable() {
- public void run() {
- execute(command, entity);
- }
- }, "Start " + entity.getEntityType());
+ public void run() {
+ execute(command, entity);
+ }
+ }, "Start " + entity.getEntityType());
start.start();
}
@@ -351,13 +352,12 @@ class EnabledManagedEntityController implements ManagedEntityController {
* Stops a managed entity.
*/
public void stop(final InternalManagedEntity entity) {
- final String command =
- arrangeRemoteCommand(entity, entity.getStopCommand());
+ final String command = arrangeRemoteCommand(entity, entity.getStopCommand());
Thread stop = new Thread(this.threadGroup, new Runnable() {
- public void run() {
- execute(command, entity);
- }
- }, "Stop " + entity.getEntityType());
+ public void run() {
+ execute(command, entity);
+ }
+ }, "Stop " + entity.getEntityType());
stop.start();
}
@@ -365,22 +365,17 @@ class EnabledManagedEntityController implements ManagedEntityController {
* Returns whether or not a managed entity is running
*/
public boolean isRunning(InternalManagedEntity entity) {
- final String command =
- arrangeRemoteCommand(entity, entity.getIsRunningCommand());
+ final String command = arrangeRemoteCommand(entity, entity.getIsRunningCommand());
String output = execute(command, entity);
- if (output == null ||
- (output.indexOf("stop" /* "ing" "ped" */) != -1) ||
- (output.indexOf("killed") != -1) ||
- (output.indexOf("starting") != -1)) {
+ if (output == null || (output.indexOf("stop" /* "ing" "ped" */) != -1) || (output.indexOf("killed") != -1) || (output.indexOf("starting") != -1)) {
return false;
} else if (output.indexOf("running") != -1) {
return true;
} else {
- throw new IllegalStateException(LocalizedStrings.ManagedEntityController_COULD_NOT_DETERMINE_IF_MANAGED_ENTITY_WAS_RUNNING_0
- .toLocalizedString(output));
+ throw new IllegalStateException(LocalizedStrings.ManagedEntityController_COULD_NOT_DETERMINE_IF_MANAGED_ENTITY_WAS_RUNNING_0.toLocalizedString(output));
}
}
@@ -390,8 +385,7 @@ class EnabledManagedEntityController implements ManagedEntityController {
* members.
*/
public String getLog(DistributionLocatorImpl locator) {
- String command =
- arrangeRemoteCommand(locator, locator.getLogCommand());
+ String command = arrangeRemoteCommand(locator, locator.getLogCommand());
return execute(command, locator);
}
@@ -399,13 +393,10 @@ class EnabledManagedEntityController implements ManagedEntityController {
* Returns the contents of the given directory using the given
* managed entity to determine the host and remote command.
*/
- private String listDirectory(InternalManagedEntity entity,
- String dir) {
+ private String listDirectory(InternalManagedEntity entity, String dir) {
ManagedEntityConfig config = entity.getEntityConfig();
- String listFile =
- pathIsWindows(config.getProductDirectory()) ? "dir " : "ls ";
- String command =
- arrangeRemoteCommand(entity, listFile + dir);
+ String listFile = pathIsWindows(config.getProductDirectory()) ? "dir " : "ls ";
+ String command = arrangeRemoteCommand(entity, listFile + dir);
return execute(command, entity);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/ManagedEntityConfigXmlGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/ManagedEntityConfigXmlGenerator.java b/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/ManagedEntityConfigXmlGenerator.java
index e406ba3..a2d23a6 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/ManagedEntityConfigXmlGenerator.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/ManagedEntityConfigXmlGenerator.java
@@ -16,40 +16,70 @@
*/
package com.gemstone.gemfire.admin.internal;
-import com.gemstone.gemfire.admin.*;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.AttributesImpl;
+
+import com.gemstone.gemfire.admin.AdminDistributedSystem;
+import com.gemstone.gemfire.admin.AdminException;
+import com.gemstone.gemfire.admin.CacheServer;
+import com.gemstone.gemfire.admin.CacheServerConfig;
+import com.gemstone.gemfire.admin.DistributedSystemConfig;
+import com.gemstone.gemfire.admin.DistributionLocator;
+import com.gemstone.gemfire.admin.DistributionLocatorConfig;
+import com.gemstone.gemfire.admin.ManagedEntityConfig;
import com.gemstone.gemfire.internal.Assert;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.management.internal.SSLUtil;
-import javax.xml.transform.*;
-//import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamResult;
-import org.xml.sax.*;
+//import javax.xml.transform.dom.DOMSource;
//import org.xml.sax.ext.*;
-import org.xml.sax.helpers.AttributesImpl;
-import java.io.*;
-import java.util.*;
/**
* Generates XML data that represents the managed entities in an
* <code>AdminDistributedSystem</code>. This class is used mainly for
* testing.
- *
* @since GemFire 4.0
*/
-public class ManagedEntityConfigXmlGenerator
- extends ManagedEntityConfigXml implements XMLReader {
+public class ManagedEntityConfigXmlGenerator extends ManagedEntityConfigXml implements XMLReader {
- /** An empty <code>Attributes</code> */
+ /**
+ * An empty <code>Attributes</code>
+ */
private static Attributes EMPTY = new AttributesImpl();
///////////////////////// Instance Fields ////////////////////////
- /** The <code>AdminDistributedSystem</code> for which we are
- * generating XML */
+ /**
+ * The <code>AdminDistributedSystem</code> for which we are
+ * generating XML
+ */
private AdminDistributedSystem system;
- /** The content handler to which SAX events are generated */
+ /**
+ * The content handler to which SAX events are generated
+ */
private ContentHandler handler;
///////////////////////// Static Methods ////////////////////////
@@ -58,8 +88,7 @@ public class ManagedEntityConfigXmlGenerator
* Generates an XML representation of all of the managed entities in
* the given <code>AdminDistributedSystem</code>.
*/
- public static void generate(AdminDistributedSystem system,
- PrintWriter pw) {
+ public static void generate(AdminDistributedSystem system, PrintWriter pw) {
(new ManagedEntityConfigXmlGenerator(system)).generate(pw);
}
@@ -67,10 +96,9 @@ public class ManagedEntityConfigXmlGenerator
/**
* Creates a new generator for the given
- * <code>AdminDistributedSystem</code>.
+ * <code>AdminDistributedSystem</code>.
*/
- private ManagedEntityConfigXmlGenerator(AdminDistributedSystem
- system) {
+ private ManagedEntityConfigXmlGenerator(AdminDistributedSystem system) {
this.system = system;
}
@@ -115,8 +143,7 @@ public class ManagedEntityConfigXmlGenerator
AttributesImpl atts = new AttributesImpl();
- atts.addAttribute("", "", ID, "",
- String.valueOf(this.system.getConfig().getSystemId()));
+ atts.addAttribute("", "", ID, "", String.valueOf(this.system.getConfig().getSystemId()));
handler.startElement("", DISTRIBUTED_SYSTEM, DISTRIBUTED_SYSTEM, atts);
@@ -143,8 +170,7 @@ public class ManagedEntityConfigXmlGenerator
handler.startElement("", REMOTE_COMMAND, REMOTE_COMMAND, EMPTY);
- handler.characters(remoteCommand.toCharArray(), 0,
- remoteCommand.length());
+ handler.characters(remoteCommand.toCharArray(), 0, remoteCommand.length());
handler.endElement("", REMOTE_COMMAND, REMOTE_COMMAND);
}
@@ -156,7 +182,7 @@ public class ManagedEntityConfigXmlGenerator
handler.startElement("", LOCATORS, LOCATORS, EMPTY);
generateLocators();
-
+
handler.endElement("", LOCATORS, LOCATORS);
}
@@ -164,8 +190,7 @@ public class ManagedEntityConfigXmlGenerator
* Generates XML for the distributed system's locators
*/
private void generateLocators() throws SAXException {
- DistributionLocator[] locators =
- this.system.getDistributionLocators();
+ DistributionLocator[] locators = this.system.getDistributionLocators();
for (int i = 0; i < locators.length; i++) {
generateLocator(locators[i].getConfig());
}
@@ -174,12 +199,10 @@ public class ManagedEntityConfigXmlGenerator
/**
* Generates XML for a locator
*/
- private void generateLocator(DistributionLocatorConfig config)
- throws SAXException {
-
+ private void generateLocator(DistributionLocatorConfig config) throws SAXException {
+
AttributesImpl atts = new AttributesImpl();
- atts.addAttribute("", "", PORT, "",
- String.valueOf(config.getPort()));
+ atts.addAttribute("", "", PORT, "", String.valueOf(config.getPort()));
handler.startElement("", LOCATOR, LOCATOR, atts);
@@ -191,8 +214,7 @@ public class ManagedEntityConfigXmlGenerator
/**
* Generates XML for attributes common to all managed entities.
*/
- private void generateEntityConfig(ManagedEntityConfig config)
- throws SAXException {
+ private void generateEntityConfig(ManagedEntityConfig config) throws SAXException {
String host = config.getHost();
if (host != null) {
@@ -204,24 +226,21 @@ public class ManagedEntityConfigXmlGenerator
String remoteCommand = config.getRemoteCommand();
if (remoteCommand != null) {
handler.startElement("", REMOTE_COMMAND, REMOTE_COMMAND, EMPTY);
- handler.characters(remoteCommand.toCharArray(), 0,
- remoteCommand.length());
+ handler.characters(remoteCommand.toCharArray(), 0, remoteCommand.length());
handler.endElement("", REMOTE_COMMAND, REMOTE_COMMAND);
}
String workingDirectory = config.getWorkingDirectory();
if (workingDirectory != null) {
handler.startElement("", WORKING_DIRECTORY, WORKING_DIRECTORY, EMPTY);
- handler.characters(workingDirectory.toCharArray(), 0,
- workingDirectory.length());
+ handler.characters(workingDirectory.toCharArray(), 0, workingDirectory.length());
handler.endElement("", WORKING_DIRECTORY, WORKING_DIRECTORY);
}
String productDirectory = config.getProductDirectory();
if (productDirectory != null) {
handler.startElement("", PRODUCT_DIRECTORY, PRODUCT_DIRECTORY, EMPTY);
- handler.characters(productDirectory.toCharArray(), 0,
- productDirectory.length());
+ handler.characters(productDirectory.toCharArray(), 0, productDirectory.length());
handler.endElement("", PRODUCT_DIRECTORY, PRODUCT_DIRECTORY);
}
}
@@ -239,34 +258,30 @@ public class ManagedEntityConfigXmlGenerator
}
AttributesImpl atts = new AttributesImpl();
- atts.addAttribute("", "", AUTHENTICATION_REQUIRED, "",
- String.valueOf(config.isSSLAuthenticationRequired()));
+ atts.addAttribute("", "", AUTHENTICATION_REQUIRED, "", String.valueOf(config.isSSLAuthenticationRequired()));
handler.startElement("", SSL, SSL, atts);
- String protocols = config.getSSLProtocols();
+ String protocols = SSLUtil.arrayToSpaceDelimitedString(config.getSSLProtocols());
if (protocols != null) {
handler.startElement("", PROTOCOLS, PROTOCOLS, EMPTY);
- handler.characters(protocols.toCharArray(), 0,
- protocols.length());
+ handler.characters(protocols.toCharArray(), 0, protocols.length());
handler.endElement("", PROTOCOLS, PROTOCOLS);
}
- String ciphers = config.getSSLCiphers();
+ String ciphers = SSLUtil.arrayToSpaceDelimitedString(config.getSSLCiphers());
if (ciphers != null) {
handler.startElement("", CIPHERS, CIPHERS, EMPTY);
- handler.characters(ciphers.toCharArray(), 0,
- ciphers.length());
+ handler.characters(ciphers.toCharArray(), 0, ciphers.length());
handler.endElement("", CIPHERS, CIPHERS);
}
Properties sslProps = config.getSSLProperties();
- for (Iterator iter = sslProps.entrySet().iterator();
- iter.hasNext(); ) {
+ for (Iterator iter = sslProps.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry) iter.next();
String key = (String) entry.getKey();
String value = (String) entry.getValue();
-
+
handler.startElement("", PROPERTY, PROPERTY, EMPTY);
handler.startElement("", KEY, KEY, EMPTY);
@@ -287,8 +302,7 @@ public class ManagedEntityConfigXmlGenerator
* Generates an XML representation of the
* <code>CacheServer</code>s in the distributed system.
*/
- private void generateCacheServers()
- throws SAXException, AdminException {
+ private void generateCacheServers() throws SAXException, AdminException {
CacheServer[] servers = this.system.getCacheServers();
for (int i = 0; i < servers.length; i++) {
@@ -300,8 +314,7 @@ public class ManagedEntityConfigXmlGenerator
* Generates an XML representation of a
* <code>CacheServerConfig</code>.
*/
- private void generateCacheServer(CacheServerConfig config)
- throws SAXException {
+ private void generateCacheServer(CacheServerConfig config) throws SAXException {
handler.startElement("", CACHE_SERVER, CACHE_SERVER, EMPTY);
@@ -310,8 +323,7 @@ public class ManagedEntityConfigXmlGenerator
String classpath = config.getClassPath();
if (classpath != null) {
handler.startElement("", CLASSPATH, CLASSPATH, EMPTY);
- handler.characters(classpath.toCharArray(), 0,
- classpath.length());
+ handler.characters(classpath.toCharArray(), 0, classpath.length());
handler.endElement("", CLASSPATH, CLASSPATH);
}
@@ -323,11 +335,11 @@ public class ManagedEntityConfigXmlGenerator
*/
public void setContentHandler(ContentHandler handler) {
this.handler = handler;
- }
+ }
public ContentHandler getContentHandler() {
return this.handler;
- }
+ }
public ErrorHandler getErrorHandler() {
return this;
@@ -335,24 +347,20 @@ public class ManagedEntityConfigXmlGenerator
////////// Inherited methods that don't do anything //////////
- public boolean getFeature(String name)
- throws SAXNotRecognizedException, SAXNotSupportedException {
+ public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
return false;
}
- public void setFeature(String name, boolean value)
- throws SAXNotRecognizedException, SAXNotSupportedException {
+ public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
}
- public Object getProperty(String name)
- throws SAXNotRecognizedException, SAXNotSupportedException {
+ public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
return null;
}
- public void setProperty(String name, Object value)
- throws SAXNotRecognizedException, SAXNotSupportedException {
+ public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
}
@@ -363,7 +371,7 @@ public class ManagedEntityConfigXmlGenerator
public EntityResolver getEntityResolver() {
return this;
}
-
+
public void setDTDHandler(DTDHandler handler) {
}
@@ -376,8 +384,7 @@ public class ManagedEntityConfigXmlGenerator
}
- public void parse(String systemId)
- throws IOException, SAXException {
+ public void parse(String systemId) throws IOException, SAXException {
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/ManagedEntityConfigXmlParser.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/ManagedEntityConfigXmlParser.java b/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/ManagedEntityConfigXmlParser.java
index 58e90e9..9ea26c9 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/ManagedEntityConfigXmlParser.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/admin/internal/ManagedEntityConfigXmlParser.java
@@ -16,30 +16,43 @@
*/
package com.gemstone.gemfire.admin.internal;
-import com.gemstone.gemfire.admin.*;
-import com.gemstone.gemfire.internal.Assert;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-
+import java.io.InputStream;
+import java.util.Stack;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import org.xml.sax.*;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
-import java.io.*;
-import java.util.*;
+
+import com.gemstone.gemfire.admin.AdminXmlException;
+import com.gemstone.gemfire.admin.CacheServerConfig;
+import com.gemstone.gemfire.admin.DistributedSystemConfig;
+import com.gemstone.gemfire.admin.DistributionLocatorConfig;
+import com.gemstone.gemfire.admin.ManagedEntityConfig;
+import com.gemstone.gemfire.internal.Assert;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.management.internal.SSLUtil;
/**
* Parses an XML file and configures a {@link DistributedSystemConfig}
* from it.
- *
* @since GemFire 4.0
*/
-public class ManagedEntityConfigXmlParser
- extends ManagedEntityConfigXml implements ContentHandler {
+public class ManagedEntityConfigXmlParser extends ManagedEntityConfigXml implements ContentHandler {
- /** The <code>DistributedSystemConfig</code> to be configured */
+ /**
+ * The <code>DistributedSystemConfig</code> to be configured
+ */
private DistributedSystemConfig config;
- /** The stack of intermediate values used while parsing */
+ /**
+ * The stack of intermediate values used while parsing
+ */
private Stack stack = new Stack();
////////////////////// Static Methods //////////////////////
@@ -47,14 +60,10 @@ public class ManagedEntityConfigXmlParser
/**
* Parses XML data and from it configures a
* <code>DistributedSystemConfig</code>.
- *
- * @throws AdminXmlException
- * If an error is encountered while parsing the XML
+ * @throws AdminXmlException If an error is encountered while parsing the XML
*/
- public static void parse(InputStream is,
- DistributedSystemConfig config) {
- ManagedEntityConfigXmlParser handler =
- new ManagedEntityConfigXmlParser();
+ public static void parse(InputStream is, DistributedSystemConfig config) {
+ ManagedEntityConfigXmlParser handler = new ManagedEntityConfigXmlParser();
handler.config = config;
try {
@@ -87,9 +96,7 @@ public class ManagedEntityConfigXmlParser
/**
* Helper method for parsing an integer
- *
- * @throws com.gemstone.gemfire.cache.CacheXmlException
- * If <code>s</code> is a malformed integer
+ * @throws com.gemstone.gemfire.cache.CacheXmlException If <code>s</code> is a malformed integer
*/
private static int parseInt(String s) {
try {
@@ -102,13 +109,11 @@ public class ManagedEntityConfigXmlParser
////////////////////// Instance Methods //////////////////////
-// if (this.system.isMcastEnabled()) {
-// generateMulticast();
-// }
+ // if (this.system.isMcastEnabled()) {
+ // generateMulticast();
+ // }
- public void startElement(String namespaceURI, String localName,
- String qName, Attributes atts)
- throws SAXException {
+ public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
if (qName.equals(DISTRIBUTED_SYSTEM)) {
startDistributedSystem(atts);
@@ -118,7 +123,7 @@ public class ManagedEntityConfigXmlParser
} else if (qName.equals(LOCATORS)) {
startLocators(atts);
-
+
} else if (qName.equals(MULTICAST)) {
startMulticast(atts);
@@ -163,9 +168,7 @@ public class ManagedEntityConfigXmlParser
}
}
- public void endElement(String namespaceURI, String localName,
- String qName)
- throws SAXException {
+ public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
if (qName.equals(DISTRIBUTED_SYSTEM)) {
endDistributedSystem();
@@ -231,7 +234,7 @@ public class ManagedEntityConfigXmlParser
if (id != null) {
this.config.setSystemId(id);
}
-
+
String disable_tcp = atts.getValue(DISABLE_TCP);
if (disable_tcp != null) {
this.config.setDisableTcp(DISABLE_TCP.equalsIgnoreCase("true"));
@@ -244,7 +247,7 @@ public class ManagedEntityConfigXmlParser
* When a <code>distributed-system</code> element is finished
*/
private void endDistributedSystem() {
-
+
}
/**
@@ -253,8 +256,7 @@ public class ManagedEntityConfigXmlParser
* and set its multicast config appropriately.
*/
private void startMulticast(Attributes atts) {
- DistributedSystemConfig config =
- (DistributedSystemConfig) stack.peek();
+ DistributedSystemConfig config = (DistributedSystemConfig) stack.peek();
String port = atts.getValue(PORT);
config.setMcastPort(parseInt(port));
@@ -296,8 +298,7 @@ public class ManagedEntityConfigXmlParser
((ManagedEntityConfig) top).setRemoteCommand(remoteCommand);
} else {
- String s = "Did not expect a " + top.getClass().getName() +
- " on top of the stack";
+ String s = "Did not expect a " + top.getClass().getName() + " on top of the stack";
Assert.assertTrue(false, s);
}
}
@@ -313,13 +314,11 @@ public class ManagedEntityConfigXmlParser
private void startLocator(Attributes atts) {
String port = atts.getValue(PORT);
- DistributedSystemConfig system =
- (DistributedSystemConfig) stack.peek();
+ DistributedSystemConfig system = (DistributedSystemConfig) stack.peek();
system.setMcastPort(0);
- DistributionLocatorConfig config =
- system.createDistributionLocatorConfig();
-
+ DistributionLocatorConfig config = system.createDistributionLocatorConfig();
+
config.setPort(parseInt(port));
stack.push(config);
@@ -365,12 +364,10 @@ public class ManagedEntityConfigXmlParser
}
private void startSSL(Attributes atts) {
- DistributedSystemConfig config =
- (DistributedSystemConfig) stack.peek();
+ DistributedSystemConfig config = (DistributedSystemConfig) stack.peek();
config.setSSLEnabled(true);
- String authenticationRequired =
- atts.getValue(AUTHENTICATION_REQUIRED);
+ String authenticationRequired = atts.getValue(AUTHENTICATION_REQUIRED);
config.setSSLAuthenticationRequired(Boolean.valueOf(authenticationRequired).booleanValue());
}
@@ -384,9 +381,8 @@ public class ManagedEntityConfigXmlParser
private void endProtocols() {
String protocols = popString();
- DistributedSystemConfig config =
- (DistributedSystemConfig) stack.peek();
- config.setSSLProtocols(protocols);
+ DistributedSystemConfig config = (DistributedSystemConfig) stack.peek();
+ config.setSSLProtocols(SSLUtil.stringToArray(protocols));
}
private void startCiphers(Attributes atts) {
@@ -395,9 +391,8 @@ public class ManagedEntityConfigXmlParser
private void endCiphers() {
String ciphers = popString();
- DistributedSystemConfig config =
- (DistributedSystemConfig) stack.peek();
- config.setSSLCiphers(ciphers);
+ DistributedSystemConfig config = (DistributedSystemConfig) stack.peek();
+ config.setSSLCiphers(SSLUtil.stringToArray(ciphers));
}
private void startProperty(Attributes atts) {
@@ -407,8 +402,7 @@ public class ManagedEntityConfigXmlParser
private void endProperty() {
String value = popString();
String key = popString();
- DistributedSystemConfig config =
- (DistributedSystemConfig) stack.peek();
+ DistributedSystemConfig config = (DistributedSystemConfig) stack.peek();
config.addSSLProperty(key, value);
}
@@ -431,15 +425,14 @@ public class ManagedEntityConfigXmlParser
}
private void startCacheServer(Attributes atts) {
- DistributedSystemConfig config =
- (DistributedSystemConfig) stack.peek();
- CacheServerConfig server =
- config.createCacheServerConfig();
+ DistributedSystemConfig config = (DistributedSystemConfig) stack.peek();
+ CacheServerConfig server = config.createCacheServerConfig();
stack.push(server);
}
private void endCacheServer() {
- /* CacheServerConfig server = (CacheServerConfig) */ stack.pop();
+ /* CacheServerConfig server = (CacheServerConfig) */
+ stack.pop();
}
private void startClassPath(Attributes atts) {
@@ -473,8 +466,7 @@ public class ManagedEntityConfigXmlParser
* into one big string by using a <code>StringBuffer</code>. See
* bug 32122.
*/
- public void characters(char[] ch, int start, int length)
- throws SAXException {
+ public void characters(char[] ch, int start, int length) throws SAXException {
Object top = stack.peek();
@@ -492,25 +484,29 @@ public class ManagedEntityConfigXmlParser
////////// Inherited methods that don't do anything //////////
- public void setDocumentLocator(Locator locator) { }
+ public void setDocumentLocator(Locator locator) {
+ }
- public void startDocument() throws SAXException { }
+ public void startDocument() throws SAXException {
+ }
- public void endDocument() throws SAXException { }
+ public void endDocument() throws SAXException {
+ }
- public void startPrefixMapping(String prefix, String uri)
- throws SAXException { }
+ public void startPrefixMapping(String prefix, String uri) throws SAXException {
+ }
- public void endPrefixMapping(String prefix)
- throws SAXException { }
+ public void endPrefixMapping(String prefix) throws SAXException {
+ }
- public void ignorableWhitespace(char[] ch, int start, int length)
- throws SAXException { }
+ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
+ }
- public void processingInstruction(String target, String data)
- throws SAXException { }
+ public void processingInstruction(String target, String data) throws SAXException {
+ }
- public void skippedEntity(String name) throws SAXException { }
+ public void skippedEntity(String name) throws SAXException {
+ }
/////////////////////// Inner Classes ///////////////////////
@@ -521,8 +517,11 @@ public class ManagedEntityConfigXmlParser
* <B>is not</B> a <code>DefaultHandler</code>.
*/
static class DefaultHandlerDelegate extends DefaultHandler {
- /** The <code>ManagedEntityConfigXmlParser</code> that does the
- * real work */
+
+ /**
+ * The <code>ManagedEntityConfigXmlParser</code> that does the
+ * real work
+ */
private ManagedEntityConfigXmlParser handler;
/**
@@ -535,9 +534,7 @@ public class ManagedEntityConfigXmlParser
}
@Override
- public InputSource resolveEntity(String publicId,
- String systemId)
- throws SAXException {
+ public InputSource resolveEntity(String publicId, String systemId) throws SAXException {
return handler.resolveEntity(publicId, systemId);
}
@@ -557,8 +554,7 @@ public class ManagedEntityConfigXmlParser
}
@Override
- public void startPrefixMapping(String prefix, String uri)
- throws SAXException {
+ public void startPrefixMapping(String prefix, String uri) throws SAXException {
handler.startPrefixMapping(prefix, uri);
}
@@ -568,33 +564,27 @@ public class ManagedEntityConfigXmlParser
}
@Override
- public void startElement(String uri, String localName,
- String qName, Attributes attributes)
- throws SAXException {
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
handler.startElement(uri, localName, qName, attributes);
}
@Override
- public void endElement(String uri, String localName, String qName)
- throws SAXException {
+ public void endElement(String uri, String localName, String qName) throws SAXException {
handler.endElement(uri, localName, qName);
}
@Override
- public void characters(char[] ch, int start, int length)
- throws SAXException {
+ public void characters(char[] ch, int start, int length) throws SAXException {
handler.characters(ch, start, length);
}
@Override
- public void ignorableWhitespace(char[] ch, int start, int length)
- throws SAXException {
+ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
handler.ignorableWhitespace(ch, start, length);
}
@Override
- public void processingInstruction(String target, String data)
- throws SAXException {
+ public void processingInstruction(String target, String data) throws SAXException {
handler.processingInstruction(target, data);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/AdminDistributedSystemJmxImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/AdminDistributedSystemJmxImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/AdminDistributedSystemJmxImpl.java
index fa5a1ea..d920265 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/AdminDistributedSystemJmxImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/AdminDistributedSystemJmxImpl.java
@@ -1191,19 +1191,19 @@ public class AdminDistributedSystemJmxImpl
this.getConfig().setSSLEnabled(enabled);
}
- public String getSSLProtocols() {
+ public String[] getSSLProtocols() {
return this.getConfig().getSSLProtocols();
}
- public void setSSLProtocols(String protocols) {
+ public void setSSLProtocols(final String[] protocols) {
this.getConfig().setSSLProtocols(protocols);
}
- public String getSSLCiphers() {
+ public String[] getSSLCiphers() {
return this.getConfig().getSSLCiphers();
}
- public void setSSLCiphers(String ciphers) {
+ public void setSSLCiphers(final String[] ciphers) {
this.getConfig().setSSLCiphers(ciphers);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/AgentConfigImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/AgentConfigImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/AgentConfigImpl.java
index 6aa8944..72dd46e 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/AgentConfigImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/AgentConfigImpl.java
@@ -42,6 +42,7 @@ import com.gemstone.gemfire.admin.jmx.AgentConfig;
import com.gemstone.gemfire.internal.ClassPathLoader;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
import com.gemstone.gemfire.internal.util.IOUtils;
+import com.gemstone.gemfire.management.internal.SSLUtil;
/**
* Provides the JMX Agent configuration properties.
@@ -936,8 +937,8 @@ public class AgentConfigImpl extends DistributedSystemConfigImpl implements Agen
this.httpAuthPassword = validateNonEmptyString(props.getProperty(HTTP_AUTHENTICATION_PASSWORD_NAME), DEFAULT_HTTP_AUTHENTICATION_PASSWORD);
this.sslEnabled = validateBoolean(props.getProperty(CLUSTER_SSL_ENABLED), DEFAULT_SSL_ENABLED);
- this.sslProtocols = validateNonEmptyString(props.getProperty(CLUSTER_SSL_PROTOCOLS), DEFAULT_SSL_PROTOCOLS);
- this.sslCiphers = validateNonEmptyString(props.getProperty(CLUSTER_SSL_CIPHERS), DEFAULT_SSL_CIPHERS);
+ this.sslProtocols = validateNonEmptyStringArray(props.getProperty(CLUSTER_SSL_PROTOCOLS), DEFAULT_SSL_PROTOCOLS);
+ this.sslCiphers = validateNonEmptyStringArray(props.getProperty(CLUSTER_SSL_CIPHERS), DEFAULT_SSL_CIPHERS);
this.sslAuthenticationRequired = validateBoolean(props.getProperty(CLUSTER_SSL_REQUIRE_AUTHENTICATION), DEFAULT_SSL_REQUIRE_AUTHENTICATION);
this.sslProperties = new Properties();
for (int i = 0; true; i++) {
@@ -996,6 +997,10 @@ public class AgentConfigImpl extends DistributedSystemConfigImpl implements Agen
}
}
+ private String[] validateNonEmptyStringArray(final String property, final String defaultSslProtocols) {
+ return isEmpty(property) ? SSLUtil.stringToArray(defaultSslProtocols) : SSLUtil.stringToArray(property);
+ }
+
/**
* Filter all agent configuration attributes out of the given <code>Properties</code> object.
* <p/>
@@ -1676,8 +1681,8 @@ public class AgentConfigImpl extends DistributedSystemConfigImpl implements Agen
// SSL support...
// -------------------------------------------------------------------------
private boolean sslEnabled = DEFAULT_SSL_ENABLED;
- private String sslProtocols = DEFAULT_SSL_PROTOCOLS;
- private String sslCiphers = DEFAULT_SSL_CIPHERS;
+ private String[] sslProtocols = new String[] { DEFAULT_SSL_PROTOCOLS };
+ private String[] sslCiphers = new String[] { DEFAULT_SSL_CIPHERS };
private boolean sslAuthenticationRequired = DEFAULT_SSL_REQUIRE_AUTHENTICATION;
private Properties sslProperties = new Properties();
@@ -1693,23 +1698,23 @@ public class AgentConfigImpl extends DistributedSystemConfigImpl implements Agen
}
@Override
- public String getSSLProtocols() {
+ public String[] getSSLProtocols() {
return this.sslProtocols;
}
@Override
- public void setSSLProtocols(String protocols) {
+ public void setSSLProtocols(String[] protocols) {
this.sslProtocols = protocols;
configChanged();
}
@Override
- public String getSSLCiphers() {
+ public String[] getSSLCiphers() {
return this.sslCiphers;
}
@Override
- public void setSSLCiphers(String ciphers) {
+ public void setSSLCiphers(String[] ciphers) {
this.sslCiphers = ciphers;
configChanged();
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/AgentImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/AgentImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/AgentImpl.java
index 7d880ad..7000aea 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/AgentImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/AgentImpl.java
@@ -1422,16 +1422,16 @@ implements com.gemstone.gemfire.admin.jmx.Agent,
public void setSSLEnabled(boolean enabled) {
this.agentConfig.setSSLEnabled(enabled);
}
- public String getSSLProtocols() {
+ public String[] getSSLProtocols() {
return this.agentConfig.getSSLProtocols();
}
- public void setSSLProtocols(String protocols) {
+ public void setSSLProtocols(String[] protocols) {
this.agentConfig.setSSLProtocols(protocols);
}
- public String getSSLCiphers() {
+ public String[] getSSLCiphers() {
return this.agentConfig.getSSLCiphers();
}
- public void setSSLCiphers(String ciphers) {
+ public void setSSLCiphers(String[] ciphers) {
this.agentConfig.setSSLCiphers(ciphers);
}
public boolean isSSLAuthenticationRequired() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/distributed/ConfigurationProperties.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/ConfigurationProperties.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/ConfigurationProperties.java
index 34953a0..049cbd2 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/ConfigurationProperties.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/ConfigurationProperties.java
@@ -1710,7 +1710,7 @@ public interface ConfigurationProperties {
/**
* The static String definition of the <i>"cluster-ssl-protocols"</i> property
* <a name="ssl-protocols"/a></p>
- * <U>Description</U>: A space separated list of the SSL protocols to
+ * <U>Description</U>: A comma separated list of the SSL protocols to
* enable. Those listed must be supported by the available providers.
* </p>
* <U>Default</U>: "any"</p>