org.hibernate.cache.jbc.util
Class CacheHelper

java.lang.Object
  extended by org.hibernate.cache.jbc.util.CacheHelper

public class CacheHelper
extends Object

Helper for dealing with JBossCache Configuration.CacheMode.

Author:
Steve Ebersole, Brian Stansberry

Nested Class Summary
static class CacheHelper.Internal
           
 
Field Summary
static String DUMMY
          Key and value used in a hack to create region root nodes
static String ITEM
          Key under which items are cached
 
Method Summary
static org.jboss.cache.Node addNode(org.jboss.cache.Cache cache, org.jboss.cache.Fqn fqn, boolean localOnly, boolean resident, org.jboss.cache.optimistic.DataVersion version)
           
static Object get(org.jboss.cache.Cache cache, org.jboss.cache.Fqn region, Object key)
          Builds an Fqn from region and key and performs a JBoss Cache get(Fqn, Object), wrapping any exception in a CacheException.
static Object getAllowingTimeout(org.jboss.cache.Cache cache, org.jboss.cache.Fqn region, Object key)
          Builds an Fqn from region and key and performs a JBoss Cache get(Fqn, Object), wrapping any exception in a CacheException.
static Set getChildrenNames(org.jboss.cache.Cache cache, org.jboss.cache.Fqn fqn)
           
static org.jboss.cache.Fqn getInternalFqn(org.jboss.cache.Fqn region)
           
static boolean isClusteredInvalidation(org.jboss.cache.Cache cache)
          Is this cache participating in a cluster with invalidation?
static boolean isClusteredInvalidation(org.jboss.cache.config.Configuration.CacheMode cacheMode)
          Does this cache mode indicate clustered invalidation?
static boolean isClusteredReplication(org.jboss.cache.Cache cache)
          Is this cache participating in a cluster with replication?
static boolean isClusteredReplication(org.jboss.cache.config.Configuration.CacheMode cacheMode)
          Does this cache mode indicate clustered replication?
static boolean isSynchronous(org.jboss.cache.Cache cache)
           
static boolean isSynchronous(org.jboss.cache.config.Configuration.CacheMode cacheMode)
           
static void put(org.jboss.cache.Cache cache, org.jboss.cache.Fqn region, Object key, Object value)
          Builds an Fqn from region and key and performs a JBoss Cache put(Object, Object), wrapping any exception in a CacheException.
static void put(org.jboss.cache.Cache cache, org.jboss.cache.Fqn region, Object key, Object value, org.jboss.cache.config.Option option)
          Builds an Fqn from region and key and performs a JBoss Cache put(Object, Object), wrapping any exception in a CacheException.
static void putAllowingTimeout(org.jboss.cache.Cache cache, org.jboss.cache.Fqn region, Object key, Object value, org.jboss.cache.config.Option option)
          Builds an Fqn from region and key and performs a JBoss Cache put(Object, Object), ignoring any TimeoutException and wrapping any other exception in a CacheException.
static boolean putForExternalRead(org.jboss.cache.Cache cache, org.jboss.cache.Fqn region, Object key, Object value)
          Builds an Fqn from region and key and performs a JBoss Cache putForExternalRead(Object, Object), wrapping any exception in a CacheException.
static boolean putForExternalRead(org.jboss.cache.Cache cache, org.jboss.cache.Fqn region, Object key, Object value, org.jboss.cache.config.Option option)
          Builds an Fqn from region and key and performs a JBoss Cache putForExternalRead(Object, Object), wrapping any exception in a CacheException.
static void remove(org.jboss.cache.Cache cache, org.jboss.cache.Fqn region, Object key)
          Builds an Fqn from region and key and performs a JBoss Cache removeNode(Fqn), wrapping any exception in a CacheException.
static void remove(org.jboss.cache.Cache cache, org.jboss.cache.Fqn region, Object key, org.jboss.cache.config.Option option)
          Builds an Fqn from region and key and performs a JBoss Cache removeNode(Fqn), wrapping any exception in a CacheException.
static void removeAll(org.jboss.cache.Cache cache, org.jboss.cache.Fqn region)
          Performs a JBoss Cache removeNode(Fqn), wrapping any exception in a CacheException.
static void removeAll(org.jboss.cache.Cache cache, org.jboss.cache.Fqn region, org.jboss.cache.config.Option option)
          Performs a JBoss Cache removeNode(Fqn), wrapping any exception in a CacheException.
static void removeNode(org.jboss.cache.Cache cache, org.jboss.cache.Fqn region, Object key, org.jboss.cache.config.Option option)
          Performs a JBoss Cache removeNode(Fqn), wrapping any exception in a CacheException.
static void sendEvictAllNotification(org.jboss.cache.Cache cache, org.jboss.cache.Fqn region, Object member, org.jboss.cache.config.Option option)
           
