com.ibm.oti.shared
Class SharedDataHelperImpl

java.lang.Object
  extended by com.ibm.oti.shared.SharedAbstractHelper
      extended by com.ibm.oti.shared.SharedDataHelperImpl
All Implemented Interfaces:
SharedDataHelper, SharedHelper

public class SharedDataHelperImpl
extends SharedAbstractHelper
implements SharedDataHelper

Implementation of SharedDataHelper.

Version:
initial
Author:
OTI
See Also:
SharedDataHelper, SharedAbstractHelper

Method Summary
 java.nio.ByteBuffer findSharedData(java.lang.String token)
          Find data in the shared cache using a specific token.
 java.nio.ByteBuffer storeSharedData(java.lang.String token, java.nio.ByteBuffer data)
          Store data in the shared cache using a specific token.
 
Methods inherited from class com.ibm.oti.shared.SharedAbstractHelper
getClassLoader
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.oti.shared.SharedHelper
getClassLoader
 

Method Detail

findSharedData

public java.nio.ByteBuffer findSharedData(java.lang.String token)
Description copied from interface: SharedDataHelper
Find data in the shared cache using a specific token.

Data will be returned only for an exact String match of the token. Otherwise, null is returned.
The ByteBuffer returned is read-only and cannot be modified.
If a SecurityManager is installed, findSharedData can only be called by code whos caller-classloader has been granted "read" permissions to the shared class cache.

Specified by:
findSharedData in interface SharedDataHelper
Parameters:
token - String. A String token to be used as a key
Returns:
ByteBuffer A read-only ByteBuffer containing the cached data, or null.

storeSharedData

public java.nio.ByteBuffer storeSharedData(java.lang.String token,
                                           java.nio.ByteBuffer data)
Description copied from interface: SharedDataHelper
Store data in the shared cache using a specific token.

If the data is stored successfully, the shared read-only copy of the data is returned. Otherwise, null is returned.
If data already exists for the token specified, the old data is marked "stale" in the cache and is replaced by the new data.
If the exact same data already exists in the cache under the same token, the data is not duplicated and the cached version is returned.
If null is passed as the data argument, the data currently stored against that token is marked "stale" and null is returned.
If a SecurityManager is installed, storeSharedData can only be called by code whos caller-classloader has been granted "write" permissions to the shared class cache.

Specified by:
storeSharedData in interface SharedDataHelper
Parameters:
token - String. A String token to be used as a key
data - ByteBuffer. A ByteBuffer of data to copy to the cache
Returns:
ByteBuffer. A read-only ByteBuffer containing the cached data, or null.