|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.net.ScopedCacheFactoryBuilder
public class ScopedCacheFactoryBuilder
Implementation of CacheFactoryBuilder
that manages multiple instances of ConfigurableCacheFactory
. This implementation supports isolation of cache configurations via the following mechanisms:
<scope-name>
attribute. If this element exists, this attribute will be set on the CCF instance.ScopeResolver
. This will usually be done by containers that manage multiple applications that each use their own cache configuration.This scope name may be used by the ConfigurableCacheFactory
instance as a service name prefix.
Field Summary | |
---|---|
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_mapConfigByLoader Mapping used to associate class loaders with specific configuration elements. |
protected ScopeResolver |
m_scopeResolver Scope resolver used to resolve scope name upon CCF construction. |
protected static java.lang.String |
URI_DEFAULT Internally used "default" URI identifier. |
Constructor Summary | |
---|---|
ScopedCacheFactoryBuilder() Default constructor; reads scope resolver configuration from operational configuration file (tangosol-coherence.xml). |
|
ScopedCacheFactoryBuilder(ScopeResolver resolver) Constructor to provide a custom scope resolver. |
Method Summary | |
---|---|
protected ConfigurableCacheFactory |
buildFactory(java.lang.String sConfigURI, java.lang.ClassLoader loader) Construct and configure a ConfigurableCacheFactory for the specified cache config URI and ClassLoader . |
protected void |
configureScope(java.lang.String sConfigURI, java.lang.ClassLoader loader, XmlElement xmlConfig, ConfigurableCacheFactory ccf) For a given cache configuration URI and ClassLoader, configure the scope name for the associated ConfigurableCacheFactory . |
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). |
protected java.util.Map |
ensureConfigMap(java.lang.ClassLoader loader) Ensure that a map from URL 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 XmlElement |
getConfigurableCacheFactoryConfig() Return the XML configuration used for the construction of a ConfigurableCacheFactory . |
protected ConfigurableCacheFactory |
getFactory(java.lang.String sConfigURI, java.lang.ClassLoader loader) Helper method to return a ConfigurableCacheFactory instance for the specified URI and class loader. |
ScopeResolver |
getScopeResolver() Obtain the scope resolver for this builder. |
protected ConfigurableCacheFactory |
instantiateFactory(java.lang.ClassLoader loader, XmlElement xmlConfig, XmlElement xmlFactory, java.lang.String sConfigURI, java.lang.String sPofConfigURI, ScopeResolver scopeResolver) Create a new instance of ConfigurableCacheFactory based on a given ClassLoader and cache configuration XML. |
protected XmlElement |
loadConfigFromURI(java.lang.String sConfigURI, java.lang.ClassLoader loader) Load the XML configuration from the specified URI. |
void |
release(ConfigurableCacheFactory factory) Release the specified ConfigurableCacheFactory. |
void |
releaseAll(java.lang.ClassLoader loader) Release all ConfigurableCacheFactory objects for a given ClassLoader. |
protected java.lang.String |
resolveURI(java.lang.String sConfigURI) Resolve the URI that identifies the cache configuration. |
protected java.net.URL |
resolveURL(java.lang.String sConfigURI, java.lang.ClassLoader loader) Resolve the URL based on the provided configuration URI. |
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. |
ConfigurableCacheFactory |
setConfigurableCacheFactory(ConfigurableCacheFactory ccf, java.lang.String sConfigURI, java.lang.ClassLoader loader, boolean fReplace) Dynamically set the ConfigurableCacheFactory for a given URI and class loader. |
void |
setScopeResolver(ScopeResolver scopeResolver) Specify the scope resolver for this builder. |
Field Detail |
---|
protected ScopeResolver m_scopeResolver
protected java.util.Map m_mapByLoader
protected java.util.Map m_mapConfigByLoader
protected static final java.lang.String URI_DEFAULT
Constructor Detail |
---|
public ScopedCacheFactoryBuilder()
public ScopedCacheFactoryBuilder(ScopeResolver resolver)
resolver
- scope resolverMethod Detail |
---|
public ScopeResolver getScopeResolver()
public void setScopeResolver(ScopeResolver scopeResolver)
scopeResolver
- scope resolverpublic 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 nullpublic 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 ConfigurableCacheFactory setConfigurableCacheFactory(ConfigurableCacheFactory ccf, java.lang.String sConfigURI, java.lang.ClassLoader loader, boolean fReplace)
ConfigurableCacheFactory
for a given URI and class loader. If a ConfigurableCacheFactory for the given URI and class loader already exists and the replacement is requested, the factory will be released.setConfigurableCacheFactory
in interface CacheFactoryBuilder
ccf
- the ConfigurableCacheFactory instancesConfigURI
- the configuration URI; must not be nullloader
- class loader for which the configuration should be used; must not be nullfReplace
- specifies whether to replace a ConfigurableCacheFactory if one is already registeredpublic 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 ConfigurableCacheFactory getFactory(java.lang.String sConfigURI, java.lang.ClassLoader loader)
ConfigurableCacheFactory
instance for the specified URI and class loader.sConfigURI
- the configuration URI to return a ConfigurableCacheFactory
forloader
- the loader to return a CCF forConfigurableCacheFactory
instanceprotected java.util.Map ensureConfigCCFMap(java.lang.ClassLoader loader)
loader
- the class loader to which the map correspondsprotected java.util.Map ensureConfigMap(java.lang.ClassLoader loader)
loader
- the class loader to which the map correspondsprotected XmlElement loadConfigFromURI(java.lang.String sConfigURI, java.lang.ClassLoader loader)
sConfigURI
- the configuration URI; must not be nullloader
- class loader to useprotected XmlElement getConfigurableCacheFactoryConfig()
ConfigurableCacheFactory
.XmlElement
that contains construction configurationprotected ConfigurableCacheFactory buildFactory(java.lang.String sConfigURI, java.lang.ClassLoader loader)
ConfigurableCacheFactory
for the specified cache config URI and ClassLoader
.sConfigURI
- the URI to the cache configurationloader
- the ClassLoader
associated with the factoryprotected ConfigurableCacheFactory instantiateFactory(java.lang.ClassLoader loader, XmlElement xmlConfig, XmlElement xmlFactory, java.lang.String sConfigURI, java.lang.String sPofConfigURI, ScopeResolver scopeResolver)
ConfigurableCacheFactory
based on a given ClassLoader
and cache configuration XML.loader
- the ClassLoader
used to instantiate the ConfigurableCacheFactory
xmlConfig
- the XmlElement
containing the cache configurationxmlFactory
- the XmlElement
containing the factory definitionsConfigURI
- the URI to the cache configurationsPofConfigURI
- the POF configuration URIscopeResolver
- the ScopeResolver
used to scope servicesConfigurableCacheFactory
createdprotected java.lang.String resolveURI(java.lang.String sConfigURI)
CacheFactory.getConfigurableCacheFactory()
. If the "default" URI is requested, the URI is resolved to the default cache configuration name indicated in the operational configuration file; otherwise the provided URI is returned.sConfigURI
- the passed in URIURI_DEFAULT
protected java.net.URL resolveURL(java.lang.String sConfigURI, java.lang.ClassLoader loader)
sConfigURI
- the configuration URI to make a URL out ofloader
- the ClassLoader
to useURL
for the resourceprotected void configureScope(java.lang.String sConfigURI, java.lang.ClassLoader loader, XmlElement xmlConfig, ConfigurableCacheFactory ccf)
ConfigurableCacheFactory
.sConfigURI
- the configuration URI for the CCFloader
- the ClassLoader for the CCFxmlConfig
- XML configuration for the provided CCF; this may contain a scope nameccf
- the ConfigurableCacheFactory that will have its scope modified
|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |