org.apache.lucene.gdata.storage.lucenestorage
Class StorageImplementation

java.lang.Object
  extended by org.apache.lucene.gdata.storage.lucenestorage.StorageImplementation
All Implemented Interfaces:
Storage

public class StorageImplementation
extends Object
implements Storage

This is an implementation of the Storage interface. The StorageImplementation provides access to the StorageQuery and the StorageModifier. This class will be instantiated per client request.

Author:
Simon Willnauer

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

Constructor Detail

StorageImplementation

public StorageImplementation()
                      throws StorageException
Creates a new StorageImplementation

Throws:
StorageException - - if the storage controller can not be obtained
Method Detail

storeEntry

public com.google.gdata.data.BaseEntry storeEntry(ServerBaseEntry entry)
                                           throws StorageException
Description copied from interface: Storage
Stores the given entry. The ServerBaseEntry must provide a feed id and the service type. configuration for the entry.

Specified by:
storeEntry in interface Storage
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.
See Also:
Storage.storeEntry(org.apache.lucene.gdata.data.ServerBaseEntry)

deleteEntry

public void deleteEntry(ServerBaseEntry entry)
                 throws StorageException
Description copied from interface: Storage
Deletes the given entry. The ServerBaseEntry just hase to provide the entry id to be deleted.

Specified by:
deleteEntry in interface Storage
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.
See Also:
Storage.deleteEntry(org.apache.lucene.gdata.data.ServerBaseEntry)

updateEntry

public com.google.gdata.data.BaseEntry updateEntry(ServerBaseEntry entry)
                                            throws StorageException
Description copied from interface: Storage
Updates the given entry. The ServerBaseEntry must provide a feed id, service id and the ProvidedService

Specified by:
updateEntry in interface Storage
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.
See Also:
Storage.updateEntry(org.apache.lucene.gdata.data.ServerBaseEntry)

getFeed

public com.google.gdata.data.BaseFeed getFeed(ServerBaseFeed feed)
                                       throws StorageException
Description copied from interface: Storage
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.

Specified by:
getFeed in interface Storage
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.
See Also:
Storage.getFeed(org.apache.lucene.gdata.data.ServerBaseFeed)

getEntry

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

Specified by:
getEntry in interface Storage
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.
See Also:
Storage.getEntry(org.apache.lucene.gdata.data.ServerBaseEntry)

close

public void close()
Description copied from interface: Storage
close this storage instance. This method will be called by clients after use.

Specified by:
close in interface Storage
See Also:
Storage.close()

storeAccount

public void storeAccount(GDataAccount Account)
                  throws StorageException
Description copied from interface: Storage
Saves a new account. Required attributes to set are password and accountname

Specified by:
storeAccount in interface Storage
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.
See Also:
Storage.storeAccount(org.apache.lucene.gdata.data.GDataAccount)

updateAccount

public void updateAccount(GDataAccount Account)
                   throws StorageException
Description copied from interface: Storage
Updates an existing account. Required attributes to set are password and accountname

Specified by:
updateAccount in interface Storage
Parameters:
Account - - the account to update
Throws:
StorageException - - if the account does not exist or required field are not set.
See Also:
Storage.updateAccount(org.apache.lucene.gdata.data.GDataAccount)

deleteAccount

public void deleteAccount(String Accountname)
                   throws StorageException
Description copied from interface: Storage
Deletes the account for the given account name. All feeds and entries referencing this account will be deleted as well!

Specified by:
deleteAccount in interface Storage
Parameters:
Accountname - - the name of the account to delete
Throws:
StorageException - - if the account does not exist
See Also:
Storage.deleteAccount(java.lang.String)

storeFeed

public void storeFeed(ServerBaseFeed feed,
                      String accountName)
               throws StorageException
Description copied from interface: Storage
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.

Specified by:
storeFeed in interface Storage
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:
Storage.storeFeed(org.apache.lucene.gdata.data.ServerBaseFeed, java.lang.String)

deleteFeed

public void deleteFeed(String feedId)
                throws StorageException
Description copied from interface: Storage
Deletes the feed for the given feed id. All Entries referencing the given feed id will be deleted as well.

Specified by:
deleteFeed in interface Storage
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
See Also:
Storage.deleteFeed(java.lang.String)

updateFeed

public void updateFeed(ServerBaseFeed feed,
                       String accountName)
                throws StorageException
Description copied from interface: Storage
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.

Specified by:
updateFeed in interface 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
See Also:
Storage.updateFeed(org.apache.lucene.gdata.data.ServerBaseFeed, java.lang.String)

getServiceForFeed

public String getServiceForFeed(String feedId)
                         throws StorageException
Description copied from interface: Storage
Retrieves the service name for a stored feed

Specified by:
getServiceForFeed in interface Storage
Parameters:
feedId - - the feed id
Returns:
- the name of the service
Throws:
StorageException - - if no feed for the provided id is stored
See Also:
Storage.getServiceForFeed(java.lang.String)

getAccount

public GDataAccount getAccount(String accountName)
                        throws StorageException
Description copied from interface: Storage
Retrieves the GDataAccount for the given account name

Specified by:
getAccount in interface Storage
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
See Also:
Storage.getAccount(java.lang.String)

getAccountNameForFeedId

public String getAccountNameForFeedId(String feedId)
                               throws StorageException
Description copied from interface: Storage
Each feed belongs to one specific account. This method retrieves the account name for

Specified by:
getAccountNameForFeedId in interface Storage
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
See Also:
Storage.getAccountNameForFeedId(java.lang.String)

getEntryLastModified

public Long getEntryLastModified(String entryId,
                                 String feedId)
                          throws StorageException
Description copied from interface: Storage
Retrieves the date of the last modification for the given id

Specified by:
getEntryLastModified in interface Storage
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
See Also:
Storage.getEntryLastModified(java.lang.String, java.lang.String)

getFeedLastModified

public Long getFeedLastModified(String feedId)
                         throws StorageException
Description copied from interface: Storage
Retrieves the date of the last modification for the given id

Specified by:
getFeedLastModified in interface Storage
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
See Also:
Storage.getFeedLastModified(java.lang.String)


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