org.clapper.curn
Interface PersistentDataClient

All Known Implementing Classes:
AbstractPersistentDataClient

public interface PersistentDataClient

A PersistentDataClient is a class that wants to persist its own data in the persisted curn data store. A PersistentDataClient object can store and retrieve three kinds of data in the store:

  1. Feed-related metadata, i.e., data that relates to a feed or channel.
  2. Item-related metadata, i.e., data that relates to an item within a feed.
  3. "Extra" data, i.e., data that is to be persisted but that isn't specifically related to a feed or an item.

Each PersistentDataClient object has its own namespace, to ensure that its variable names don't clash with other data. The namespace name is supplied by the PersistentDataClient itself; the fully-qualified class name is typically a good choice for a namespace name.

A PersistentDataClient must register itself with the DataPersister class to activate itself; once registered, the client will be invoked automatically during the appropriate phases of execution. Note: Plug-in classes that implement this interface are automatically registered during plug-in discovery.

When saving the feed meta data, curn polls each registered PersistentDataClient for its data.

Version:
$Revision: 6480 $

Method Summary
 java.util.Map<java.lang.String,java.lang.String> getExtraFeedMetadata()
          Get any extra metadata (i.e., data that is not associated with a feed or an item) that is to be saved.
 java.util.Map<java.lang.String,java.lang.String> getMetadataForFeed(FeedCacheEntry feedData)
          Get the metadata that is to be saved with a particular feed or channel.
 java.util.Map<java.lang.String,java.lang.String> getMetadataForItem(FeedCacheEntry itemData, FeedCacheEntry feedData)
          Get the metadata that is to be saved with a particular item within a feed.
 java.lang.String getMetatdataNamespace()
          Get the namespace for this object's metadata.
 void parseExtraMetadata(java.lang.String name, java.lang.String value)
          Process an "extra" data item that is not associated with a feed or an item.
 void parseFeedMetadata(java.lang.String name, java.lang.String value, FeedCacheEntry feedData)
          Process a data item that has been read from the metadata store and is associated with a feed (or channel).
 void parseItemMetadata(java.lang.String name, java.lang.String value, FeedCacheEntry itemData)
          Process a data item that has been read from the metadata store and is associated with a cached item.
 

Method Detail

parseFeedMetadata

void parseFeedMetadata(java.lang.String name,
                       java.lang.String value,
                       FeedCacheEntry feedData)
                       throws CurnException
Process a data item that has been read from the metadata store and is associated with a feed (or channel). This method is called when the metadata store is being loaded into memory at the beginning of a curn run. This method is only called for data items within this object's name space.

Parameters:
name - the name associated with the data item
value - the (string) value of the data
feedData - the FeedCacheEntry record for the feed
Throws:
CurnException - on error
See Also:
getMetatdataNamespace()

parseItemMetadata

void parseItemMetadata(java.lang.String name,
                       java.lang.String value,
                       FeedCacheEntry itemData)
                       throws CurnException
Process a data item that has been read from the metadata store and is associated with a cached item. This method is called when the metadata store is being loaded into memory at the beginning of a curn run. This method is only called for data items within this object's name space.

Parameters:
name - the name associated with the data item
value - the (string) value of the data
itemData - The FeedCacheEntry data for the item
Throws:
CurnException - on error
See Also:
getMetatdataNamespace()

parseExtraMetadata

void parseExtraMetadata(java.lang.String name,
                        java.lang.String value)
                        throws CurnException
Process an "extra" data item that is not associated with a feed or an item. This method is called when the metadata store is being loaded into memory at the beginning of a curn run. This method is only called for data items within this object's name space.

Parameters:
name - the name of the data item
value - its value
Throws:
CurnException - on error
See Also:
getMetatdataNamespace()

getMetadataForFeed

java.util.Map<java.lang.String,java.lang.String> getMetadataForFeed(FeedCacheEntry feedData)
                                                                    throws CurnException
Get the metadata that is to be saved with a particular feed or channel.

Parameters:
feedData - the FeedCacheEntry record for the feed
Returns:
a Map of all the name/value pairs to be associated with the feed. The names should not be qualified by the namespace; the caller will handle that. An empty or null map signifies that this object has no metadata for the feed.
Throws:
CurnException - on error

getMetadataForItem

java.util.Map<java.lang.String,java.lang.String> getMetadataForItem(FeedCacheEntry itemData,
                                                                    FeedCacheEntry feedData)
                                                                    throws CurnException
Get the metadata that is to be saved with a particular item within a feed.

Parameters:
itemData - the FeedCacheEntry record for the item
feedData - the FeedCacheEntry record for the parent feed
Returns:
a Map of all the name/value pairs to be associated with the item. The names should not be qualified by the namespace; the caller will handle that. An empty or null map signifies that this object has no metadata for the item.
Throws:
CurnException - on error

getExtraFeedMetadata

java.util.Map<java.lang.String,java.lang.String> getExtraFeedMetadata()
                                                                      throws CurnException
Get any extra metadata (i.e., data that is not associated with a feed or an item) that is to be saved.

Returns:
a Map of all the name/value pairs to be associated with the feed. The names should not be qualified by the namespace; the caller will handle that. An empty or null map signifies that this object has no extract metadata.
Throws:
CurnException - on error

getMetatdataNamespace

java.lang.String getMetatdataNamespace()
Get the namespace for this object's metadata. The namespace must be unique. Think of it as a package name for the data. Recommendation: Use the fully-qualified class name.

Returns:
the namespace


Copyright © 2004-2006 Brian M. Clapper. All Rights Reserved.