modified the authentication and storage modules to throw their

own exception classes AuthenticationException and StorageException
instead of invalid_argument and logic_error
This commit is contained in:
fgerlits 2004-12-23 11:37:55 +00:00
parent adf05eaf29
commit de2b5a49a2
61 changed files with 1121 additions and 539 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.9 $
Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.h,v $
------------------------------------------------------------------------------*/
@ -99,7 +99,7 @@ using namespace LiveSupport::Core;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.9 $
* @version $Revision: 1.10 $
*/
class WebStorageClient :
virtual public Configurable,
@ -153,19 +153,18 @@ class WebStorageClient :
return configElementNameStr;
}
/**
* Configure the object based on the XML element supplied.
*
* @param element the XML element to configure the object from.
* @exception std::invalid_argument if the supplied XML element
* contains bad configuraiton information
* @exception std::logic_error if the scheduler daemon has already
* been configured, and can not be reconfigured.
*/
virtual void
configure(const xmlpp::Element & element)
throw (std::invalid_argument,
std::logic_error);
throw (std::invalid_argument);
/**
* Tell if a playlist with a given id exists.
@ -174,12 +173,13 @@ class WebStorageClient :
* @param id the id of the playlist to check for.
* @return true if a playlist with the specified id exists,
* false otherwise.
* @exception std::logic_error if we have not logged in yet.
* @exception StorageException if there is a problem with the XML-RPC
* call.
*/
virtual const bool
existsPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const
throw (std::logic_error);
existsPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const
throw (StorageException);
/**
* Return a playlist with the specified id, to be displayed.
@ -187,14 +187,15 @@ class WebStorageClient :
* @param sessionId the session ID from the authentication client
* @param id the id of the playlist to return.
* @return the requested playlist.
* @exception std::logic_error if no playlist with the specified
* id exists.
* @exception std::logic_error if we have not logged in yet.
* @exception StorageException if there is a problem with the XML-RPC
* call or no playlist with the specified
* id exists.
*/
virtual Ptr<Playlist>::Ref
getPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const
throw (std::logic_error);
throw (StorageException);
/**
* Return a playlist with the specified id, to be edited.
@ -202,27 +203,29 @@ class WebStorageClient :
* @param sessionId the session ID from the authentication client
* @param id the id of the playlist to return.
* @return the requested playlist.
* @exception std::logic_error if no playlist with the specified
* id exists.
* @exception std::logic_error if we have not logged in yet.
* @exception StorageException if there is a problem with the XML-RPC
* call or no playlist with the specified
* id exists.
*/
virtual Ptr<Playlist>::Ref
editPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const
throw (std::logic_error);
throw (StorageException);
/**
* Save the playlist after editing.
*
* @param sessionId the session ID from the authentication client
* @param playlist the playlist to save.
* @exception std::logic_error if the playlist has not been previously
* opened by getPlaylist()
* @exception StorageException if there is a problem with the XML-RPC
* call or the playlist has not been
* previously opened by getPlaylist()
*/
virtual void
savePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref playlist) const
throw (std::logic_error);
throw (StorageException);
/**
* Acquire the resources for the playlist.
@ -237,14 +240,14 @@ class WebStorageClient :
* @return a new Playlist instance containing a uri field which
* points to an executable (playable) SMIL representation of
* the playlist (in the local storage).
* @exception std::logic_error if no playlist with the specified
* specified id exists.
* @exception std::logic_error if we have not logged in yet.
* @exception StorageException if there is a problem with the XML-RPC
* call or no playlist with the specified
* specified id exists.
*/
virtual Ptr<Playlist>::Ref
acquirePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const
throw (std::logic_error);
throw (StorageException);
/**
* Release the resources (audio clips, other playlists) used
@ -253,50 +256,52 @@ class WebStorageClient :
*
* @param sessionId the session ID from the authentication client
* @param playlist the playlist to release.
* @exception std::logic_error if the playlist has no uri field,
* or the file does not exist, etc.
* @exception std::logic_error if we have not logged in yet.
* @exception StorageException if there is a problem with the XML-RPC
* call or the playlist has no uri field,
* or the file does not exist, etc.
*/
virtual void
releasePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref playlist) const
throw (std::logic_error);
releasePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref playlist) const
throw (StorageException);
/**
* Delete the playlist with the specified id.
* Delete a playlist with the specified id.
*
* @param sessionId the session ID from the authentication client
* @param id the id of the playlist to be deleted.
* @exception std::logic_error if no playlist with the specified
* id exists.
* @exception std::logic_error if we have not logged in yet.
* @exception StorageException if there is a problem with the XML-RPC
* call or no playlist with the specified
* id exists.
*/
virtual void
deletePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id)
throw (std::logic_error);
deletePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id)
throw (StorageException);
/**
* Return a list of all playlists in the playlist store.
*
* @param sessionId the session ID from the authentication client
* @return a vector containing the playlists.
* @exception std::logic_error if we have not logged in yet.
* @exception StorageException if there is a problem with the XML-RPC
* call.
*/
virtual Ptr<std::vector<Ptr<Playlist>::Ref> >::Ref
getAllPlaylists(Ptr<SessionId>::Ref sessionId) const
throw (std::logic_error);
throw (StorageException);
/**
* Create a new playlist.
*
* @param sessionId the session ID from the authentication client
* @return the newly created playlist.
* @exception std::logic_error if we have not logged in yet.
* @exception StorageException if there is a problem with the XML-RPC
* call.
*/
virtual Ptr<Playlist>::Ref
createPlaylist(Ptr<SessionId>::Ref sessionId)
throw (std::logic_error);
throw (StorageException);
/**
* Tell if an audio clip with a given id exists.
@ -305,12 +310,13 @@ class WebStorageClient :
* @param id the id of the audio clip to check for.
* @return true if an audio clip with the specified id exists,
* false otherwise.
* @exception std::logic_error if we have not logged in yet
* @exception StorageException if there is a problem with the XML-RPC
* call.
*/
virtual const bool
existsAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const
throw (std::logic_error);
throw (StorageException);
/**
* Return an audio clip with the specified id.
@ -318,14 +324,14 @@ class WebStorageClient :
* @param sessionId the session ID from the authentication client
* @param id the id of the audio clip to return.
* @return the requested audio clip.
* @exception std::logic_error if no audio clip with the
* specified id exists.
* @exception std::logic_error if we have not logged in yet.
* @exception StorageException if there is a problem with the XML-RPC
* call or no audio clip with the
* specified id exists.
*/
virtual Ptr<AudioClip>::Ref
getAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const
throw (std::logic_error);
getAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const
throw (StorageException);
/**
* Store an audio clip. The <code>uri</code> field of the audio clip
@ -339,12 +345,13 @@ class WebStorageClient :
* @param audioClip the audio clip to store.
* @return true if the operation was successful.
*
* @exception std::logic_error if we have not logged in yet.
* @exception StorageException if there is a problem with the XML-RPC
* call or we have not logged in yet.
*/
virtual bool
storeAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<AudioClip>::Ref audioClip)
throw (std::logic_error);
throw (StorageException);
/**
* Acquire the resources for the audio clip with the specified id.
@ -356,14 +363,14 @@ class WebStorageClient :
* @param id the id of the audio clip to acquire.
* @return a new AudioClip instance, containing a uri field which
* points to (a way of getting) the sound file.
* @exception std::logic_error if no audio clip with the
* specified id exists.
* @exception std::logic_error if we have not logged in yet.
* @exception StorageException if there is a problem with the XML-RPC
* call or if no audio clip with the
* specified id exists.
*/
virtual Ptr<AudioClip>::Ref
acquireAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const
throw (std::logic_error);
acquireAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const
throw (StorageException);
/**
* Release the resource (sound file) used by an audio clip. The
@ -371,40 +378,42 @@ class WebStorageClient :
* deleted.
*
* @param sessionId the session ID from the authentication client
* @param audioClip the audio clip to release.
* @exception std::logic_error if the audio clip has no uri field,
* or the file does not exist, etc.
* @exception std::logic_error if we have not logged in yet.
* @param audioClip the id of the audio clip to release.
* @exception StorageException if there is a problem with the XML-RPC
* call or the audio clip has no uri field,
* or the file does not exist, etc.
*/
virtual void
releaseAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<AudioClip>::Ref audioClip) const
throw (std::logic_error);
throw (StorageException);
/**
* Delete the audio clip with the specified id.
* Delete an audio clip with the specified id.
*
* @param sessionId the session ID from the authentication client
* @param id the id of the audio clip to be deleted.
* @exception std::logic_error if no audio clip with the
* specified id exists.
* @exception std::logic_error if we have not logged in yet.
* @exception StorageException if there is a problem with the XML-RPC
* call or no audio clip with the
* specified id exists.
*/
virtual void
deleteAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id)
throw (std::logic_error);
deleteAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id)
throw (StorageException);
/**
* Return a list of all audio clips in the playlist store.
*
* @param sessionId the session ID from the authentication client
* @return a vector containing the audio clips.
* @exception std::logic_error if we have not logged in yet.
* @return a vector containing the playlists.
* @exception StorageException if there is a problem with the XML-RPC
* call.
*/
virtual Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref
getAllAudioClips(Ptr<SessionId>::Ref sessionId) const
throw (std::logic_error);
throw (StorageException);
/**
* Reset the storage to its initial state. Used for testing.
@ -415,7 +424,7 @@ class WebStorageClient :
*/
Ptr<std::vector<Ptr<UniqueId>::Ref> >::Ref
reset(void)
throw (std::logic_error);
throw (StorageException);
};