Cleanup to the SDG dependency repository references, preferring Spring IO Repos over external repos (such as dist.gemstone.com). Added conditional logic around the GemFire 8 Distribution Configuration Properties in the CacheFactoryBean in an effort to enable SDG 1.5 to work with GemFire 7.x versions and earlier. Refactored the GemfireUtils class's logic for detecting GemFire Versions at runtime.
This commit is contained in:
@@ -12,8 +12,9 @@ description = 'Spring Data GemFire'
|
||||
group = 'org.springframework.data'
|
||||
|
||||
repositories {
|
||||
maven { url "http://repo.spring.io/gemstone-release-cache" }
|
||||
//maven { url "http://nexus.gemstone.com:8081/nexus/content/repositories/snapshots" }
|
||||
maven { url "http://dist.gemstone.com.s3.amazonaws.com/maven/release"}
|
||||
maven { url "http://dist.gemstone.com/maven/release"}
|
||||
maven { url "http://repo.spring.io/gemstone-snapshot-cache" }
|
||||
maven { url "http://repo.spring.io/libs-snapshot" }
|
||||
maven { url "http://repo.spring.io/plugins-release"}
|
||||
|
||||
@@ -909,10 +909,12 @@ public class CacheFactoryBean implements BeanClassLoaderAware, BeanFactoryAware,
|
||||
}
|
||||
|
||||
protected void postProcessPropertiesBeforeInitialization(Properties gemfireProperties) {
|
||||
gemfireProperties.setProperty("disable-auto-reconnect", String.valueOf(
|
||||
!Boolean.TRUE.equals(getEnableAutoReconnect())));
|
||||
gemfireProperties.setProperty("use-cluster-configuration", String.valueOf(
|
||||
Boolean.TRUE.equals(getUseClusterConfiguration())));
|
||||
if (GemfireUtils.isGemfireVersion8OrAbove()) {
|
||||
gemfireProperties.setProperty("disable-auto-reconnect", String.valueOf(
|
||||
!Boolean.TRUE.equals(getEnableAutoReconnect())));
|
||||
gemfireProperties.setProperty("use-cluster-configuration", String.valueOf(
|
||||
Boolean.TRUE.equals(getUseClusterConfiguration())));
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -34,6 +34,11 @@ public abstract class GemfireUtils {
|
||||
|
||||
public final static String GEMFIRE_VERSION = CacheFactory.getVersion();
|
||||
|
||||
public static boolean isGemfireVersionGreaterThanEqual(double expectedVersion) {
|
||||
double actualVersion = Double.parseDouble(GEMFIRE_VERSION.substring(0, 3));
|
||||
return actualVersion >= expectedVersion;
|
||||
}
|
||||
|
||||
public static boolean isGemfireVersion65OrAbove() {
|
||||
// expected 'major.minor'
|
||||
try {
|
||||
@@ -48,15 +53,25 @@ public abstract class GemfireUtils {
|
||||
|
||||
public static boolean isGemfireVersion7OrAbove() {
|
||||
try {
|
||||
int version = Integer.parseInt(GEMFIRE_VERSION.substring(0, 1));
|
||||
return version >= 7;
|
||||
return isGemfireVersionGreaterThanEqual(7.0);
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
// NOTE the com.gemstone.gemfire.distributed.ServerLauncher class only exists in GemFire v 7.0.x or above...
|
||||
return ClassUtils.isPresent("com.gemstone.gemfire.distributed.ServerLauncher",
|
||||
Thread.currentThread().getContextClassLoader());
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isGemfireVersion8OrAbove() {
|
||||
try {
|
||||
return isGemfireVersionGreaterThanEqual(8.0);
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
// NOTE the com.gemstone.gemfire.management.internal.web.domain.LinkIndex class only exists
|
||||
// in GemFire v 8.0.0 or above...
|
||||
return ClassUtils.isPresent("com.gemstone.gemfire.management.internal.web.domain.LinkIndex",
|
||||
Thread.currentThread().getContextClassLoader());
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(final String... args) {
|
||||
|
||||
Reference in New Issue
Block a user