public class ClientCacheHelper extends Object
ClientCacheDescription. Methods are thread-safe.| Modifier and Type | Field and Description |
|---|---|
protected static String |
TheCacheConfig
Name of the client cache description used to create the current cache
|
| Constructor and Description |
|---|
ClientCacheHelper() |
| Modifier and Type | Method and Description |
|---|---|
static String |
cacheToString(com.gemstone.gemfire.cache.client.ClientCache 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.client.ClientCache |
createCache(String cacheConfig)
Creates a client cache for the given client cache configuration from
ClientCachePrms.names, configured using the corresponding ClientCacheDescription. |
static com.gemstone.gemfire.cache.client.ClientCache |
createCacheFromXml(String cacheXmlFile)
Creates a client cache using the given XML configuration file.
|
static void |
generateCacheXmlFile(String cacheConfig,
com.gemstone.gemfire.cache.DynamicRegionFactory.Config dynamicRegionConfig,
String regionConfig,
List regionNames,
List functions,
String cacheXmlFile)
Generates XML for the given client cache and region configurations from
ClientCachePrms.names and ClientRegionPrms.names, using
the corresponding ClientCacheDescription and ClientRegionDescription. |
static void |
generateCacheXmlFile(String cacheConfig,
String regionConfig,
List regionNames,
String cacheXmlFile)
Generates XML for the given client cache and region configurations from
ClientCachePrms.names and ClientRegionPrms.names, using
the corresponding ClientCacheDescription and ClientRegionDescription. |
static void |
generateCacheXmlFile(String cacheConfig,
String regionConfig,
String cacheXmlFile)
Generates XML for the given client cache and region configurations from
ClientCachePrms.names and ClientRegionPrms.names, using
the corresponding ClientCacheDescription and ClientRegionDescription. |
static com.gemstone.gemfire.cache.client.ClientCache |
getCache()
Returns the client cache if it exists and is open, or null if no cache exists.
|
static ClientCacheDescription |
getClientCacheDescription(String cacheConfig)
Returns the
ClientCacheDescription with the given configuration name
from ClientCachePrms.names. |
protected static String TheCacheConfig
public static com.gemstone.gemfire.cache.client.ClientCache createCache(String cacheConfig)
ClientCachePrms.names, configured using the corresponding ClientCacheDescription. Returns the existing client cache if it was
previously created and is still open.
The product connects the cache to a loner distributed system, using
properties from the GemFireDescription corresponding to the
system property GemFirePrms.GEMFIRE_NAME_PROPERTY. Note that
this system is not noted in or checked by DistributedSystemHelper.
Hydra creates the default disk store named "DEFAULT" using the DiskStoreDescription corresponding to #defaultDiskStoreName, if specified. THe disk store is created using
DiskStoreHelper.createDiskStore(String).
The product creates the default pool, configured using the PoolDescription corresponding to ClientCachePrms.defaultPoolName,
if specified. Note that this pool is not noted in or checked by PoolHelper. If no pool name is given, the product sets the default pool
to the existing pool, if exactly one exists, or to null, if more than one
pool exists, or to a pool configured with default settings, if no pool
exists.
The default pool, if any, is only used by regions created through a region shortcut that do not specify some other pool. If the default pool is null, then regions created through a region shortcut must specify a pool name.
HydraRuntimeException - if an attempt is made to reconfigure an
existing client cache or distributed system.public static com.gemstone.gemfire.cache.client.ClientCache createCacheFromXml(String cacheXmlFile)
HydraRuntimeException - if an attempt is made to reconfigure an
existing cache.public static void generateCacheXmlFile(String cacheConfig, String regionConfig, String cacheXmlFile)
ClientCachePrms.names and ClientRegionPrms.names, using
the corresponding ClientCacheDescription and ClientRegionDescription. Writes the resulting XML to the specified file.
Includes the default pool and disk store from #defaultPoolName and ClientCachePrms.defaultDiskStoreName, if
specified, as well as any pool and disk store specified in the region
configuration from ClientRegionPrms.poolName and ClientRegionPrms.diskStoreName, plus any disk store specified in ClientCachePrms.pdxDiskStoreName.
IMPORTANT: This method should only be invoked from the JVM 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 JVMs. It is up to the user to avoid writing to the same filename from multiple JVMs.
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)
ClientCachePrms.names and ClientRegionPrms.names, using
the corresponding ClientCacheDescription and ClientRegionDescription. Generates a region for each name given.
Writes the resulting XML to the specified file.
Includes the default pool and disk store from #defaultPoolName and ClientCachePrms.defaultDiskStoreName, if
specified, as well as any pool and disk store specified in the region
configuration from ClientRegionPrms.poolName and ClientRegionPrms.diskStoreName, plus any disk store specified in ClientCachePrms.pdxDiskStoreName.
IMPORTANT: This method should only be invoked from the JVM 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 JVMs. It is up to the user to avoid writing to the same filename from multiple JVMs.
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, List functions, String cacheXmlFile)
ClientCachePrms.names and ClientRegionPrms.names, using
the corresponding ClientCacheDescription and ClientRegionDescription. Generates a region for each name given.
Includes the dynamic region and functions, if given. Writes the
resulting XML to the specified file.
Includes the default pool and disk store from #defaultPoolName and ClientCachePrms.defaultDiskStoreName, if
specified, as well as any pool and disk store specified in the region
configuration from ClientRegionPrms.poolName and ClientRegionPrms.diskStoreName, plus any disk store specified in ClientCachePrms.pdxDiskStoreName.
IMPORTANT: This method should only be invoked from the JVM 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 JVMs. It is up to the user to avoid writing to the same filename from multiple JVMs.
HydraRuntimeException - if an attempt is made to rewrite an existing
cache XML file with different content.public static com.gemstone.gemfire.cache.client.ClientCache getCache()
public static void closeCache()
public static String cacheToString(com.gemstone.gemfire.cache.client.ClientCache cache)
public static ClientCacheDescription getClientCacheDescription(String cacheConfig)
ClientCacheDescription with the given configuration name
from ClientCachePrms.names.Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.