changed #includes to refer to the XmlRpcTools in Core

removed XmlRpcTools and PlayLogEntry from Scheduler
This commit is contained in:
fgerlits 2005-01-07 19:30:29 +00:00
parent cf1054852c
commit 7dfcde7c3b
34 changed files with 61 additions and 1457 deletions

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/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -46,7 +46,7 @@
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "ScheduleInterface.h"
#include "ScheduleFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "AddAudioClipToPlaylistMethod.h"

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/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/
@ -47,7 +47,7 @@
#include "LiveSupport/Db/ConnectionManagerFactory.h"
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "LiveSupport/Authentication/AuthenticationClientFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "OpenPlaylistForEditingMethod.h"
#include "AddAudioClipToPlaylistMethod.h"

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.8 $
Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -46,7 +46,7 @@
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "ScheduleInterface.h"
#include "ScheduleFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "CreatePlaylistMethod.h"

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.8 $
Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/DeletePlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -39,7 +39,7 @@
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "ScheduleInterface.h"
#include "ScheduleFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "DeletePlaylistMethod.h"

View File

@ -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/DisplayAudioClipMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -46,7 +46,7 @@
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "ScheduleInterface.h"
#include "ScheduleFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "DisplayAudioClipMethod.h"

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipsMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -38,7 +38,7 @@
#include "LiveSupport/Storage/StorageClientInterface.h"
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "DisplayAudioClipsMethod.h"

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.7 $
Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -46,7 +46,7 @@
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "ScheduleInterface.h"
#include "ScheduleFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "DisplayPlaylistMethod.h"

View File

@ -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/DisplayPlaylistsMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -38,7 +38,7 @@
#include "LiveSupport/Storage/StorageClientInterface.h"
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "DisplayPlaylistsMethod.h"

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayScheduleMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -44,7 +44,7 @@
#include "ScheduleInterface.h"
#include "ScheduleFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "DisplayScheduleMethod.h"

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/products/scheduler/src/GeneratePlayReportMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -44,7 +44,7 @@
#include "PlayLogInterface.h"
#include "PlayLogFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "GeneratePlayReportMethod.h"

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/products/scheduler/src/GeneratePlayReportMethod.h,v $
------------------------------------------------------------------------------*/
@ -49,7 +49,7 @@
#include <XmlRpcException.h>
#include "LiveSupport/Core/Ptr.h"
#include "PlayLogEntry.h"
#include "LiveSupport/Core/PlayLogEntry.h"
namespace LiveSupport {
@ -104,7 +104,7 @@ using namespace LiveSupport::Core;
* </ul>
*
* @author $Author: fgerlits $
* @version $Revision: 1.4 $
* @version $Revision: 1.5 $
*/
class GeneratePlayReportMethod : public XmlRpc::XmlRpcServerMethod
{

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/products/scheduler/src/GetSchedulerTimeMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -46,7 +46,7 @@
#include "LiveSupport/Storage/StorageClientInterface.h"
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "LiveSupport/Core/TimeConversion.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "GetSchedulerTimeMethod.h"

View File

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $
Version : $Revision: 1.3 $
Author : $Author: fgerlits $
Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/GetVersionMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -42,7 +42,7 @@
#include <string>
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "GetVersionMethod.h"

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.12 $
Version : $Revision: 1.13 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -46,7 +46,7 @@
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "ScheduleInterface.h"
#include "ScheduleFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "OpenPlaylistForEditingMethod.h"

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/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx,v $
------------------------------------------------------------------------------*/
@ -47,7 +47,7 @@
#include "LiveSupport/Db/ConnectionManagerFactory.h"
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "LiveSupport/Authentication/AuthenticationClientFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "OpenPlaylistForEditingMethod.h"
#include "OpenPlaylistForEditingMethodTest.h"

View File

@ -1,170 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/PlayLogEntry.h,v $
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Scheduler_PlayLogEntry_h
#define LiveSupport_Scheduler_PlayLogEntry_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <stdexcept>
#include <string>
#include <libxml++/libxml++.h>
#include <boost/date_time/posix_time/posix_time.hpp>
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/UniqueId.h"
namespace LiveSupport {
namespace Scheduler {
using namespace boost::posix_time;
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A class representing a play log entry.
* PlayLogEntries contain information about the audio clips played.
*
* @author $Author: fgerlits $
* @version $Revision: 1.3 $
*/
class PlayLogEntry
{
private:
/**
* The unique id of the play log entry.
*/
Ptr<UniqueId>::Ref id;
/**
* The id of the audio clip referenced by this play log entry.
*/
Ptr<UniqueId>::Ref audioClipId;
/**
* The time this audio clip was played.
*/
Ptr<ptime>::Ref timestamp;
public:
/**
* Default constructor.
*/
PlayLogEntry(void) throw ()
{
}
/**
* Create a play log entry by specifying all details.
*
* @param id the ID of the play log entry.
* @param audioClipId the ID of the audio clip logged
* @param timestamp the time this audio clip was played.
*/
PlayLogEntry(Ptr<UniqueId>::Ref id,
Ptr<UniqueId>::Ref audioClipId,
Ptr<ptime>::Ref timestamp) throw()
{
this->id = id;
this->audioClipId = audioClipId;
this->timestamp = timestamp;
}
/**
* A virtual destructor, as this class has virtual functions.
*/
virtual
~PlayLogEntry(void) throw ()
{
}
/**
* Return the ID of the play log entry.
*
* @return the unique ID of the play log entry.
*/
Ptr<const UniqueId>::Ref
getId(void) const throw ()
{
return id;
}
/**
* Return the ID of the audio clip referenced by this entry.
*
* @return the unique ID of the audio clip.
*/
Ptr<const UniqueId>::Ref
getAudioClipId(void) const throw ()
{
return audioClipId;
}
/**
* Return the time this audio clip was played.
*
* @return the the time the audio clip was played.
*/
Ptr<const ptime>::Ref
getTimestamp(void) const throw ()
{
return timestamp;
}
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Scheduler
} // namespace LiveSupport
#endif // LiveSupport_Scheduler_PlayLogEntry_h

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/products/scheduler/src/PlayLogInterface.h,v $
------------------------------------------------------------------------------*/
@ -46,7 +46,7 @@
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/Installable.h"
#include "LiveSupport/Core/Playlist.h"
#include "PlayLogEntry.h"
#include "LiveSupport/Core/PlayLogEntry.h"
namespace LiveSupport {
@ -70,7 +70,7 @@ using namespace LiveSupport::Core;
* The generic interface for the component scheduling events.
*
* @author $Author: fgerlits $
* @version $Revision: 1.3 $
* @version $Revision: 1.4 $
*/
class PlayLogInterface : virtual public Installable
{

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.8 $
Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -46,7 +46,7 @@
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "ScheduleInterface.h"
#include "ScheduleFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "RemoveAudioClipFromPlaylistMethod.h"

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.8 $
Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/
@ -47,7 +47,7 @@
#include "LiveSupport/Db/ConnectionManagerFactory.h"
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "LiveSupport/Authentication/AuthenticationClientFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "OpenPlaylistForEditingMethod.h"
#include "AddAudioClipToPlaylistMethod.h"

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveFromScheduleMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -44,7 +44,7 @@
#include "ScheduleInterface.h"
#include "ScheduleFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "RemoveFromScheduleMethod.h"

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RescheduleMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -44,7 +44,7 @@
#include "ScheduleInterface.h"
#include "ScheduleFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "RescheduleMethod.h"

View File

@ -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/RevertEditedPlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -44,7 +44,7 @@
#include "LiveSupport/Storage/StorageClientInterface.h"
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "RevertEditedPlaylistMethod.h"

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx,v $
------------------------------------------------------------------------------*/
@ -48,7 +48,7 @@
#include "SchedulerDaemon.h"
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "LiveSupport/Authentication/AuthenticationClientFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "OpenPlaylistForEditingMethod.h"
#include "AddAudioClipToPlaylistMethod.h"

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/products/scheduler/src/RpcUploadPlaylistTest.cxx,v $
------------------------------------------------------------------------------*/
@ -44,7 +44,7 @@
#include <XmlRpcClient.h>
#include <XmlRpcValue.h>
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "LiveSupport/Core/UniqueId.h"
#include "SchedulerDaemon.h"
#include "LiveSupport/Authentication/AuthenticationClientFactory.h"

View File

@ -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/SavePlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -44,7 +44,7 @@
#include "LiveSupport/Storage/StorageClientInterface.h"
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "SavePlaylistMethod.h"

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -48,7 +48,7 @@
#include "LiveSupport/Core/FadeInfo.h"
#include "ScheduleInterface.h"
#include "ScheduleFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "UpdateFadeInFadeOutMethod.h"

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.cxx,v $
------------------------------------------------------------------------------*/
@ -47,7 +47,7 @@
#include "LiveSupport/Db/ConnectionManagerFactory.h"
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "LiveSupport/Authentication/AuthenticationClientFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "OpenPlaylistForEditingMethod.h"
#include "AddAudioClipToPlaylistMethod.h"

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/products/scheduler/src/UploadPlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -46,7 +46,7 @@
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "ScheduleInterface.h"
#include "ScheduleFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "UploadPlaylistMethod.h"

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.7 $
Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/
@ -46,7 +46,7 @@
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "ScheduleInterface.h"
#include "ScheduleFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "ValidatePlaylistMethod.h"

View File

@ -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/ValidatePlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/
@ -47,7 +47,7 @@
#include "LiveSupport/Db/ConnectionManagerFactory.h"
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "LiveSupport/Authentication/AuthenticationClientFactory.h"
#include "XmlRpcTools.h"
#include "LiveSupport/Core/XmlRpcTools.h"
#include "OpenPlaylistForEditingMethod.h"
#include "RemoveAudioClipFromPlaylistMethod.h"

View File

@ -1,531 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/XmlRpcTools.cxx,v $
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#ifdef HAVE_TIME_H
#include <time.h>
#else
#error need time.h
#endif
#include <string>
#include "LiveSupport/Core/TimeConversion.h"
#include "XmlRpcTools.h"
using namespace boost;
using namespace boost::posix_time;
using namespace LiveSupport;
using namespace LiveSupport::Core;
using namespace LiveSupport::Scheduler;
/* =================================================== local data structures */
/*------------------------------------------------------------------------------
* The name of the playlist ID member in the XML-RPC parameter structure
*----------------------------------------------------------------------------*/
static const std::string playlistIdName = "playlistId";
/*------------------------------------------------------------------------------
* The name of the audio clip ID member in the XML-RPC parameter structure
*----------------------------------------------------------------------------*/
static const std::string audioClipIdName = "audioClipId";
/*------------------------------------------------------------------------------
* The name of the relative offset member in the XML-RPC parameter structure
*----------------------------------------------------------------------------*/
static const std::string relativeOffsetName = "relativeOffset";
/*------------------------------------------------------------------------------
* The name of the from member in the XML-RPC parameter structure.
*----------------------------------------------------------------------------*/
static const std::string fromTimeName = "from";
/*------------------------------------------------------------------------------
* The name of the to member in the XML-RPC parameter structure.
*----------------------------------------------------------------------------*/
static const std::string toTimeName = "to";
/*------------------------------------------------------------------------------
* The name of the playlist id member in the XML-RPC parameter structure.
*----------------------------------------------------------------------------*/
static const std::string scheduleEntryIdName = "scheduleEntryId";
/*------------------------------------------------------------------------------
* The name of the playtime member in the XML-RPC parameter structure.
*----------------------------------------------------------------------------*/
static const std::string playtimeName = "playtime";
/*------------------------------------------------------------------------------
* The name of the fade in member in the XML-RPC parameter structure.
*----------------------------------------------------------------------------*/
static const std::string fadeInName = "fadeIn";
/*------------------------------------------------------------------------------
* The name of the fade out member in the XML-RPC parameter structure.
*----------------------------------------------------------------------------*/
static const std::string fadeOutName = "fadeOut";
/*------------------------------------------------------------------------------
* The name of the session ID member in the XML-RPC parameter structure
*----------------------------------------------------------------------------*/
static const std::string sessionIdName = "sessionId";
/* ================================================ local constants & macros */
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Extract the schedule entry ID from an XML-RPC function call parameter
*----------------------------------------------------------------------------*/
Ptr<UniqueId>::Ref
XmlRpcTools :: extractScheduleEntryId(
XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument)
{
if (!xmlRpcValue.hasMember(scheduleEntryIdName)
|| xmlRpcValue[scheduleEntryIdName].getType()
!= XmlRpc::XmlRpcValue::TypeString) {
throw std::invalid_argument("missing or bad schedule entry ID "
"argument");
}
Ptr<UniqueId>::Ref id(new UniqueId(std::string(
xmlRpcValue[scheduleEntryIdName] )));
return id;
}
/*------------------------------------------------------------------------------
* Extract the playlist ID from an XML-RPC function call parameter
*----------------------------------------------------------------------------*/
Ptr<UniqueId>::Ref
XmlRpcTools :: extractPlaylistId(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument)
{
if (!xmlRpcValue.hasMember(playlistIdName)
|| xmlRpcValue[playlistIdName].getType()
!= XmlRpc::XmlRpcValue::TypeString) {
throw std::invalid_argument("missing or bad playlist ID argument");
}
Ptr<UniqueId>::Ref id(new UniqueId(std::string(
xmlRpcValue[playlistIdName] )));
return id;
}
/*------------------------------------------------------------------------------
* Extract the audio clip ID from an XML-RPC function call parameter
*----------------------------------------------------------------------------*/
Ptr<UniqueId>::Ref
XmlRpcTools :: extractAudioClipId(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument)
{
if (!xmlRpcValue.hasMember(audioClipIdName)
|| xmlRpcValue[audioClipIdName].getType()
!= XmlRpc::XmlRpcValue::TypeString) {
throw std::invalid_argument("missing or bad audio clip ID argument");
}
Ptr<UniqueId>::Ref id(new UniqueId(std::string(
xmlRpcValue[audioClipIdName] )));
return id;
}
/*------------------------------------------------------------------------------
* Extract the relative offset from an XML-RPC function call parameter
*----------------------------------------------------------------------------*/
Ptr<time_duration>::Ref
XmlRpcTools :: extractRelativeOffset(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument)
{
if (!xmlRpcValue.hasMember(relativeOffsetName)
|| xmlRpcValue[relativeOffsetName].getType()
!= XmlRpc::XmlRpcValue::TypeInt) {
throw std::invalid_argument("missing relative offset argument");
}
Ptr<time_duration>::Ref relativeOffset(new time_duration(0,0,
int(xmlRpcValue[relativeOffsetName]), 0));
return relativeOffset;
}
/*------------------------------------------------------------------------------
* Convert a Playlist to an XmlRpcValue
*----------------------------------------------------------------------------*/
void
XmlRpcTools :: playlistToXmlRpcValue(
Ptr<const Playlist>::Ref playlist,
XmlRpc::XmlRpcValue & xmlRpcValue)
throw ()
{
xmlRpcValue["id"] = std::string(*playlist->getId());
xmlRpcValue["playlength"] = int(playlist->getPlaylength()->total_seconds());
}
/*------------------------------------------------------------------------------
* Convert a vector of Playlists into an XML-RPC value.
* This function returns an XML-RPC array of XML-RPC structures.
*----------------------------------------------------------------------------*/
void
XmlRpcTools :: playlistVectorToXmlRpcValue(
const Ptr<std::vector<Ptr<Playlist>::Ref> >::Ref playlistVector,
XmlRpc::XmlRpcValue & returnValue)
throw ()
{
returnValue.setSize(playlistVector->size());
// a call to setSize() makes sure it's an XML-RPC
// array
std::vector<Ptr<Playlist>::Ref>::const_iterator it =
playlistVector->begin();
int arraySize = 0;
while (it != playlistVector->end()) {
Ptr<Playlist>::Ref playlist = *it;
XmlRpc::XmlRpcValue returnStruct;
playlistToXmlRpcValue(playlist, returnStruct);
returnValue[arraySize++] = returnStruct;
++it;
}
}
/*------------------------------------------------------------------------------
* Convert an AudioClip to an XmlRpcValue
*----------------------------------------------------------------------------*/
void
XmlRpcTools :: audioClipToXmlRpcValue(
Ptr<const AudioClip>::Ref audioClip,
XmlRpc::XmlRpcValue & xmlRpcValue)
throw ()
{
xmlRpcValue["id"] = std::string(*audioClip->getId());
xmlRpcValue["playlength"] = int(audioClip->getPlaylength()
->total_seconds());
}
/*------------------------------------------------------------------------------
* Convert a vector of AudioClips into an XML-RPC value.
* This function returns an XML-RPC array of XML-RPC structures.
*----------------------------------------------------------------------------*/
void
XmlRpcTools :: audioClipVectorToXmlRpcValue(
const Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref audioClipVector,
XmlRpc::XmlRpcValue & returnValue)
throw ()
{
returnValue.setSize(audioClipVector->size());
// a call to setSize() makes sure it's an XML-RPC
// array
std::vector<Ptr<AudioClip>::Ref>::const_iterator it =
audioClipVector->begin();
int arraySize = 0;
while (it != audioClipVector->end()) {
Ptr<AudioClip>::Ref audioClip = *it;
XmlRpc::XmlRpcValue returnStruct;
audioClipToXmlRpcValue(audioClip, returnStruct);
returnValue[arraySize++] = returnStruct;
++it;
}
}
/*------------------------------------------------------------------------------
* Convert an error code, error message pair to an XML-RPC fault response
*----------------------------------------------------------------------------*/
void
XmlRpcTools :: markError(int errorCode, const std::string errorMessage,
XmlRpc::XmlRpcValue & xmlRpcValue)
throw (XmlRpc::XmlRpcException)
{
throw XmlRpc::XmlRpcException(errorMessage, errorCode);
}
/*------------------------------------------------------------------------------
* Convert the valid status of a playlist to an XmlRpcValue
*----------------------------------------------------------------------------*/
void
XmlRpcTools :: validStatusToXmlRpcValue(
bool validStatus,
XmlRpc::XmlRpcValue & xmlRpcValue)
throw ()
{
xmlRpcValue["valid"] = XmlRpc::XmlRpcValue(validStatus);
}
/*------------------------------------------------------------------------------
* Extract the from time from an XML-RPC function call parameter
*----------------------------------------------------------------------------*/
Ptr<ptime>::Ref
XmlRpcTools :: extractFromTime(
XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument)
{
if (!xmlRpcValue.hasMember(fromTimeName)
|| xmlRpcValue[fromTimeName].getType()
!= XmlRpc::XmlRpcValue::TypeDateTime) {
throw std::invalid_argument("missing or bad 'from' time in "
"parameter structure");
}
struct tm time = (struct tm) xmlRpcValue[fromTimeName];
return TimeConversion::tmToPtime(&time);
}
/*------------------------------------------------------------------------------
* Extract the to time from an XML-RPC function call parameter
*----------------------------------------------------------------------------*/
Ptr<ptime>::Ref
XmlRpcTools :: extractToTime(
XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument)
{
if (!xmlRpcValue.hasMember(toTimeName)
|| xmlRpcValue[toTimeName].getType()
!= XmlRpc::XmlRpcValue::TypeDateTime) {
throw std::invalid_argument("missing or bad 'to' time in "
"parameter structure");
}
struct tm time = (struct tm) xmlRpcValue[toTimeName];
return TimeConversion::tmToPtime(&time);
}
/*------------------------------------------------------------------------------
* Convert a boost::posix_time::ptime to an XmlRpcValue
*----------------------------------------------------------------------------*/
void
XmlRpcTools :: ptimeToXmlRpcValue(
Ptr<const ptime>::Ref ptimeParam,
XmlRpc::XmlRpcValue& xmlRpcValue)
throw ()
{
struct tm time;
Ptr<ptime>::Ref myPtime(new ptime(*ptimeParam)); // get rid of const
TimeConversion::ptimeToTm(myPtime, time);
xmlRpcValue = XmlRpc::XmlRpcValue(&time);
}
/*------------------------------------------------------------------------------
* Convert a vector of ScheduleEntries into an XML-RPC value.
* This function returns an XML-RPC array of XML-RPC structures.
*----------------------------------------------------------------------------*/
void
XmlRpcTools :: scheduleEntriesToXmlRpcValue(
Ptr<std::vector<Ptr<ScheduleEntry>::Ref> >::Ref scheduleEntries,
XmlRpc::XmlRpcValue & returnValue)
throw ()
{
returnValue.setSize(scheduleEntries->size());
// a call to setSize() makes sure it's an XML-RPC
// array
std::vector<Ptr<ScheduleEntry>::Ref>::iterator it
= scheduleEntries->begin();
int arraySize = 0;
while (it != scheduleEntries->end()) {
Ptr<ScheduleEntry>::Ref entry = *it;
XmlRpc::XmlRpcValue returnStruct;
returnStruct["id"] = std::string(*entry->getId());
returnStruct["playlistId"] = std::string(*entry->getPlaylistId());
XmlRpc::XmlRpcValue time;
ptimeToXmlRpcValue(entry->getStartTime(), time);
returnStruct["start"] = time;
ptimeToXmlRpcValue(entry->getEndTime(), time);
returnStruct["end"] = time;
returnValue[arraySize++] = returnStruct;
++it;
}
}
/*------------------------------------------------------------------------------
* Extract the playtime from an XML-RPC function call parameter
*----------------------------------------------------------------------------*/
Ptr<ptime>::Ref
XmlRpcTools :: extractPlayschedule(
XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument)
{
if (!xmlRpcValue.hasMember(playtimeName)
|| xmlRpcValue[playtimeName].getType()
!= XmlRpc::XmlRpcValue::TypeDateTime) {
throw std::invalid_argument("missing or bad playtime in "
"parameter structure");
}
struct tm time = (struct tm) xmlRpcValue[playtimeName];
return TimeConversion::tmToPtime(&time);
}
/*------------------------------------------------------------------------------
* Extract the fade in time from an XML-RPC function call parameter
*----------------------------------------------------------------------------*/
Ptr<time_duration>::Ref
XmlRpcTools :: extractFadeIn(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument)
{
if (!xmlRpcValue.hasMember(fadeInName)
|| xmlRpcValue[fadeInName].getType()
!= XmlRpc::XmlRpcValue::TypeInt) {
throw std::invalid_argument("missing or bad 'fade in' argument");
}
Ptr<time_duration>::Ref fadeIn(new time_duration(0,0,
int(xmlRpcValue[fadeInName]), 0));
return fadeIn;
}
/*------------------------------------------------------------------------------
* Extract the fade out time from an XML-RPC function call parameter
*----------------------------------------------------------------------------*/
Ptr<time_duration>::Ref
XmlRpcTools :: extractFadeOut(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument)
{
if (!xmlRpcValue.hasMember(fadeOutName)
|| xmlRpcValue[fadeOutName].getType()
!= XmlRpc::XmlRpcValue::TypeInt) {
throw std::invalid_argument("missing or bad 'fade out' argument");
}
Ptr<time_duration>::Ref fadeOut(new time_duration(0,0,
int(xmlRpcValue[fadeOutName]), 0));
return fadeOut;
}
/*------------------------------------------------------------------------------
* Convert a schedule entry ID (a UniqueId) to an XmlRpcValue
*----------------------------------------------------------------------------*/
void
XmlRpcTools :: scheduleEntryIdToXmlRpcValue(
Ptr<const UniqueId>::Ref scheduleEntryId,
XmlRpc::XmlRpcValue & returnValue)
throw ()
{
returnValue[scheduleEntryIdName] = std::string(*scheduleEntryId);
}
/*------------------------------------------------------------------------------
* Convert a PlayLogEntry to an XmlRpcValue
*----------------------------------------------------------------------------*/
void
XmlRpcTools :: playLogEntryToXmlRpcValue(
Ptr<const PlayLogEntry>::Ref playLogEntry,
XmlRpc::XmlRpcValue & returnValue)
throw ()
{
returnValue["audioClipId"] = std::string(*playLogEntry->getAudioClipId());
XmlRpc::XmlRpcValue timestamp;
ptimeToXmlRpcValue(playLogEntry->getTimestamp(), timestamp);
returnValue["timestamp"] = timestamp;
}
/*------------------------------------------------------------------------------
* Convert a vector of PlayLogEntries into an XML-RPC value.
* This function returns an XML-RPC array of XML-RPC structures.
*----------------------------------------------------------------------------*/
void
XmlRpcTools :: playLogVectorToXmlRpcValue(
Ptr<const std::vector<Ptr<PlayLogEntry>::Ref> >::Ref
playLogVector,
XmlRpc::XmlRpcValue & returnValue)
throw ()
{
returnValue.setSize(playLogVector->size());
// a call to setSize() makes sure it's an XML-RPC
// array
std::vector<Ptr<PlayLogEntry>::Ref>::const_iterator it =
playLogVector->begin();
int arraySize = 0;
while (it != playLogVector->end()) {
Ptr<PlayLogEntry>::Ref playLog = *it;
XmlRpc::XmlRpcValue returnStruct;
playLogEntryToXmlRpcValue(playLog, returnStruct);
returnValue[arraySize++] = returnStruct;
++it;
}
}
/*------------------------------------------------------------------------------
* Extract the session ID from an XML-RPC function call parameter
*----------------------------------------------------------------------------*/
Ptr<SessionId>::Ref
XmlRpcTools :: extractSessionId(
XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument)
{
if (!xmlRpcValue.hasMember(sessionIdName)
|| xmlRpcValue[sessionIdName].getType()
!= XmlRpc::XmlRpcValue::TypeString) {
throw std::invalid_argument("missing or bad session ID argument");
}
Ptr<SessionId>::Ref id(new SessionId(std::string(
xmlRpcValue[sessionIdName] )));
return id;
}

View File

@ -1,358 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $
Version : $Revision: 1.14 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/XmlRpcTools.h,v $
------------------------------------------------------------------------------*/
#ifndef XmlRpcTools_h
#define XmlRpcTools_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <stdexcept>
#include <string>
#include <vector>
#include <XmlRpcValue.h>
#include <XmlRpcException.h>
#include <boost/date_time/posix_time/posix_time.hpp>
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/SessionId.h"
#include "LiveSupport/Core/Playlist.h"
#include "LiveSupport/Core/ScheduleEntry.h"
#include "PlayLogEntry.h"
namespace LiveSupport {
namespace Scheduler {
using namespace LiveSupport;
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A toolbox for converting between inner representations of classes
* and XmlRpcValues. Used by almost all XmlRpcServerMethod subclasses
* in the Scheduler.
*
* @author $Author: maroy $
* @version $Revision: 1.14 $
*/
class XmlRpcTools
{
private:
/**
* Convert a boost::posix_time::ptime to an XmlRpcValue
*
* @param ptime the ptime to convert
* @param xmlRpcValue the output parameter holding the value of
* the conversion.
*/
static void
ptimeToXmlRpcValue(Ptr<const ptime>::Ref ptime,
XmlRpc::XmlRpcValue & xmlRpcValue)
throw ();
/**
* Convert a PlayLogEntry to an XmlRpcValue
*
* @param playLogEntry the PlayLogEntry to convert.
* @param xmlRpcValue the output parameter holding the result of
* the conversion.
*/
static void
playLogEntryToXmlRpcValue(Ptr<const PlayLogEntry>::Ref playLogEntry,
XmlRpc::XmlRpcValue & returnValue)
throw ();
public:
/**
* Extract the schedule entry id from the XML-RPC parameters.
*
* @param xmlRpcValue the XML-RPC parameter to extract from.
* @return a UniqueId that was found in the XML-RPC parameter.
* @exception std::invalid_argument if there was no UniqueId
* in xmlRpcValue
*/
static Ptr<UniqueId>::Ref
extractScheduleEntryId(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument);
/**
* Extract the playlist id from the XML-RPC parameters.
*
* @param xmlRpcValue the XML-RPC parameter to extract from.
* @return a UniqueId that was found in the XML-RPC parameter.
* @exception std::invalid_argument if there was no playlistId
* member in xmlRpcValue
*/
static Ptr<UniqueId>::Ref
extractPlaylistId(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument);
/**
* Extract the audio clip id from the XML-RPC parameters.
*
* @param xmlRpcValue the XML-RPC parameter to extract from.
* @return a UniqueId that was found in the XML-RPC parameter.
* @exception std::invalid_argument if there was no audioClipId
* member in xmlRpcValue
*/
static Ptr<UniqueId>::Ref
extractAudioClipId(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument);
/**
* Extract the relative offset from the XML-RPC parameters.
*
* @param xmlRpcValue the XML-RPC parameter to extract from.
* @return a time_duration that was found in the XML-RPC parameter.
* @exception std::invalid_argument if there was no relativeOffset
* member in xmlRpcValue
*/
static Ptr<time_duration>::Ref
extractRelativeOffset(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument);
/**
* Convert a Playlist to an XmlRpcValue
*
* @param playlist the Playlist to convert.
* @param xmlRpcValue the output parameter holding the result of
* the conversion.
*/
static void
playlistToXmlRpcValue(Ptr<const Playlist>::Ref playlist,
XmlRpc::XmlRpcValue & xmlRpcValue)
throw ();
/**
* Convert a vector of Playlists to an XML-RPC return value.
*
* @param playlistVector a list of Playlists.
* @param returnValue the output parameter holding an XML-RPC
* representation of the list of Playlists.
*/
static void
playlistVectorToXmlRpcValue(
const Ptr<std::vector<Ptr<Playlist>::Ref> >::Ref playlistVector,
XmlRpc::XmlRpcValue & returnValue)
throw ();
/**
* Convert an AudioClip to an XmlRpcValue
*
* @param audioClip the AudioClip to convert.
* @param xmlRpcValue the output parameter holding the result of
* the conversion.
*/
static void
audioClipToXmlRpcValue(Ptr<const AudioClip>::Ref audioClip,
XmlRpc::XmlRpcValue & xmlRpcValue)
throw ();
/**
* Convert a vector of AudioClips to an XML-RPC return value.
*
* @param audioClipVector a list of AudioClips.
* @param returnValue the output parameter holding an XML-RPC
* representation of the list of AudioClips.
*/
static void
audioClipVectorToXmlRpcValue(
const Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref audioClipVector,
XmlRpc::XmlRpcValue & returnValue)
throw ();
/**
* Convert an error code, message pair to an XML-RPC fault response.
* This is done by throwing an XmlRpc::XmlRpcException. The client
* receives a fault response, and the return value is set to a
* { faultCode, faultString } structure holding the error code and
* message.
*
* @param errorCode the numerical code of the error.
* @param errorMessage a short English description of the error.
* @param xmlRpcValue remains here from an earlier version
* TODO: remove this later.
*/
static void
markError(int errorCode, const std::string errorMessage,
XmlRpc::XmlRpcValue & xmlRpcValue)
throw (XmlRpc::XmlRpcException);
/**
* Convert the valid status of a playlist to an XmlRpcValue
*
* @param validStatus true if the playlist is valid, false otherwise.
* @param xmlRpcValue the output parameter holding the result of
* the conversion.
*/
static void
validStatusToXmlRpcValue(bool validStatus,
XmlRpc::XmlRpcValue & xmlRpcValue)
throw ();
/**
* Extract the from time parameter from the XML-RPC parameters.
*
* @param xmlRpcValue the XML-RPC parameter to extract from.
* @return the time value for the from parameter
* @exception std::invalid_argument if there was no from parameter
* in xmlRpcValue
*/
static Ptr<boost::posix_time::ptime>::Ref
extractFromTime(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument);
/**
* Extract the to parameter from the XML-RPC parameters.
*
* @param xmlRpcValue the XML-RPC parameter to extract from.
* @return the time value for the to parameter
* @exception std::invalid_argument if there was no to parameter
* in xmlRpcValue
*/
static Ptr<boost::posix_time::ptime>::Ref
extractToTime(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument);
/**
* Extract the playtime from the XML-RPC parameters.
*
* @param xmlRpcValue the XML-RPC parameter to extract from.
* @return the playing time, as stored in the XML-RPC parameter
* @exception std::invalid_argument if there was no playtime
* in xmlRpcValue
*/
static Ptr<boost::posix_time::ptime>::Ref
extractPlayschedule(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument);
/**
* Extract the fade in time from the XML-RPC parameters.
*
* @param xmlRpcValue the XML-RPC parameter to extract from.
* @return a time_duration that was found in the XML-RPC parameter.
* @exception std::invalid_argument if there was no fadeIn
* member in xmlRpcValue
*/
static Ptr<time_duration>::Ref
extractFadeIn(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument);
/**
* Extract the fade out time from the XML-RPC parameters.
*
* @param xmlRpcValue the XML-RPC parameter to extract from.
* @return a time_duration that was found in the XML-RPC parameter.
* @exception std::invalid_argument if there was no fadeOut
* member in xmlRpcValue
*/
static Ptr<time_duration>::Ref
extractFadeOut(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument);
/**
* Convert a vector of ScheduleEntries to an XML-RPC return value.
*
* @param scheduleEntries a list of ScheduleEntries.
* @param returnValue the output parameter holding an XML-RPC
* representation of the suppied schedule entires.
*/
static void
scheduleEntriesToXmlRpcValue(
Ptr<std::vector<Ptr<ScheduleEntry>::Ref> >::Ref scheduleEntries,
XmlRpc::XmlRpcValue & returnValue)
throw ();
/**
* Convert a schedule entry ID (a UniqueId) to an XmlRpcValue
*
* @param scheduleEntryId the UniqueId to convert.
* @param returnValue the output parameter holding the result of
* the conversion.
*/
static void
scheduleEntryIdToXmlRpcValue(
Ptr<const UniqueId>::Ref scheduleEntryId,
XmlRpc::XmlRpcValue & returnValue) throw ();
/**
* Convert a vector of PlayLogEntries to an XML-RPC return value.
*
* @param playLogVector a list of PlayLogEntries.
* @param returnValue the output parameter holding an XML-RPC
* representation of the list of PlayLogEntries.
*/
static void
playLogVectorToXmlRpcValue(
Ptr<const std::vector<Ptr<PlayLogEntry>::Ref> >::Ref
playLogVector,
XmlRpc::XmlRpcValue & returnValue)
throw ();
/**
* Extract the session ID from the XML-RPC parameters.
*
* @param xmlRpcValue the XML-RPC parameter to extract from.
* @return a SessionId that was found in the XML-RPC parameter.
* @exception std::invalid_argument if there was no sessionId
* member in xmlRpcValue
*/
static Ptr<SessionId>::Ref
extractSessionId(XmlRpc::XmlRpcValue & xmlRpcValue)
throw (std::invalid_argument);
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Scheduler
} // namespace LiveSupport
#endif // XmlRpcTools_h

View File

@ -1,204 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/XmlRpcToolsTest.cxx,v $
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#else
#error "Need unistd.h"
#endif
#include <string>
#include <iostream>
#include <XmlRpcValue.h>
#include "LiveSupport/Db/ConnectionManagerFactory.h"
#include "LiveSupport/Storage/StorageClientFactory.h"
#include "XmlRpcTools.h"
#include "XmlRpcToolsTest.h"
using namespace LiveSupport::Db;
using namespace LiveSupport::Storage;
using namespace LiveSupport::Scheduler;
using namespace std;
using namespace XmlRpc;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
CPPUNIT_TEST_SUITE_REGISTRATION(XmlRpcToolsTest);
/**
* The name of the configuration file for the playlist.
*/
const std::string configFileName = "etc/playlist.xml";
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Configure a Configurable with an XML file.
*----------------------------------------------------------------------------*/
void
XmlRpcToolsTest :: configure(
Ptr<Configurable>::Ref configurable,
const std::string fileName)
throw (CPPUNIT_NS::Exception)
{
try {
Ptr<xmlpp::DomParser>::Ref parser(
new xmlpp::DomParser(configFileName, true));
const xmlpp::Document * document = parser->get_document();
const xmlpp::Element * root = document->get_root_node();
configurable->configure(*root);
} catch (std::invalid_argument &e) {
CPPUNIT_FAIL("semantic error in configuration file");
} catch (xmlpp::exception &e) {
CPPUNIT_FAIL("error parsing configuration file");
}
}
/*------------------------------------------------------------------------------
* Set up the test environment
*----------------------------------------------------------------------------*/
void
XmlRpcToolsTest :: setUp(void) throw ()
{
}
/*------------------------------------------------------------------------------
* Clean up the test environment
*----------------------------------------------------------------------------*/
void
XmlRpcToolsTest :: tearDown(void) throw ()
{
}
/*------------------------------------------------------------------------------
* Just a very simple smoke test
*----------------------------------------------------------------------------*/
void
XmlRpcToolsTest :: firstTest(void)
throw (CPPUNIT_NS::Exception)
{
XmlRpcValue xmlRpcPlaylist;
XmlRpcValue xmlRpcAudioClip;
Ptr<Playlist>::Ref playlist = Ptr<Playlist>::Ref(new Playlist);
Ptr<const AudioClip>::Ref audioClip;
// set up a playlist instance
configure(playlist, configFileName);
audioClip = playlist->begin()->second->getAudioClip();
// run the packing methods
XmlRpcTools :: playlistToXmlRpcValue(playlist, xmlRpcPlaylist);
XmlRpcTools :: audioClipToXmlRpcValue(audioClip, xmlRpcAudioClip);
CPPUNIT_ASSERT(xmlRpcPlaylist.hasMember("id"));
CPPUNIT_ASSERT(xmlRpcPlaylist["id"].getType() == XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(xmlRpcPlaylist["id"]) == "0000000000000001");
CPPUNIT_ASSERT(xmlRpcPlaylist.hasMember("playlength"));
CPPUNIT_ASSERT(xmlRpcPlaylist["playlength"].getType()
== XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(xmlRpcPlaylist["playlength"]) == 90 * 60);
CPPUNIT_ASSERT(xmlRpcAudioClip.hasMember("id"));
CPPUNIT_ASSERT(xmlRpcAudioClip["id"].getType() == XmlRpcValue::TypeString);
CPPUNIT_ASSERT(std::string(xmlRpcAudioClip["id"]) == "0000000000010001");
CPPUNIT_ASSERT(xmlRpcAudioClip.hasMember("playlength"));
CPPUNIT_ASSERT(xmlRpcAudioClip["playlength"].getType()
== XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(xmlRpcAudioClip["playlength"]) == 60 * 60);
XmlRpcValue xmlRpcPlaylistId;
Ptr<UniqueId>::Ref playlistId(new UniqueId(rand()));
Ptr<UniqueId>::Ref audioClipId(new UniqueId(rand()));
Ptr<time_duration>::Ref relativeOffset(new time_duration(0,0,rand(),0));
xmlRpcPlaylistId["playlistId"] = std::string(*playlistId);
xmlRpcPlaylistId["audioClipId"] = std::string(*audioClipId);
xmlRpcPlaylistId["relativeOffset"] = relativeOffset->total_seconds();
// run the unpacking methods
Ptr<UniqueId>::Ref newPlaylistId;
Ptr<UniqueId>::Ref newAudioClipId;
Ptr<time_duration>::Ref newRelativeOffset;
try {
newPlaylistId = XmlRpcTools::extractPlaylistId(xmlRpcPlaylistId);
newAudioClipId = XmlRpcTools::extractAudioClipId(xmlRpcPlaylistId);
newRelativeOffset = XmlRpcTools::extractRelativeOffset(xmlRpcPlaylistId);
}
catch (std::invalid_argument &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(*playlistId == *newPlaylistId);
CPPUNIT_ASSERT(*audioClipId == *newAudioClipId);
CPPUNIT_ASSERT(*relativeOffset == *newRelativeOffset);
}
/*------------------------------------------------------------------------------
* Testing markError()
*----------------------------------------------------------------------------*/
void
XmlRpcToolsTest :: errorTest(void)
throw (CPPUNIT_NS::Exception)
{
XmlRpcValue xmlRpcValue;
try {
XmlRpcTools :: markError(42, "this is an error", xmlRpcValue);
CPPUNIT_FAIL("did not throw exception in markError()");
}
catch (XmlRpc::XmlRpcException &e) {
CPPUNIT_ASSERT(e.getCode() == 42);
CPPUNIT_ASSERT(e.getMessage() == "this is an error");
}
}

View File

@ -1,133 +0,0 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/XmlRpcToolsTest.h,v $
------------------------------------------------------------------------------*/
#ifndef XmlRpcToolsTest_h
#define XmlRpcToolsTest_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <cppunit/extensions/HelperMacros.h>
namespace LiveSupport {
namespace Scheduler {
using namespace LiveSupport;
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* Unit test for the XmlRpcTools class.
*
* @author $Author: fgerlits $
* @version $Revision: 1.3 $
* @see XmlRpcTools
*/
class XmlRpcToolsTest : public CPPUNIT_NS::TestFixture
{
CPPUNIT_TEST_SUITE(XmlRpcToolsTest);
CPPUNIT_TEST(firstTest);
CPPUNIT_TEST(errorTest);
CPPUNIT_TEST_SUITE_END();
private:
/**
* Configure a configurable with an XML file.
*
* @param configurable configure this
* @param fileName the name of the XML file to configure with.
* @exception CPPUNIT_NS::Exception on XML parsing errors.
*/
void
configure(Ptr<Configurable>::Ref configurable,
std::string fileName)
throw (CPPUNIT_NS::Exception);
protected:
/**
* A simple test.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
firstTest(void) throw (CPPUNIT_NS::Exception);
/**
* Testing the method for error message packaging.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
errorTest(void) throw (CPPUNIT_NS::Exception);
public:
/**
* Set up the environment for the test case.
*/
void
setUp(void) throw ();
/**
* Clean up the environment after the test case.
*/
void
tearDown(void) throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Scheduler
} // namespace LiveSupport
#endif // XmlRpcToolsTest_h