IBM WebSphere® DataPower® XC10 Appliance
Release 2.0 Client API Specification

com.ibm.websphere.objectgrid
Interface ObjectMap


public interface ObjectMap

This is a handle to a named Map. Maps should have homogeneous keys and values. An instance of this ObjectMap can only be used by the thread that is currently associated with the Session that was used to get this ObjectMap instance. Both Session and ObjectMap objects are not allowed to be shared by multiple threads concurrently. Keywords are applied within a transaction. A transaction rollback will rollback any keywords association applied during this transaction. The keyword function is deprecated in version 6.1 and later.

The CopyMode setting on the map determines whether or not a copy of the value is returned by get methods. It also determines whether or not a copy of the committed value is made at commit time. The LockStrategy setting for the map determines whether or not a lock is obtained for each map entry accessed by the transaction, the lock mode of the lock obtained, and when the lock is obtained.

Since:
WAS XD 6.0, XC10
See Also:
Session.getMap(String), BackingMap.setCopyMode(CopyMode, Class), BackingMap.setLockStrategy(LockStrategy)

Field Summary
static long QUEUE_TIMEOUT_INFINITE
          Used as a parameter on the getNextKey(long) method, specifies the method should block until a key becomes available.
static long QUEUE_TIMEOUT_NONE
          Used as a parameter on the getNextKey(long) method, specifies to return a null value if the map is empty.
static int TTL_FOREVER
          A constant indicating the time-to-live value is "forever".
static int USE_DEFAULT
          A constant indicating the time-to-live value or lock timeout value is the default setting.
 
Method Summary
 void clear()
          Clear all keys from the Map.
 void clearCopyMode()
          Resets the CopyMode back to the one in the BackingMap.
 boolean containsKey(java.lang.Object key)
          Returns true if this map contains a mapping for the specified key.
 void flush()
          Pushes the current set of changes for the ObjectMap instance to the Loader without committing the changes.
 java.lang.Object get(java.lang.Object key)
          Retrieves the object from the cache at the given key.
 java.lang.Object get(java.lang.Object key, java.io.Serializable keyword)
          Deprecated. Use Index or query function to get Objects with specific attributes
 AgentManager getAgentManager()
          Returns the Agent Manager that allows DataGrid operations to be performed on the objects within this Map.
 java.util.List getAll(java.util.List keyList)
          Gets a list of entries from the map.
 java.util.List getAll(java.util.List keyList, java.io.Serializable keyword)
          Deprecated. Use Index or query function to get Objects with specific attributes
 java.util.List getAllForUpdate(java.util.List keyList)
          Same as the getAll(List) method except that if pessimistic lock strategy is used for this map, an upgradable lock mode is obtained for these map entries.
 java.util.List getAllForUpdate(java.util.List keyList, java.io.Serializable keyword)
          Deprecated. Use Index or query function to get Objects with specific attributes
 EntityMetadata getEntityMetadata()
          Retrieve the metadata for the entity associated with this map.
 java.lang.Object getForUpdate(java.lang.Object key)
          Same as get(Object) method except that if pessimistic lock strategy is used for this map, an upgradable lock mode is obtained for this map entry.
 java.lang.Object getForUpdate(java.lang.Object key, java.io.Serializable keyword)
          Deprecated. Use Index or query function to get Objects with specific attributes
 java.lang.Object getIndex(java.lang.String name)
          Returns a reference to the named index that can be used with this Map.
 java.lang.Object getIndex(java.lang.String name, boolean forUpdate)
          Returns a reference to the named index that can be used with this Map.
 java.util.Map getJavaMap()
          Returns an implementation of java.util.Map that is backed by this ObjectMap.
 int getMapType()
          Returns the type of the underlying BackingMap.
 java.lang.String getName()
          Returns the name of the ObjectMap as defined by the configuration.
 java.lang.Object getNextKey(long timeout)
          Retrieves a key off the map in first-in-first-out (FIFO) insert order.
 void insert(java.lang.Object key, java.lang.Object value)
          Performs an explicit insert of a given entry.
 void insert(java.lang.Object key, java.lang.Object value, java.io.Serializable keyword)
          Deprecated. Use Index or query function to get Objects with specific attributes
 void invalidate(java.lang.Object key, boolean isGlobal)
          Invalidates an entry in the cache based on the key parameter.
 void invalidateAll(java.util.Collection keyList, boolean isGlobal)
          Invalidate a set of cache entries based on the Collection of keys provided.
 void invalidateUsingKeyword(java.io.Serializable keyword, boolean isGlobal)
          Deprecated. Use Index or query function to get Objects with specific attributes
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Puts the Object value into the cache at location represented by key.
 void put(java.lang.Object key, java.lang.Object value, java.io.Serializable keyword)
          Deprecated. Use Index or query function to get Objects with specific attributes
 void putAll(java.util.Map map)
          Puts each of the Object value into the cache at location represented by key contained in the Map.
 void putAll(java.util.Map map, java.io.Serializable keyword)
          Deprecated. Use Index or query function to get Objects with specific attributes
 java.lang.Object remove(java.lang.Object key)
          Removes the Object value from the cache represented by key.
 void removeAll(java.util.Collection keyList)
          Batch remove from the Map.
 void setCopyMode(CopyMode copyMode, java.lang.Class valueInterface)
          Allows the CopyMode for the Map to be overridden on this map on this session only.
 void setDefaultKeyword(java.io.Serializable keyword)
          Deprecated. Use Index or query function to get Objects with specific attributes
 void setLockTimeout(int seconds)
          Overrides the BackingMap's lock timeout for this ObjectMap.
 int setTimeToLive(int ttl)
          Establishes the number of seconds that any given cache entry can live for, which is referred to as "time to live" or TTL.
 void touch(java.lang.Object key)
          Updates the last access time in the BackingMap without retrieving the value to the ObjectMap.
 void touch(java.lang.Object key, java.io.Serializable keyword)
          Deprecated. Use Index or query function to get Objects with specific attributes
 void update(java.lang.Object key, java.lang.Object value)
          Performs an explicit update of a given entry.
 void update(java.lang.Object key, java.lang.Object value, java.io.Serializable keyword)
          Deprecated. Use Index or query function to get Objects with specific attributes
 

