changed return values in AudioClip and Playlist from Ptr<std::string>::Ref

and Ptr<Glib::ustring>::Ref to Ptr<const ... >::Ref
finished adding audio clip methods to WebStorageClient
modified helix install script to copy the splay executable to $LS/usr/bin
    (HELIX_LIBS needs to be set to "$LS/usr/lib/helix/" for this to work)
This commit is contained in:
fgerlits 2004-12-29 19:16:33 +00:00
parent 11f46d11ba
commit 562705b031
10 changed files with 388 additions and 101 deletions

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.13 $
Version : $Revision: 1.14 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h,v $
------------------------------------------------------------------------------*/
@ -124,7 +124,7 @@ using namespace boost::posix_time;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.13 $
* @version $Revision: 1.14 $
*/
class AudioClip : public Configurable,
public Playable
@ -138,32 +138,32 @@ class AudioClip : public Configurable,
/**
* The unique id of the audio clip.
*/
Ptr<UniqueId>::Ref id;
Ptr<UniqueId>::Ref id;
/**
* The title of the audio clip.
*/
Ptr<Glib::ustring>::Ref title;
Ptr<const Glib::ustring>::Ref title;
/**
* The playling length of the audio clip.
*/
Ptr<time_duration>::Ref playlength;
Ptr<time_duration>::Ref playlength;
/**
* The location of the binary audio clip sound file.
*/
Ptr<const std::string>::Ref uri;
Ptr<const std::string>::Ref uri;
/**
* The identifying token returned by the storage server.
*/
Ptr<const std::string>::Ref token;
Ptr<const std::string>::Ref token;
/**
* This audio clip in XML format.
*/
Ptr<xmlpp::Document>::Ref xmlAudioClip;
Ptr<xmlpp::Document>::Ref xmlAudioClip;
public:
@ -196,9 +196,9 @@ class AudioClip : public Configurable,
* @param uri the location of the sound file corresponding to
* this audio clip object (optional)
*/
AudioClip(Ptr<UniqueId>::Ref id,
Ptr<time_duration>::Ref playlength,
Ptr<string>::Ref uri = Ptr<string>::Ref())
AudioClip(Ptr<UniqueId>::Ref id,
Ptr<time_duration>::Ref playlength,
Ptr<const std::string>::Ref uri = Ptr<string>::Ref())
throw ();
/**
@ -210,10 +210,10 @@ class AudioClip : public Configurable,
* @param uri the location of the sound file corresponding to
* this audio clip object (optional)
*/
AudioClip(Ptr<UniqueId>::Ref id,
Ptr<Glib::ustring>::Ref title,
Ptr<time_duration>::Ref playlength,
Ptr<string>::Ref uri = Ptr<string>::Ref())
AudioClip(Ptr<UniqueId>::Ref id,
Ptr<const Glib::ustring>::Ref title,
Ptr<time_duration>::Ref playlength,
Ptr<const std::string>::Ref uri = Ptr<string>::Ref())
throw ();
/**
@ -326,7 +326,7 @@ class AudioClip : public Configurable,
*
* @return the title.
*/
virtual Ptr<Glib::ustring>::Ref
virtual Ptr<const Glib::ustring>::Ref
getTitle(void) const throw ()
{
return title;
@ -338,7 +338,7 @@ class AudioClip : public Configurable,
* @param title a new title.
*/
virtual void
setTitle(Ptr<Glib::ustring>::Ref title)
setTitle(Ptr<const Glib::ustring>::Ref title)
throw ();
/**
@ -361,8 +361,8 @@ class AudioClip : public Configurable,
* @param ns the namespace of the metadata field (optional)
*/
virtual void
setMetadata(Ptr<Glib::ustring>::Ref value, const std::string &key,
const std::string &ns = "")
setMetadata(Ptr<const Glib::ustring>::Ref value,
const std::string &key, const std::string &ns = "")
throw ();
@ -371,6 +371,13 @@ class AudioClip : public Configurable,
* the metadata fields of the audio clip, and it's roughly the
* inverse of the configure() method.
*
* (NOTE: This returns a non-constant pointer to a member of the
* AudioClip object, so handle with care, and do not ever, ever
* modify the Document object returned. It cannot be made const
* because <code>xmlpp::Document::write_to_file()</code> and
* <code>xmlpp::Document::write_to_string()</code> are only defined on
* non-constant instances.)
*
* @return an xmlpp::Document containing the metadata.
*/
Ptr<xmlpp::Document>::Ref

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.3 $
Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playable.h,v $
------------------------------------------------------------------------------*/
@ -54,7 +54,6 @@
namespace LiveSupport {
namespace Core {
using namespace std;
using namespace boost::posix_time;
/* ================================================================ constants */
@ -70,7 +69,7 @@ using namespace boost::posix_time;
* It contains the methods which are common to these classes.
*
* @author $Author: fgerlits $
* @version $Revision: 1.3 $
* @version $Revision: 1.4 $
*/
class Playable
{
@ -100,7 +99,7 @@ class Playable
*
* @return the URI.
*/
virtual Ptr<const string>::Ref
virtual Ptr<const std::string>::Ref
getUri(void) const throw () = 0;
/**
@ -111,7 +110,7 @@ class Playable
* @param uri the new URI.
*/
virtual void
setUri(Ptr<const string>::Ref uri) throw () = 0;
setUri(Ptr<const std::string>::Ref uri) throw () = 0;
/**
@ -120,7 +119,7 @@ class Playable
*
* @return the token.
*/
virtual Ptr<const string>::Ref
virtual Ptr<const std::string>::Ref
getToken(void) const throw () = 0;
/**
@ -130,7 +129,8 @@ class Playable
* @param token a new token.
*/
virtual void
setToken(Ptr<const string>::Ref token) throw () = 0;
setToken(Ptr<const std::string>::Ref token)
throw () = 0;
/**
@ -138,7 +138,7 @@ class Playable
*
* @return the title.
*/
virtual Ptr<Glib::ustring>::Ref
virtual Ptr<const Glib::ustring>::Ref
getTitle(void) const throw () = 0;
/**
@ -147,7 +147,7 @@ class Playable
* @param title a new title.
*/
virtual void
setTitle(Ptr<Glib::ustring>::Ref title)
setTitle(Ptr<const Glib::ustring>::Ref title)
throw () = 0;
@ -171,8 +171,9 @@ class Playable
* @param ns the namespace of the metadata field (optional)
*/
virtual void
setMetadata(Ptr<Glib::ustring>::Ref value, const std::string &key,
const std::string &ns = "")
setMetadata(Ptr<const Glib::ustring>::Ref value,
const std::string &key,
const std::string &ns = "")
throw () = 0;

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.21 $
Version : $Revision: 1.22 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $
------------------------------------------------------------------------------*/
@ -93,7 +93,7 @@ using namespace boost::posix_time;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.21 $
* @version $Revision: 1.22 $
*/
class Playlist : public Configurable,
public Playable
@ -107,27 +107,27 @@ class Playlist : public Configurable,
/**
* The unique id of the playlist.
*/
Ptr<UniqueId>::Ref id;
Ptr<UniqueId>::Ref id;
/**
* The title of the playlist.
*/
Ptr<Glib::ustring>::Ref title;
Ptr<const Glib::ustring>::Ref title;
/**
* The playling length of the playlist.
*/
Ptr<time_duration>::Ref playlength;
Ptr<time_duration>::Ref playlength;
/**
* The uri of the SMIL file generated from this playlist (if any).
*/
Ptr<const std::string>::Ref uri;
Ptr<const std::string>::Ref uri;
/**
* The token given to this playlist by the storage server.
*/
Ptr<const std::string>::Ref token;
Ptr<const std::string>::Ref token;
/**
* Flag set if playlist is currently playing.
@ -171,7 +171,7 @@ class Playlist : public Configurable,
/**
* The type for storing the metadata.
*/
typedef std::map<const std::string, Ptr<Glib::ustring>::Ref>
typedef std::map<const std::string, Ptr<const Glib::ustring>::Ref>
metadataType;
/**
@ -200,9 +200,9 @@ class Playlist : public Configurable,
* @param uri the location of the SMIL file representing this
* playlist (optional)
*/
Playlist(Ptr<UniqueId>::Ref id,
Ptr<time_duration>::Ref playlength,
Ptr<std::string>::Ref uri = Ptr<std::string>::Ref())
Playlist(Ptr<UniqueId>::Ref id,
Ptr<time_duration>::Ref playlength,
Ptr<const std::string>::Ref uri = Ptr<std::string>::Ref())
throw ()
{
this->id = id;
@ -223,10 +223,10 @@ class Playlist : public Configurable,
* @param uri the location of the SMIL file representing this
* playlist (optional)
*/
Playlist(Ptr<UniqueId>::Ref id,
Ptr<Glib::ustring>::Ref title,
Ptr<time_duration>::Ref playlength,
Ptr<std::string>::Ref uri = Ptr<std::string>::Ref())
Playlist(Ptr<UniqueId>::Ref id,
Ptr<const Glib::ustring>::Ref title,
Ptr<time_duration>::Ref playlength,
Ptr<const std::string>::Ref uri = Ptr<std::string>::Ref())
throw ()
{
this->id = id;
@ -312,7 +312,7 @@ class Playlist : public Configurable,
* @param uri the new URI.
*/
virtual void
setUri(Ptr<const string>::Ref uri) throw ()
setUri(Ptr<const std::string>::Ref uri) throw ()
{
this->uri = uri;
}
@ -323,7 +323,7 @@ class Playlist : public Configurable,
*
* @return the token.
*/
virtual Ptr<const string>::Ref
virtual Ptr<const std::string>::Ref
getToken(void) const throw ()
{
return token;
@ -336,7 +336,8 @@ class Playlist : public Configurable,
* @param token a new token.
*/
virtual void
setToken(Ptr<const string>::Ref token) throw ()
setToken(Ptr<const std::string>::Ref token)
throw ()
{
this->token = token;
}
@ -541,7 +542,7 @@ class Playlist : public Configurable,
*
* @return the title.
*/
virtual Ptr<Glib::ustring>::Ref
virtual Ptr<const Glib::ustring>::Ref
getTitle(void) const throw ()
{
return title;
@ -553,7 +554,7 @@ class Playlist : public Configurable,
* @param title a new title.
*/
virtual void
setTitle(Ptr<Glib::ustring>::Ref title)
setTitle(Ptr<const Glib::ustring>::Ref title)
throw ()
{
this->title = title;
@ -580,8 +581,8 @@ class Playlist : public Configurable,
* @param ns the namespace of the metadata field (optional)
*/
virtual void
setMetadata(Ptr<Glib::ustring>::Ref value, const std::string &key,
const std::string &ns = "")
setMetadata(Ptr<const Glib::ustring>::Ref value,
const std::string &key, const std::string &ns = "")
throw ();

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.11 $
Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClip.cxx,v $
------------------------------------------------------------------------------*/
@ -115,9 +115,9 @@ static const std::string defaultPrefixUri ="http://www.streamonthefly.org/";
/*------------------------------------------------------------------------------
* Test constructor without title.
*----------------------------------------------------------------------------*/
AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
Ptr<time_duration>::Ref playlength,
Ptr<std::string>::Ref uri)
AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
Ptr<time_duration>::Ref playlength,
Ptr<const std::string>::Ref uri)
throw ()
{
this->id = id;
@ -125,7 +125,7 @@ AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
this->playlength = playlength;
this->uri = uri;
Ptr<Glib::ustring>::Ref playlengthString(new Glib::ustring(
Ptr<const Glib::ustring>::Ref playlengthString(new const Glib::ustring(
to_simple_string(*playlength) ));
setMetadata(playlengthString, extentElementName, extentElementPrefix);
}
@ -133,10 +133,10 @@ AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
/*------------------------------------------------------------------------------
* Test constructor with title.
*----------------------------------------------------------------------------*/
AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
Ptr<Glib::ustring>::Ref title,
Ptr<time_duration>::Ref playlength,
Ptr<std::string>::Ref uri)
AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
Ptr<const Glib::ustring>::Ref title,
Ptr<time_duration>::Ref playlength,
Ptr<const std::string>::Ref uri)
throw ()
{
this->id = id;
@ -144,7 +144,7 @@ AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
this->playlength = playlength;
this->uri = uri;
Ptr<Glib::ustring>::Ref playlengthString(new Glib::ustring(
Ptr<const Glib::ustring>::Ref playlengthString(new const Glib::ustring(
to_simple_string(*playlength) ));
setMetadata(playlengthString, extentElementName, extentElementPrefix);
@ -156,7 +156,7 @@ AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
* Set the value of the title field.
*----------------------------------------------------------------------------*/
void
AudioClip :: setTitle(Ptr<Glib::ustring>::Ref title)
AudioClip :: setTitle(Ptr<const Glib::ustring>::Ref title)
throw ()
{
this->title = title;
@ -243,7 +243,8 @@ AudioClip :: configure(const xmlpp::Element & element)
&& dataElement->has_child_text()) {
Glib::ustring value = dataElement->get_child_text()
->get_content();
Ptr<Glib::ustring>::Ref ptrToValue(new Glib::ustring(value));
Ptr<const Glib::ustring>::Ref ptrToValue(
new const Glib::ustring(value));
title = ptrToValue;
}
@ -267,7 +268,7 @@ AudioClip :: configure(const xmlpp::Element & element)
throw std::invalid_argument(eMsg);
}
Ptr<Glib::ustring>::Ref playlengthString(new Glib::ustring(
Ptr<const Glib::ustring>::Ref playlengthString(new const Glib::ustring(
to_simple_string(*playlength) ));
setMetadata(playlengthString, extentElementName, extentElementPrefix);
}
@ -317,8 +318,9 @@ AudioClip :: getMetadata(const string &key, const std::string &ns) const
* Set the value of a metadata field.
*----------------------------------------------------------------------------*/
void
AudioClip :: setMetadata(Ptr<Glib::ustring>::Ref value, const std::string &key,
const std::string &ns)
AudioClip :: setMetadata(Ptr<const Glib::ustring>::Ref value,
const std::string &key,
const std::string &ns)
throw ()
{
if (ns == extentElementPrefix && key == extentElementName) {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.4 $
Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClipTest.cxx,v $
------------------------------------------------------------------------------*/
@ -109,16 +109,16 @@ AudioClipTest :: firstTest(void)
CPPUNIT_ASSERT(duration->minutes() == 18);
CPPUNIT_ASSERT(duration->seconds() == 30);
Ptr<Glib::ustring>::Ref title = audioClip->getTitle();
Ptr<const Glib::ustring>::Ref title = audioClip->getTitle();
CPPUNIT_ASSERT(title);
CPPUNIT_ASSERT(*title == "File Title txt");
Ptr<Glib::ustring>::Ref subject = audioClip
Ptr<const Glib::ustring>::Ref subject = audioClip
->getMetadata("subject", "dc");
CPPUNIT_ASSERT(subject);
CPPUNIT_ASSERT(*subject == "Keywords: qwe, asd, zcx");
Ptr<Glib::ustring>::Ref alternativeTitle = audioClip
Ptr<const Glib::ustring>::Ref alternativeTitle = audioClip
->getMetadata("alternative", "dcterms");
CPPUNIT_ASSERT(alternativeTitle);
CPPUNIT_ASSERT(*alternativeTitle ==

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.17 $
Version : $Revision: 1.18 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
------------------------------------------------------------------------------*/
@ -376,7 +376,8 @@ Playlist :: getMetadata(const string &key, const string &ns) const
metadataType::const_iterator it = metadata.find(completeKey);
if (it != metadata.end()) {
return it->second;
Ptr<Glib::ustring>::Ref data(new Glib::ustring(*it->second));
return data;
}
else {
Ptr<Glib::ustring>::Ref nullPointer;
@ -389,8 +390,8 @@ Playlist :: getMetadata(const string &key, const string &ns) const
* Set the value of a metadata field.
*----------------------------------------------------------------------------*/
void
Playlist :: setMetadata(Ptr<Glib::ustring>::Ref value, const string &key,
const string &ns)
Playlist :: setMetadata(Ptr<const Glib::ustring>::Ref value,
const string &key, const string &ns)
throw ()
{
std::string completeKey = key + ns;

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.14 $
Version : $Revision: 1.15 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $
------------------------------------------------------------------------------*/
@ -283,6 +283,83 @@ static const std::string storeAudioClipUrlParamName = "url";
static const std::string storeAudioClipTokenParamName = "token";
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ storage server constants: acquireAudioClip */
/*------------------------------------------------------------------------------
* The name of the acquire audio clip method on the storage server
*----------------------------------------------------------------------------*/
static const std::string acquireAudioClipMethodName
= "locstor.accessRawAudioData";
/*------------------------------------------------------------------------------
* The name of the session ID parameter in the input structure
*----------------------------------------------------------------------------*/
static const std::string acquireAudioClipSessionIdParamName = "sessid";
/*------------------------------------------------------------------------------
* The name of the audio clip unique ID parameter in the input structure
*----------------------------------------------------------------------------*/
static const std::string acquireAudioClipAudioClipIdParamName = "gunid";
/*------------------------------------------------------------------------------
* The name of the result URL parameter returned by the method
*----------------------------------------------------------------------------*/
static const std::string acquireAudioClipUrlParamName = "url";
/*------------------------------------------------------------------------------
* The name of the token parameter returned by the method
*----------------------------------------------------------------------------*/
static const std::string acquireAudioClipTokenParamName = "token";
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ storage server constants: releaseAudioClip */
/*------------------------------------------------------------------------------
* The name of the release audio clip method on the storage server
*----------------------------------------------------------------------------*/
static const std::string releaseAudioClipMethodName
= "locstor.releaseRawAudioData";
/*------------------------------------------------------------------------------
* The name of the session ID parameter in the input structure
*----------------------------------------------------------------------------*/
static const std::string releaseAudioClipSessionIdParamName = "sessid";
/*------------------------------------------------------------------------------
* The name of the token parameter in the input structure
*----------------------------------------------------------------------------*/
static const std::string releaseAudioClipTokenParamName = "token";
/*------------------------------------------------------------------------------
* The name of the result parameter returned by the method
*----------------------------------------------------------------------------*/
static const std::string releaseAudioClipResultParamName = "status";
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ storage server constants: deleteAudioClip */
/*------------------------------------------------------------------------------
* The name of the delete audio clip method on the storage server
*----------------------------------------------------------------------------*/
static const std::string deleteAudioClipMethodName
= "locstor.deleteAudioClip";
/*------------------------------------------------------------------------------
* The name of the session ID parameter in the input structure
*----------------------------------------------------------------------------*/
static const std::string deleteAudioClipSessionIdParamName = "sessid";
/*------------------------------------------------------------------------------
* The name of the audio clip unique ID parameter in the input structure
*----------------------------------------------------------------------------*/
static const std::string deleteAudioClipAudioClipIdParamName = "gunid";
/*------------------------------------------------------------------------------
* The name of the result parameter returned by the method
*----------------------------------------------------------------------------*/
static const std::string deleteAudioClipResultParamName = "status";
/* =============================================== local function prototypes */
@ -651,7 +728,7 @@ WebStorageClient :: storeAudioClip(Ptr<SessionId>::Ref sessionId,
}
std::string metadata = audioClip->toXml()
->write_to_string("UTF-8");
->write_to_string("utf-8");
// temporary hack; we will expect an absolute file name from getUri()
// in the final version
@ -799,9 +876,61 @@ WebStorageClient :: acquireAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const
throw (StorageException)
{
Ptr<AudioClip>::Ref playlist(new AudioClip);
return playlist;
Ptr<AudioClip>::Ref audioClip = getAudioClip(sessionId, id);
XmlRpcValue parameters;
XmlRpcValue result;
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
storageServerPath.c_str(), false);
parameters.clear();
parameters[acquireAudioClipSessionIdParamName]
= sessionId->getId();
parameters[acquireAudioClipAudioClipIdParamName]
= std::string(*id);
result.clear();
if (!xmlRpcClient.execute(acquireAudioClipMethodName.c_str(),
parameters, result)) {
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += acquireAudioClipMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
<< acquireAudioClipMethodName
<< "' returned error message:\n"
<< result;
throw XmlRpcMethodFaultException(eMsg.str());
}
if (! result.hasMember(acquireAudioClipUrlParamName)
|| result[acquireAudioClipUrlParamName].getType()
!= XmlRpcValue::TypeString
|| ! result.hasMember(acquireAudioClipTokenParamName)
|| result[acquireAudioClipTokenParamName].getType()
!= XmlRpcValue::TypeString) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
<< acquireAudioClipMethodName
<< "' returned unexpected value:\n"
<< result;
throw XmlRpcMethodResponseException(eMsg.str());
}
Ptr<const std::string>::Ref uri(new const std::string(
result[acquireAudioClipUrlParamName] ));
Ptr<const std::string>::Ref token(new const std::string(
result[acquireAudioClipTokenParamName] ));
audioClip->setUri(uri);
audioClip->setToken(token);
return audioClip;
}
@ -813,7 +942,58 @@ WebStorageClient :: releaseAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<AudioClip>::Ref audioClip) const
throw (StorageException)
{
XmlRpcValue parameters;
XmlRpcValue result;
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
storageServerPath.c_str(), false);
parameters.clear();
parameters[releaseAudioClipSessionIdParamName]
= sessionId->getId();
parameters[releaseAudioClipTokenParamName]
= *audioClip->getToken();
result.clear();
if (!xmlRpcClient.execute(releaseAudioClipMethodName.c_str(),
parameters, result)) {
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += releaseAudioClipMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
<< releaseAudioClipMethodName
<< "' returned error message:\n"
<< result;
throw XmlRpcMethodFaultException(eMsg.str());
}
if (! result.hasMember(releaseAudioClipResultParamName)
|| result[releaseAudioClipResultParamName].getType()
!= XmlRpcValue::TypeBoolean) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
<< releaseAudioClipMethodName
<< "' returned unexpected value:\n"
<< result;
throw XmlRpcMethodResponseException(eMsg.str());
}
if (! bool(result[releaseAudioClipResultParamName])) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
<< releaseAudioClipMethodName
<< "' returned 'false'";
throw XmlRpcMethodResponseException(eMsg.str());
}
Ptr<const std::string>::Ref nullpointer;
audioClip->setToken(nullpointer);
audioClip->setUri(nullpointer);
}
@ -825,7 +1005,54 @@ WebStorageClient :: deleteAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id)
throw (StorageException)
{
XmlRpcValue parameters;
XmlRpcValue result;
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
storageServerPath.c_str(), false);
parameters.clear();
parameters[deleteAudioClipSessionIdParamName]
= sessionId->getId();
parameters[deleteAudioClipAudioClipIdParamName]
= std::string(*id);
result.clear();
if (!xmlRpcClient.execute(deleteAudioClipMethodName.c_str(),
parameters, result)) {
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += deleteAudioClipMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
<< deleteAudioClipMethodName
<< "' returned error message:\n"
<< result;
throw XmlRpcMethodFaultException(eMsg.str());
}
if (! result.hasMember(deleteAudioClipResultParamName)
|| result[deleteAudioClipResultParamName].getType()
!= XmlRpcValue::TypeBoolean) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
<< deleteAudioClipMethodName
<< "' returned unexpected value:\n"
<< result;
throw XmlRpcMethodResponseException(eMsg.str());
}
if (! bool(result[deleteAudioClipResultParamName])) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
<< deleteAudioClipMethodName
<< "' returned 'false'";
throw XmlRpcMethodResponseException(eMsg.str());
}
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.10 $
Version : $Revision: 1.11 $
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.10 $
* @version $Revision: 1.11 $
*/
class WebStorageClient :
virtual public Configurable,
@ -405,6 +405,10 @@ class WebStorageClient :
/**
* Return a list of all audio clips in the playlist store.
*
* Since this makes no sense whatsoever, this method currently returns
* an empty list. It will be replaced by a method which uses
* <code>locstor.searchMetadata</code>.
*
* @param sessionId the session ID from the authentication client
* @return a vector containing the playlists.
* @exception StorageException if there is a problem with the XML-RPC

View File

@ -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/WebStorageClientTest.cxx,v $
------------------------------------------------------------------------------*/
@ -186,7 +186,7 @@ WebStorageClientTest :: audioClipTest(void)
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(uniqueIdVector->size() > 0);
Ptr<UniqueId>::Ref id01 = uniqueIdVector->at(0);
Ptr<UniqueId>::Ref id01 = uniqueIdVector->at(1);
/* std::cout << "\nReset storage result:\n";
for (unsigned i=0; i<uniqueIdVector->size(); i++) {
@ -202,6 +202,8 @@ WebStorageClientTest :: audioClipTest(void)
}
CPPUNIT_ASSERT(sessionId);
// test existsAudioClip(), deleteAudioClip() and getAudioClip()
bool exists = false;;
try {
exists = wsc->existsAudioClip(sessionId, id01);
@ -219,6 +221,21 @@ WebStorageClientTest :: audioClipTest(void)
CPPUNIT_FAIL(e.what());
}
try {
wsc->deleteAudioClip(sessionId, id01);
}
catch (StorageException &e) {
CPPUNIT_FAIL(e.what());
}
try {
exists = wsc->existsAudioClip(sessionId, id01);
}
catch (StorageException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(!exists);
Ptr<UniqueId>::Ref id77(new UniqueId(10077));
try {
exists = wsc->existsAudioClip(sessionId, id77);
@ -228,10 +245,12 @@ WebStorageClientTest :: audioClipTest(void)
}
CPPUNIT_ASSERT(!exists);
Ptr<UniqueId>::Ref id02 = UniqueId::generateId();
// test storeAudioClip() and getAudioClip()
Ptr<UniqueId>::Ref idxx = UniqueId::generateId();
Ptr<time_duration>::Ref playlength(new time_duration(0,0,11,0));
Ptr<std::string>::Ref uri(new std::string("file:var/test10001.mp3"));
audioClip.reset(new AudioClip(id02, playlength, uri));
audioClip.reset(new AudioClip(idxx, playlength, uri));
try {
wsc->storeAudioClip(sessionId, audioClip);
@ -241,7 +260,7 @@ WebStorageClientTest :: audioClipTest(void)
}
try {
CPPUNIT_ASSERT( wsc->existsAudioClip(sessionId, id02));
CPPUNIT_ASSERT( wsc->existsAudioClip(sessionId, idxx));
}
catch (StorageException &e) {
CPPUNIT_FAIL(e.what());
@ -249,32 +268,53 @@ WebStorageClientTest :: audioClipTest(void)
Ptr<AudioClip>::Ref newAudioClip;
try {
newAudioClip = wsc->getAudioClip(sessionId, id02);
newAudioClip = wsc->getAudioClip(sessionId, idxx);
}
catch (StorageException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(std::string(*newAudioClip->getId()) == std::string(*id02));
CPPUNIT_ASSERT(std::string(*newAudioClip->getId()) == std::string(*idxx));
CPPUNIT_ASSERT(newAudioClip->getPlaylength()->total_seconds()
== audioClip->getPlaylength()->total_seconds());
// test acquireAudioClip() and releaseAudioClip()
try {
newAudioClip = wsc->acquireAudioClip(sessionId, idxx);
}
catch (StorageException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(newAudioClip->getUri());
// std::cerr << *newAudioClip->getUri() << std::endl;
// sleep(30);
try {
wsc->releaseAudioClip(sessionId, newAudioClip);
}
catch (StorageException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(!newAudioClip->getUri());
// test getAllAudioClips() [pointless]
Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref audioClipVector;
try {
audioClipVector = wsc->getAllAudioClips(sessionId);
}
catch (StorageException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(audioClipVector->size() == 0);
try{
authentication->logout(sessionId);
}
catch (AuthenticationException &e) {
CPPUNIT_FAIL(e.what());
}
/*
Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref audioClipVector =
wsc->getAllAudioClips();
CPPUNIT_ASSERT(audioClipVector->size() == 2);
audioClip = (*audioClipVector)[0];
CPPUNIT_ASSERT((int) (audioClip->getId()->getId()) == 10001);
wsc->deleteAudioClip(id2);
CPPUNIT_ASSERT(!wsc->existsAudioClip(id2));
*/
}

View File

@ -21,8 +21,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Author : $Author: maroy $
# Version : $Revision: 1.2 $
# Author : $Author: fgerlits $
# Version : $Revision: 1.3 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/tools/helix/hxclient_1_3_0_neptunex-2004-12-15/bin/Attic/install.sh,v $
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
@ -78,6 +78,10 @@ mkdir -p $helix_lib_dir
cp ./release/*.a $helix_lib_dir
cp ./release/*.so $helix_lib_dir
usr_bin_dir=$installdir/bin
mkdir -p $usr_bin_dir
cp ./release/splay $usr_bin_dir
# clean up
cd $basedir
rm -rf tmp