FileDocCategorySizeDatePackage
StorageFeedWrapper.javaAPI DocApache Lucene 2.1.03750Wed Feb 14 10:46:04 GMT 2007org.apache.lucene.gdata.storage.lucenestorage

StorageFeedWrapper

public class StorageFeedWrapper extends Object implements StorageWrapper
This immutable class wrapps GDataAccount instances for an internal Storage representation of an account. This class also acts as a Documentfactory for lucene documents to be stored inside the index.
author
Simon Willnauer

Fields Summary
private static final String
INTERNAL_ENCODING
public static final String
FIELD_ACCOUNTREFERENCE
the account who owns the feed
public static final String
FIELD_FEED_ID
the id of the feed
public static final String
FIELD_CONTENT
The xml feed representation
public static final String
FIELD_TIMESTAMP
The creation timestamp
public static final String
FIELD_SERVICE_ID
The Service this feed belongs to.
private final org.apache.lucene.gdata.data.ServerBaseFeed
feed
private final String
accountName
private final org.apache.lucene.gdata.server.registry.ProvidedService
config
private final String
content
Constructors Summary
public StorageFeedWrapper(org.apache.lucene.gdata.data.ServerBaseFeed feed, String accountname)

param
feed
param
accountname
throws
IOException

    
    
                   
             
        this.feed = feed;
        this.accountName = accountname;
        this.config = feed.getServiceConfig();
        this.content = buildContent();
       
    
Methods Summary
private java.lang.StringbuildContent()

 
        StringWriter writer = new StringWriter(); 
        XmlWriter xmlWriter = new XmlWriter(writer, INTERNAL_ENCODING); 
        this.feed.generateAtom(xmlWriter,this.config.getExtensionProfile()); 
        return writer.toString(); 
    
public com.google.gdata.data.BaseFeedgetFeed()

return
- the wrapped feed

        return this.feed.getFeed();
    
public org.apache.lucene.document.DocumentgetLuceneDocument()

see
org.apache.lucene.gdata.storage.lucenestorage.StorageWrapper#getLuceneDocument()

        Document doc = new Document();
        doc.add(new Field(FIELD_ACCOUNTREFERENCE,this.accountName,Field.Store.YES,Field.Index.UN_TOKENIZED));
        doc.add(new Field(FIELD_FEED_ID,this.feed.getId(),Field.Store.YES,Field.Index.UN_TOKENIZED));
        doc.add(new Field(FIELD_CONTENT,this.content,Field.Store.COMPRESS,Field.Index.NO));
        doc.add(new Field(FIELD_SERVICE_ID,this.feed.getServiceType(),Field.Store.YES,Field.Index.NO));
        return doc;