org.jboss.ha.framework.server
Class PojoCacheManagerLocator

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

public class PojoCacheManagerLocator
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 PojoCacheManagers are bound
 
Constructor Summary
protected PojoCacheManagerLocator()
          Allow subclasses to create a new HAPartitionLocator.
 
Method Summary
 void deregisterCacheManager()
          Deregister the manager from this locator.
protected  PojoCacheManager findInJndi(Hashtable jndiProperties)
          Find the given CacheManager in JNDI under a standard binding.
 PojoCacheManager getCacheManager(Hashtable jndiProperties)
          Locates and returns the HAPartition whose partition name matches the given partitionName.
static PojoCacheManagerLocator getCacheManagerLocator()
          Gets the
 PojoCacheManager getDirectlyRegisteredManager()
           
 void registerCacheManager(PojoCacheManager manager)
          Register a CacheManager with this locator.
protected static void setSharedInstance(PojoCacheManagerLocator 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 PojoCacheManagers are bound

See Also:
Constant Field Values
Constructor Detail

PojoCacheManagerLocator

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

Method Detail

getCacheManagerLocator

public static PojoCacheManagerLocator getCacheManagerLocator()
Gets the

Returns:
the shared CacheManagerLocator; will not be null

setSharedInstance

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

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

getCacheManager

public PojoCacheManager 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(PojoCacheManager manager)
Register a CacheManager with this locator.

Parameters:
manager - the manager

getDirectlyRegisteredManager

public PojoCacheManager getDirectlyRegisteredManager()

deregisterCacheManager

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


findInJndi

protected PojoCacheManager 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.