Field Detail

TTL_FOREVER

static final int TTL_FOREVER
A constant indicating the time-to-live value is "forever".

See Also:
Constant Field Values

USE_DEFAULT

static final int USE_DEFAULT
A constant indicating the time-to-live value or lock timeout value is the default setting.

The default setting is to retain the time-to-live value for any existing map entry and to use the default value from BackingMap setting if a new map entry is being created.

For lock timeout override the default setting is to use the value defined on the BackingMap

See Also:
setLockTimeout(int), setTimeToLive(int), BackingMap.setTimeToLive(int), BackingMap.getTimeToLive(), BackingMap.setLockTimeout(int), Constant Field Values

QUEUE_TIMEOUT_NONE

static final long QUEUE_TIMEOUT_NONE
Used as a parameter on the getNextKey(long) method, specifies to return a null value if the map is empty.

See Also:
Constant Field Values

QUEUE_TIMEOUT_INFINITE

static final long QUEUE_TIMEOUT_INFINITE
Used as a parameter on the getNextKey(long) method, specifies the method should block until a key becomes available.

See Also:
Constant Field Values
Method Detail

getName

java.lang.String getName()
Returns the name of the ObjectMap as defined by the configuration.

Returns:
name of ObjectMap

get

java.lang.Object get(java.lang.Object key)
                     throws ObjectGridException
Retrieves the object from the cache at the given key.

Whether or not a copy of the object is returned is determined by the CopyMode setting for this map. See CopyMode for a description of each possible CopyMode. If the key cannot be found in the map, a null value will be returned. A null value is also returned if a value is null and this map allows null values. To distinguish the two, use the containsKey method.

Required Client Permission: MapPermission.READ

Parameters:
key - The entry to fetch
Returns:
the value or null
Throws:
java.lang.IllegalArgumentException - if key is null
ObjectGridException - if an error occurs during processing
See Also:
containsKey(Object), getForUpdate(Object), CopyMode

get

java.lang.Object get(java.lang.Object key,
                     java.io.Serializable keyword)
                     throws ObjectGridException
Deprecated. Use Index or query function to get Objects with specific attributes

Gets an entry and associates it with the specified keyword.

The keyword is associated only when the transaction commits. Whether or not a copy of the object is returned is determined by the CopyMode setting for this map. See CopyMode for a description of each possible CopyMode. If the key cannot be found in the map, a null value will be returned. A null value is also returned if a value is null and this map allows null values. To distinguish the two, use the containsKey method.

