CSessionManager Class

# CSessionManager Class Reference

[CADIHash.h Index] [CADIHash.h Hierarchy]

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

`#include <../libInvertedFile/include/CSessionManager.h>`

Inherits: CAlgorithmCollection

## Public Members

- CSessionManager (string inSessions, string inConfiguration)
- CQuery* makeQuery (const string& inBaseType, CAlgorithm& inAlgorithm)
- istream& read (istream&)
- ostream& write (ostream&)
- CXMLElement* openSession (string inUserName, string inSessionID, string inSessionName)
- CXMLElement* renameSession (string inSessionID, string inSessionName)
- CXMLElement* deleteSession (string inSessionID)
- CXMLElement* closeSession (string inSessionID)
- CXMLElement* query (const string& inSessionID, const CXMLElement& inRelevanceLevelList)
- /** retrieving random images (as seeds for subsequent searches)
- list<CAccessorElement>* getAllAccessorElements (const string& inSessionID, const string& inAlgorithm )
- list<TID>* getAllIDs (const string& inSessionID, const string& inAlgorithm )
- bool setAlgorithm (const string& inSessionID, CAlgorithm* inAlgorithm)
- string newSession (const string& inUser, const string& inSessionName)
- void setSessionName (const string& inOldSessionName, const string& inNewSessionName)
- string toXML (bool isPrivate=false)
- string toXMLSessions (const string& inUser, bool isPrivate=false)
- string toXMLSessionConfiguration ()
- pair<string,string> toXMLHandshake (const string& inUser)
- CXMLElement* getPropertySheet (string inSessionID, string inAlgorithmID)
- void startPropertySheetSubtree ()
- CXMLElement* getPropertySheetSubtree ()
- void endPropertySheetSubtree ()
- CXMLElement* getCollections ()
- CXMLElement* getAlgorithms ()

## Protected Members

- CAccessorCollection mAccessorCollection
- mutable CUserToSessions mUserToSessions
- mutable CIDToSession mIDToSession
- CPropertySheetList* mPropertySheetList
- CXMLElement* mPropertySheetSubtree

## 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.

Together with CCommunicationHandler, this is the structure is the most affected with all the business about changing and improving MRML. It contains now quite a lot of entropic code which needs to be cleaned up.

NOTE: I (WM) guess, that the outcome will be something like a new ConfigurationManager Class, which contains a CSessionManager (which will manage only sessions) a CAccessorCollection, and a CAlgorithmCollection. It will contain quite a fat interface to hand through to them.

## CSessionManager(string inSessions, string inConfiguration)

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. Not yet implemented.

## CXMLElement* renameSession(string inSessionID, string inSessionName)

to be used by the Interface. Not yet implemented.

## CXMLElement* deleteSession(string inSessionID)

to be used by the Interface.

## CXMLElement* closeSession(string inSessionID)

to be used by the Interface.

## CXMLElement* query(const string& inSessionID, const CXMLElement& inRelevanceLevelList)

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

## 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 sessionit will also lead to a new construction of the query.

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

## string newSession(const string& inUser, const string& inSessionName)

making a new session and returning its ID

## void setSessionName(const string& inOldSessionName, const string& inNewSessionName)

Set the name of the current session.

## string toXML(bool isPrivate=false)

turn this into a part of the welcome message THIS CODE IS TO LEAVE SOON

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

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)

## string toXMLSessionConfiguration()

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)

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.

## void startPropertySheetSubtree()

Building a property sheet listI 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

## 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()

This function probably will quite soon be removed from this class,

## CXMLElement* getAlgorithms()

This function probably will quite soon be removed from this class,

## CAccessorCollection mAccessorCollection

The accessor collection is needed for constructing queries

## CPropertySheetList* mPropertySheetList

These are the building blocks of the property sheets to be generated by *this.

## CXMLElement* mPropertySheetSubtree

The subtree from which the mPropertySheets

| Kdoc