Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


com.tangosol.net.cache
Class ReadonlyNamedCache

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.AbstractKeyBasedMap
          extended by com.tangosol.util.AbstractKeySetBasedMap
              extended by com.tangosol.util.WrapperObservableMap
                  extended by com.tangosol.util.WrapperConcurrentMap
                      extended by com.tangosol.net.cache.WrapperNamedCache
                          extended by com.tangosol.net.cache.ReadonlyNamedCache

All Implemented Interfaces:
CacheMap, NamedCache, ConcurrentMap, InvocableMap, ObservableMap, QueryMap, java.util.Map

public class ReadonlyNamedCache
extends WrapperNamedCache

A simple extension of the WrapperNamedCache implementation that shields all content mutating operations such as put(), remove(), lock() etc.

Author:
gg 2006.08.06

Nested Class Summary

 

Nested classes/interfaces inherited from class com.tangosol.util.WrapperConcurrentMap
WrapperConcurrentMap.Lock

 

Nested classes/interfaces inherited from class com.tangosol.util.WrapperObservableMap
WrapperObservableMap.InternalListener

 

Nested classes/interfaces inherited from class com.tangosol.util.AbstractKeySetBasedMap
AbstractKeySetBasedMap.EntrySet, AbstractKeySetBasedMap.KeyIterator, AbstractKeySetBasedMap.KeySet, AbstractKeySetBasedMap.ValuesCollection

 

Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry

 

Nested classes/interfaces inherited from interface com.tangosol.util.QueryMap
QueryMap.Entry

 

Nested classes/interfaces inherited from interface com.tangosol.util.InvocableMap
InvocableMap.Entry, InvocableMap.EntryAggregator, InvocableMap.EntryProcessor, InvocableMap.ParallelAwareAggregator

 

Field Summary
protected  boolean m_fStrict
          Specifies whether or not the "read-only" nature of this NamedCache is strictly enforced.

 

Fields inherited from class com.tangosol.net.cache.WrapperNamedCache
m_service, m_sName

 

Fields inherited from class com.tangosol.util.WrapperConcurrentMap
m_cWaitMillis, m_fEnforceLocking, m_gateMap, m_mapLock

 

Fields inherited from class com.tangosol.util.WrapperObservableMap
m_fDeferredEvent, m_fTranslateEvents, m_listenerInternal, m_listenerSupport, m_map, m_stats

 

Fields inherited from interface com.tangosol.net.cache.CacheMap
EXPIRY_DEFAULT, EXPIRY_NEVER

 

Fields inherited from interface com.tangosol.util.ConcurrentMap
LOCK_ALL

 

Constructor Summary
ReadonlyNamedCache(java.util.Map map, java.lang.String sName, boolean fStrict)
          Construct a NamedCache wrapper based on the specified map.
ReadonlyNamedCache(NamedCache cache, boolean fStrict)
          Construct a NamedCache wrapper based on the specified map.

 

Method Summary
protected  void checkStrict()
          Enforce the "strict" read-only policy.
 void clear()
          Should not be called.
 void destroy()
          Should not be called.
 java.lang.Object invoke(java.lang.Object oKey, InvocableMap.EntryProcessor agent)
          Should not be called.
 java.util.Map invokeAll(java.util.Collection collKeys, InvocableMap.EntryProcessor agent)
          Should not be called.
 java.util.Map invokeAll(Filter filter, InvocableMap.EntryProcessor agent)
          Should not be called.
 boolean lock(java.lang.Object oKey)
          Should not be called.
 boolean lock(java.lang.Object oKey, long cWait)
          Should not be called.
 java.lang.Object put(java.lang.Object oKey, java.lang.Object oValue)
          Should not be called.
 void putAll(java.util.Map map)
          Should not be called.
 java.lang.Object remove(java.lang.Object oKey)
          Should not be called.
protected  boolean removeBlind(java.lang.Object oKey)
          Should not be called.
 boolean unlock(java.lang.Object oKey)
          Should not be called.

 

Methods inherited from class com.tangosol.net.cache.WrapperNamedCache
addIndex, aggregate, aggregate, entrySet, entrySet, getAll, getCacheName, getCacheService, isActive, keySet, put, release, removeIndex

 

Methods inherited from class com.tangosol.util.WrapperConcurrentMap
getDescription, getLockDescription, getWaitMillis, instantiateLock, isInternalKeySetIteratorMutable, isLockingEnforced, setLockingEnforced, setWaitMillis, toString

 

Methods inherited from class com.tangosol.util.WrapperObservableMap
addMapListener, addMapListener, addMapListener, containsValue, dispatchEvent, dispatchPendingEvent, ensureInternalListener, ensureMapListenerSupport, get, getCacheStatistics, getInternalKeySet, getMap, getMapListenerSupport, hasListeners, instantiateInternalListener, isCollectStats, isEventFabricator, isSynthetic, isTranslateEvents, removeMapListener, removeMapListener, removeMapListener, setCollectStats, setTranslateEvents

 

Methods inherited from class com.tangosol.util.AbstractKeySetBasedMap
containsKey, instantiateEntrySet, instantiateKeyIterator, instantiateKeySet, instantiateValues, isEmpty, iterateKeys, size

 

Methods inherited from class com.tangosol.util.AbstractKeyBasedMap
clone, entrySet, equals, hashCode, keySet, values

 

Methods inherited from interface com.tangosol.util.ObservableMap
addMapListener, addMapListener, addMapListener, removeMapListener, removeMapListener, removeMapListener

 