Required Client Permission: MapPermission.READ

Parameters:
key - The entry to fetch
keyword - The keyword to associate with this entry if it exists.
Returns:
the value or null
Throws:
java.lang.IllegalArgumentException - if key or keyword is null
ObjectGridException - if an error occurs during processing
See Also:
containsKey(Object), get(Object), CopyMode

put

java.lang.Object put(java.lang.Object key,
                     java.lang.Object value)
                     throws ObjectGridException
Puts the Object value into the cache at location represented by key.

The value will be pushed down to the BackingMap/Loader at commit time. The semantics of this method are that a put without a preceding get is an insert. For an entry in a map, a put following a get is always an update. However, if the entry is not in the map, a put following a get is an insert.

Whether or not a copy of the object is made when transaction is committed is determined by the copy mode setting for this map. See CopyMode for a description of each possible copy mode.

Required Client Permission: MapPermission.WRITE

Parameters:
key - The entry to put into the map
value - The value to put into the map using the key
Returns:
the previous value in this transaction
Throws:
java.lang.IllegalArgumentException - if key is null, or if the map does not allow null values and value is null
ObjectGridException - if an error occurs during processing
See Also:
CopyMode

getForUpdate

java.lang.Object getForUpdate(java.lang.Object key)
                              throws ObjectGridException
Same as get(Object) method except that if pessimistic lock strategy is used for this map, an upgradable lock mode is obtained for this map entry. See LockStrategy.PESSIMISTIC for additional information. Whether or not a copy of the object is returned is determined by the CopyMode setting for this map. See CopyMode for a description of each possible CopyMode. If the key cannot be found in the map, a null value will be returned. A null value is also returned if the value is null and this map allows null values. To distinguish the two, use the containsKey method.

Required Client Permission: MapPermission.READ

Parameters:
key - The entry to fetch
Returns:
the value retrieved for update or null
Throws:
java.lang.IllegalArgumentException - if key is null
ObjectGridException - if an error occurs during processing
See Also:
containsKey(Object), get(Object), CopyMode, LockStrategy.PESSIMISTIC

getForUpdate

java.lang.Object getForUpdate(java.lang.Object key,
                              java.io.Serializable keyword)
                              throws ObjectGridException
Deprecated. Use Index or query function to get Objects with specific attributes

The same as getForUpdate(Object) except the returned entry is associated with the specified keyword.

Required Client Permission: MapPermission.READ

Parameters:
key - The entry to fetch
keyword - The keyword to associate with the returned entry
Returns:
the value retrieved for update purposes or null
Throws:
java.lang.IllegalArgumentException - if key or keyword is null
ObjectGridException - if an error occurs during processing
See Also:
getForUpdate(Object), get(Object, Serializable)

remove

java.lang.Object remove(java.lang.Object key)
                        throws ObjectGridException
Removes the Object value from the cache represented by key.

This removal will be pushed down to the BackingMap/Loader at commit time. If the key cannot be found in the map, a null value will be returned.

Required Client Permission: MapPermission.REMOVE

Parameters:
key - The entry to remove
Returns:
the current value at invocation time
Throws:
java.lang.IllegalArgumentException - if key is null
ObjectGridException - if an error occurs during processing

put

void put(java.lang.Object key,
         java.lang.Object value,
         java.io.Serializable keyword)
         throws ObjectGridException
Deprecated. Use Index or query function to get Objects with specific attributes

Puts an entry in the cache and associates it with the specified keyword.

The keyword is added to the current set of keywords for the entry. Whether or not a copy of the object is made when the transaction is committed is determined by the CopyMode setting for this map. See CopyMode for a description of each possible CopyMode.

Required Client Permission: MapPermission.WRITE

Parameters:
key - The key of the entry to update or insert
value - The new value
keyword - The keyword
Throws:
java.lang.IllegalArgumentException - if key or keyword is null, or if the map does not allow null values and value is null
ObjectGridException - if an error occurs during processing
See Also:
put(Object, Object), CopyMode

getAll

java.util.List getAll(java.util.List keyList)
                      throws ObjectGridException
Gets a list of entries from the map.

If a key in the list cannot be found, a null value will be set at the appropriate position in the returned list.

Required Client Permission: MapPermission.READ

