org.clapper.curn
Class AbstractPersistentDataClient

java.lang.Object
  extended by org.clapper.curn.AbstractPersistentDataClient
All Implemented Interfaces:
PersistentDataClient

public class AbstractPersistentDataClient
extends java.lang.Object
implements PersistentDataClient

Abstract class that implements the PersistentDataClient interface, providing stubs or simple versions of the methods. This class makes it easier for a class to declare itself as a PersistentDataClient, even if it doesn't need to implement all the PersistentDataClient methods.

Version:
$Revision: 6491 $

Constructor Summary
protected AbstractPersistentDataClient()
          Creates a new instance of AbstractPersistentDataClient
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPersistentDataClient

protected AbstractPersistentDataClient()
Creates a new instance of AbstractPersistentDataClient

Method Detail

parseFeedMetadata

public 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.

This stub implementation does nothing.

Specified by:
parseFeedMetadata in interface PersistentDataClient
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

public 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.

This stub implementation does nothing.

Specified by:
parseItemMetadata in interface PersistentDataClient
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

public 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.

Specified by:
parseExtraMetadata in interface PersistentDataClient
Parameters:
name - the name of the data item
value - its value
Throws:
CurnException - on error
See Also:
getMetatdataNamespace()

getMetadataForFeed

public 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.

This stub implementation does nothing and returns an empty map.

Specified by:
getMetadataForFeed in interface PersistentDataClient
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

public 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.

This stub implementation does nothing and returns an empty map.

Specified by:
getMetadataForItem in interface PersistentDataClient
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

public 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.

This stub implementation does nothing and returns an empty map.

Specified by:
getExtraFeedMetadata in interface PersistentDataClient
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

public 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.

This implementation returns the fully-qualified class name of the subclass.

Specified by:
getMetatdataNamespace in interface PersistentDataClient
Returns:
the namespace


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