org.apache.lucene.gdata.storage
Interface Storage

All Known Implementing Classes:
DB4oStorage, StorageImplementation

public interface Storage

A interface every storage implementation must provide to access the Storage. It describes all access methodes needed to store, retrieve and look up data stored in the Storage component. This interface acts as a Facade to hide the storage implementation from the user.

This could also act as a proxy for a remote storage. It also removes any restrictions from custom storage implementations.

Author:
Simon Willnauer

Method Summary
 void close()
          close this storage instance.
 void deleteAccount(String accountname)
          Deletes the account for the given account name.
 void deleteEntry(ServerBaseEntry entry)
          Deletes the given entry.
 void deleteFeed(String feedId)
          Deletes the feed for the given feed id.
 GDataAccount getAccount(String accountName)
          Retrieves the GDataAccount for the given account name
 String getAccountNameForFeedId(String feedId)
          Each feed belongs to one specific account.
 com.google.gdata.data.BaseEntry getEntry(ServerBaseEntry entry)
          Retrieves the requested entry from the storage.
 Long getEntryLastModified(String entryId, String feedId)
          Retrieves the date of the last modification for the given id
 com.google.gdata.data.BaseFeed getFeed(ServerBaseFeed feed)
          Retrieves the requested feed from the storage.
 Long getFeedLastModified(String feedId)
          Retrieves the date of the last modification for the given id
 String getServiceForFeed(String feedId)
          Retrieves the service name for a stored feed
 void storeAccount(GDataAccount account)
          Saves a new account.
 com.google.gdata.data.BaseEntry storeEntry(ServerBaseEntry entry)
          Stores the given entry.
 void storeFeed(ServerBaseFeed feed, String accountname)
          Stores a new feed for a existing account.
 void updateAccount(GDataAccount account)
          Updates an existing account.
 com.google.gdata.data.BaseEntry updateEntry(ServerBaseEntry entry)
          Updates the given entry.
 void updateFeed(ServerBaseFeed feed, String accountname)
          Updates a stored feed.
 

Method Detail

storeEntry

com.google.gdata.data.BaseEntry storeEntry(ServerBaseEntry entry)
                                           throws StorageException
Stores the given entry. The ServerBaseEntry must provide a feed id and the service type. configuration for the entry.

Parameters:
entry - - the entry to store
Returns:
- the stored Entry for the server response
Throws:
StorageException - - if the entry can not be stored or required field are not set.

deleteEntry

void deleteEntry(ServerBaseEntry entry)
                 throws StorageException
Deletes the given entry. The ServerBaseEntry just hase to provide the entry id to be deleted.

Parameters:
entry - - the entry to delete from the storage
Throws:
StorageException - - if the entry can not be deleted or the entry does not exist or required field are not set.

updateEntry

com.google.gdata.data.BaseEntry updateEntry(ServerBaseEntry entry)
                                            throws StorageException
Updates the given entry. The ServerBaseEntry must provide a feed id, service id and the ProvidedService

Parameters:
entry - - the entry to update
Returns:
- the updated entry for server response.
Throws:
StorageException - - if the entry can not be updated or does not exist or required field are not set.

getFeed

com.google.gdata.data.BaseFeed getFeed(ServerBaseFeed feed)
                                       throws StorageException
Retrieves the requested feed from the storage. The given ServerBaseFeed must provide information about the feed id, max-result count and the start index. To create feeds and entries also the service type must be provided.

Parameters:
feed - - the to retieve from the storage
Returns:
the requested feed
Throws:
StorageException - - the feed does not exist or can not be retrieved or required field are not set.

getEntry

com.google.gdata.data.BaseEntry getEntry(ServerBaseEntry entry)
                                         throws StorageException
Retrieves the requested entry from the storage. The given entry must provide information about the entry id and service type.

Parameters:
entry - - the entry to retrieve
Returns:
- the requested entry
Throws:
StorageException - - if the entry does not exist or can not be created or required field are not set.

storeAccount

void storeAccount(GDataAccount account)
                  throws StorageException
Saves a new account. Required attributes to set are password and accountname

Parameters:
account - - the account to save
Throws:
StorageException - - if the account can not be stored or the account already exists or required field are not set.

updateAccount

void updateAccount(GDataAccount account)
                   throws StorageException
Updates an existing account. Required attributes to set are password and accountname

Parameters:
account - - the account to update
Throws:
StorageException - - if the account does not exist or required field are not set.

deleteAccount

void deleteAccount(String accountname)
                   throws StorageException
Deletes the account for the given account name. All feeds and entries referencing this account will be deleted as well!

Parameters:
accountname - - the name of the account to delete
Throws:
StorageException - - if the account does not exist

storeFeed

void storeFeed(ServerBaseFeed feed,
               String accountname)
               throws StorageException
Stores a new feed for a existing account. The Feed must provide information about the service type to store the feed for and the feed id used for accessing and retrieving the feed from the storage. Each feed is associated with a provided service. This method does check wheather a feed with the same feed id as the given feed does already exists.

Parameters:
feed - - the feed to create
accountname - - the account name belongs to the feed
Throws:
StorageException - - if the feed already exists or the feed can not be stored
See Also:
ProvidedService

deleteFeed

void deleteFeed(String feedId)
                throws StorageException
Deletes the feed for the given feed id. All Entries referencing the given feed id will be deleted as well.

Parameters:
feedId - - the feed id for the feed to delete.
Throws:
StorageException - - if the feed for the feed id does not exist or the feed can not be deleted

updateFeed

void updateFeed(ServerBaseFeed feed,
                String accountname)
                throws StorageException
Updates a stored feed. The Feed must provide information about the service type to store the feed for and the feed id used for accessing and retrieving the feed from the storage.

Parameters:
feed - - the feed to update
accountname - - the account name belongs to the feed
Throws:
StorageException - - if the feed does not exist or the feed can not be updated

getServiceForFeed

String getServiceForFeed(String feedId)
                         throws StorageException
Retrieves the service name for a stored feed

Parameters:
feedId - - the feed id
Returns:
- the name of the service
Throws:
StorageException - - if no feed for the provided id is stored

getAccount

GDataAccount getAccount(String accountName)
                        throws StorageException
Retrieves the GDataAccount for the given account name

Parameters:
accountName - - the name of the requested account
Returns:
- a GDataAccount instance for the requested account name
Throws:
StorageException - - if no account for the account name is stored

close

void close()
close this storage instance. This method will be called by clients after use.


getAccountNameForFeedId

String getAccountNameForFeedId(String feedId)
                               throws StorageException
Each feed belongs to one specific account. This method retrieves the account name for

Parameters:
feedId - - the id of the feed to retrieve the accountname
Returns:
- the name / id of the account associated with the feed for the given feed id
Throws:
StorageException - - if the feed is not stored or the storage can not be accessed

getEntryLastModified

Long getEntryLastModified(String entryId,
                          String feedId)
                          throws StorageException
Retrieves the date of the last modification for the given id

Parameters:
entryId - - the entry Id
feedId - - the feed which contains the entry
Returns:
- The date of the last modifiaction in milliseconds or new Long(0) if the resource can not be found eg. the time can not be accessed
Throws:
StorageException - - if the storage can not be accessed

getFeedLastModified

Long getFeedLastModified(String feedId)
                         throws StorageException
Retrieves the date of the last modification for the given id

Parameters:
feedId - - the feed Id
Returns:
- The date of the last modifiaction in milliseconds or new Long(0) if the resource can not be found eg. the time can not be accessed
Throws:
StorageException - - if the storage can not be accessed


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.