Parameters:
keyList - A list of keys for identifying which entries to fetch
Returns:
a list of values
Throws:
java.lang.IllegalArgumentException - if keyList is null or contains a null element.
ObjectGridException - if an error occurs during processing
See Also:
get(Object)

getAll

java.util.List getAll(java.util.List keyList,
                      java.io.Serializable keyword)
                      throws ObjectGridException
Deprecated. Use Index or query function to get Objects with specific attributes

Gets a list of entries from the map and associates them with the specified keyword.

If a key in the list cannot be found, a null value will be set at the appropriate position in the returned list. All returned entries will also be associated with the specified keyword.

Required Client Permission: MapPermission.READ

Parameters:
keyList - A list of keys for identifying which entries to fetch
keyword - the keyword to associate with each fetched entry
Returns:
a list of values
Throws:
java.lang.IllegalArgumentException - if keyList is null or contains a null element or keyword is null.
ObjectGridException - if an error occurs during processing
See Also:
get(Object, Serializable), getAll(List)

getAllForUpdate

java.util.List getAllForUpdate(java.util.List keyList)
                               throws ObjectGridException
Same as the getAll(List) method except that if pessimistic lock strategy is used for this map, an upgradable lock mode is obtained for these map entries. See LockStrategy.PESSIMISTIC for additional information. If a key in the list cannot be found, a null value will be set at the appropriate position in the returned list.

Required Client Permission: MapPermission.READ

Parameters:
keyList - A list of keys for identifying which entries to fetch
Returns:
a list of values
Throws:
java.lang.IllegalArgumentException - if keyList is null or contains a null element.
ObjectGridException - if an error occurs during processing
See Also:
getAll(List), getForUpdate(Object), LockStrategy.PESSIMISTIC

getAllForUpdate

java.util.List getAllForUpdate(java.util.List keyList,
                               java.io.Serializable keyword)
                               throws ObjectGridException
Deprecated. Use Index or query function to get Objects with specific attributes

The same as the getAllForUpdate(List) method except the returned entries are associated with the specified keyword.

Required Client Permission: MapPermission.READ

Parameters:
keyList - A list of keys for identifying which entries to fetch
keyword - the keyword to associate with each fetched entry
Returns:
the list of values
Throws:
java.lang.IllegalArgumentException - if keyList is null or contains a null element or keyword is null.
ObjectGridException - if an error occurs during processing
See Also:
getAll(List), getForUpdate(Object)

removeAll

void removeAll(java.util.Collection keyList)
               throws ObjectGridException
Batch remove from the Map. If a key in the list cannot be found, it will be ignored.

Required Client Permission: MapPermission.REMOVE

Parameters:
keyList - A list of keys for identifying which entries to remove
Throws:
java.lang.IllegalArgumentException - if keyList is null or contains a null element.
ObjectGridException - if an error occurs during processing
See Also:
remove(Object)

putAll

void putAll(java.util.Map map)
            throws ObjectGridException
Puts each of the Object value into the cache at location represented by key contained in the Map.

The value will be pushed down to the BackingMap/Loader at commit time. The semantics of this method are that a put without a preceding get is an insert. For an entry in a map, a put following a get is always an update. However, if the entry is not in the map, a put following a get is an insert.

Whether or not a copy of the object is made when transaction is committed is determined by the copy mode setting for this map. See CopyMode for a description of each possible copy mode.

An existing Map object will be passed in to use for obtaining the keys and values to be inserted or updated into the existing Map.

Required Client Permission: MapPermission.WRITE

Parameters:
map - The key/values to be put into the map.
Throws:
java.lang.IllegalArgumentException - if map is null or contains a null key or if null values are not allowed and map contains a null value.
ObjectGridException - if an error occurs during processing
See Also:
put(Object, Object)

putAll

void putAll(java.util.Map map,
            java.io.Serializable keyword)
            throws ObjectGridException
Deprecated. Use Index or query function to get Objects with specific attributes

Batch put to the Map, with the addition of associating a keyword with each entry.

Required Client Permission: MapPermission.WRITE

Parameters:
map - The key/values to be put into the map.
keyword - The keyword to associate with all these entries.
Throws:
java.lang.IllegalArgumentException - if keyword is null, or map is null or contains a null key or if null values are not allowed and map contains a null value.
ObjectGridException - if an error occurs during processing
See Also:
putAll(Map)

invalidate

void invalidate(java.lang.Object key,
                boolean isGlobal)
                throws ObjectGridException
