changed StorageClientFactory to produce only one kind of client

added some documentation (of xml configuration file format)
This commit is contained in:
fgerlits 2004-11-24 16:21:59 +00:00
parent bcbe880d42
commit 8d7e16a0c4
17 changed files with 168 additions and 85 deletions

View File

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE authenticationClientFactory [
<!ELEMENT authenticationClientFactory (testAuthentication?,
webAuthentication?)>
<!ELEMENT authenticationClientFactory (testAuthentication)>
<!ELEMENT testAuthentication (user) >
@ -10,20 +9,9 @@
<!ATTLIST user login CDATA #REQUIRED >
<!ATTLIST user password CDATA #REQUIRED >
<!ELEMENT webAuthentication (location) >
<!ELEMENT location EMPTY >
<!ATTLIST location server CDATA #REQUIRED >
<!ATTLIST location port NMTOKEN #REQUIRED >
<!ATTLIST location path CDATA #REQUIRED >
]>
<authenticationClientFactory>
<testAuthentication>
<user login="root" password="q" />
</testAuthentication>
<webAuthentication>
<location server="localhost" port="80"
path="/storage/var/xmlrpc/xrLocStor.php" />
</webAuthentication>
</authenticationClientFactory>

View File

@ -10,5 +10,5 @@
]>
<webAuthentication>
<location server="localhost" port="80"
path="/storage/var/xmlrpc/xrLocStor.php" />
path="/livesupportStorageServer/xmlrpc/xrLocStor.php" />
</webAuthentication>

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/authentication/include/LiveSupport/Authentication/AuthenticationClientFactory.h,v $
------------------------------------------------------------------------------*/
@ -61,14 +61,17 @@ using namespace LiveSupport::Core;
/* =============================================================== data types */
/**
* The factory to create appropriate AuthenticationClient objects.
* The factory to create AuthenticationClientInterface objects.
*
* This object has to be configured with an XML configuration element
* called authenticationClientFactory. This element contains a child element
* specifying and configuring the kind of AuthenticationClient that the
* factory builds. Currently only the WebAuthenticationClient is supported.
* factory builds. This client is either a TestAuthenticationClient or
* a WebAuthenticationClient, and the child element name is either
* testAuthentication or webAuthentication, correspondingly.
*
* A authenticationClientFactory configuration element may look like the following:
* An authenticationClientFactory configuration element may look like
* the following:
*
* <pre><code>
* &lt;authenticationClientFactory&gt;
@ -78,8 +81,9 @@ using namespace LiveSupport::Core;
* &lt;/authenticationClientFactory&gt;
* </code></pre>
*
* For detais of the testAuthentication element, see the documentation for the
* WebAuthenticationClient class.
* For detais of the testAuthentication and webAuthentication elements, see the
* documentation for the TestAuthenticationClient and WebAuthenticationClient
* classes.
*
* The DTD for the above element is:
*
@ -88,8 +92,9 @@ using namespace LiveSupport::Core;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.2 $
* @version $Revision: 1.3 $
* @see TestAuthenticationClient
* @see WebAuthenticationClient
*/
class AuthenticationClientFactory :
virtual public Configurable

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/authentication/include/LiveSupport/Authentication/Attic/WebAuthenticationClient.h,v $
------------------------------------------------------------------------------*/
@ -76,7 +76,7 @@ using namespace LiveSupport::Core;
* &lt;location
* server="localhost"
* port="80"
* path="/storage/var/xmlrpc/xrLocStor.php"
* path="/livesupportStorageServer/xmlrpc/xrLocStor.php"
* /&gt;
* &lt;/webAuthentication&gt;
* </code></pre>
@ -92,7 +92,7 @@ using namespace LiveSupport::Core;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.4 $
* @version $Revision: 1.5 $
*/
class WebAuthenticationClient :
virtual public Configurable,
@ -162,8 +162,6 @@ class WebAuthenticationClient :
* Returns a new session ID; in case of an error, returns a
* null pointer.
*
* For testing, use the login "root" with the password "q".
*
* @return the new session ID
*/
virtual Ptr<SessionId>::Ref

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClient.cxx,v $
------------------------------------------------------------------------------*/
@ -147,6 +147,7 @@ TestAuthenticationClient :: configure(const xmlpp::Element & element)
}
sessionIdList.clear();
sessionCounter = 0;
}
@ -162,8 +163,10 @@ TestAuthenticationClient :: login(const std::string & login,
if (login == userLogin && password == userPassword) {
std::stringstream sessionIdStream;
sessionIdStream << dummySessionIdString;
sessionIdStream << rand();
sessionIdStream << dummySessionIdString
<< sessionCounter++
<< '-'
<< rand();
sessionIdList.insert(sessionIdStream.str());
sessionId.reset(new SessionId(sessionIdStream.str()));
}
@ -178,6 +181,7 @@ const bool
TestAuthenticationClient :: logout(Ptr<SessionId>::Ref sessionId)
throw ()
{
// this returns the number of entries found and erased
if (sessionIdList.erase(sessionId->getId())) {
return true;
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClient.h,v $
------------------------------------------------------------------------------*/
@ -92,7 +92,7 @@ using namespace LiveSupport::Core;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
*/
class TestAuthenticationClient :
virtual public Configurable,
@ -126,6 +126,11 @@ class TestAuthenticationClient :
*/
sessionIdListType sessionIdList;
/**
* The number of the sessionId's we have issued.
*/
int sessionCounter;
public:
/**
@ -168,8 +173,6 @@ class TestAuthenticationClient :
* Returns a new session ID; in case of an error, returns a
* null pointer.
*
* For testing, use the login "root" with the password "q".
*
* @return the new session ID
*/
virtual Ptr<SessionId>::Ref

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/modules/core/include/LiveSupport/Core/AudioClip.h,v $
------------------------------------------------------------------------------*/
@ -67,12 +67,31 @@ using namespace boost::posix_time;
/**
* A class representing an audio clip.
* AudioClips contain the basic information about the audio clip.
* They are contained in PlaylistElements, which provide the relative offset
* and fade in/fade out info. PlaylistElements, in turn, are contained
* in a Playlist.
* An AudioClip is contained in a PlaylistElement, which provides the
* relative offset and fade in/fade out information. A PlaylistElement,
* in turn, is contained in a Playlist.
*
* This object has to be configured with an XML configuration element
* called audioClip. This may look like the following:
*
* <pre><code>
* &lt;audioClip id="1"
* playlength="00:18:30.000000"
* uri="file:var/test1.mp3" &gt;
* &lt;/audioClip&gt;
* </code></pre>
*
* The DTD for the above element is:
*
* <pre><code>
* &lt;!ELEMENT audioClip EMPTY &gt;
* &lt;!ATTLIST audioClip id NMTOKEN #REQUIRED &gt;
* &lt;!ATTLIST audioClip playlength NMTOKEN #REQUIRED &gt;
* &lt;!ATTLIST audioClip uri CDATA #REQUIRED &gt;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.6 $
* @version $Revision: 1.7 $
*/
class AudioClip : public Configurable
{
@ -112,6 +131,8 @@ class AudioClip : public Configurable
*
* @param id the id of the audio clip.
* @param playlength the playing length of the audio clip.
* @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,

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/FadeInfo.h,v $
------------------------------------------------------------------------------*/
@ -66,11 +66,30 @@ using namespace boost::posix_time;
/**
* A class representing fade in / fade out information of a playlist element.
* These are contained in a PlaylistElement, a list of which, in turn, is
* This is contained in a PlaylistElement, a list of which, in turn, is
* contained in a Playlist.
*
* This object has to be configured with an XML configuration element
* called fadeInfo. This may look like the following:
*
* <pre><code>
* &lt;fadeInfo id="9901"
* fadeIn="00:00:02.000000"
* fadeOut="00:00:01.500000" &gt;
* &lt;/fadeInfo&gt;
* </code></pre>
*
* The DTD for the above element is:
*
* <pre><code>
* &lt;!ELEMENT fadeInfo EMPTY &gt;
* &lt;!ATTLIST fadeInfo id NMTOKEN #REQUIRED &gt;
* &lt;!ATTLIST fadeInfo fadeIn NMTOKEN #REQUIRED &gt;
* &lt;!ATTLIST fadeInfo fadeIn NMTOKEN #REQUIRED &gt;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.2 $
* @version $Revision: 1.3 $
*/
class FadeInfo : public Configurable
{

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.15 $
Version : $Revision: 1.16 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $
------------------------------------------------------------------------------*/
@ -70,8 +70,29 @@ using namespace boost::posix_time;
* information of when and how each audio clip is played inside
* the playlist.
*
* This object has to be configured with an XML configuration element
* called playlist. This may look like the following:
*
* <pre><code>
* &lt;playlist id="1" playlength="00:18:30.000000" &gt;
* &lt;playlistElement&gt; ... &lt;/playlistElement&gt;
* ...
* &lt;/playlist&gt;
* </code></pre>
*
* For detais of the playlistElement element, see the documentation
* for the PlaylistElement class.
*
* The DTD for the above element is:
*
* <pre><code>
* &lt;!ELEMENT playlist (playlistElement*) &gt;
* &lt;!ATTLIST playlist id NMTOKEN #REQUIRED &gt;
* &lt;!ATTLIST playlist playlength NMTOKEN #REQUIRED &gt;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.15 $
* @version $Revision: 1.16 $
*/
class Playlist : public Configurable
{
@ -152,6 +173,8 @@ class Playlist : public Configurable
*
* @param id the id of the playlist.
* @param playlength the playing length of the playlist.
* @param uri the location of the SMIL file representing this
* playlist (optional)
*/
Playlist(Ptr<UniqueId>::Ref id,
Ptr<time_duration>::Ref playlength,

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/modules/core/include/LiveSupport/Core/PlaylistElement.h,v $
------------------------------------------------------------------------------*/
@ -71,10 +71,32 @@ using namespace LiveSupport::Core;
/* =============================================================== data types */
/**
* An item in a playlist.
* An item in a Playlist, consisting of an AudioClip
* and optional FadeInfo (fade in / fade out information).
*
* This object has to be configured with an XML configuration element
* called playlistElement. This may look like the following:
*
* <pre><code>
* &lt;playlistElement id="707" relativeOffset="00:12:34.000000" &gt;
* &lt;audioClip&gt; ... &lt;/audioClip&gt;
* &lt;fadeInfo&gt; ... &lt;/fadeInfo&gt;
* &lt;/playlist&gt;
* </code></pre>
*
* For detais of the audioClip and fadeInfo elements, see the documentation
* for the AudioClip and FadeInfo classes.
*
* The DTD for the above element is:
*
* <pre><code>
* &lt;!ELEMENT playlistElement (audioClip, fadeInfo?) &gt;
* &lt;!ATTLIST playlistElement id NMTOKEN #REQUIRED &gt;
* &lt;!ATTLIST playlistElement relativeOffset NMTOKEN #REQUIRED &gt;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.6 $
* @version $Revision: 1.7 $
*/
class PlaylistElement : public Configurable
{
@ -123,6 +145,7 @@ class PlaylistElement : public Configurable
* the start of the playlist.
* @param audioClip (a pointer to) the audio clip associated
* with the playlist element.
* @param fadeInfo fade in / fade out information (optional)
*/
PlaylistElement(Ptr<UniqueId>::Ref id,
Ptr<time_duration>::Ref relativeOffset,
@ -145,6 +168,7 @@ class PlaylistElement : public Configurable
* the start of the playlist.
* @param audioClip (a pointer to) the audio clip associated
* with the playlist element.
* @param fadeInfo fade in / fade out information (optional)
*/
PlaylistElement(Ptr<time_duration>::Ref relativeOffset,
Ptr<AudioClip>::Ref audioClip,

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/src/Playlist.cxx,v $
------------------------------------------------------------------------------*/
@ -100,7 +100,7 @@ Playlist :: configure(const xmlpp::Element & element)
if (!(attribute = element.get_attribute(playlengthAttrName))) {
std::string eMsg = "missing attribute ";
eMsg += idAttrName;
eMsg += playlengthAttrName;
throw std::invalid_argument(eMsg);
}
playlength.reset(new time_duration(

View File

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE authenticationClientFactory [
<!ELEMENT authenticationClientFactory (testAuthentication?,
webAuthentication?)>
<!ELEMENT authenticationClientFactory (testAuthentication)>
<!ELEMENT testAuthentication (user) >
@ -10,20 +9,9 @@
<!ATTLIST user login CDATA #REQUIRED >
<!ATTLIST user password CDATA #REQUIRED >
<!ELEMENT webAuthentication (location) >
<!ELEMENT location EMPTY >
<!ATTLIST location server CDATA #REQUIRED >
<!ATTLIST location port NMTOKEN #REQUIRED >
<!ATTLIST location path CDATA #REQUIRED >
]>
<authenticationClientFactory>
<testAuthentication>
<user login="root" password="q" />
</testAuthentication>
<webAuthentication>
<location server="localhost" port="80"
path="/storage/var/xmlrpc/xrLocStor.php" />
</webAuthentication>
</authenticationClientFactory>

View File

@ -12,5 +12,5 @@
]>
<webStorage tempFiles="file:///tmp/tempPlaylist" >
<location server="localhost" port="80"
path="/storage/var/xmlrpc/xrLocStor.php" />
path="/livesupportStorageServer/xmlrpc/xrLocStor.php" />
</webStorage>

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/modules/storage/include/LiveSupport/Storage/StorageClientFactory.h,v $
------------------------------------------------------------------------------*/
@ -61,12 +61,12 @@ using namespace LiveSupport::Core;
/* =============================================================== data types */
/**
* The factory to create appropriate StorageClient objects.
* The factory to create StorageClientInterface objects.
*
* This object has to be configured with an XML configuration element
* called storageClientFactory. This element contains a child element
* specifying and configuring the kind of StorageClient that the
* factory builds. Currently on the TestStorageClient is supported.
* factory builds. Currently only the TestStorageClient is supported.
*
* A storageClientFactory configuration element may look like the following:
*
@ -87,8 +87,8 @@ using namespace LiveSupport::Core;
* &lt;!ELEMENT storageClientFactory (testStorage) &gt;
* </code></pre>
*
* @author $Author: maroy $
* @version $Revision: 1.3 $
* @author $Author: fgerlits $
* @version $Revision: 1.4 $
* @see TestStorageClient
*/
class StorageClientFactory :

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/storage/src/TestStorageClient.cxx,v $
------------------------------------------------------------------------------*/
@ -270,7 +270,7 @@ TestStorageClient :: acquirePlaylist(Ptr<SessionId>::Ref sessionId,
std::stringstream fileName;
fileName << localTempStorage << newPlaylist->getId()->getId()
<< "#" << std::rand() << ".smil";
<< "-" << std::rand() << ".smil";
smilDocument->write_to_file(fileName.str(), "UTF-8");

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.15 $
Version : $Revision: 1.16 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.h,v $
------------------------------------------------------------------------------*/
@ -67,8 +67,30 @@ using namespace LiveSupport::Core;
/**
* A dummy storage client, only used for test purposes.
*
* This object has to be configured with an XML configuration element
* called testStorage. This may look like the following:
*
* <pre><code>
* &lt;testStorage tempFiles="file:///tmp/tempPlaylist" &gt;
* &lt;playlist&gt; ... &lt;/playlist&gt;
* ...
* &lt;audioClip&gt; ... &lt;/audioClip&gt;
* ...
* &lt;/testStorage&gt;
* </code></pre>
*
* For detais of the playlist and audioClip elements, see the documentation
* for the Core::Playlist and Core::AudioClip classes.
*
* The DTD for the above element is:
*
* <pre><code>
* &lt;!ELEMENT testStorage (playlist*, audioClip*) &gt;
* &lt;!ATTLIST testStorage tempFiles CDATA #REQUIRED &gt;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.15 $
* @version $Revision: 1.16 $
*/
class TestStorageClient :
virtual public Configurable,

View File

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE authenticationClientFactory [
<!ELEMENT authenticationClientFactory (testAuthentication?,
webAuthentication?)>
<!ELEMENT authenticationClientFactory (testAuthentication)>
<!ELEMENT testAuthentication (user) >
@ -10,20 +9,9 @@
<!ATTLIST user login CDATA #REQUIRED >
<!ATTLIST user password CDATA #REQUIRED >
<!ELEMENT webAuthentication (location) >
<!ELEMENT location EMPTY >
<!ATTLIST location server CDATA #REQUIRED >
<!ATTLIST location port NMTOKEN #REQUIRED >
<!ATTLIST location path CDATA #REQUIRED >
]>
<authenticationClientFactory>
<testAuthentication>
<user login="root" password="q" />
</testAuthentication>
<webAuthentication>
<location server="localhost" port="80"
path="/storage/var/xmlrpc/xrLocStor.php" />
</webAuthentication>
</authenticationClientFactory>