|
Oracle® Coherence Java API Reference v3.5.3 E15583-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.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:
| 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 configurations| Method 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 CacheFactoryBuilderloader - class loader for which the configuration should be
used; must not be null
public ConfigurableCacheFactory getConfigurableCacheFactory(java.lang.String sConfigURI,
java.lang.ClassLoader loader)
getConfigurableCacheFactory in interface CacheFactoryBuildersConfigURI - the configuration URI; must not be nullloader - class loader for which the configuration should be
used; must not be null
protected 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 for
public void setCacheConfiguration(java.lang.ClassLoader loader,
XmlElement xmlConfig)
setCacheConfiguration in interface CacheFactoryBuilderloader - class loader for which the configuration should be
used; must not be nullxmlConfig - cache configuration in xml element format
public void setCacheConfiguration(java.lang.String sConfigURI,
java.lang.ClassLoader loader,
XmlElement xmlConfig)
setCacheConfiguration in interface CacheFactoryBuildersConfigURI - 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 CacheFactoryBuilderloader - the class loader for which all associated cache factories
should be releasedpublic void release(ConfigurableCacheFactory factory)
release in interface CacheFactoryBuilderfactory - the ConfigurableCacheFactory to releaseprotected java.lang.String getScopeName(java.lang.ClassLoader loader)
modifyServiceName(java.lang.String, java.lang.String).
Note: this method must be overriden if the unique naming strategy is to be
used.
loader - the class loader
protected 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 name
protected java.util.Map ensureConfigCCFMap(java.lang.ClassLoader loader)
loader - the class loader to which the map corresponds
protected ConfigurableCacheFactory getDefaultFactory(java.lang.ClassLoader loader)
loader - the loader for which to create a default cache factory
protected XmlElement loadConfigFromURI(java.lang.String sConfigURI,
java.lang.ClassLoader loader)
sConfigURI - the configuration URI; must not be nullloader - class loader to use
protected 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
strategy
protected void validateConfig(XmlElement xmlConfig)
xmlConfig - the configuration to validate with respect to the
existing config
java.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 config
protected 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.3 E15583-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||