public class CacheHelper extends Object
CacheDescription. Methods are thread-safe.| Modifier and Type | Field and Description |
|---|---|
static String |
CACHE_SERVER_PORT_TAG
Tag used in pre-existing XML files to represent autogenerated ports.
|
protected static String |
TheCacheConfig
Name of the cache description used to create the current cache
|
| Constructor and Description |
|---|
CacheHelper() |
| Modifier and Type | Method and Description |
|---|---|
static String |
cacheToString(com.gemstone.gemfire.cache.Cache cache)
Returns the given cache as a string.
|
static void |
closeCache()
Closes the cache if it exists and is open.
|
static com.gemstone.gemfire.cache.Cache |
createCache(String cacheConfig)
Creates a cache for the given cache configuration from
CachePrms.names, configured using the corresponding CacheDescription. |
static com.gemstone.gemfire.cache.Cache |
createCacheFromXml(String cacheXmlFile)
Creates a cache using the given XML configuration file.
|
static void |
finishCacheXmlGenerationForGateway(com.gemstone.gemfire.cache.Cache cache,
String cacheConfig,
String gatewayHubConfig,
String gatewayConfig,
String regionConfig,
List regionNames,
String bridgeConfig,
String poolConfig,
String diskStoreConfig,
List functions,
String cacheXmlFile)
Generates XML for the given cache (the creation object returned by
generateCacheXmlForGatewayHub) with the given gatewayConfig, region,
bridge, pool, and disk store configurations from
GatewayPrms.names,
CachePrms.names, RegionPrms.names, BridgePrms.names,
PoolPrms.names, and DiskStorePrms.names. |
static void |
generateCacheXmlFile(String cacheConfig,
com.gemstone.gemfire.cache.DynamicRegionFactory.Config dynamicRegionConfig,
String regionConfig,
List regionNames,
String bridgeConfig,
String poolConfig,
String cacheXmlFile)
Generates XML for the given cache, region, bridge, and pool configurations
from
DynamicRegionFactory.Config, CachePrms.names, RegionPrms.names, BridgePrms.names, and PoolPrms.names,
using the corresponding CacheDescription, RegionDescription, BridgeDescription, and PoolDescription. |
static void |
generateCacheXmlFile(String cacheConfig,
com.gemstone.gemfire.cache.DynamicRegionFactory.Config dynamicRegionConfig,
String regionConfig,
List regionNames,
String bridgeConfig,
String poolConfig,
String diskStoreConfig,
List functions,
String cacheXmlFile)
Generates XML for the given cache, region, bridge, pool, and disk store
configurations from
DynamicRegionFactory.Config, CachePrms.names, RegionPrms.names, BridgePrms.names,
PoolPrms.names, and DiskStorePrms.names, using the
corresponding CacheDescription, RegionDescription, BridgeDescription, PoolDescription, and DiskStoreDescription. |
static void |
generateCacheXmlFile(String cacheConfig,
com.gemstone.gemfire.cache.DynamicRegionFactory.Config dynamicRegionConfig,
String regionConfig,
List regionNames,
String bridgeConfig,
String poolConfig,
String diskStoreConfig,
String gatewaySenderConfig,
String gatewayReceiverConfig,
String asyncEventQueueConfig,
List functions,
String cacheXmlFile)
Generates XML for the given cache, region, bridge, pool, and disk store
configurations from
DynamicRegionFactory.Config, CachePrms.names, RegionPrms.names, BridgePrms.names,
PoolPrms.names, and DiskStorePrms.names, using the
corresponding CacheDescription, RegionDescription, BridgeDescription, PoolDescription, DiskStoreDescription, etc. |
static void |
generateCacheXmlFile(String cacheConfig,
String regionConfig,
List regionNames,
String cacheXmlFile)
Generates XML for the given cache and region configurations from
CachePrms.names and RegionPrms.names, using the corresponding
CacheDescription and RegionDescription. |
static void |
generateCacheXmlFile(String cacheConfig,
String regionConfig,
List regionNames,
String bridgeConfig,
String poolConfig,
String cacheXmlFile)
Generates XML for the given cache, region, bridge, and pool configurations
from
CachePrms.names, RegionPrms.names, #names, and PoolPrms.names, using the corresponding CacheDescription, RegionDescription, BridgeDescription,
and PoolDescription. |
static void |
generateCacheXmlFile(String cacheConfig,
String regionConfig,
String cacheXmlFile)
Generates XML for the given cache and region configurations from
CachePrms.names and RegionPrms.names, using the corresponding
CacheDescription and RegionDescription. |
static void |
generateCacheXmlFile(String cacheConfig,
String regionConfig,
String bridgeConfig,
String poolConfig,
String cacheXmlFile)
Generates XML for the given cache, region, bridge, and pool configurations
from
CachePrms.names, RegionPrms.names, #names, and PoolPrms.names, using the corresponding CacheDescription, RegionDescription, BridgeDescription,
and PoolDescription. |
static void |
generateCacheXmlFileNoCheck(String cacheConfig,
com.gemstone.gemfire.cache.DynamicRegionFactory.Config dynamicRegionConfig,
List regionConfigs,
List regionNames,
String bridgeConfig,
List poolConfigs,
List diskStoreConfigs,
List functions,
String cacheXmlFile)
Generates XML for the given cache, region, bridge, pool, and disk store
configurations from
DynamicRegionFactory.Config, CachePrms.names, RegionPrms.names, BridgePrms.names,
PoolPrms.names, and DiskStorePrms.names, using the
corresponding CacheDescription, RegionDescriptions, BridgeDescription, PoolDescriptions, and DiskStoreDescriptions. |
static void |
generateCacheXmlFileNoCheck(String cacheConfig,
com.gemstone.gemfire.cache.DynamicRegionFactory.Config dynamicRegionConfig,
List regionConfigs,
List regionNames,
String bridgeConfig,
List poolConfigs,
List diskStoreConfigs,
String gatewaySenderConfig,
String gatewayReceiverConfig,
String asyncEventQueueConfig,
List functions,
String cacheXmlFile)
Generates XML for the given cache, region, bridge, pool, and disk store
configurations from
DynamicRegionFactory.Config, CachePrms.names, RegionPrms.names, BridgePrms.names,
PoolPrms.names, and DiskStorePrms.names, using the
corresponding CacheDescription, RegionDescriptions, BridgeDescription, PoolDescriptions, DiskStoreDescriptions, etc. |
static void |
generateCacheXmlFileNoCheck(String cacheConfig,
com.gemstone.gemfire.cache.DynamicRegionFactory.Config dynamicRegionConfig,
List regionConfigs,
List regionNames,
String bridgeConfig,
List poolConfigs,
String cacheXmlFile)
Generates XML for the given cache, region, bridge, and pool configurations
from
DynamicRegionFactory.Config, CachePrms.names, RegionPrms.names, BridgePrms.names, and PoolPrms.names,
using the corresponding CacheDescription, RegionDescriptions, BridgeDescription, and PoolDescriptions. |
static com.gemstone.gemfire.cache.Cache |
getCache()
Returns the cache if it exists and is open, or null if no cache exists.
|
static CacheDescription |
getCacheDescription(String cacheConfig)
Returns the
CacheDescription with the given configuration name
from CachePrms.names. |
static com.gemstone.gemfire.cache.Cache |
startCacheXmlGenerationForGateway(String cacheConfig,
com.gemstone.gemfire.cache.DynamicRegionFactory.Config dynamicRegionConfig,
String gatewayHubConfig,
String cacheXmlFile)
Generates a CacheCreation object (dummyCache) for the given cache, dynamicRegionConfig
and GatewayHubConfig using configurations from
GatewayHubPrms.names,
DynamicRegionFactory.Config, and CachePrms#names. |
public static String CACHE_SERVER_PORT_TAG
protected static String TheCacheConfig
public static com.gemstone.gemfire.cache.Cache createCache(String cacheConfig)
CachePrms.names, configured using the corresponding CacheDescription. Returns the existing cache if it was previously
created and is still open.
The distributed system is automatically connected using DistributedSystemHelper.connect().
HydraRuntimeException - if an attempt is made to reconfigure an
existing cache.public static com.gemstone.gemfire.cache.Cache createCacheFromXml(String cacheXmlFile)
Replaces any occurrences of CACHE_SERVER_PORT_TAG in the file
with an autogenerated random port.
The distributed system is automatically connected using DistributedSystemHelper#connect(String).
HydraRuntimeException - if an attempt is made to reconfigure an
existing cache.public static void generateCacheXmlFile(String cacheConfig, String regionConfig, String cacheXmlFile)
CachePrms.names and RegionPrms.names, using the corresponding
CacheDescription and RegionDescription. Writes the result
to the specified file.
IMPORTANT: This method should only be invoked from the VM that will use the result. Otherwise, runtime-generated artifacts (e.g., ports, disk directories) might not work as required.
IMPORTANT: This method is not synchronized across multiple VMs. It is up to the user to avoid writing to the same filename from multiple VMs.
HydraRuntimeException - if an attempt is made to rewrite an existing
cache XML file with different content.public static void generateCacheXmlFile(String cacheConfig, String regionConfig, List regionNames, String cacheXmlFile)
CachePrms.names and RegionPrms.names, using the corresponding
CacheDescription and RegionDescription. Creates a region
for each region name. Writes the result to the specified file.
IMPORTANT: This method should only be invoked from the VM that will use the result. Otherwise, runtime-generated artifacts (e.g., ports, disk directories) might not work as required.
IMPORTANT: This method is not synchronized across multiple VMs. It is up to the user to avoid writing to the same filename from multiple VMs.
HydraRuntimeException - if an attempt is made to rewrite an existing
cache XML file with different content.public static void generateCacheXmlFile(String cacheConfig, String regionConfig, String bridgeConfig, String poolConfig, String cacheXmlFile)
CachePrms.names, RegionPrms.names, #names, and PoolPrms.names, using the corresponding CacheDescription, RegionDescription, BridgeDescription,
and PoolDescription. Writes the result to the specified file.
IMPORTANT: This method should only be invoked from the VM that will use the result. Otherwise, runtime-generated artifacts (e.g., ports, disk directories) might not work as required.
IMPORTANT: This method is not synchronized across multiple VMs. It is up to the user to avoid writing to the same filename from multiple VMs.
HydraRuntimeException - if an attempt is made to rewrite an existing
cache XML file with different content.public static void generateCacheXmlFile(String cacheConfig, String regionConfig, List regionNames, String bridgeConfig, String poolConfig, String cacheXmlFile)
CachePrms.names, RegionPrms.names, #names, and PoolPrms.names, using the corresponding CacheDescription, RegionDescription, BridgeDescription,
and PoolDescription. Creates a region for each region name.
Writes the result to the specified file.
IMPORTANT: This method should only be invoked from the VM that will use the result. Otherwise, runtime-generated artifacts (e.g., ports, disk directories) might not work as required.
IMPORTANT: This method is not synchronized across multiple VMs. It is up to the user to avoid writing to the same filename from multiple VMs.
HydraRuntimeException - if an attempt is made to rewrite an existing
cache XML file with different content.public static void generateCacheXmlFile(String cacheConfig, com.gemstone.gemfire.cache.DynamicRegionFactory.Config dynamicRegionConfig, String regionConfig, List regionNames, String bridgeConfig, String poolConfig, String cacheXmlFile)
DynamicRegionFactory.Config, CachePrms.names, RegionPrms.names, BridgePrms.names, and PoolPrms.names,
using the corresponding CacheDescription, RegionDescription, BridgeDescription, and PoolDescription.
Creates a region for each region name. Writes the result to the specified
file.
IMPORTANT: This method should only be invoked from the VM that will use the result. Otherwise, runtime-generated artifacts (e.g., ports, disk directories) might not work as required.
IMPORTANT: This method is not synchronized across multiple VMs. It is up to the user to avoid writing to the same filename from multiple VMs.
HydraRuntimeException - if an attempt is made to rewrite an existing
cache XML file with different content.public static void generateCacheXmlFile(String cacheConfig, com.gemstone.gemfire.cache.DynamicRegionFactory.Config dynamicRegionConfig, String regionConfig, List regionNames, String bridgeConfig, String poolConfig, String diskStoreConfig, List functions, String cacheXmlFile)
DynamicRegionFactory.Config, CachePrms.names, RegionPrms.names, BridgePrms.names,
PoolPrms.names, and DiskStorePrms.names, using the
corresponding CacheDescription, RegionDescription, BridgeDescription, PoolDescription, and DiskStoreDescription. Creates a region for each region name.
Registers the list of functions. Writes the result to the specified file.
IMPORTANT: This method should only be invoked from the VM that will use the result. Otherwise, runtime-generated artifacts (e.g., ports, disk directories) might not work as required.
IMPORTANT: This method is not synchronized across multiple VMs. It is up to the user to avoid writing to the same filename from multiple VMs.
HydraRuntimeException - if an attempt is made to rewrite an existing
cache XML file with different content.public static void generateCacheXmlFile(String cacheConfig, com.gemstone.gemfire.cache.DynamicRegionFactory.Config dynamicRegionConfig, String regionConfig, List regionNames, String bridgeConfig, String poolConfig, String diskStoreConfig, String gatewaySenderConfig, String gatewayReceiverConfig, String asyncEventQueueConfig, List functions, String cacheXmlFile)
DynamicRegionFactory.Config, CachePrms.names, RegionPrms.names, BridgePrms.names,
PoolPrms.names, and DiskStorePrms.names, using the
corresponding CacheDescription, RegionDescription, BridgeDescription, PoolDescription, DiskStoreDescription, etc. Creates a region for each region name.
Registers the list of functions. Writes the result to the specified file.
IMPORTANT: This method should only be invoked from the VM that will use the result. Otherwise, runtime-generated artifacts (e.g., ports, disk directories) might not work as required.
IMPORTANT: This method is not synchronized across multiple VMs. It is up to the user to avoid writing to the same filename from multiple VMs.
HydraRuntimeException - if an attempt is made to rewrite an existing
cache XML file with different content.public static com.gemstone.gemfire.cache.Cache startCacheXmlGenerationForGateway(String cacheConfig, com.gemstone.gemfire.cache.DynamicRegionFactory.Config dynamicRegionConfig, String gatewayHubConfig, String cacheXmlFile)
GatewayHubPrms.names,
DynamicRegionFactory.Config, and CachePrms#names.
Return the CacheCreation object for subsequent use in generateCacheXmlFile() with
gatewayConfig as well as regionConfig, bridgeConfig, poolConfig, etc.
IMPORTANT: This method should only be invoked from the VM that will use the result. Otherwise, runtime-generated artifacts (e.g., ports, disk directories) might not work as required.
IMPORTANT: This method is not synchronized across multiple VMs. It is up to the user to avoid writing to the same filename from multiple VMs.
public static void finishCacheXmlGenerationForGateway(com.gemstone.gemfire.cache.Cache cache,
String cacheConfig,
String gatewayHubConfig,
String gatewayConfig,
String regionConfig,
List regionNames,
String bridgeConfig,
String poolConfig,
String diskStoreConfig,
List functions,
String cacheXmlFile)
GatewayPrms.names,
CachePrms.names, RegionPrms.names, BridgePrms.names,
PoolPrms.names, and DiskStorePrms.names.
Writes the result to the specified file.
IMPORTANT: This method should only be invoked from the VM that will use the result. Otherwise, runtime-generated artifacts (e.g., ports, disk directories) might not work as required.
IMPORTANT: This method is not synchronized across multiple VMs. It is up to the user to avoid writing to the same filename from multiple VMs.
HydraRuntimeException - if an attempt is made to rewrite an existing
cache XML file with different content.public static void generateCacheXmlFileNoCheck(String cacheConfig, com.gemstone.gemfire.cache.DynamicRegionFactory.Config dynamicRegionConfig, List regionConfigs, List regionNames, String bridgeConfig, List poolConfigs, String cacheXmlFile)
DynamicRegionFactory.Config, CachePrms.names, RegionPrms.names, BridgePrms.names, and PoolPrms.names,
using the corresponding CacheDescription, RegionDescriptions, BridgeDescription, and PoolDescriptions. Creates a region for each region configuration and
name. Creates a pool for each pool configuration. Writes the result to
the specified file.
If regionNames are provided, the number of regionNames must
match the number of regionConfigs.
IMPORTANT: This method should only be invoked from the VM that will use the result. Otherwise, runtime-generated artifacts (e.g., ports, disk directories) might not work as required.
IMPORTANT: This method is not synchronized across multiple VMs. It is up to the user to avoid writing to the same filename from multiple VMs.
IMPORTANT: Unlike other XML-generating methods, no attempt is made to prevent overwriting an existing XML file with a different configuration.
HydraRuntimeException - if the number of region names is different
from the number of region configs (when region names are provided).public static void generateCacheXmlFileNoCheck(String cacheConfig, com.gemstone.gemfire.cache.DynamicRegionFactory.Config dynamicRegionConfig, List regionConfigs, List regionNames, String bridgeConfig, List poolConfigs, List diskStoreConfigs, List functions, String cacheXmlFile)
DynamicRegionFactory.Config, CachePrms.names, RegionPrms.names, BridgePrms.names,
PoolPrms.names, and DiskStorePrms.names, using the
corresponding CacheDescription, RegionDescriptions, BridgeDescription, PoolDescriptions, and DiskStoreDescriptions. Creates a region for each region configuration
and name. Creates a pool for each pool configuration. Creates a disk
store for each disk store configuration. Registers the list of functions.
Writes the result to the specified file.
If regionNames are provided, the number of regionNames must
match the number of regionConfigs.
IMPORTANT: This method should only be invoked from the VM that will use the result. Otherwise, runtime-generated artifacts (e.g., ports, disk directories) might not work as required.
IMPORTANT: This method is not synchronized across multiple VMs. It is up to the user to avoid writing to the same filename from multiple VMs.
IMPORTANT: Unlike other XML-generating methods, no attempt is made to prevent overwriting an existing XML file with a different configuration.
HydraRuntimeException - if the number of region names is different
from the number of region configs (when region names are provided).public static void generateCacheXmlFileNoCheck(String cacheConfig, com.gemstone.gemfire.cache.DynamicRegionFactory.Config dynamicRegionConfig, List regionConfigs, List regionNames, String bridgeConfig, List poolConfigs, List diskStoreConfigs, String gatewaySenderConfig, String gatewayReceiverConfig, String asyncEventQueueConfig, List functions, String cacheXmlFile)
DynamicRegionFactory.Config, CachePrms.names, RegionPrms.names, BridgePrms.names,
PoolPrms.names, and DiskStorePrms.names, using the
corresponding CacheDescription, RegionDescriptions, BridgeDescription, PoolDescriptions, DiskStoreDescriptions, etc. Creates a region for each region configuration
and name. Creates a pool for each pool configuration. Creates a disk
store for each disk store configuration. Registers the list of functions.
Writes the result to the specified file.
If regionNames are provided, the number of regionNames must
match the number of regionConfigs.
IMPORTANT: This method should only be invoked from the VM that will use the result. Otherwise, runtime-generated artifacts (e.g., ports, disk directories) might not work as required.
IMPORTANT: This method is not synchronized across multiple VMs. It is up to the user to avoid writing to the same filename from multiple VMs.
IMPORTANT: Unlike other XML-generating methods, no attempt is made to prevent overwriting an existing XML file with a different configuration.
HydraRuntimeException - if the number of region names is different
from the number of region configs (when region names are provided).public static com.gemstone.gemfire.cache.Cache getCache()
public static void closeCache()
public static String cacheToString(com.gemstone.gemfire.cache.Cache cache)
public static CacheDescription getCacheDescription(String cacheConfig)
CacheDescription with the given configuration name
from CachePrms.names.Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.