This structure handles the sessions; by this, it encapsulates the current state of the server. More...
#include <CSessionManager.h>
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. | |
CQuery * | makeQuery (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. | |
CXMLElement * | openSession (string inUserName, string inSessionID, string inSessionName) |
to be used by the Interface. More... | |
CXMLElement * | renameSession (string inSessionID, string inSessionName) |
to be used by the Interface. More... | |
CXMLElement * | deleteSession (string inSessionID) |
to be used by the Interface. More... | |
CXMLElement * | closeSession (string inSessionID) |
Closes the session, but keeps it in memory. More... | |
CXMLElement * | query (const string &inSessionID, const CXMLElement &inRelevanceLevelList) |
VeryImportantFunction: More... | |
CXMLElement * | getRandomImages (const string &inSessionID, const string &inAlgorithm, int inResultSize) |
retrieving random images (as seeds for subsequent searches) More... | |
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. More... | |
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. More... | |
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 More... | |
string | toXMLSessions (const string &inUser, bool isPrivate=false) const |
The sessions for one user only. More... | |
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 | |
CXMLElement * | getPropertySheet (string inSessionID, string inAlgorithmID) const |
Get the property sheet of the algorithm with ID inAlgorithmID. More... | |
void | startPropertySheetSubtree () |
Building a property sheet list I consider building a list on a call by call basis as tedious. More... | |
CXMLElement * | getPropertySheetSubtree () |
This function gets us the current property sheet subtree. | |
void | endPropertySheetSubtree () |
This function does the actual breaking down into a CPropertySheetList. | |
CXMLElement * | getCollections () const |
This function probably will quite soon be removed from this class, and it will become part of a class containing the CSessionManager. | |
CXMLElement * | getAlgorithms () 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. More... | |
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 | |
![]() | |
CAlgorithm * | getAlgorithmInConstruction () |
returns a pointer to the algorithm in construction | |
void | startAlgorithmConstruction (CAlgorithm *inAlgorithm) |
CAlgorithmCollection (string inConfigFileName) | |
Constructor. | |
~CAlgorithmCollection () | |
Destructor destroys all members of CContent. | |
void | addAlgorithm (CAlgorithm *inAlgorithm) |
adding a completely built algorithm XML document tree | |
CAlgorithm & | getAlgorithmByType (const string &inType) const |
Algorithm for TYPE => permits configuring probably only the pointered version is interesting. | |
bool | containsAlgorithmByType (const string &inType) const |
Algorithm for TYPE => permits configuring probably only the pointered version is interesting. | |
CAlgorithm * | makeAlgorithmByType (const string &inType) const |
Creates a new algorithm for agiven type by cloning what you would get with getAlgorithm. More... | |
CAlgorithm * | getDefaultAlgorithm () const |
A default algorithm for the default session This algorithm will be given by the ONE ALGORITHM which has the type "adefault". | |
CAlgorithm * | makeDefaultAlgorithm () const |
creates a copy of what you'd get with the above function get... More... | |
CXMLElement * | getAlgorithmList (const CXMLElement &inGetAlgorithms) const |
For handshaking: This makes you a list of all algorithms which work with a given query paradigm. | |
string | toXML (bool inIsPrivate=false) const |
for shandshake and for state output | |
CXMLElement * | toXMLElement () const |
for get-algorithms: the output is an CXMLElement, containing an algorithm-list element. | |
CQuery * | makeQuery (const string &inBaseType, CAccessorAdminCollection &inAccessorAdminCollection, CAlgorithm &inAlgorithm, CStaticQueryFactory &inFactory) |
handed through to the CStaticQueryFactory | |
![]() | |
virtual CQuery * | makeQuery (const string &inBaseType, CAccessorAdminCollection &inAccessorAdminCollection, CAlgorithm &inAlgorithm) |
generates a new CQuery for a given basetype. More... | |
Protected Types | |
typedef map< string, list < CSession > > | CUserToSessions |
point the user to all the sessions | |
typedef map< string, CSession * > | CIDToSession |
![]() | |
typedef map< string, CAlgorithm * > | CContent |
The content of an algorithm collection is a map between algorihm type and a pointer to the corresponding CAlgorithm. | |
Protected Attributes | |
CAccessorAdminCollection | mAccessorAdminCollection |
The accessor collection is needed for constructing queries. | |
CI18nTranslator | mI18nTranslator |
The Translator for this. | |
CUserToSessions | mUserToSessions |
CIDToSession | mIDToSession |
CPropertySheetList * | mPropertySheetList |
These are the building blocks of the property sheets to be generated by *this. | |
CXMLElement * | mPropertySheetSubtree |
The subtree from which the mPropertySheets will be built. | |
CStaticQueryFactory * | mBaseTypeFactory |
The base type factory is a factory for query base types. | |
![]() | |
CAlgorithm * | mAlgorithmInConstruction |
as the name sais | |
CContent | mContent |
Additional Inherited Members | |
![]() | |
CContent::const_iterator | begin () const |
for being able to read all the content | |
CContent::const_iterator | end () const |
for being able to read all the content | |
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
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)
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:
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
string CSessionManager::toXMLSessions | ( | const string & | inUser, |
bool | isPrivate = false |
||
) | const |
The sessions for one user only.
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) |