Invalidates an entry in the cache based on the key parameter.

If the key's value has changes pending in the ObjectMap, it is the application's responsibility to flush these changes to the Loader before invalidation. If a flush is not performed prior to invoking the invalidate operation, all pending changes for this key will be removed from the ObjectMap. If the key cannot be found in the map, it will be ignored.

The isGlobal parameter is used to indicate which cache level is used to invalidate the entries. If isGlobal is true, when the transaction is committed, the key is removed from the BackingMap also. If a subsequent get operation is performed, the BackingMap will be skipped and the Loader will be used to get the data. If isGlobal is false, the entry is only invalidated in the ObjectMap (transactional cache). If a subsequent get operation is performed, the BackingMap can be used; and, if it's not in the BackingMap, the Loader will be used to get the data.

A typical use of isGlobal being false is when a large number of records are touched in a transaction and the application wants to evict records that are no longer used in the cache.

Required Client Permission: MapPermission.INVALIDATE

Parameters:
key - Object representing the key to be used for cache entry invalidation
isGlobal - Indicates whether to remove the entry from the BackingMap (true) or just the ObjectMap (false).
Throws:
java.lang.IllegalArgumentException - if key is null
ObjectGridException - if an error occurs during processing

invalidateAll

void invalidateAll(java.util.Collection keyList,
                   boolean isGlobal)
                   throws ObjectGridException
Invalidate a set of cache entries based on the Collection of keys provided. If a key in the collection cannot be found, it will be ignored.

Required Client Permission: MapPermission.INVALIDATE

Parameters:
keyList - A Collection of keys representing the entries to be invalidated
isGlobal - Indicates whether to remove the entry from the BackingMap (true) or just the ObjectMap (false).
Throws:
java.lang.IllegalArgumentException - if keyList is null or contains a null element.
ObjectGridException - if an error occurs during processing
See Also:
invalidate(Object, boolean)

invalidateUsingKeyword

void invalidateUsingKeyword(java.io.Serializable keyword,
                            boolean isGlobal)
                            throws ObjectGridException
Deprecated. Use Index or query function to get Objects with specific attributes

Invalidates a set of cache entries based on the keyword provided.

Required Client Permission: MapPermission.INVALIDATE

Parameters:
keyword - The keyword to be used for finding associated entries
isGlobal - Indicates whether to remove the entry from the BackingMap (true) or just the ObjectMap (false).
Throws:
java.lang.IllegalArgumentException - if keyword is null.
ObjectGridException - if an error occurs during processing

setTimeToLive

int setTimeToLive(int ttl)
Establishes the number of seconds that any given cache entry can live for, which is referred to as "time to live" or TTL. Setting a new TTL value affects cache entries that are accessed after this method call occurs. It does not affect any cache entry that was created or accessed prior to this method call. By calling this method on this ObjectMap, any previous value set by the BackingMap.setTimeToLive(int) method is overridden for this ObjectMap. If this method is never called on the ObjectMap, the default setting is used. The default setting is to retain the time-to-live value for any existing map entry and to use the default value from BackingMap setting if a new map entry is being created. If TTL is never set on the BackingMap, the cache entry can live "forever".

This method can only be used when the TTLType is set to LAST_ACCESS_TIME or LAST_UPDATE_TIME on the BackingMap. If this method is called on the ObjectMap and the TTLType is something other than LAST_ACCESS_TIME or LAST_UPDATE_TIME, an IllegalStateException is thrown.

Required Client Permission: MapPermission.INVALIDATE

Parameters:
ttl - is the time-to-live value in seconds. The value must be >= -1. A value of 0 is used to indicate the cache entry can live "forever" and -1 to indicate to use default setting. Use of the constant TTL_FOREVER is recommended when "forever" is desired and the constantUSE_DEFAULT is recommended when "use default" setting is desired.
Returns:
previous time-to-live value in seconds. The constant TTL_FOREVER and constant USE_DEFAULTcan be used to determine if the previous TTL is one of the special values.
Throws:
java.lang.IllegalArgumentException - if seconds argument is < -1.
java.lang.IllegalStateException - if BackingMap.getTtlEvictorType() returns anything other than TTLType.LAST_ACCESS_TIME or TTLType.LAST_UPDATE_TIME.
See Also:
TTL_FOREVER, USE_DEFAULT, BackingMap.setTimeToLive(int), TTLType.LAST_ACCESS_TIME, TTLType.LAST_UPDATE_TIME

