System documentation of the GNU Image-Finding Tool

CSessionManager Class Reference

This structure handles the sessions; by this, it encapsulates the current state of the server. More...

#include <CSessionManager.h>

Inheritance diagram for CSessionManager:

CAlgorithmCollection CStaticQueryFactory

List of all members.

Public Member Functions

 CSessionManager (string inSessions, string inConfiguration, string inI18nFileName)
 The session manager slurps in two XML files and generates out of this its initial state.
CQuerymakeQuery (const string &inBaseType, CAlgorithm &inAlgorithm)
 this CSessionManager has all the information to make a query structure.
istream & read (istream &)
 Initialization: read from a stream.
ostream & write (ostream &)
 Write into a stream.
CXMLElementopenSession (string inUserName, string inSessionID, string inSessionName)
 to be used by the Interface.
CXMLElementrenameSession (string inSessionID, string inSessionName)
 to be used by the Interface.
CXMLElementdeleteSession (string inSessionID)
 to be used by the Interface.
CXMLElementcloseSession (string inSessionID)
 Closes the session, but keeps it in memory.
CXMLElementquery (const string &inSessionID, const CXMLElement &inRelevanceLevelList)
 VeryImportantFunction:.
CXMLElementgetRandomImages (const string &inSessionID, const string &inAlgorithm, int inResultSize)
 retrieving random images (as seeds for subsequent searches)
list< CAccessorElement > * getAllAccessorElements (const string &inSessionID, const string &inAlgorithm)
 retrieving the URLs of all images (for generating distance matrices)
list< TID > * getAllIDs (const string &inSessionID, const string &inAlgorithm)
 retrieving the IDs of all images (for generating distance matrices)
bool setAlgorithm (const string &inSessionID, CAlgorithm *inAlgorithm)
 set the algorithm used in this session it will also lead to a new construction of the query.
string newSession (const string &inUser, const string &inSessionName)
 making a new session and returning its ID
string newSession (const string &inID, const string &inUser, const string &inSessionName)
 making a new session and for a given ID, returnig the ID
void setSessionName (const string &inOldSessionName, const string &inNewSessionName)
 Set the name of the current session.
string toXML (bool isPrivate=false) const
 turn this into a part of the welcome message in fact, this generates standard property sheets out of the collections and algorithms available
string toXMLSessions (const string &inUser, bool isPrivate=false) const
 The sessions for one user only.
string toXMLSessionConfiguration () const
 The sessions for everybody known to the system.
pair< string, string > toXMLHandshake (const string &inUser)
 this is almost the complete shandshake message
CXMLElementgetPropertySheet (string inSessionID, string inAlgorithmID) const
 Get the property sheet of the algorithm with ID inAlgorithmID.
void startPropertySheetSubtree ()
 Building a property sheet list I consider building a list on a call by call basis as tedious.
CXMLElementgetPropertySheetSubtree ()
 This function gets us the current property sheet subtree.
void endPropertySheetSubtree ()
 This function does the actual breaking down into a CPropertySheetList.
CXMLElementgetCollections () const
 This function probably will quite soon be removed from this class, and it will become part of a class containing the CSessionManager.
CXMLElementgetAlgorithms () const
 This function probably will quite soon be removed from this class, and it will become part of a class containing the CSessionManager.
bool clearSessionLanguages (const string &inSessionID)
 i18n clear the preferred languages list of a given session
bool addSessionLanguage (const string &inSessionID, const string &inLanguageCode)
 i18n: add one language code to the list of preferred languages
bool commitSessionLanguages (const string &inSessionID)
 commit the languages to be used for a session.
list< string > getSessionLanguages (const string &inSessionID) const
 i18n: get the list of preferred languages of this session
void translate (string inSessionID, CXMLElement &inoutToBeTranslated) const
 i18n: get the list of preferred languages of this session

Protected Types

typedef map< string, list
< CSession > > 
CUserToSessions
 point the user to all the sessions
typedef map< string, CSession * > CIDToSession

Protected Attributes

CAccessorAdminCollection mAccessorAdminCollection
 The accessor collection is needed for constructing queries.
CI18nTranslator mI18nTranslator
 The Translator for this.
CUserToSessions mUserToSessions
CIDToSession mIDToSession
CPropertySheetListmPropertySheetList
 These are the building blocks of the property sheets to be generated by *this.