Methods inherited from interface java.util.Map
containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, size, values

 

Methods inherited from interface com.tangosol.util.ConcurrentMap
containsKey, containsValue, get, isEmpty, size

 

Field Detail

m_fStrict

protected boolean m_fStrict
Specifies whether or not the "read-only" nature of this NamedCache is strictly enforced.

Constructor Detail

ReadonlyNamedCache

public ReadonlyNamedCache(NamedCache cache,
                          boolean fStrict)
Construct a NamedCache wrapper based on the specified map.
Parameters:
cache - the NamedCache object that will be wrapped by this read-only wrapper
fStrict - if true, calls to mutating opearations will throw the UnsupportedOpearionException; otherwise those calls will have no effect whatsoever

ReadonlyNamedCache

public ReadonlyNamedCache(java.util.Map map,
                          java.lang.String sName,
                          boolean fStrict)
Construct a NamedCache wrapper based on the specified map.
Parameters:
map - the Map that will be wrapped by this read-only wrapper
sName - the cache name
fStrict - if true, calls to mutating opearations will throw the UnsupportedOpearionException; otherwise those calls will have no effect whatsoever

Method Detail

destroy

public void destroy()
Should not be called.
Specified by:
destroy in interface NamedCache
Overrides:
destroy in class WrapperNamedCache
See Also:
CacheFactory.destroyCache(NamedCache), ConfigurableCacheFactory.destroyCache(NamedCache)

invoke

public java.lang.Object invoke(java.lang.Object oKey,
                               InvocableMap.EntryProcessor agent)
Should not be called.
Specified by:
invoke in interface InvocableMap
Overrides:
invoke in class WrapperNamedCache
Parameters:
oKey - the key to process; it is not required to exist within the Map
agent - the EntryProcessor to use to process the specified key
Returns:
the result of the invocation as returned from the EntryProcessor

invokeAll

public java.util.Map invokeAll(java.util.Collection collKeys,
                               InvocableMap.EntryProcessor agent)
Should not be called.
Specified by:
invokeAll in interface InvocableMap
Overrides:
invokeAll in class WrapperNamedCache
Parameters:
collKeys - the keys to process; these keys are not required to exist within the Map
agent - the EntryProcessor to use to process the specified keys
Returns:
a Map containing the results of invoking the EntryProcessor against each of the specified keys

invokeAll

public java.util.Map invokeAll(Filter filter,
                               InvocableMap.EntryProcessor agent)
Should not be called.
Specified by:
invokeAll in interface InvocableMap
Overrides:
invokeAll in class WrapperNamedCache
Parameters:
filter - a Filter that results in the set of keys to be processed
agent - the EntryProcessor to use to process the specified keys
Returns:
a Map containing the results of invoking the EntryProcessor against the keys that are selected by the given Filter

put

public java.lang.Object put(java.lang.Object oKey,
                            java.lang.Object oValue)
Should not be called.
Specified by:
put in interface CacheMap
Specified by:
put in interface ConcurrentMap
Specified by:
put in interface java.util.Map
Overrides:
put in class WrapperConcurrentMap
Parameters:
oKey - key with which the specified value is to be associated
oValue - value to be associated with the specified key
Returns:
previous value associated with specified key, or null if there was no mapping for key

putAll

public void putAll(java.util.Map map)
Should not be called.
Specified by:
putAll in interface ConcurrentMap
Specified by:
putAll in interface java.util.Map
Overrides:
putAll in class WrapperConcurrentMap
Parameters:
map - the Map containing the key/value pairings to put into this Map

remove

public java.lang.Object remove(java.lang.Object oKey)
Should not be called.
Specified by:
remove in interface ConcurrentMap
Specified by:
remove in interface java.util.Map
Overrides:
remove in class WrapperConcurrentMap
Parameters:
oKey - key whose mapping is to be removed from the map
Returns:
previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key, if the implementation supports null values.

clear

public void clear()
Should not be called.
Specified by:
clear in interface ConcurrentMap
Specified by:
clear in interface java.util.Map
Overrides:
clear in class WrapperConcurrentMap

lock

public boolean lock(java.lang.Object oKey,
                    long cWait)
Should not be called.
Specified by:
lock in interface ConcurrentMap
Overrides:
lock in class WrapperConcurrentMap
Parameters:
oKey - key being locked
cWait - the number of milliseconds to continue trying to obtain a lock; pass zero to return immediately; pass -1 to block the calling thread until the lock could be obtained
Returns:
true if the item was successfully locked within the specified time; false otherwise

lock

public boolean lock(java.lang.Object oKey)
Should not be called.
Specified by:
lock in interface ConcurrentMap
Overrides:
lock in class WrapperConcurrentMap
Parameters:
oKey - key being locked
Returns:
true if the item was successfully locked; false otherwise

unlock

public boolean unlock(java.lang.Object oKey)
Should not be called.
Specified by:
unlock in interface ConcurrentMap
Overrides:
unlock in class WrapperConcurrentMap
Parameters:
oKey - key being unlocked
Returns:
true if the item was successfully unlocked; false otherwise

removeBlind

protected boolean removeBlind(java.lang.Object oKey)
Should not be called.
Overrides:
removeBlind in class WrapperConcurrentMap
Parameters:
oKey - key whose mapping is to be removed from the map
Returns:
true iff the Map changed as the result of this operation

checkStrict

protected void checkStrict()
Enforce the "strict" read-only policy.

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


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