update

void update(java.lang.Object key,
            java.lang.Object value)
            throws KeyNotFoundException,
                   ObjectGridException
Performs an explicit update of a given entry.

A get operation is not required prior to invoking the update method (unlike the put method). Also, an update invocation will never insert a new record. If a the map's LockStrategy is LockStrategy.OPTIMISTIC this method will implicitly get the entry so as to have the version value of the object for when this method was invoked. Whether or not a copy of the object is made when transaction is committed is determined by the CopyMode setting for this map. See CopyMode for a description of each possible CopyMode.

If a key cannot be found in the map during commit, a TransactionException will be thrown.

Required Client Permission: MapPermission.WRITE

Parameters:
key - Identifies the entry to be updated
value - The updated value for this entry
Throws:
java.lang.IllegalArgumentException - if key is null or if the map does not allow null values and value is null.
KeyNotFoundException - if the key cannot be found in the map
ObjectGridException - if an error occurs during processing
See Also:
insert(Object, Object), put(Object, Object), CopyMode, LockStrategy.OPTIMISTIC

update

void update(java.lang.Object key,
            java.lang.Object value,
            java.io.Serializable keyword)
            throws KeyNotFoundException,
                   ObjectGridException
Deprecated. Use Index or query function to get Objects with specific attributes

Performs an explicit update of a given entry, also associating the given keyword with the entry.

A get operation is not required prior to invoking the update method (unlike the put method). Also, an update invocation will never insert a new record. If a the map's LockStrategy is LockStrategy.OPTIMISTIC this method will implicitly get the entry so as to have the version value of the object for when this method was invoked. Whether or not a copy of the object is made when transaction is committed is determined by the CopyMode setting for this map. See CopyMode for a description of each possible CopyMode.

Required Client Permission: MapPermission.WRITE

Parameters:
key - Identifies the entry to be updated
value - The updated value for this entry
keyword - The keyword to associate with this entry.
Throws:
java.lang.IllegalArgumentException - if key or keyword is null or if the map does not allow null values and value is null.
KeyNotFoundException - if the key cannot be found in the map
ObjectGridException - if an error occurs during processing
See Also:
update(Object, Object), CopyMode, LockStrategy.OPTIMISTIC

insert

void insert(java.lang.Object key,
            java.lang.Object value)
            throws DuplicateKeyException,
                   ObjectGridException
Performs an explicit insert of a given entry.

The key must not exist before executing this method. Also, an insert invocation will never update an existing record. Whether or not a copy of the object is made when a transaction is committed is determined by the CopyMode setting for this map. See CopyMode for a description of each possible CopyMode.

If the key is already in the map, a TransactionException will be thrown during commit.

Required Client Permission: MapPermission.INSERT

Parameters:
key - Identifies the entry to be inserted
value - The value for this entry
Throws:
java.lang.IllegalArgumentException - if key is null or if the map does not allow null values and value is null.
DuplicateKeyException - if this entries already exists in the map
ObjectGridException - if an error occurs during processing
See Also:
put(Object, Object), update(Object, Object), CopyMode

insert

void insert(java.lang.Object key,
            java.lang.Object value,
            java.io.Serializable keyword)
            throws DuplicateKeyException,
                   ObjectGridException
Deprecated. Use Index or query function to get Objects with specific attributes

Performs an explicit insert of a given entry, also associating the given keyword with the entry.

Whether or not a copy of the object is made when transaction is committed is determined by the copy mode setting for this map. See CopyMode for a description of each possible copy mode.

If the key is already in the map, a TransactionException will be thrown during commit.

Required Client Permission: MapPermission.INSERT

Parameters:
key - Identifies the entry to be inserted
value - The value for this entry
keyword - The keyword to associate with the entry.
Throws:
java.lang.IllegalArgumentException - if key or keyword is null or if the map does not allow null values and value is null.
DuplicateKeyException - if this entries already exists in the map
ObjectGridException - if an error occurs during processing
See Also:
insert(Object, Object), CopyMode

getIndex

java.lang.Object getIndex(java.lang.String name)
                          throws IndexUndefinedException,
                                 IndexNotReadyException
Returns a reference to the named index that can be used with this Map. This index cannot be shared between threads and works on the same rules as Session. The returned value should be cast to the right index interface such as MapIndex, MapRangeIndex or a custom index interface such as a geo spatial index.