static void sendEvictNotification(org.jboss.cache.Cache cache, org.jboss.cache.Fqn region, Object member, Object key, org.jboss.cache.config.Option option)
           
static void setDataVersionOption(org.jboss.cache.Cache cache, org.jboss.cache.optimistic.DataVersion version)
          Creates an Option using the given DataVersion and passes it to setInvocationOption(Cache, Option).
static void setInvocationOption(org.jboss.cache.Cache cache, org.jboss.cache.config.Option option)
          Assigns the given Option to the cache's InvocationContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ITEM

public static final String ITEM
Key under which items are cached

See Also:
Constant Field Values

DUMMY

public static final String DUMMY
Key and value used in a hack to create region root nodes

See Also:
Constant Field Values
Method Detail

isClusteredInvalidation

public static boolean isClusteredInvalidation(org.jboss.cache.Cache cache)
Is this cache participating in a cluster with invalidation?

Parameters:
cache - The cache to check.
Returns:
True if the cache is configured for synchronous/asynchronous invalidation; false otherwise.

isClusteredInvalidation

public static boolean isClusteredInvalidation(org.jboss.cache.config.Configuration.CacheMode cacheMode)
Does this cache mode indicate clustered invalidation?

Parameters:
cacheMode - The cache to check
Returns:
True if the cache mode is confiogured for synchronous/asynchronous invalidation; false otherwise.

isClusteredReplication

public static boolean isClusteredReplication(org.jboss.cache.Cache cache)
Is this cache participating in a cluster with replication?

Parameters:
cache - The cache to check.
Returns:
True if the cache is configured for synchronous/asynchronous invalidation; false otherwise.

isClusteredReplication

public static boolean isClusteredReplication(org.jboss.cache.config.Configuration.CacheMode cacheMode)
Does this cache mode indicate clustered replication?

Parameters:
cacheMode - The cache to check
Returns:
True if the cache mode is confiogured for synchronous/asynchronous invalidation; false otherwise.

isSynchronous

public static boolean isSynchronous(org.jboss.cache.Cache cache)

isSynchronous

public static boolean isSynchronous(org.jboss.cache.config.Configuration.CacheMode cacheMode)

getChildrenNames

public static Set getChildrenNames(org.jboss.cache.Cache cache,
                                   org.jboss.cache.Fqn fqn)

get

public static Object get(org.jboss.cache.Cache cache,
                         org.jboss.cache.Fqn region,
                         Object key)
                  throws CacheException
Builds an Fqn from region and key and performs a JBoss Cache get(Fqn, Object), wrapping any exception in a CacheException.

Parameters:
cache - the cache to invoke on
region - base Fqn for the cache region
key - specific key to append to the region to form the full Fqn
Throws:
CacheException

getAllowingTimeout

public static Object getAllowingTimeout(org.jboss.cache.Cache cache,
                                        org.jboss.cache.Fqn region,
                                        Object key)
                                 throws CacheException
Builds an Fqn from region and key and performs a JBoss Cache get(Fqn, Object), wrapping any exception in a CacheException.

Parameters:
cache - the cache to invoke on
region - base Fqn for the cache region
key - specific key to append to the region to form the full Fqn
Throws:
CacheException

put

public static void put(org.jboss.cache.Cache cache,
                       org.jboss.cache.Fqn region,
                       Object key,
                       Object value)
                throws CacheException
Builds an Fqn from region and key and performs a JBoss Cache put(Object, Object), wrapping any exception in a CacheException.

Parameters:
cache - the cache to invoke on
region - base Fqn for the cache region
key - specific key to append to the region to form the full Fqn
value - data to store in the cache node
Throws:
CacheException

put

public static void put(org.jboss.cache.Cache cache,
                       org.jboss.cache.Fqn region,
                       Object key,
                       Object value,
                       org.jboss.cache.config.Option option)
                throws CacheException
Builds an Fqn from region and key and performs a JBoss Cache put(Object, Object), wrapping any exception in a CacheException.

Parameters:
cache - the cache to invoke on
region - base Fqn for the cache region
key - specific key to append to the region to form the full Fqn
value - data to store in the cache node
option - invocation Option to set for this invocation. May be null.
Throws:
CacheException

putAllowingTimeout

public static void putAllowingTimeout(org.jboss.cache.Cache cache,
                                      org.jboss.cache.Fqn region,
                                      Object key,
                                      Object value,
                                      org.jboss.cache.config.Option option)
                               throws CacheException
Builds an Fqn from region and key and performs a JBoss Cache put(Object, Object), ignoring any TimeoutException and wrapping any other exception in a CacheException.

Parameters:
cache - the cache to invoke on
region - base Fqn for the cache region
key - specific key to append to the region to form the full Fqn
value - data to store in the cache node
option - invocation Option to set for this invocation. May be null.
Throws:
CacheException

putForExternalRead

public static boolean putForExternalRead(org.jboss.cache.Cache cache,
                                         org.jboss.cache.Fqn region,
                                         Object key,
                                         Object value)
                                  throws CacheException
