Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


com.tangosol.coherence.weblogic
Class PortalCacheProvider

java.lang.Object
  extended by com.bea.p13n.cache.spi.CacheProvider
      extended by com.tangosol.coherence.weblogic.PortalCacheProvider

All Implemented Interfaces:
XmlConfigurable

public class PortalCacheProvider
extends com.bea.p13n.cache.spi.CacheProvider
implements XmlConfigurable

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, which can be overridden with the PROP_CACHE_CONFIG system property. 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.

Author:
jhowes 2005.12.2005

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.
static java.lang.String PROP_CACHE_CONFIG
          The name of the system property used to specify a cache configuration file that will be used to configure the CacheProvider's own ConfigurableCacheFactory.

 

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

m_factory

protected ConfigurableCacheFactory m_factory
The CacheProvider's own ConfigurableCacheFactory.

m_xmlConfig

protected XmlElement m_xmlConfig
The CacheProvider's configuration.

m_fClusterOwned

protected boolean m_fClusterOwned
True to indicate that the CacheProvider should shutdown the cluster when it is shutdown.

m_fEntrySetRealized

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.

m_fReloadableCacheSupported

protected boolean m_fReloadableCacheSupported
True to indicate that the CacheProvider should return Cache implementations that support the ReloadableCache API.

m_sScopeSeparator

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.

m_sInvocationServiceName

protected java.lang.String m_sInvocationServiceName
The name of the InvocationService used by the CacheProvider to send messages to remote cluster nodes.

m_serviceInvocation

protected InvocationService m_serviceInvocation
The InvocationService used by the CacheProvider.

PATH_PROVIDER_CONFIG

public static final java.lang.String PATH_PROVIDER_CONFIG
The name of the optional resource that will be used to configure the CacheProvider itself.
See Also:
Constant Field Values

PATH_CACHE_CONFIG

public static final java.lang.String PATH_CACHE_CONFIG
The name of the required resource that will be used to configure the CacheProvider's own ConfigurableCacheFactory.
See Also:
Constant Field Values

PROP_CACHE_CONFIG

public static final java.lang.String PROP_CACHE_CONFIG
The name of the system property used to specify a cache configuration file that will be used to configure the CacheProvider's own ConfigurableCacheFactory. If not specified, PATH_CACHE_CONFIG will be used.
See Also:
Constant Field Values

INVOCATION_SERVICE_NAME

public static final java.lang.String INVOCATION_SERVICE_NAME
The default name of the InvocationService used by the CacheProvider.
See Also:
Constant Field Values

Constructor Detail

PortalCacheProvider

public PortalCacheProvider()
Default constructor.

Method Detail

getConfig

public XmlElement getConfig()
Determine the current configuration of the object.
Specified by:
getConfig in interface XmlConfigurable
Returns:
the XML configuration or null

setConfig

public void setConfig(XmlElement xmlConfig)
Specify the configuration for the object.
Specified by:
setConfig in interface XmlConfigurable
Parameters:
xmlConfig - the XML configuration for the object

toString

public java.lang.String toString()
Return a human readable String representation of this CacheProvider.
Overrides:
toString in class com.bea.p13n.cache.spi.CacheProvider
Returns:
a String representation of this object.

getProviderId

public java.lang.String getProviderId()
Return a unique identifier for this CacheProvider.

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).

Specified by:
getProviderId in class com.bea.p13n.cache.spi.CacheProvider
Returns:
the unique identifier for this CacheProvider

getVendorInfo

public java.lang.String getVendorInfo()
Returns the name of the organization, vendor, or company that provided this implementation.
Specified by:
getVendorInfo in class com.bea.p13n.cache.spi.CacheProvider
Returns:
the name of the vendor that implemented this CacheProvider

getVersionString

public java.lang.String getVersionString()
Return the version of this CacheProvider implementation.
Specified by:
getVersionString in class com.bea.p13n.cache.spi.CacheProvider
Returns:
the version string

getDescription

protected java.lang.String getDescription()
Return a string representation of this CacheProvider's attributes.
Returns:
a string representation of this CacheProvider's attributes

init

public void init()
Initialize the CacheProvider.

This method is called immediately after instantiation but before the provider is used.

Overrides:
init in class com.bea.p13n.cache.spi.CacheProvider

release

public void release()
Release all local resources associated with the CacheProvider.

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.

Overrides:
release in class com.bea.p13n.cache.spi.CacheProvider

getCache

public com.bea.p13n.cache.Cache getCache(java.lang.String sName,
                                         com.bea.p13n.cache.CacheConfig config)
Return a Cache implementation with the given name.

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.

