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