Parameters:
name - The index name
Returns:
A reference to the index, it must be cast to the appropriate index interface.
Throws:
IndexUndefinedException - if the index is not defined on the BackingMap
IndexNotReadyException - if the index is a dynamic index and it is not ready
Since:
WAS XD 6.0.1

getIndex

java.lang.Object getIndex(java.lang.String name,
                          boolean forUpdate)
                          throws IndexUndefinedException,
                                 IndexNotReadyException
Returns a reference to the named index that can be used with this Map. This index cannot be shared between threads and works on the same rules as Session. The returned value should be cast to the right index interface such as MapIndex, MapRangeIndex or a custom index interface such as a geo spatial index.

Parameters:
name - The index name
forUpdate - if true, the returned index will always operate with forUpdate intent.
Returns:
A reference to the index, it must be cast to the appropriate index interface.
Throws:
IndexUndefinedException - if the index is not defined on the BackingMap
IndexNotReadyException - if the index is a dynamic index and it is not ready
Since:
WAS XD 6.1.0.1

flush

void flush()
           throws ObjectGridException
Pushes the current set of changes for the ObjectMap instance to the Loader without committing the changes. The changes are not propagated to the BackingMap either. This is useful for re-priming the Loader's data without committing the current transaction and starting over.

Throws:
ObjectGridException - if an error occurs during processing
See Also:
Session.flush()

containsKey

boolean containsKey(java.lang.Object key)
                    throws ObjectGridException
Returns true if this map contains a mapping for the specified key. ObjectGrid does not support null keys. If you configured the map to support null values, this method can be used to determine whether a key is contained in the map or not.

Required Client Permission: MapPermission.READ

Parameters:
key - key whose presence in this map is to be tested.
Returns:
true if this map contains a mapping for the specified key.
Throws:
java.lang.IllegalArgumentException - if null key parameter is passed in
ObjectGridException - if an error occurs during processing

getJavaMap

java.util.Map getJavaMap()
Returns an implementation of java.util.Map that is backed by this ObjectMap.

The returned java.util.Map implementation can be cast to com.ibm.websphere.objectgrid.JavaMap to be able to use the rest of the ObjectGrid programming model, but with java.util.Map's use of RuntimeExceptions instead of checked ObjectGridExceptions.

Returns:
a java.util.Map backed by this ObjectMap
See Also:
Map, JavaMap

touch

void touch(java.lang.Object key)
           throws ObjectGridException
Updates the last access time in the BackingMap without retrieving the value to the ObjectMap.

The last access time is updated during commit. If the key does not exist in the BackingMap, a TransactionException will be returned during commit processing.

Parameters:
key - key to be touched
Throws:
java.lang.IllegalArgumentException - if key is null
ObjectGridException - if an error occurs during processing

touch

void touch(java.lang.Object key,
           java.io.Serializable keyword)
           throws ObjectGridException
Deprecated. Use Index or query function to get Objects with specific attributes

Updates the last access time in the BackingMap without retrieving the value to the ObjectMap and also associate a keyword with this entry.

The last access time is updated during commit. If the key does not exist in the BackingMap, a TransactionException will be returned during commit processing.

Parameters:
key - key to be touched
keyword - keyword to add to this entry
Throws:
java.lang.IllegalArgumentException - if key or keyword is null
ObjectGridException - if an error occurs during processing
See Also:
touch(Object)

setCopyMode

void setCopyMode(CopyMode copyMode,
                 java.lang.Class valueInterface)
                 throws TransactionAlreadyActiveException,
                        ObjectGridException
Allows the CopyMode for the Map to be overridden on this map on this session only.

This method allows an application to use an optimal CopyMode TRANSACTION by TRANSACTION as its needs dictate. The CopyMode cannot be changed during a transaction. There must be no active transaction when this method is called.

Parameters:
copyMode - must be one of the final static variables defined in CopyMode. See CopyMode class for an explanation of each mode and how the valueInterface is used for CopyMode.COPY_ON_WRITE .
valueInterface - the value interface Class object. Specify null in version 7.1 and later.
Throws:
java.lang.IllegalArgumentException - if copyMode is null or COPY_ON_WRITE CopyMode is specified and the required value interface parameter is null
TransactionAlreadyActiveException - if a transaction is active on the associated session
ObjectGridException - if an error occurs during processing
See Also:
BackingMap.setCopyMode(CopyMode, Class), CopyMode

