com.alachisoft.jvcache.web.caching
Class JvCache

java.lang.Object
  extended by com.alachisoft.jvcache.web.caching.JvCache

public final class JvCache
extends java.lang.Object

Provides static methods and properties to to aid with clustered cache initialization and access. This class cannot be inherited.


Constructor Summary
JvCache()
           
 
Method Summary
static CacheCollection getCaches()
          Maintains the list of running caches.
static java.lang.String getConfigPath()
          Gets the directory path where the JvCache configuration files are placed.
static Cache initializeCache(java.lang.String cacheId)
          Initializes the cache based on the cacheid.
static Cache initializeCache(java.lang.String cacheId, CacheInitParams initParams)
           
static Cache initializeCache(java.lang.String remoteCacheId, CacheInitParams remoteInitParams, java.lang.String clientCacheId, CacheInitParams clientInitParams)
           
static Cache initializeCache(java.lang.String cacheId, java.lang.String clientCacheId)
          Initializes the cache represented by the cache id.
static void setConfigPath(java.lang.String path)
          Sets the directory path where the JvCache configuration files are placed.
static void setExceptionsEnabled(boolean value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JvCache

public JvCache()
Method Detail

initializeCache

public static Cache initializeCache(java.lang.String cacheId)
                             throws ConfigurationException,
                                    GeneralFailureException,
                                    CacheException,
                                    java.lang.Exception
Initializes the cache based on the cacheid. behaves in the same way as if you have called initializeCache(cacheid, null, 0);

Parameters:
cacheId - The id of the cache to be initialized.
Returns:
The cache instance.
Throws:
com.alachisoft.ncache.runtime.exceptions.CacheException - Thrown incase of any error during intializaing the cache.
com.alachisoft.ncache.runtime.exceptions.ConfigurationException - Thrown when an exception occurs during configuration. Likely causes are badly specified configuration strings.
com.alachisoft.ncache.runtime.exceptions.GeneralFailureException - Thrown when an exception occurs during a clustered operation.
ConfigurationException
GeneralFailureException
CacheException
java.lang.Exception

initializeCache

public static Cache initializeCache(java.lang.String cacheId,
                                    java.lang.String clientCacheId)
                             throws ConfigurationException,
                                    GeneralFailureException,
                                    CacheException,
                                    java.lang.Exception
Initializes the cache represented by the cache id. It overrides the configuration.

Parameters:
cacheId - The cache id to initialize.
clientCacheId - Name of Inproc ClientCache
Returns:
The cache instance.
Throws:
com.alachisoft.ncache.runtime.exceptions.CacheException - Thrown incase of any error during initializing the cache.
com.alachisoft.ncache.runtime.exceptions.ConfigurationException - Thrown when an exception occurs during configuration. Likely causes are badly specified configuration strings.
com.alachisoft.ncache.runtime.exceptions.GeneralFailureException - Thrown when an exception occurs during a clustered operation.
ConfigurationException
GeneralFailureException
CacheException
java.lang.Exception

initializeCache

public static Cache initializeCache(java.lang.String cacheId,
                                    CacheInitParams initParams)
                             throws ConfigurationException,
                                    GeneralFailureException,
                                    CacheException,
                                    java.lang.Exception
Parameters:
cacheId - The cache id to initialize.
initParams - initialization parameters, Security Credentials and other properties are provided here, if null is provided, default instance of CacheInitParams is used.
Returns:
The cache instance.
Throws:
ConfigurationException
GeneralFailureException
CacheException
java.lang.Exception
See Also:
CacheInitParams

initializeCache

public static Cache initializeCache(java.lang.String remoteCacheId,
                                    CacheInitParams remoteInitParams,
                                    java.lang.String clientCacheId,
                                    CacheInitParams clientInitParams)
                             throws java.lang.Exception
Throws:
java.lang.Exception

getConfigPath

public static java.lang.String getConfigPath()
Gets the directory path where the JvCache configuration files are placed.

Returns:
returns Configuration Path

setConfigPath

public static void setConfigPath(java.lang.String path)
Sets the directory path where the JvCache configuration files are placed.

Parameters:
path - The directory path of configuration files.

setExceptionsEnabled

public static void setExceptionsEnabled(boolean value)
Parameters:
value - Flag that indicates whether exceptions are enabled or not. If this property is set the Cache object throws exceptions from public operations. If not set no exception is thrown and the operation fails silently. Setting this flag is especially helpful during development phase of application since exceptions provide more information about the specific causes of failure.
See Also:
Cache

getCaches

public static CacheCollection getCaches()
Maintains the list of running caches.

Returns:
the CacheCollection of the currently running caches.