|
Oracle® Coherence Java API Reference v3.5.1 E15583-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 java.util.Map |
m_mapByLoader Mapping used to associate class loaders with the cache factories that are configured on them. |
protected java.util.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 java.lang.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, java.lang.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, java.lang.ClassLoader loader) Construct a ConfigurableCacheFactory for the specified XML configuration. |
protected java.util.Set |
collectServiceNames() Construct and return a collection of service names defined by any cache configurations known to this cache factory builder. |
protected java.util.Map |
ensureConfigCCFMap(java.lang.ClassLoader loader) Ensure that a map from URI to ConfigurableCacheFactory for the specified loader exists (creating it if necessary). |
ConfigurableCacheFactory |
getConfigurableCacheFactory(java.lang.ClassLoader loader) Return the default ConfigurableCacheFactory for a given class loader. |
ConfigurableCacheFactory |
getConfigurableCacheFactory(java.lang.String sConfigURI, java.lang.ClassLoader loader) Return the ConfigurableCacheFactory for a given URI and class loader. |
protected ConfigurableCacheFactory |
getDefaultFactory(java.lang.ClassLoader loader) Return a default cache factory for the specified loader. |
protected ConfigurableCacheFactory |
getFactory(java.lang.String sConfigURI, java.lang.ClassLoader loader) Helper method to return a CCF instance for the specified URI and class loader. |
int |
getResolutionStrategy() Return the configuration resolution strategy. |
protected java.lang.String |
getScopeName(java.lang.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(java.lang.String sConfigURI, java.lang.ClassLoader loader) Load the XML configuration from the specified URI. |
protected XmlElement |
modifyConfig(XmlElement xmlConfig, java.lang.ClassLoader loader) Modify the specified configuration to resolve any conflicts with existing service configurations. |
protected java.lang.String |
modifyServiceName(java.lang.String sName, java.lang.String sScope) Modify the specified service name to reflect the specified scope. |
void |
release(ConfigurableCacheFactory factory) Release the specified ConfigurableCacheFactory. |
void |
releaseAll(java.lang.ClassLoader loader) Release all ConfigurableCacheFactory objects for a given ClassLoader. |
void |
setCacheConfiguration(java.lang.ClassLoader loader, XmlElement xmlConfig) Dynamically set the default cache configuration for a given class loader. |
void |
setCacheConfiguration(java.lang.String sConfigURI, java.lang.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 java.lang.String URI_DEFAULT
protected java.util.Map m_mapByLoader
protected java.util.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(java.lang.ClassLoader loader)
getConfigurableCacheFactory
in interface CacheFactoryBuilder
loader
- class loader for which the configuration should be used; must not be nullpublic ConfigurableCacheFactory getConfigurableCacheFactory(java.lang.String sConfigURI, java.lang.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(java.lang.String sConfigURI, java.lang.ClassLoader loader)
sConfigURI
- the configuration URI to return a CCF forloader
- the loader to return a CCF forpublic void setCacheConfiguration(java.lang.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(java.lang.String sConfigURI, java.lang.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(java.lang.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 java.lang.String getScopeName(java.lang.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 java.lang.String modifyServiceName(java.lang.String sName, java.lang.String sScope)
getScopeName(java.lang.ClassLoader)
.sName
- the configured service name to modifysScope
- the scope identifier to use in modifying the service nameprotected java.util.Map ensureConfigCCFMap(java.lang.ClassLoader loader)
loader
- the class loader to which the map correspondsprotected ConfigurableCacheFactory getDefaultFactory(java.lang.ClassLoader loader)
loader
- the loader for which to create a default cache factoryprotected XmlElement loadConfigFromURI(java.lang.String sConfigURI, java.lang.ClassLoader loader)
sConfigURI
- the configuration URI; must not be nullloader
- class loader to useprotected java.util.Set collectServiceNames()
protected XmlElement applyStrategy(XmlElement xmlConfig, java.lang.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 configjava.lang.IllegalStateException
- if there are conflicting service definitions.protected XmlElement modifyConfig(XmlElement xmlConfig, java.lang.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, java.lang.ClassLoader loader)
xmlConfig
- the XML configuration to create a factory forloader
- the class loader associated with the factory
|
Oracle® Coherence Java API Reference v3.5.1 E15583-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |