CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.util
Class ConverterCollections.ConverterObservableMap

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.ConverterCollections.ConverterMap
          extended by com.tangosol.util.ConverterCollections.ConverterObservableMap
All Implemented Interfaces:
CacheMap, ObservableMap, QueryMap, Serializable, Map
Enclosing class:
ConverterCollections

public static class ConverterCollections.ConverterObservableMap
extends ConverterCollections.ConverterMap
implements ObservableMap, CacheMap, Serializable

A Converter ObservableMap views an underlying ObservableMap through a set of key and value Converters.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.tangosol.util.QueryMap
QueryMap.Entry
 
Field Summary
 
Fields inherited from class com.tangosol.util.ConverterCollections.ConverterMap
m_convKeyDown, m_convKeyUp, m_convValDown, m_convValUp, m_map, m_set
 
Fields inherited from interface com.tangosol.net.cache.CacheMap
EXPIRY_DEFAULT, EXPIRY_NEVER
 
Constructor Summary
ConverterCollections.ConverterObservableMap(ObservableMap map, Converter convKeyUp, Converter convKeyDown, Converter convValUp, Converter convValDown)
          Constructor.
 
Method Summary
 void addMapListener(MapListener listener)
          Add a standard map listener that will receive all events (inserts, updates, deletes) that occur against the map, with the key, old-value and new-value included.
 void addMapListener(MapListener listener, Filter filter, boolean fLite)
          Add a map listener that receives events based on a filter evaluation.
 void addMapListener(MapListener listener, Object oKey, boolean fLite)
          Add a map listener for a specific key.
 Map getAll(Collection colKeys)
          Get all the specified keys, if they are in the cache.
protected  MapListener getConverterListener(MapListener listener)
          Create a converter listener for the specified listener.
 Object put(Object oKey, Object oValue, long cMillis)
          Associates the specified value with the specified key in this cache.
 void removeMapListener(MapListener listener)
          Remove a standard map listener that previously signed up for all events.
 void removeMapListener(MapListener listener, Filter filter)
          Remove a map listener that previously signed up for events based on a filter evaluation.
 void removeMapListener(MapListener listener, Object oKey)
          Remove a map listener that previously signed up for events about a specific key.
 
Methods inherited from class com.tangosol.util.ConverterCollections.ConverterMap
addIndex, clear, containsKey, containsValue, entrySet, entrySet, entrySet, get, instantiateCollection, instantiateEntrySet, instantiateMap, instantiateSet, isEmpty, keySet, keySet, put, putAll, remove, removeIndex, size, toString, values
 
Methods inherited from interface com.tangosol.net.cache.CacheMap
put
 

Constructor Detail

ConverterCollections.ConverterObservableMap

public ConverterCollections.ConverterObservableMap(ObservableMap map,
                                                   Converter convKeyUp,
                                                   Converter convKeyDown,
                                                   Converter convValUp,
                                                   Converter convValDown)
Constructor.

Parameters:
map - the underlying SortedMap
convKeyUp - the Converter to view the underlying SortedMap's keys through
convKeyDown - the Converter to use to pass keys down to the underlying SortedMap
convValUp - the Converter to view the underlying SortedMap's values through
convValDown - the Converter to use to pass values down to the underlying SortedMap
Method Detail

addMapListener

public void addMapListener(MapListener listener)
Add a standard map listener that will receive all events (inserts, updates, deletes) that occur against the map, with the key, old-value and new-value included. This has the same result as the following call:
   addMapListener(listener, (Filter) null, false);
 

Specified by:
addMapListener in interface ObservableMap
Parameters:
listener - the MapEvent listener to add

removeMapListener

public void removeMapListener(MapListener listener)
Remove a standard map listener that previously signed up for all events. This has the same result as the following call:
   removeMapListener(listener, (Filter) null);
 

Specified by:
removeMapListener in interface ObservableMap
Parameters:
listener - the listener to remove

addMapListener

public void addMapListener(MapListener listener,
                           Object oKey,
                           boolean fLite)
Add a map listener for a specific key.

The listeners will receive MapEvent objects, but if fLite is passed as true, they might not contain the OldValue and NewValue properties.

To unregister the MapListener, use the removeMapListener(MapListener, Object) method.

Specified by:
addMapListener in interface ObservableMap
Parameters:
listener - the MapEvent listener to add
oKey - the key that identifies the entry for which to raise events
fLite - true to indicate that the MapEvent objects do not have to include the OldValue and NewValue property values in order to allow optimizations
Since:
Coherence 2.3

removeMapListener

public void removeMapListener(MapListener listener,
                              Object oKey)
Remove a map listener that previously signed up for events about a specific key.

Specified by:
removeMapListener in interface ObservableMap
Parameters:
listener - the listener to remove
oKey - the key that identifies the entry for which to raise events
Since:
Coherence 2.3

addMapListener

public void addMapListener(MapListener listener,
                           Filter filter,
                           boolean fLite)
Add a map listener that receives events based on a filter evaluation.

The listeners will receive MapEvent objects, but if fLite is passed as true, they might not contain the OldValue and NewValue properties.

To unregister the MapListener, use the removeMapListener(MapListener, Filter) method.

Specified by:
addMapListener in interface ObservableMap
Parameters:
listener - the MapEvent listener to add
filter - a filter that will be passed MapEvent objects to select from; a MapEvent will be delivered to the listener only if the filter evaluates to true for that MapEvent; null is equivalent to a filter that alway returns true
fLite - true to indicate that the MapEvent objects do not have to include the OldValue and NewValue property values in order to allow optimizations

removeMapListener

public void removeMapListener(MapListener listener,
                              Filter filter)
Remove a map listener that previously signed up for events based on a filter evaluation.

Specified by:
removeMapListener in interface ObservableMap
Parameters:
listener - the listener to remove
filter - a filter used to evaluate events; null is equivalent to a filter that alway returns true

getAll

public Map getAll(Collection colKeys)
Get all the specified keys, if they are in the cache. For each key that is in the cache, that key and its corresponding value will be placed in the map that is returned by this method. The absence of a key in the returned map indicates that it was not in the cache, which may imply (for caches that can load behind the scenes) that the requested data could not be loaded.

Specified by:
getAll in interface CacheMap
Parameters:
colKeys - a collection of keys that may be in the named cache
Returns:
a Map of keys to values for the specified keys passed in col
Since:
Coherence 2.5

put

public Object put(Object oKey,
                  Object oValue,
                  long cMillis)
Associates the specified value with the specified key in this cache. If the cache previously contained a mapping for this key, the old value is replaced.

Specified by:
put in interface CacheMap
Parameters:
oKey - key with which the specified value is to be associated
oValue - value to be associated with the specified key
cMillis - the number of milliseconds until the cache entry will expire, also referred to as the entry's "time to live"
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
Throws:
UnsupportedOperationException - if the requested expiry is a positive value and the implementation does not support expiry of cache entries

getConverterListener

protected MapListener getConverterListener(MapListener listener)
Create a converter listener for the specified listener.

Parameters:
listener - the underlying listener
Returns:
the converting listener

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation