org.directwebremoting.datasync
Class AbstractStoreProvider<T>

java.lang.Object
  extended by org.directwebremoting.datasync.AbstractStoreProvider<T>
All Implemented Interfaces:
StoreProvider<T>
Direct Known Subclasses:
MapStoreProvider

public abstract class AbstractStoreProvider<T>
extends java.lang.Object
implements StoreProvider<T>

Some methods to help implementors create StoreProviders. It is strongly recommended that all implementors of StoreProvider inherit from this class in case it can provide some form of backwards compatibility.

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Constructor Summary
AbstractStoreProvider(java.lang.Class<T> type)
           
 
Method Summary
 void put(java.lang.String itemId, RawData rawData)
          Similar to Map.put(K, V) in adding items to a Store.
 Item viewItem(java.lang.String itemId)
          Similar to Map.get(java.lang.Object) in fetching items from a Store.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.directwebremoting.datasync.StoreProvider
put, unsubscribe, update, viewItem, viewRegion, viewRegion
 

Constructor Detail

AbstractStoreProvider

public AbstractStoreProvider(java.lang.Class<T> type)
Method Detail

put

public void put(java.lang.String itemId,
                RawData rawData)
Description copied from interface: StoreProvider
Similar to Map.put(K, V) in adding items to a Store. A value of null is equivalent to removing the item from the store. Part of the function of put is to convert the data stored in RawData into alterations to data in the store. This boiler plate code is implemented in AbstractStoreProvider.

See notes on Item.getItemId()

Specified by:
put in interface StoreProvider<T>
Parameters:
itemId - The key (or some mapping) to it.
rawData - Data from the web to be converted and added to the store

viewItem

public Item viewItem(java.lang.String itemId)
Description copied from interface: StoreProvider
Similar to Map.get(java.lang.Object) in fetching items from a Store.

Specified by:
viewItem in interface StoreProvider<T>
Parameters:
itemId - The ID of the item to fetch
Returns:
The matched item, or null if it was not found

Copyright 2008