Builds an Fqn from region and key and performs a JBoss Cache putForExternalRead(Object, Object), wrapping any exception in a CacheException. Ignores any JBoss Cache TimeoutException.

Parameters:
cache - the cache to invoke on
region - base Fqn for the cache region
key - specific key to append to the region to form the full Fqn
value - data to store in the cache node
Throws:
CacheException

putForExternalRead

public static boolean putForExternalRead(org.jboss.cache.Cache cache,
                                         org.jboss.cache.Fqn region,
                                         Object key,
                                         Object value,
                                         org.jboss.cache.config.Option option)
                                  throws CacheException
Builds an Fqn from region and key and performs a JBoss Cache putForExternalRead(Object, Object), wrapping any exception in a CacheException. Ignores any JBoss Cache TimeoutException.

Parameters:
cache - the cache to invoke on
region - base Fqn for the cache region
key - specific key to append to the region to form the full Fqn
value - data to store in the cache node
option - invocation Option to set for this invocation. May be null.
Throws:
CacheException

remove

public static void remove(org.jboss.cache.Cache cache,
                          org.jboss.cache.Fqn region,
                          Object key)
                   throws CacheException
Builds an Fqn from region and key and performs a JBoss Cache removeNode(Fqn), wrapping any exception in a CacheException.

Parameters:
cache - the cache to invoke on
region - base Fqn for the cache region
key - specific key to append to the region to form the full Fqn
Throws:
CacheException

remove

public static void remove(org.jboss.cache.Cache cache,
                          org.jboss.cache.Fqn region,
                          Object key,
                          org.jboss.cache.config.Option option)
                   throws CacheException
Builds an Fqn from region and key and performs a JBoss Cache removeNode(Fqn), wrapping any exception in a CacheException.

Parameters:
cache - the cache to invoke on
region - base Fqn for the cache region
key - specific key to append to the region to form the full Fqn
option - invocation Option to set for this invocation. May be null.
Throws:
CacheException

removeAll

public static void removeAll(org.jboss.cache.Cache cache,
                             org.jboss.cache.Fqn region)
                      throws CacheException
Performs a JBoss Cache removeNode(Fqn), wrapping any exception in a CacheException.

Parameters:
cache - the cache to invoke on
region - base Fqn for the cache region
Throws:
CacheException

removeAll

public static void removeAll(org.jboss.cache.Cache cache,
                             org.jboss.cache.Fqn region,
                             org.jboss.cache.config.Option option)
                      throws CacheException
Performs a JBoss Cache removeNode(Fqn), wrapping any exception in a CacheException.

Parameters:
cache - the cache to invoke on
region - base Fqn for the cache region
option - invocation Option to set for this invocation. May be null.
Throws:
CacheException

removeNode

public static void removeNode(org.jboss.cache.Cache cache,
                              org.jboss.cache.Fqn region,
                              Object key,
                              org.jboss.cache.config.Option option)
                       throws CacheException
Performs a JBoss Cache removeNode(Fqn), wrapping any exception in a CacheException.

Parameters:
cache - the cache to invoke on
region - base Fqn for the cache region
option - invocation Option to set for this invocation. May be null.
Throws:
CacheException

addNode

public static org.jboss.cache.Node addNode(org.jboss.cache.Cache cache,
                                           org.jboss.cache.Fqn fqn,
                                           boolean localOnly,
                                           boolean resident,
                                           org.jboss.cache.optimistic.DataVersion version)
                                    throws CacheException
Throws:
CacheException

setInvocationOption

public static void setInvocationOption(org.jboss.cache.Cache cache,
                                       org.jboss.cache.config.Option option)
Assigns the given Option to the cache's InvocationContext. Does nothing if option is null.

Parameters:
cache - the cache. Cannot be null.
option - the option. May be null.
See Also:
Cache#getInvocationContext()}, InvocationContext#setOptionOverrides(Option)}

setDataVersionOption

public static void setDataVersionOption(org.jboss.cache.Cache cache,
                                        org.jboss.cache.optimistic.DataVersion version)
Creates an Option using the given DataVersion and passes it to setInvocationOption(Cache, Option).

Parameters:
cache - the cache to set the Option on. Cannot be null.
version - the DataVersion to set. Cannot be null.

getInternalFqn

public static org.jboss.cache.Fqn getInternalFqn(org.jboss.cache.Fqn region)

sendEvictNotification

public static void sendEvictNotification(org.jboss.cache.Cache cache,
                                         org.jboss.cache.Fqn region,
                                         Object member,
                                         Object key,
                                         org.jboss.cache.config.Option option)

sendEvictAllNotification

public static void sendEvictAllNotification(org.jboss.cache.Cache cache,
                                            org.jboss.cache.Fqn region,
                                            Object member,
                                            org.jboss.cache.config.Option option)


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.