|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.bea.p13n.cache.spi.CacheProvider
com.tangosol.coherence.weblogic.PortalCacheProvider
public class PortalCacheProvider
WebLogic Portal CacheProvider implementation that provides Cache instances that use Coherence™ to cache data.
Each Cache implementation returned by this CacheProvider delegates most operations to a Coherence NamedCache
configured via the XML cache configuration descriptor with URI PATH_CACHE_CONFIG
. The name of the delegate NamedCache is constructed by appending the value returned by the getScopeIdentifier() method to the Cache name. For example, a Cache named "portalControlTreeCache" used within the "portalApp" J2EE application would delegate to the "portalControlTreeCache:portalApp" NamedCache.
If a serialization error occurs while updating a cached value, the Cache implementation will store the updated value in a LocalCache
and log an error message (once per non-serializable class). In this case, the configuration of the Cache should be changed to a LocalCache.
The CacheProvider is configured via the XML configuration file loaded using the PATH_PROVIDER_CONFIG
resource URI. This file contains configuration for the following PortalCacheProvider properties:
Property Description Default Value ClusterOwned
Either true or false to indicate whether the PortalCacheProvider should shutdown the Coherence cluster when it is shutdown. For example, this should be set to true if coherence.jar and coherence-wlp.jar are deployed within the portal application. false EntrySetRealized
Either true or false to indicate whether the Cache implementations returned by the PortalCacheProvider should return a fully realized set of cached values from the entrySet() method, rather than a virtual collection of cached values. The Cache API specifies that the entrySet() method should return the set of cached values. Not only is this quite unconventional (see the JavaDoc for the java.util.Map#entrySet method), but it can be a CPU- and memory-intensive operation; therefore, it is recommended that this elment be set to false unless strict compatibility with the default P13N CacheProvider is required. false ReloadableCacheSupported
Either true or false to indiciate whether the PortalCacheProvider should return Cache implementations that support the ReloadableCache API. Supporting the ReloadableCache API requires additional resources; therefore, if Cache reloading is not needed, it is recommended that this element be set to false. false ScopeSeparator
The string that separates the Cache name from the scope identifier in the fully qualified name of the delegate NamedCache. : InvocationServiceName
The name of the InvocationService used to send messages to remote cluster nodes. INVOCATION_SERVICE_NAME
Note: Use of the PortalCacheProvider requires WebLogic Portal 8.1.6 or higher. Additionally, the PortalCacheProvider is a feature of the Coherence Enterprise Edition and Coherence Grid Edition. It cannot be used in a Coherence Standard Edition cluster.
Nested Class Summary | |
---|---|
protected class |
PortalCacheProvider.CacheImpl Cache implementation that delegates most operations to a Coherence NamedCache. |
static class |
PortalCacheProvider.FlushAgent Invocable implementation that is used to flush a Cache instance located on one or more remote cluster nodes. |
protected class |
PortalCacheProvider.ReloadableCacheImpl CacheImpl extension that supports the ReloadableCache interface. |
Field Summary | |
---|---|
static java.lang.String |
INVOCATION_SERVICE_NAME The default name of the InvocationService used by the CacheProvider. |
protected ConfigurableCacheFactory |
m_factory The CacheProvider's own ConfigurableCacheFactory. |
protected boolean |
m_fClusterOwned True to indicate that the CacheProvider should shutdown the cluster when it is shutdown. |
protected boolean |
m_fEntrySetRealized True to indicate that the Cache implementations returned by this CacheProvider should return a fully realized set of cached values from the entrySet() method rather than a virtual collection of values. |
protected boolean |
m_fReloadableCacheSupported True to indicate that the CacheProvider should return Cache implementations that support the ReloadableCache API. |
protected InvocationService |
m_serviceInvocation The InvocationService used by the CacheProvider. |
protected java.lang.String |
m_sInvocationServiceName The name of the InvocationService used by the CacheProvider to send messages to remote cluster nodes. |
protected java.lang.String |
m_sScopeSeparator The string that separates the Cache name from the scope identifier in the fully qualified name of the delegate NamedCache. |
protected XmlElement |
m_xmlConfig The CacheProvider's configuration. |
static java.lang.String |
PATH_CACHE_CONFIG The name of the required resource that will be used to configure the CacheProvider's own ConfigurableCacheFactory. |
static java.lang.String |
PATH_PROVIDER_CONFIG The name of the optional resource that will be used to configure the CacheProvider itself. |
Constructor Summary | |
---|---|
PortalCacheProvider() Default constructor. |
Method Summary | |
---|---|
protected InvocationService |
ensureInvocationService() Obtain the Coherence InvocationService used by the CacheProvider, initializing it if it hasn't already been initialized. |
void |
flushCache(java.lang.String sName, java.lang.Object oKey) Flush all clustered replicas of the Cache with the given name. |
protected static com.bea.p13n.cache.Cache |
getCache(java.lang.String sName) Obtain an existing P13N Cache by name. |
com.bea.p13n.cache.Cache |
getCache(java.lang.String sName, com.bea.p13n.cache.CacheConfig config) Return a Cache implementation with the given name. |
XmlElement |
getConfig() Determine the current configuration of the object. |
protected ConfigurableCacheFactory |
getConfigurableCacheFactory() Obtain the ConfigurableCacheFactory used by this PortalCacheFactory. |
protected java.lang.String |
getDescription() Return a string representation of this CacheProvider's attributes. |
protected java.lang.String |
getInvocationServiceName() Determine the name of the InvocationService used by the CacheProvider to send messages to remote cluster nodes. |
protected NamedCache |
getNamedCache(java.lang.String sName) Obtain a Coherence NamedCache by name. |
java.lang.String |
getProviderId() Return a unique identifier for this CacheProvider. |
protected java.lang.String |
getQualifiedCacheName(java.lang.String sName) Given a Cache name as passed from the CacheFactory, return a fully-qualified Cache name that contains the CacheProvider scope identifier. |
protected java.lang.String |
getScopeSeparator() Determine the string that separates the Cache name from the scope identifier in the fully qualified name of the delegate NamedCache. |
protected java.lang.String |
getUnqualifiedCacheName(java.lang.String sName) Given a qualified cache name as returned by the getQualifiedCacheName(String) method, return the unqualified name that does not contain the CacheProvider scope identifier. |
java.lang.String |
getVendorInfo() Returns the name of the organization, vendor, or company that provided this implementation. |
java.lang.String |
getVersionString() Return the version of this CacheProvider implementation. |
void |
init() Initialize the CacheProvider. |
protected PortalCacheProvider.CacheImpl |
instantiateCacheImpl(java.lang.String sName, NamedCache cache) Factory pattern: Create a new CacheImpl. |
protected PortalCacheProvider.FlushAgent |
instantiateFlushAgent(java.lang.String sName, java.lang.Object oKey) Factory pattern: Create a new FlushAgent. |
protected boolean |
isClusterOwned() Determine if the CacheProvider should shutdown the cluster when it is shutdown. |
protected boolean |
isEntrySetRealized() Determine if the CacheProvider should return Cache implementations that return a fully realized set of cached values from the entrySet() method, rather than a virtual collection of cached values. |
protected static boolean |
isLocalCache(NamedCache cache) Determine if the given NamedCache is a LocalCache. |
protected boolean |
isReloadableCacheSupported() Determine if the CacheProvider should return Cache implementations that support the ReloadableCache API. |
protected static java.lang.Object |
put(CacheMap cache, java.lang.Object oKey, java.lang.Object oValue, long cMillis) Cache the given value in the specified CacheMap using the specified time-to-live and return the old cached value. |
protected static void |
putBlind(CacheMap cache, java.lang.Object oKey, java.lang.Object oValue, long cMillis) Cache the given value in the specified CacheMap using the specified time-to-live. |
void |
release() Release all local resources associated with the CacheProvider. |
void |
releaseCache(com.bea.p13n.cache.Cache cache) Release all local resources associated with the specified Cache instance. |
void |
setConfig(XmlElement xmlConfig) Specify the configuration for the object. |
java.lang.String |
toString() Return a human readable String representation of this CacheProvider. |
Methods inherited from class com.bea.p13n.cache.spi.CacheProvider |
---|
getScopeIdentifier |
Field Detail |
---|
protected ConfigurableCacheFactory m_factory
protected XmlElement m_xmlConfig
protected boolean m_fClusterOwned
protected boolean m_fEntrySetRealized
protected boolean m_fReloadableCacheSupported
protected java.lang.String m_sScopeSeparator
protected java.lang.String m_sInvocationServiceName
protected InvocationService m_serviceInvocation
public static final java.lang.String PATH_PROVIDER_CONFIG
public static final java.lang.String PATH_CACHE_CONFIG
public static final java.lang.String INVOCATION_SERVICE_NAME
Constructor Detail |
---|
public PortalCacheProvider()
Method Detail |
---|
public XmlElement getConfig()
getConfig
in interface XmlConfigurable
public void setConfig(XmlElement xmlConfig)
setConfig
in interface XmlConfigurable
xmlConfig
- the XML configuration for the objectpublic java.lang.String toString()
toString
in class com.bea.p13n.cache.spi.CacheProvider
public java.lang.String getProviderId()
This identifier is used to uniquely identify a provider during configuration. It is suggested that this identifier be based on the vendor package namespace, such as "com.bea.p13n" (which is the identifier for the default P13nCacheProvider).
getProviderId
in class com.bea.p13n.cache.spi.CacheProvider
public java.lang.String getVendorInfo()
getVendorInfo
in class com.bea.p13n.cache.spi.CacheProvider
public java.lang.String getVersionString()
getVersionString
in class com.bea.p13n.cache.spi.CacheProvider
protected java.lang.String getDescription()
public void init()
This method is called immediately after instantiation but before the provider is used.
init
in class com.bea.p13n.cache.spi.CacheProvider
public void release()
The CacheFactory will call this method after the J2EE application for which this CacheProvider is providing Cache implementations is shutdown.
Releasing a CacheProvider makes it no longer usable; any attempt to use the CacheProvider may result in an exception.
release
in class com.bea.p13n.cache.spi.CacheProvider
public com.bea.p13n.cache.Cache getCache(java.lang.String sName, com.bea.p13n.cache.CacheConfig config)
It is the responsibility of the CacheProvider to perform any necessary Cache configuration before returning the Cache instance from this method. The Cache configuration mechanism is assumed to be vendor specific.
getCache
in class com.bea.p13n.cache.spi.CacheProvider
sName
- the name of the Cache to return; must be non-null and non- emptyconfig
- suggested Cache configuration that may be used by the CacheProvider to configure the returned Cache; this may be ignored by the CacheProviderjava.lang.IllegalArgumentException
- if the given Cache name is invalidpublic void flushCache(java.lang.String sName, java.lang.Object oKey)
flushCache
in class com.bea.p13n.cache.spi.CacheProvider
sName
- the name of the Cache to flush; must not be nulloKey
- an optional key; if not null, only the entry with the given key should be flushed from all clustered replicaspublic void releaseCache(com.bea.p13n.cache.Cache cache)
Releasing a Cache reference makes it no longer usable; any attempt to use the reference may result in an exception.
releaseCache
in class com.bea.p13n.cache.spi.CacheProvider
cache
- the Cache to releaseprotected java.lang.String getQualifiedCacheName(java.lang.String sName)
sName
- the unqualified cache name; must not be nulljava.lang.IllegalArgumentException
- if the given Cache name is invalidprotected java.lang.String getUnqualifiedCacheName(java.lang.String sName)
getQualifiedCacheName(String)
method, return the unqualified name that does not contain the CacheProvider scope identifier.sName
- the fully-qualified cache name; must not be nullprotected InvocationService ensureInvocationService()
protected static boolean isLocalCache(NamedCache cache)
cache
- the NamedCache to testprotected static com.bea.p13n.cache.Cache getCache(java.lang.String sName)
sName
- the name of the Cache to obtainprotected ConfigurableCacheFactory getConfigurableCacheFactory()
protected NamedCache getNamedCache(java.lang.String sName)
sName
- the name of the NamedCache to obtainprotected static java.lang.Object put(CacheMap cache, java.lang.Object oKey, java.lang.Object oValue, long cMillis)
If the given time-to-live is equal to CacheMap.EXPIRY_DEFAULT
or if the CacheMap does not support the extended put()
method, the standard put() method is used.
cache
- the target CacheMapoKey
- the key with which to cache the valueoValue
- the value to cachecMillis
- the time-to-live of the cached entryprotected static void putBlind(CacheMap cache, java.lang.Object oKey, java.lang.Object oValue, long cMillis)
If the given time-to-live is equal to CacheMap.EXPIRY_DEFAULT
or if the CacheMap does not support the extended put()
method, the putAll() method is used.
cache
- the target CacheMapoKey
- the key with which to cache the valueoValue
- the value to cachecMillis
- the time-to-live of the cached entryprotected PortalCacheProvider.CacheImpl instantiateCacheImpl(java.lang.String sName, NamedCache cache)
sName
- the name of the Cache; must not be nullcache
- the delegate NamedCache used to implement most cache operations; must not be nullprotected PortalCacheProvider.FlushAgent instantiateFlushAgent(java.lang.String sName, java.lang.Object oKey)
sName
- the name of the Cache to flush; must not be nulloKey
- an optional key; if non-null, only the Cache entry with the given key will be flushedprotected boolean isClusterOwned()
protected boolean isEntrySetRealized()
protected boolean isReloadableCacheSupported()
protected java.lang.String getScopeSeparator()
protected java.lang.String getInvocationServiceName()
|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |