added login, logout and resetStorage XML-RPC methods to scheduler daemon;

fixed the existing 'Rpc...Test's, and added some more
This commit is contained in:
fgerlits 2005-01-31 19:51:25 +00:00
parent d78879f893
commit 2d4c16a1d3
41 changed files with 1600 additions and 1524 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.19 $
Version : $Revision: 1.20 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h,v $
------------------------------------------------------------------------------*/
@ -87,7 +87,7 @@ using namespace boost::posix_time;
* xmlns:xbmf="http://www.streamonthefly.org/xbmf"
* xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
* <dc:title >File Title txt</dc:title>
* <dcterms:extent >123</dcterms:extent>
* <dcterms:extent >00:02:30.000000</dcterms:extent>
* ...
* </metadata>
* </audioClip>
@ -124,7 +124,7 @@ using namespace boost::posix_time;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.19 $
* @version $Revision: 1.20 $
*/
class AudioClip : public Configurable,
public Playable

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.2 $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Attic/TagConversion.h,v $
------------------------------------------------------------------------------*/
@ -65,7 +65,7 @@ using namespace LiveSupport::Core;
*
* For a description of these metadata tag standards, see
* http://www.id3.org/id3v2.4.0-frames.txt
* and http://dublincore.org/documents/dces/.
* and http://dublincore.org/documents/dcmi-terms/.
*
* This object has to be configured with an XML configuration element
* called tagConversionTable. This may look like the following:
@ -79,12 +79,17 @@ using namespace LiveSupport::Core;
* &lt;tag&gt;
* &lt;id3&gt;Artist&lt;/id3&gt;
* &lt;id3&gt;TPE1&lt;/id3&gt;
* &lt;dc&gt;dcterms:extent&lt;/dc&gt;
* &lt;dc&gt;dc:creator&lt;/dc&gt;
* &lt;/tag&gt;
* ...
* &lt;/tagConversionTable&gt;
* </code></pre>
*
*
* The id3 tag names in the table should be one of the id3v1 tag names
* Artist, Title, Album, Comment, Genre, Year, Track, or one of the
* four-letter id3v2 tag abbreviations, e.g., TLEN (length) or
* TOPE (original performer) etc.
*
* Note that more than one id3 tag name can map to the same dc tag name.
*
* The DTD for the above element is:
@ -92,12 +97,12 @@ using namespace LiveSupport::Core;
* <pre><code>
* &lt;!ELEMENT tagConversionTable (tag*) &gt;
* &lt;!ATTLIST tag (id3+, dc) &gt;
* &lt;!ATTLIST id3 (#CDATA) &gt;
* &lt;!ATTLIST dc (#CDATA) &gt;
* &lt;!ATTLIST id3 (#PCDATA) &gt;
* &lt;!ATTLIST dc (#PCDATA) &gt;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.2 $
* @version $Revision: 1.3 $
*/
class TagConversion
{

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/modules/core/include/LiveSupport/Core/XmlRpcTools.h,v $
------------------------------------------------------------------------------*/
@ -73,8 +73,8 @@ using namespace LiveSupport::Core;
* and XmlRpcValues. Used by almost all XmlRpcServerMethod subclasses
* in the Scheduler.
*
* @author $Author: maroy $
* @version $Revision: 1.2 $
* @author $Author: fgerlits $
* @version $Revision: 1.3 $
*/
class XmlRpcTools
{
@ -455,6 +455,30 @@ class XmlRpcTools
extractSessionId(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument);
/**
* Extract the login name from the XML-RPC parameters.
*
* @param xmlRpcValue the XML-RPC parameter to extract from.
* @return a std::string that was found in the XML-RPC parameter.
* @exception std::invalid_argument if there was no login
* member in xmlRpcValue
*/
static Ptr<std::string>::Ref
extractLoginName(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument);
/**
* Extract the password from the XML-RPC parameters.
*
* @param xmlRpcValue the XML-RPC parameter to extract from.
* @return a std::string that was found in the XML-RPC parameter.
* @exception std::invalid_argument if there was no sessionId
* member in xmlRpcValue
*/
static Ptr<std::string>::Ref
extractPassword(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument);
};
/* ================================================= external data structures */

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/modules/core/src/XmlRpcTools.cxx,v $
------------------------------------------------------------------------------*/
@ -119,6 +119,16 @@ static const std::string fadeOutName = "fadeOut";
*----------------------------------------------------------------------------*/
static const std::string sessionIdName = "sessionId";
/*------------------------------------------------------------------------------
* The name of the login name member in the XML-RPC parameter structure
*----------------------------------------------------------------------------*/
static const std::string loginName = "login";
/*------------------------------------------------------------------------------
* The name of the password member in the XML-RPC parameter structure
*----------------------------------------------------------------------------*/
static const std::string passwordName = "password";
/* ================================================ local constants & macros */
@ -663,9 +673,8 @@ XmlRpcTools :: playLogEntryToXmlRpcValue(
*----------------------------------------------------------------------------*/
void
XmlRpcTools :: playLogVectorToXmlRpcValue(
Ptr<const std::vector<Ptr<PlayLogEntry>::Ref> >::Ref
playLogVector,
XmlRpc::XmlRpcValue & returnValue)
Ptr<const std::vector<Ptr<PlayLogEntry>::Ref> >::Ref playLogVector,
XmlRpc::XmlRpcValue & returnValue)
throw ()
{
returnValue.setSize(playLogVector->size());
@ -704,3 +713,43 @@ XmlRpcTools :: extractSessionId(
return id;
}
/*------------------------------------------------------------------------------
* Extract the login name from an XML-RPC function call parameter
*----------------------------------------------------------------------------*/
Ptr<std::string>::Ref
XmlRpcTools :: extractLoginName(
XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument)
{
if (!xmlRpcValue.hasMember(loginName)
|| xmlRpcValue[loginName].getType()
!= XmlRpc::XmlRpcValue::TypeString) {
throw std::invalid_argument("missing or bad login name argument");
}
Ptr<std::string>::Ref loginName(new std::string(
xmlRpcValue[loginName] ));
return loginName;
}
/*------------------------------------------------------------------------------
* Extract the password from an XML-RPC function call parameter
*----------------------------------------------------------------------------*/
Ptr<std::string>::Ref
XmlRpcTools :: extractPassword(
XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument)
{
if (!xmlRpcValue.hasMember(passwordName)
|| xmlRpcValue[passwordName].getType()
!= XmlRpc::XmlRpcValue::TypeString) {
throw std::invalid_argument("missing or bad password argument");
}
Ptr<std::string>::Ref password(new std::string(
xmlRpcValue[passwordName] ));
return password;
}