|
Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.util.Base
com.tangosol.net.DefaultCacheFactoryBuilder
public class DefaultCacheFactoryBuilder
DefaultCacheFactoryBuilder provides the basic means to manage configurable cache factories (CCF). This implementation employs one of serveral strategies for resolving cache configurations with potentially conflicting service definitions:
DefaultCacheFactoryBuilder could be extended in advanced use-cases to provide further domain-specific logic for creating and managing CCF's. For example, a J2EE or OSGi container would extend DefaultCacheFactoryBuilder to provide classloader-based application scoping.
Field Summary | |
---|---|
protected ConfigurableCacheFactory |
m_ccfSingleton Singleton ConfigurableCacheFactory instance for the default URI, used when the resolution strategy is STRATEGY_COMPATIBILITY. |
protected Map |
m_mapByLoader Mapping used to associate class loaders with the cache factories that are configured on them. |
protected Map |
m_mapInternedConfig Mapping of configuration resource URLs to the xml configuration elements loaded from those resources. |
protected int |
m_nResolveStrategy The strategy to use for resolving configuration conflicts. |
static int |
STRATEGY_COMPATIBILITY Backward compatibility with pre-3.5.1 behaviour. |
static int |
STRATEGY_NONVALIDATION No service name validation is performed. |
static int |
STRATEGY_RENAME_UNIQUELY Service names are uniquely renamed for each class loader scope. |
static int |
STRATEGY_VALIDATION Strict validation ensures that all service names are unique. |
protected static String |
URI_DEFAULT Innternally used "default" URI identifier. |
Constructor Summary | |
---|---|
|
DefaultCacheFactoryBuilder() Default constructor using the compatibility strategy (STRATEGY_COMPATIBILITY). |
protected |
DefaultCacheFactoryBuilder(int nResolveStrategy) Construct a DefaultCacheFactoryBuilder with the specified configuration resolution strategy. |
Method Summary | |
---|---|
protected XmlElement |
applyStrategy(XmlElement xmlConfig, ClassLoader loader) Apply the resolution strategy for this builder to the specified xml configuration in the context of the specified class loader. |
protected ConfigurableCacheFactory |
buildFactory(XmlElement xmlConfig, ClassLoader loader) Construct a ConfigurableCacheFactory for the specified XML configuration. |
protected Set |
collectServiceNames() Construct and return a collection of service names defined by any cache configurations known to this cache factory builder. |
protected Map |
ensureConfigCCFMap(ClassLoader loader) Ensure that a map from URI to ConfigurableCacheFactory for the specified loader exists (creating it if necessary). |
ConfigurableCacheFactory |
getConfigurableCacheFactory(ClassLoader loader) Return the default ConfigurableCacheFactory for a given class loader. |
ConfigurableCacheFactory |
getConfigurableCacheFactory(String sConfigURI, ClassLoader loader) Return the ConfigurableCacheFactory for a given URI and class loader. |
protected ConfigurableCacheFactory |
getDefaultFactory(ClassLoader loader) Return a default cache factory for the specified loader. |
protected ConfigurableCacheFactory |
getFactory(String sConfigURI, ClassLoader loader) Helper method to return a CCF instance for the specified URI and class loader. |
int |
getResolutionStrategy() Return the configuration resolution strategy. |
protected String |
getScopeName(ClassLoader loader) Return the scope name corresponding to the specified class loader. |
protected ConfigurableCacheFactory |
getSingletonFactory() Return the singleton cache factory. |
protected boolean |
isCompatibility() Return true iff the resolution strategy of this builder is STRATEGY_COMPATIBILITY. |
protected XmlElement |
loadConfigFromURI(String sConfigURI, ClassLoader loader) Load the XML configuration from the specified URI. |
protected XmlElement |
modifyConfig(XmlElement xmlConfig, ClassLoader loader) Modify the specified configuration to resolve any conflicts with existing service configurations. |
protected String |
modifyServiceName(String sName, String sScope) Modify the specified service name to reflect the specified scope. |
void |
release(ConfigurableCacheFactory factory) Release the specified ConfigurableCacheFactory. |
void |
releaseAll(ClassLoader loader) Release all ConfigurableCacheFactory objects for a given ClassLoader. |
void |
setCacheConfiguration(ClassLoader loader, XmlElement xmlConfig) Dynamically set the default cache configuration for a given class loader. |
void |
setCacheConfiguration(String sConfigURI, ClassLoader loader, XmlElement xmlConfig) Dynamically set the cache configuration for a given URI and class loader. |
protected void |
setSingletonFactory(ConfigurableCacheFactory ccf) Set the singleton cache factory (see getSingletonFactory() ). |
protected void |
validateConfig(XmlElement xmlConfig) Validate the specified configuration against the existing configurations. |
Field Detail |
---|
public static final int STRATEGY_COMPATIBILITY
public static final int STRATEGY_VALIDATION
public static final int STRATEGY_NONVALIDATION
public static final int STRATEGY_RENAME_UNIQUELY
protected static final String URI_DEFAULT
protected Map m_mapByLoader
protected Map m_mapInternedConfig
protected ConfigurableCacheFactory m_ccfSingleton
protected int m_nResolveStrategy
Constructor Detail |
---|
public DefaultCacheFactoryBuilder()
protected DefaultCacheFactoryBuilder(int nResolveStrategy)
nResolveStrategy
- the STRATEGY_* constant to use for resolving multiple configurationsMethod Detail |
---|
protected boolean isCompatibility()
protected ConfigurableCacheFactory getSingletonFactory()
protected void setSingletonFactory(ConfigurableCacheFactory ccf)
getSingletonFactory()
).ccf
- the singleton configurable cache factorypublic int getResolutionStrategy()
public ConfigurableCacheFactory getConfigurableCacheFactory(ClassLoader loader)
getConfigurableCacheFactory
in interface CacheFactoryBuilder
loader
- class loader for which the configuration should be used; must not be nullpublic ConfigurableCacheFactory getConfigurableCacheFactory(String sConfigURI, ClassLoader loader)
getConfigurableCacheFactory
in interface CacheFactoryBuilder
sConfigURI
- the configuration URI; must not be nullloader
- class loader for which the configuration should be used; must not be nullprotected ConfigurableCacheFactory getFactory(String sConfigURI, ClassLoader loader)
sConfigURI
- the configuration URI to return a CCF forloader
- the loader to return a CCF forpublic void setCacheConfiguration(ClassLoader loader, XmlElement xmlConfig)
setCacheConfiguration
in interface CacheFactoryBuilder
loader
- class loader for which the configuration should be used; must not be nullxmlConfig
- cache configuration in xml element formatpublic void setCacheConfiguration(String sConfigURI, ClassLoader loader, XmlElement xmlConfig)
setCacheConfiguration
in interface CacheFactoryBuilder
sConfigURI
- the configuration URI; must not be nullloader
- class loader for which the configuration should be used; must not be nullxmlConfig
- cache configuration in xml element formatpublic void releaseAll(ClassLoader loader)
releaseAll
in interface CacheFactoryBuilder
loader
- the class loader for which all associated cache factories should be releasedpublic void release(ConfigurableCacheFactory factory)
release
in interface CacheFactoryBuilder
factory
- the ConfigurableCacheFactory to releaseprotected String getScopeName(ClassLoader loader)
modifyServiceName(java.lang.String, java.lang.String)
. <p/> Note: this method must be overriden if the unique naming strategy is to be used.loader
- the class loaderprotected String modifyServiceName(String sName, String sScope)
getScopeName(java.lang.ClassLoader)
.sName
- the configured service name to modifysScope
- the scope identifier to use in modifying the service nameprotected Map ensureConfigCCFMap(ClassLoader loader)
loader
- the class loader to which the map correspondsprotected ConfigurableCacheFactory getDefaultFactory(ClassLoader loader)
loader
- the loader for which to create a default cache factoryprotected XmlElement loadConfigFromURI(String sConfigURI, ClassLoader loader)
sConfigURI
- the configuration URI; must not be nullloader
- class loader to useprotected Set collectServiceNames()
protected XmlElement applyStrategy(XmlElement xmlConfig, ClassLoader loader)
xmlConfig
- the XML configuration on which to apply the resolution strategyloader
- the class loader with which to apply the resolution strategyprotected void validateConfig(XmlElement xmlConfig)
xmlConfig
- the configuration to validate with respect to the existing configIllegalStateException
- if there are conflicting service definitions.protected XmlElement modifyConfig(XmlElement xmlConfig, ClassLoader loader)
xmlConfig
- the configuration to validate with respect to the existing configloader
- the class loader for which to modify the specified configprotected ConfigurableCacheFactory buildFactory(XmlElement xmlConfig, ClassLoader loader)
xmlConfig
- the XML configuration to create a factory forloader
- the class loader associated with the factory
|
Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |