diff --git a/livesupport/doc/model/LocalStorage/index.html b/livesupport/doc/model/LocalStorage/index.html
index 076e0c099..35f22cc68 100644
--- a/livesupport/doc/model/LocalStorage/index.html
+++ b/livesupport/doc/model/LocalStorage/index.html
@@ -14,7 +14,7 @@ Development Loan Fund, under the GNU GPL.
- Author: $Author: fgerlits $
- - Version: $Revision: 1.2 $
+ - Version: $Revision: 1.3 $
- Location: $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/doc/model/LocalStorage/index.html,v $
Scope
@@ -1552,9 +1552,15 @@ Scheduler daemon, and the main associations between the concepts.
Component responsible for doing the
authentications
|
+
+ Session ID
+ |
+ An identifier issued by Authentication, to be
+used by subsequent operations.
+ |
- Unique Id
+ | Unique ID
|
A globally unique identifier used to to
differentiate between objects that might even be created on different
@@ -1608,6 +1614,19 @@ in the Local storage
extra (fade in / fade out) information
|
+
+ URL
+ |
+ The location of a metafile (in the local filesystem)
+ |
+
+
+ Token
+ |
+ An identifier used to match the parts of two-part
+operations, e.g., access--release or edit--save
+ |
+
|
@@ -1743,6 +1762,25 @@ AudioClips
This includes creating, editing, deleting and
accessing Playlists
|
+
+ Playlist
+ |
+ Is associated with
+ |
+ URL
+ |
+ The path of (a copy of) the playlist metafile
+ |
+
+ Playlist
+ |
+ Is associated with
+ |
+ Token
+ |
+ An identifier issued by access operations, to be
+used for identification by release operations
+ |
@@ -1818,7 +1856,8 @@ see Authentication : Authenticate
| Name
|
existsAudioClip
-(audioClipId : UniqueId)
+(sessionId : SessionId,
+audioClipId : UniqueId)
: boolean
|
@@ -1891,7 +1930,8 @@ with the specified id is stored in Local storage, false otherwise
Name
|
storeAudioClip
-(audioClip : AudioClip)
+(sessionId : SessionId,
+audioClip : AudioClip)
: UniqueId
|
@@ -2041,7 +2081,8 @@ are replaced by the presented contents
Name
|
deleteAudioClip
-(audioClipId : UniqueId)
+(sessionId : SessionId,
+audioClipId : UniqueId)
: void
|
@@ -2149,7 +2190,8 @@ as an error.
Name
|
updateAudioClipMetadata
-(audioClipId : UniqueId,
+(sessionId : SessionId,
+audioClipId : UniqueId,
newMetadata : MetaData)
: void
|
@@ -2233,7 +2275,8 @@ replaced with the presented contents
Name
|
accessRawAudioData
-(audioClipId : UniqueId)
+(sessionId : SessionId,
+audioClipId : UniqueId)
: RawAudioData
|
@@ -2317,7 +2360,8 @@ RawAudioData for AudioClip is increased by one
Name
|
releaseRawAudioData
-(rawAudioData : RawAudioData)
+(sessionId : SessionId,
+rawAudioData : RawAudioData)
: void
|
@@ -2400,7 +2444,8 @@ RawAudioData for AudioClip is decreased by one
Name
|
searchMetadata
-(criteria : SearchCriteria)
+(sessionId : SessionId,
+criteria : SearchCriteria)
: UniqueId
|
@@ -2474,7 +2519,8 @@ ids, for which MetaData matches the supplied search criteria
Name
|
getAudioClip
-(audioClipId : UniqueId)
+(sessionId : SessionId,
+audioClipId : UniqueId)
: AudioClip
|
@@ -2549,7 +2595,8 @@ specified by the supplied id.
Name
|
createPlaylist
-(playlistId : UniqueId)
+(sessionId : SessionId,
+playlistId : UniqueId)
: void
|
@@ -2638,8 +2685,9 @@ not being edited
Name
|
editPlaylist
-(playlistId : UniqueId)
-: Playlist
+(sessionId : SessionId,
+playlistId : UniqueId)
+: { playlistURL : URL, playlistToken: Token }
|
@@ -2729,7 +2777,9 @@ associated with the token returned
Name
|
savePlaylist
-(playlist : Playlist)
+(sessionId : SessionId,
+playlistToken : Token,
+newPlaylistURL : URL)
: void
|
@@ -2755,15 +2805,13 @@ metafile in place of the old one.
Notes
|
- 'playlist' is two arguments,
-really: the URL of a (new) Playlist metafile,
-and the token returned previously by editPlaylist()
+ | none
|
Exceptions
|
- if the playlist token argument
+ | if the playlistToken argument
does not match a token generated earlier in this session by editPlaylist(),
report as an error
|
@@ -2799,8 +2847,8 @@ not being edited
|
- the token and the URL returned earlier by
-editPlaylist() together with it are no longer valid |
+ the playlistToken token and the URL returned earlier
+by editPlaylist() together with it are no longer valid |
association broken
|
@@ -2823,7 +2871,8 @@ editPlaylist() together with it are no longer valid
Name
|
deletePlaylist
-(playlistId : UniqueId)
+(sessionId : SessionId,
+playlistId : UniqueId)
: void
|
@@ -2904,8 +2953,9 @@ being edited, report as an error
Name
|
accessPlaylist
-(playlistId : UniqueId)
-: Playlist
+(sessionId : SessionId,
+playlistId : UniqueId)
+: { playlistURL : URL, playlistToken : Token }
|
@@ -2988,7 +3038,8 @@ associated with the token returned
Name
|
releasePlaylist
-(playlist : Playlist)
+(sessionId : SessionId,
+playlistToken : Token)
: void
|
@@ -3014,14 +3065,13 @@ obtained earlier by accessPlaylist().
Notes
|
- here 'playlist' is just one
-argument (sorry!), a token returned previously by accessPlaylist()
+ | none
|
Exceptions
|
- if the playlist token argument
+ | if the playlistToken argument
does not match a token generated earlier in this session by accessPlaylist(),
report as an error
|
@@ -3047,8 +3097,8 @@ report as an error
|
- the token and the URL returned earlier by
-accessPlaylist() together with it are no longer valid |
+ the playlistToken token and the URL returned earlier
+by accessPlaylist() together with it are no longer valid |
association broken
|
@@ -3071,7 +3121,8 @@ accessPlaylist() together with it are no longer valid
Name
|
existsPlaylist
-(playlistId : UniqueId)
+(sessionId : SessionId,
+playlistId : UniqueId)
: bool
|
@@ -3133,6 +3184,79 @@ metafile with the given playlist ID exists.
+Contract for Local storage : playlistIsAvailable
+
+
+
+
+ Name
+ |
+ playlistIsAvailable
+(sessionId : SessionId,
+playlistId : UniqueId)
+: bool
+ |
+
+
+ Responsibilities
+ |
+ Check whether a Playlist
+metafile with the given playlist ID is available for editing, i.e., exists
+and has not been opened for editing yet.
+ |
+
+
+ Type
+ |
+ system
+ |
+
+
+ Cross-reference
+ |
+ UC-7
+ |
+
+
+ Notes
+ |
+ none
+ |
+
+
+ Exceptions
+ |
+ none
+ |
+
+
+ Output
+ |
+ true if the playlist exists
+and is available; false if either condition fails
+ |
+
+
+ Pre-conditions
+ |
+ none |
+
+
+ Post-conditions
+ |
+ none |
+
+
+
+ |
+
+ |
+
+ |
+
+
+
+
Contract for Local storage : accessAudioClip
@@ -3141,8 +3265,9 @@ metafile with the given playlist ID exists.
Name
|
accessAudioClip
-(audioClipId : UniqueId)
-: AudioClip
+(sessionId : SessionId,
+audioClipId : UniqueId)
+: { audioClipURL : URL, audioClipToken : Token }
|
@@ -3223,7 +3348,8 @@ associated with the token returned
Name
|
releaseAudioClip
-(audioClip : AudioClip)
+(sessionId : SessionId,
+audioClipToken : Token)
: void
|
@@ -3249,14 +3375,13 @@ obtained earlier by accessAudioClip().
Notes
|
- here 'audioClip' is just one
-argument (sorry!), a token returned previously by accessAudioClip()
+ | none
|
Exceptions
|
- if the playlist token argument
+ | if the audioClipToken argument
does not match a token generated earlier in this session by accessAudioClip(),
report as an error
|
@@ -3282,8 +3407,8 @@ report as an error
|
- the token and the URL returned earlier by
-accessAudioClip() together with it are no longer valid |
+ the audioClipToken token and the URL returned earlier
+by accessAudioClip() together with it are no longer valid |
association broken
|
diff --git a/livesupport/modules/core/include/LiveSupport/Core/StorageClientInterface.h b/livesupport/modules/core/include/LiveSupport/Core/StorageClientInterface.h
index 486294ec3..7a86e35b5 100644
--- a/livesupport/modules/core/include/LiveSupport/Core/StorageClientInterface.h
+++ b/livesupport/modules/core/include/LiveSupport/Core/StorageClientInterface.h
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.14 $
+ Version : $Revision: 1.15 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Attic/StorageClientInterface.h,v $
------------------------------------------------------------------------------*/
@@ -62,7 +62,7 @@ namespace Core {
* An interface for storage clients.
*
* @author $Author: fgerlits $
- * @version $Revision: 1.14 $
+ * @version $Revision: 1.15 $
*/
class StorageClientInterface
{
@@ -82,7 +82,7 @@ class StorageClientInterface
= 0;
/**
- * Return a playlist with the specified id.
+ * Return a playlist with the specified id, to be displayed.
*
* @param sessionId the session ID from the authentication client
* @param id the id of the playlist to return.
@@ -96,6 +96,35 @@ class StorageClientInterface
throw (std::logic_error)
= 0;
+ /**
+ * Return a playlist with the specified id, to be edited.
+ *
+ * @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.
+ */
+ virtual Ptr::Ref
+ editPlaylist(Ptr::Ref sessionId,
+ Ptr::Ref id) const
+ throw (std::logic_error)
+ = 0;
+
+ /**
+ * 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()
+ */
+ virtual void
+ savePlaylist(Ptr::Ref sessionId,
+ Ptr::Ref playlist) const
+ throw (std::logic_error)
+ = 0;
+
/**
* Acquire the resources for the playlist.
*
diff --git a/livesupport/modules/storage/src/TestStorageClient.cxx b/livesupport/modules/storage/src/TestStorageClient.cxx
index f7bd2845d..c40d6db89 100644
--- a/livesupport/modules/storage/src/TestStorageClient.cxx
+++ b/livesupport/modules/storage/src/TestStorageClient.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.18 $
+ Version : $Revision: 1.19 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.cxx,v $
------------------------------------------------------------------------------*/
@@ -191,7 +191,7 @@ TestStorageClient :: existsPlaylist(Ptr::Ref sessionId,
/*------------------------------------------------------------------------------
- * Return a playlist.
+ * Return a playlist to be displayed.
*----------------------------------------------------------------------------*/
Ptr::Ref
TestStorageClient :: getPlaylist(Ptr::Ref sessionId,
@@ -208,6 +208,35 @@ TestStorageClient :: getPlaylist(Ptr::Ref sessionId,
}
+/*------------------------------------------------------------------------------
+ * Return a playlist to be edited.
+ *----------------------------------------------------------------------------*/
+Ptr::Ref
+TestStorageClient :: editPlaylist(Ptr::Ref sessionId,
+ Ptr::Ref id) const
+ throw (std::invalid_argument)
+{
+ PlaylistMap::const_iterator it = playlistMap.find(id->getId());
+
+ if (it == playlistMap.end()) {
+ throw std::invalid_argument("no such playlist");
+ }
+
+ return it->second;
+}
+
+
+/*------------------------------------------------------------------------------
+ * Save a playlist after editing.
+ *----------------------------------------------------------------------------*/
+void
+TestStorageClient :: savePlaylist(Ptr::Ref sessionId,
+ Ptr::Ref playlist) const
+ throw (std::logic_error)
+{
+}
+
+
/*------------------------------------------------------------------------------
* Acquire resources for a playlist.
*----------------------------------------------------------------------------*/
diff --git a/livesupport/modules/storage/src/TestStorageClient.h b/livesupport/modules/storage/src/TestStorageClient.h
index a48639751..1a97f63f5 100644
--- a/livesupport/modules/storage/src/TestStorageClient.h
+++ b/livesupport/modules/storage/src/TestStorageClient.h
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.16 $
+ Version : $Revision: 1.17 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.h,v $
------------------------------------------------------------------------------*/
@@ -90,7 +90,7 @@ using namespace LiveSupport::Core;
*
*
* @author $Author: fgerlits $
- * @version $Revision: 1.16 $
+ * @version $Revision: 1.17 $
*/
class TestStorageClient :
virtual public Configurable,
@@ -179,7 +179,7 @@ class TestStorageClient :
throw ();
/**
- * Return a playlist with the specified id.
+ * Return a playlist with the specified id, to be displayed.
*
* @param sessionId the session ID from the authentication client
* @param id the id of the playlist to return.
@@ -192,6 +192,33 @@ class TestStorageClient :
Ptr::Ref id) const
throw (std::invalid_argument);
+ /**
+ * Return a playlist with the specified id, to be edited.
+ *
+ * @param sessionId the session ID from the authentication client
+ * @param id the id of the playlist to return.
+ * @return the requested playlist.
+ * @exception std::invalid_argument if no playlist with the specified
+ * id exists.
+ */
+ virtual Ptr::Ref
+ editPlaylist(Ptr::Ref sessionId,
+ Ptr::Ref id) const
+ throw (std::invalid_argument);
+
+ /**
+ * 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()
+ */
+ virtual void
+ savePlaylist(Ptr::Ref sessionId,
+ Ptr::Ref playlist) const
+ throw (std::logic_error);
+
/**
* Acquire the resources for the playlist.
*
diff --git a/livesupport/modules/storage/src/WebStorageClient.cxx b/livesupport/modules/storage/src/WebStorageClient.cxx
index aabd07118..0e2dcf2c2 100644
--- a/livesupport/modules/storage/src/WebStorageClient.cxx
+++ b/livesupport/modules/storage/src/WebStorageClient.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.3 $
+ Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $
------------------------------------------------------------------------------*/
@@ -288,7 +288,7 @@ WebStorageClient :: existsPlaylist(Ptr::Ref sessionId,
/*------------------------------------------------------------------------------
- * Return a playlist.
+ * Return a playlist to be displayed.
*----------------------------------------------------------------------------*/
Ptr::Ref
WebStorageClient :: getPlaylist(Ptr::Ref sessionId,
@@ -300,6 +300,30 @@ WebStorageClient :: getPlaylist(Ptr::Ref sessionId,
}
+/*------------------------------------------------------------------------------
+ * Return a playlist to be edited.
+ *----------------------------------------------------------------------------*/
+Ptr::Ref
+WebStorageClient :: editPlaylist(Ptr::Ref sessionId,
+ Ptr::Ref id) const
+ throw (std::logic_error)
+{
+ Ptr::Ref playlist(new Playlist);
+ return playlist;
+}
+
+
+/*------------------------------------------------------------------------------
+ * Save a playlist after editing.
+ *----------------------------------------------------------------------------*/
+void
+WebStorageClient :: savePlaylist(Ptr::Ref sessionId,
+ Ptr::Ref playlist) const
+ throw (std::logic_error)
+{
+}
+
+
/*------------------------------------------------------------------------------
* Acquire resources for a playlist.
*----------------------------------------------------------------------------*/
diff --git a/livesupport/modules/storage/src/WebStorageClient.h b/livesupport/modules/storage/src/WebStorageClient.h
index 402a324bc..a3fa7096e 100644
--- a/livesupport/modules/storage/src/WebStorageClient.h
+++ b/livesupport/modules/storage/src/WebStorageClient.h
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.4 $
+ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.h,v $
------------------------------------------------------------------------------*/
@@ -99,7 +99,7 @@ using namespace LiveSupport::Core;
*
*
* @author $Author: fgerlits $
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
class WebStorageClient :
virtual public Configurable,
@@ -201,7 +201,7 @@ class WebStorageClient :
throw (std::logic_error);
/**
- * Return a playlist with the specified id.
+ * Return a playlist with the specified id, to be displayed.
*
* @param sessionId the session ID from the authentication client
* @param id the id of the playlist to return.
@@ -215,6 +215,34 @@ class WebStorageClient :
Ptr::Ref id) const
throw (std::logic_error);
+ /**
+ * Return a playlist with the specified id, to be edited.
+ *
+ * @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.
+ */
+ virtual Ptr::Ref
+ editPlaylist(Ptr::Ref sessionId,
+ Ptr::Ref id) const
+ throw (std::logic_error);
+
+ /**
+ * 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()
+ */
+ virtual void
+ savePlaylist(Ptr::Ref sessionId,
+ Ptr::Ref playlist) const
+ throw (std::logic_error);
+
/**
* Acquire the resources for the playlist.
*
diff --git a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx
index 4f20e61e2..f86259092 100644
--- a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx
+++ b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.6 $
+ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/
@@ -112,7 +112,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
sessionId = XmlRpcTools::extractSessionId(parameters);
}
catch (std::invalid_argument &e) {
- XmlRpcTools::markError(errorId+22,
+ XmlRpcTools::markError(errorId+20,
"missing session ID argument",
returnValue);
return;
@@ -158,15 +158,10 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
playlist = storage->getPlaylist(sessionId, playlistId);
}
catch (std::invalid_argument &e) {
- XmlRpcTools::markError(errorId+5, "playlist not found",
- returnValue);
- return;
- }
-
- if (!playlist->canBeEdited()) {
- XmlRpcTools::markError(errorId+6,
- "playlist has not been opened for editing",
- returnValue);
+ std::string eMsg = "AddAudioClipToPlaylistlaylist: ";
+ eMsg += "storage.getPlaylist() error:\n";
+ eMsg += e.what();
+ XmlRpcTools::markError(errorId+5, eMsg, returnValue);
return;
}
@@ -175,18 +170,32 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
audioClip = storage->getAudioClip(sessionId, audioClipId);
}
catch (std::invalid_argument &e) {
- XmlRpcTools::markError(errorId+7, "audio clip does not exist",
- returnValue);
+ std::string eMsg = "AddAudioClipToPlaylistlaylist: ";
+ eMsg += "storage.getAudioClip() error:\n";
+ eMsg += e.what();
+ XmlRpcTools::markError(errorId+7, eMsg, returnValue);
return;
}
- try { // and finally, the beef
+ try {
playlist->addAudioClip(audioClip, relativeOffset);
}
catch(std::invalid_argument &e) {
- XmlRpcTools::markError(errorId+8,
- "two audio clips at the same relative offset",
- returnValue);
+ std::string eMsg = "AddAudioClipToPlaylistlaylist: ";
+ eMsg += "playlist.addAudioClip() error:\n";
+ eMsg += e.what();
+ XmlRpcTools::markError(errorId+8, eMsg, returnValue);
+ return;
+ }
+
+ try {
+ storage->savePlaylist(sessionId, playlist);
+ }
+ catch (std::invalid_argument &e) {
+ std::string eMsg = "AddAudioClipToPlaylistlaylist: ";
+ eMsg += "storage.savePlaylist() error:\n";
+ eMsg += e.what();
+ XmlRpcTools::markError(errorId+10, eMsg, returnValue);
return;
}
}
diff --git a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.h b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.h
index 505c6ed97..854d11adf 100644
--- a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.h
+++ b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.h
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.6 $
+ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.h,v $
------------------------------------------------------------------------------*/
@@ -94,15 +94,15 @@ using namespace LiveSupport::Core;
* 302 - missing playlist ID argument
* 303 - missing audio clip ID argument
* 304 - missing relative offset argument
- * 305 - playlist not found
- * 306 - playlist has not been opened for editing
- * 307 - audio clip does not exist
- * 308 - two audio clips at the same relative offset
- * 322 - missing session ID argument
+ * 305 - storage.getPlaylist() returned error message
+ * 307 - storage.getAudioClip() returned error message
+ * 308 - playlist.addAudioClip() returned error message
+ * 310 - storage.savePlaylist() returned error message
+ * 320 - missing session ID argument
*
*
* @author $Author: fgerlits $
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*/
class AddAudioClipToPlaylistMethod : public XmlRpc::XmlRpcServerMethod
{