clearCopyMode

void clearCopyMode()
                   throws TransactionAlreadyActiveException
Resets the CopyMode back to the one in the BackingMap.

This method is used to reverse a previous setCopyMode method call for this ObjectMap. This method can only be called when no transaction is active on the associated session.

Throws:
TransactionAlreadyActiveException - if a transaction is active on the associated session
See Also:
setCopyMode(CopyMode, Class)

setDefaultKeyword

void setDefaultKeyword(java.io.Serializable keyword)
Deprecated. Use Index or query function to get Objects with specific attributes

Allows the setting of a default keyword.

The default keyword is used for any subsequent gets, updates, puts, etc. method invocations that do not have a keyword parameter. To reset the default keyword a parameter of null should be passed to this method. The default keyword is not used when any of the appropriate gets, updates, puts, etc. methods with a keyword parameter is invoked.

Parameters:
keyword - default keyword value to use

getNextKey

java.lang.Object getNextKey(long timeout)
                            throws ObjectGridException
Retrieves a key off the map in first-in-first-out (FIFO) insert order.

The entry is locked by the session such that other calls to getNextKey will not return the same key. The key can be used to remove or manipulate the value although leaving the entry will result in the key remaining at the beginning of the queue. This order is optimized for performance and is not guaranteed especially across partitions or in highly concurrent environments.

Parameters:
timeout - The period of time in milliseconds to wait for an entry to become available on the queue.
Returns:
the next key
Throws:
ObjectGridException - if an error occurs during processing
Since:
WAS XD 6.1
See Also:
QUEUE_TIMEOUT_INFINITE, QUEUE_TIMEOUT_NONE

getEntityMetadata

EntityMetadata getEntityMetadata()
Retrieve the metadata for the entity associated with this map.

Returns:
the EntityMetadata if an entity is associated with this map or null if there is no entity associated with this map.
Since:
WAS XD 6.1

getMapType

int getMapType()
Returns the type of the underlying BackingMap.

The return value is equivalent to one of the constants declared on the BackingMap interface, BackingMap.LOCAL, BackingMap.SERVER, or BackingMap.CLIENT.

Returns:
the BackingMap type
Since:
WAS XD 6.1

getAgentManager

AgentManager getAgentManager()
Returns the Agent Manager that allows DataGrid operations to be performed on the objects within this Map.

This method should only be called on a client ObjectGrid. If called on a non client ObjectGrid an IllegalStateException will be thrown

Returns:
AgentManager
Throws:
java.lang.IllegalStateException - if this method is invoked on a non client ObjectGrid
Since:
WAS XD 6.1

setLockTimeout

void setLockTimeout(int seconds)
Overrides the BackingMap's lock timeout for this ObjectMap.

Establishes the number of seconds that any given fetch (get, getForUpdate, find, findForUpdate) of a cache entry will wait to get a lock. When the lock strategy is LockStrategy.NONE, no lock manager is used by this map. In this case, a call to this method does nothing.

Parameters:
seconds - is the lock timeout in seconds. The value must be >= -1. A value of -1 is used to indicate to use the default setting. Use of the constantUSE_DEFAULT is recommended when "use default" setting is desired. A value of 0 indicates that if a lock cannot be retrieved immediately to time out without waiting for any period of time for the lock to be released and made available.
Throws:
java.lang.IllegalArgumentException - if seconds argument is less than -1 (USE_DEFAULT)
Since:
WAS XD 6.1
See Also:
USE_DEFAULT, BackingMap.setLockTimeout(int), BackingMap.setLockStrategy(LockStrategy), LockStrategy.OPTIMISTIC, LockStrategy.PESSIMISTIC

clear

void clear()
           throws ObjectGridException
Clear all keys from the Map.

This method is an autocommit call, so a session should not be explicitly begun or committed when calling clear on the ObjectMap.

Required Client Permission: MapPermission.REMOVE

Throws:
ObjectGridException - if an error occurs during processing
TransactionAlreadyActiveException - if a transaction is already started.
Since:
WAS XD 6.1.0.3

IBM WebSphere® DataPower® XC10 Appliance
Release 2.0 Client API Specification

© Copyright International Business Machines Corp 2005,2011. All rights reserved.