org.jboss.ha.framework.server
Class CacheManagerLocator

java.lang.Object
  extended by org.jboss.ha.framework.server.CacheManagerLocator

public class CacheManagerLocator
extends Object

Service Locator utility for locating a PojoCacheManager. Maintains an internal ref to a manager, and if it that is null, will attempt to find it in JNDI using a standard naming pattern.

Version:
$Revision: 1.1 $
Author:
Brian Stansberry

Field Summary
static String STANDARD_JNDI_NAME
          Name of the standard JNDI context under which HAPartitions are bound
 
Constructor Summary
protected CacheManagerLocator()
          Allow subclasses to create a new HAPartitionLocator.
 
Method Summary
 void deregisterCacheManager()
          Deregister the manager from this locator.
protected  org.jboss.cache.CacheManager findInJndi(Hashtable jndiProperties)
          Find the given CacheManager in JNDI under a standard binding.
 org.jboss.cache.CacheManager getCacheManager(Hashtable jndiProperties)
          Locates and returns the HAPartition whose partition name matches the given partitionName.
static CacheManagerLocator getCacheManagerLocator()
          Gets the
 org.jboss.cache.CacheManager getDirectlyRegisteredManager()
           
 void registerCacheManager(org.jboss.cache.CacheManager manager)
          Register a CacheManager with this locator.
protected static void setSharedInstance(CacheManagerLocator shared)
          Allows replacement of the default implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STANDARD_JNDI_NAME

public static final String STANDARD_JNDI_NAME
Name of the standard JNDI context under which HAPartitions are bound

See Also:
Constant Field Values
Constructor Detail

CacheManagerLocator

protected CacheManagerLocator()
Allow subclasses to create a new HAPartitionLocator.

Method Detail

getCacheManagerLocator

public static CacheManagerLocator getCacheManagerLocator()
Gets the

Returns:
the shared CacheManagerLocator; will not be null

setSharedInstance

protected static void setSharedInstance(CacheManagerLocator shared)
Allows replacement of the default implementation.

Parameters:
shared - the locator to use. Cannot be null.

getCacheManager

public org.jboss.cache.CacheManager getCacheManager(Hashtable jndiProperties)
Locates and returns the HAPartition whose partition name matches the given partitionName.

Parameters:
jndiProperties - any naming properties to pass to new InitialContext() if JNDI lookup is needed.
Returns:
the partition. Will not return null
Throws:
IllegalStateException - if no cache manager can be found

registerCacheManager

public void registerCacheManager(org.jboss.cache.CacheManager manager)
Register a CacheManager with this locator.

Parameters:
manager - the manager

getDirectlyRegisteredManager

public org.jboss.cache.CacheManager getDirectlyRegisteredManager()

deregisterCacheManager

public void deregisterCacheManager()
Deregister the manager from this locator.


findInJndi

protected org.jboss.cache.CacheManager findInJndi(Hashtable jndiProperties)
                                           throws NamingException
Find the given CacheManager in JNDI under a standard binding.

Parameters:
jndiProperties - any naming properties to pass to new InitialContext()
Returns:
the CacheManager, or null
Throws:
NamingException - if there is a problem with the naming context. Will not throw NameNotFoundException; if not found, will return null.
See Also:
STANDARD_JNDI_NAME


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.