SGF-493 - Remove unnecessary GemFire/Geode version checks.

This commit is contained in:
John Blum
2016-05-05 14:04:13 -07:00
parent 1723653a17
commit 54befa0522
2 changed files with 1 additions and 84 deletions

View File

@@ -16,15 +16,12 @@
package org.springframework.data.gemfire;
import java.util.concurrent.ConcurrentMap;
import org.springframework.data.gemfire.config.support.GemfireFeature;
import org.springframework.data.gemfire.util.CacheUtils;
import org.springframework.util.ClassUtils;
import org.w3c.dom.Element;
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.internal.GemFireVersion;
/**
@@ -37,7 +34,6 @@ import com.gemstone.gemfire.internal.GemFireVersion;
* @see com.gemstone.gemfire.cache.Region
* @since 1.3.3
*/
@SuppressWarnings("unused")
public abstract class GemfireUtils extends CacheUtils {
public final static String GEMFIRE_NAME = GemFireVersion.getProductName();
@@ -115,48 +111,6 @@ public abstract class GemfireUtils extends CacheUtils {
return isClassAvailable(GATEWAY_SENDER_TYPE_NAME);
}
/* (non-Javadoc) */
public static boolean isGemfireVersionGreaterThanEqualTo(double expectedVersion) {
double actualVersion = Double.parseDouble(GEMFIRE_VERSION.substring(0, 3));
return (actualVersion >= expectedVersion);
}
/* (non-Javadoc) */
public static boolean isGemfireVersion65OrAbove() {
try {
return isGemfireVersionGreaterThanEqualTo(6.5);
}
catch (NumberFormatException e) {
// NOTE based on logic from the PartitionedRegionFactoryBean class...
return ConcurrentMap.class.isAssignableFrom(Region.class);
}
}
/* (non-Javadoc) */
public static boolean isGemfireVersion7OrAbove() {
try {
return isGemfireVersionGreaterThanEqualTo(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());
}
}
/* (non-Javadoc) */
public static boolean isGemfireVersion8OrAbove() {
try {
return isGemfireVersionGreaterThanEqualTo(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) {
System.out.printf("GemFire Product Name (%1$s) Version (%2$s)%n", GEMFIRE_NAME, GEMFIRE_VERSION);
//System.out.printf("Is GemFire Version 6.5 of Above? %1$s%n", isGemfireVersion65OrAbove());