CXMLElementmPropertySheetSubtree
 The subtree from which the mPropertySheets will be built.
CStaticQueryFactorymBaseTypeFactory
 The base type factory is a factory for query base types.


Detailed Description

This structure handles the sessions; by this, it encapsulates the current state of the server.

Basically, it hands all requests through to the right sessions. It also handles the generation of new sessions etc.. In short, it is the configuration manager.

This class is now approaching what I would like it to be, however, cleaning is always wellcome

ATTENTION MULTITHREADING: WHAT TO LOCK AND WHAT TO UNLOCK IS NOT ENTIRELY TRIVIAL THIS MIGHT BE A SOURCE OF MISTAKES


Member Function Documentation

CXMLElement* CSessionManager::closeSession ( string  inSessionID  ) 

Closes the session, but keeps it in memory.

FUTURE: put the state of the session into a blob

bool CSessionManager::commitSessionLanguages ( const string &  inSessionID  ) 

commit the languages to be used for a session.

CXMLElement* CSessionManager::deleteSession ( string  inSessionID  ) 

to be used by the Interface.

Not yet implemented.

CXMLElement* CSessionManager::getPropertySheet ( string  inSessionID,
string  inAlgorithmID 
) const

Get the property sheet of the algorithm with ID inAlgorithmID.

We look for the attribute cui-property-sheet-id in the algorithm. If this exsists, we look for the right property sheet id in the CPropertySheetList.

CXMLElement* CSessionManager::getRandomImages ( const string &  inSessionID,
const string &  inAlgorithm,
int  inResultSize 
)

retrieving random images (as seeds for subsequent searches)

Parameters:
inSessionID The ID of the session in which the request was issued.
inAlgorithm One would think this is not needed when retrieving random images. However, it is useful to know the collection involved, and if the random images we are retrieving will fit the algorithm used later.
inCollection The collection from which random images will be retrieved.

CXMLElement* CSessionManager::openSession ( string  inUserName,
string  inSessionID,
string  inSessionName 
)

to be used by the Interface.

Not yet implemented.

CXMLElement* CSessionManager::query ( const string &  inSessionID,
const CXMLElement inRelevanceLevelList 
)

VeryImportantFunction:.

This function looks for a CSession with CSession::mSessionID==inSessionID and hands through the rest of the parameter list to CSession::query.

CXMLElement* CSessionManager::renameSession ( string  inSessionID,
string  inSessionName 
)

to be used by the Interface.

Not yet implemented.

bool CSessionManager::setAlgorithm ( const string &  inSessionID,
CAlgorithm inAlgorithm 
)

set the algorithm used in this session it will also lead to a new construction of the query.

We have to perform some comparisons here present version is probably a HACK

void CSessionManager::setSessionName ( const string &  inOldSessionName,
const string &  inNewSessionName 
)

Set the name of the current session.

Presently not implemented or tested

void CSessionManager::startPropertySheetSubtree (  ) 

Building a property sheet list I consider building a list on a call by call basis as tedious.

So what I do is: I first build a tree, and then I break down this tree into our list.

This function makes a new tree

string CSessionManager::toXML ( bool  isPrivate = false  )  const

turn this into a part of the welcome message in fact, this generates standard property sheets out of the collections and algorithms available

It means:

1. Make out of each algorithm in the collection a property sheet. 2. Make out of the algorithm-id-list-list a property sheet with a parent node which does not send messages. 3. Make out of the collection list a choice of collections, each having as a child a property sheet out of 2.

If we do things this way we are losing a bit of the flexibility given in the property sheet specification. However, for the moment I (WM) consider this loss nost as big compared to what we earn in terms of configuration of the system. If necessary recode.

string convertPropertyToXML(bool isPrivate=false)const;

THIS IS DEPRECATED STUFF, SO IT'S DELETED NOW! turn this into a part of the welcome message THIS CODE IS TO LEAVE SOON

Reimplemented from CAlgorithmCollection.

string CSessionManager::toXMLSessions ( const string &  inUser,
bool  isPrivate = false 
) const

The sessions for one user only.

Parameters:
inUser the name of the user for which we want the session names.
isPrivate send internal configuration information along? (distinction between messages for internet and config files)


The documentation for this class was generated from the following file:

Need for discussion? Want to contribute? Contact
help-gift@gnu.org Generated using Doxygen