Cache Loader

In the example below, the CacheLoaderAdapter class is used to help in the implementation of MyCacheLoader.

Figure 1. Using CacheLoaderAdapter to implement a cache loader
...
public class MyCacheLoader extends 
    CacheLoaderAdapter<Integer, ReadWorkQueueDetails> {
  /* (non-Javadoc)
   * @see curam.util.cache.CacheLoader#load(java.lang.Object)
   */
  public ReadWorkQueueDetails load(Integer workQueueID) 
       throws AppException, InformationalException {
    WorkAllocation wa = (WorkAllocation)WorkAllocationFactory
                                   .newInstance();
    ReadWorkQueueKey key = new ReadWorkQueueKey();
    key.key = new ReadWorkQueueKey();
    key.key.key = new WorkQueueKey();
    key.key.key.workQueueID = workQueueID;
    ReadWorkQueueDetails item = wa.readWorkQueue(key);
    if(item != null) {
      return item.dtls;
    }
    return null;
  }
}
...