FileDocCategorySizeDatePackage
Storage.javaAPI DocApache Lucene 2.1.09978Wed Feb 14 10:46:04 GMT 2007org.apache.lucene.gdata.storage

Storage

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

Fields Summary
Constructors Summary
Methods Summary
public abstract voidclose()
close this storage instance. This method will be called by clients after use.

public abstract voiddeleteAccount(java.lang.String accountname)
Deletes the account for the given account name. All feeds and entries referencing this account will be deleted as well!

param
accountname - the name of the account to delete
throws
StorageException - if the account does not exist

public abstract voiddeleteEntry(org.apache.lucene.gdata.data.ServerBaseEntry entry)
Deletes the given entry. The ServerBaseEntry just hase to provide the entry id to be deleted.

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

public abstract voiddeleteFeed(java.lang.String feedId)
Deletes the feed for the given feed id. All Entries referencing the given feed id will be deleted as well.

param
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

public abstract org.apache.lucene.gdata.data.GDataAccountgetAccount(java.lang.String accountName)
Retrieves the {@link GDataAccount} for the given account name

param
accountName - the name of the requested account
return
- a {@link GDataAccount} instance for the requested account name
throws
StorageException - if no account for the account name is stored

public java.lang.StringgetAccountNameForFeedId(java.lang.String feedId)
Each feed belongs to one specific account. This method retrieves the account name for

param
feedId - the id of the feed to retrieve the accountname
return
- 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

public abstract com.google.gdata.data.BaseEntrygetEntry(org.apache.lucene.gdata.data.ServerBaseEntry entry)
Retrieves the requested entry from the storage. The given entry must provide information about the entry id and service type.

param
entry - the entry to retrieve
return
- the requested entry
throws
StorageException - if the entry does not exist or can not be created or required field are not set.

public java.lang.LonggetEntryLastModified(java.lang.String entryId, java.lang.String feedId)
Retrieves the date of the last modification for the given id

param
entryId - the entry Id
param
feedId - the feed which contains the entry
return
- 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

public abstract com.google.gdata.data.BaseFeedgetFeed(org.apache.lucene.gdata.data.ServerBaseFeed feed)
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.

param
feed - the to retieve from the storage
return
the requested feed
throws
StorageException - the feed does not exist or can not be retrieved or required field are not set.

public java.lang.LonggetFeedLastModified(java.lang.String feedId)
Retrieves the date of the last modification for the given id

param
feedId - the feed Id
return
- 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

public abstract java.lang.StringgetServiceForFeed(java.lang.String feedId)
Retrieves the service name for a stored feed

param
feedId - the feed id
return
- the name of the service
throws
StorageException - if no feed for the provided id is stored

public abstract voidstoreAccount(org.apache.lucene.gdata.data.GDataAccount account)
Saves a new account. Required attributes to set are password and accountname

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

public abstract com.google.gdata.data.BaseEntrystoreEntry(org.apache.lucene.gdata.data.ServerBaseEntry entry)
Stores the given entry. The ServerBaseEntry must provide a feed id and the service type. configuration for the entry.

param
entry - the entry to store
return
- the stored Entry for the server response
throws
StorageException - if the entry can not be stored or required field are not set.

public abstract voidstoreFeed(org.apache.lucene.gdata.data.ServerBaseFeed feed, java.lang.String accountname)
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.

see
org.apache.lucene.gdata.server.registry.ProvidedService
param
feed - the feed to create
param
accountname - the account name belongs to the feed
throws
StorageException - if the feed already exists or the feed can not be stored

public abstract voidupdateAccount(org.apache.lucene.gdata.data.GDataAccount account)
Updates an existing account. Required attributes to set are password and accountname

param
account - the account to update
throws
StorageException - if the account does not exist or required field are not set.

public abstract com.google.gdata.data.BaseEntryupdateEntry(org.apache.lucene.gdata.data.ServerBaseEntry entry)
Updates the given entry. The ServerBaseEntry must provide a feed id, service id and the {@link org.apache.lucene.gdata.server.registry.ProvidedService}

param
entry - the entry to update
return
- 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.

public abstract voidupdateFeed(org.apache.lucene.gdata.data.ServerBaseFeed feed, java.lang.String accountname)
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.

param
feed - the feed to update
param
accountname - the account name belongs to the feed
throws
StorageException - if the feed does not exist or the feed can not be updated