Specified by:
getCache in class com.bea.p13n.cache.spi.CacheProvider
Parameters:
sName - the name of the Cache to return; must be non-null and non- empty
config - suggested Cache configuration that may be used by the CacheProvider to configure the returned Cache; this may be ignored by the CacheProvider
Returns:
a Cache instance identified by the given name
Throws:
java.lang.IllegalArgumentException - if the given Cache name is invalid

flushCache

public void flushCache(java.lang.String sName,
                       java.lang.Object oKey)
Flush all clustered replicas of the Cache with the given name.
Overrides:
flushCache in class com.bea.p13n.cache.spi.CacheProvider
Parameters:
sName - the name of the Cache to flush; must not be null
oKey - an optional key; if not null, only the entry with the given key should be flushed from all clustered replicas

releaseCache

public void releaseCache(com.bea.p13n.cache.Cache cache)
Release all local resources associated with the specified Cache instance.

Releasing a Cache reference makes it no longer usable; any attempt to use the reference may result in an exception.

Overrides:
releaseCache in class com.bea.p13n.cache.spi.CacheProvider
Parameters:
cache - the Cache to release

getQualifiedCacheName

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.
Parameters:
sName - the unqualified cache name; must not be null
Returns:
the fully-qualified cache name
Throws:
java.lang.IllegalArgumentException - if the given Cache name is invalid

getUnqualifiedCacheName

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.
Parameters:
sName - the fully-qualified cache name; must not be null
Returns:
the unqualified cache name

ensureInvocationService

protected InvocationService ensureInvocationService()
Obtain the Coherence InvocationService used by the CacheProvider, initializing it if it hasn't already been initialized.
Returns:
the InvocationService

isLocalCache

protected static boolean isLocalCache(NamedCache cache)
Determine if the given NamedCache is a LocalCache.
Parameters:
cache - the NamedCache to test
Returns:
true if the given NamedCache is a LocalCache; false otherwise

getCache

protected static com.bea.p13n.cache.Cache getCache(java.lang.String sName)
Obtain an existing P13N Cache by name.
Parameters:
sName - the name of the Cache to obtain
Returns:
the P13N Cache with the given name or null if the Cache doesn't exist

getConfigurableCacheFactory

protected ConfigurableCacheFactory getConfigurableCacheFactory()
Obtain the ConfigurableCacheFactory used by this PortalCacheFactory.
Returns:
the ConfigurableCacheFactory used to obtain delegate NamedCache instances

getNamedCache

protected NamedCache getNamedCache(java.lang.String sName)
Obtain a Coherence NamedCache by name.
Parameters:
sName - the name of the NamedCache to obtain
Returns:
the Coherence NamedCache with the given name

put

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.

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.

Parameters:
cache - the target CacheMap
oKey - the key with which to cache the value
oValue - the value to cache
cMillis - the time-to-live of the cached entry
Returns:
the old cached value

putBlind

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.

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.

Parameters:
cache - the target CacheMap
oKey - the key with which to cache the value
oValue - the value to cache
cMillis - the time-to-live of the cached entry

instantiateCacheImpl

protected PortalCacheProvider.CacheImpl instantiateCacheImpl(java.lang.String sName,
                                                             NamedCache cache)
Factory pattern: Create a new CacheImpl.
Parameters:
sName - the name of the Cache; must not be null
cache - the delegate NamedCache used to implement most cache operations; must not be null
Returns:
a new CacheImpl instance

instantiateFlushAgent

protected PortalCacheProvider.FlushAgent instantiateFlushAgent(java.lang.String sName,
                                                               java.lang.Object oKey)
Factory pattern: Create a new FlushAgent.
Parameters:
sName - the name of the Cache to flush; must not be null
oKey - an optional key; if non-null, only the Cache entry with the given key will be flushed
Returns:
a new FlushAgent instance

isClusterOwned

protected boolean isClusterOwned()
Determine if the CacheProvider should shutdown the cluster when it is shutdown.
Returns:
true if the CacheProvider should shutdown the cluster; false otherwise

isEntrySetRealized

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.
Returns:
true if the entrySet() method should return a fully realized set of cached values

isReloadableCacheSupported

protected boolean isReloadableCacheSupported()
Determine if the CacheProvider should return Cache implementations that support the ReloadableCache API.
Returns:
true if the CacheProvider should return ReloadableCache implementations

getScopeSeparator

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.
Returns:
the separator string

getInvocationServiceName

protected java.lang.String getInvocationServiceName()
Determine the name of the InvocationService used by the CacheProvider to send messages to remote cluster nodes.
Returns:
the name of the InvocationService used by the CacheProvider

Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.