rasdaman complete source
Classes | Public Member Functions | Static Public Attributes | List of all members
HttpServer Class Reference

#include <httpserver.hh>

Inheritance diagram for HttpServer:
ServerComm RasServerEntry

Classes

class  MDDEncoding
 the class represents an MDD in HTTP transfer encoding More...
 

Public Member Functions

 HttpServer ()
 default constructor More...
 
 HttpServer (unsigned long timeOut, unsigned long managementInterval, unsigned long listenPort, char *rasmgrHost, unsigned int rasmgrPort, char *serverName)
 
virtual ~HttpServer ()
 destructor More...
 
virtual void startRpcServer () throw ( r_Error )
 forces the server to listen for client calls More...
 
virtual void stopRpcServer ()
 stops the server More...
 
virtual void printServerStatus (ostream &s=cout)
 print server status to { s} More...
 
virtual long processRequest (unsigned long callingClientId, char *baseName, int rascommand, char *query, int binDataSize, char *binData, int Endianess, char *&result, char *capability)
 Executes a retrieval query and prepare the result for HTTP transer. More...
 
virtual ClientTblEltgetClientContext (unsigned long ClientId)
 returns a pointer to the context of the calling client, 0 it there is no context More...
 
- Public Member Functions inherited from ServerComm
 ServerComm ()
 default constructor More...
 
 ServerComm (unsigned long timeOut, unsigned long managementInterval, unsigned long listenPort, char *rasmgrHost, unsigned int rasmgrPort, char *serverName)
 constructor getting the client time out and the time interval for management routines, together with listen port, rasmgr host and port and the server name More...
 
virtual ~ServerComm ()
 destructor More...
 
void informRasMGR (int)
 
void addClientTblEntry (ClientTblElt *context) throw ( r_Error )
 adds an entry to the client table (used in RasServerEntry) More...
 
unsigned short deleteClientTblEntry (unsigned long ClientId)
 deletes an entry of the client table (must be public because it is used in the global garbage collection function) More...
 
void abortEveryThingNow ()
 
virtual void getServerStatus (ServerStatRes &returnStruct)
 get server status More...
 
const char * getExtendedErrorInfo ()
 
void setExtendedErrorInfo (const char *)
 
void clearExtendedErrorInfo ()
 
void clientEndRequest ()
 
virtual unsigned short aliveSignal (unsigned long client)
 process the client's alive signal More...
 
virtual unsigned short openDB (unsigned long callingClientId, const char *dbName, const char *userName)
 open database More...
 
virtual unsigned short closeDB (unsigned long callingClientId)
 close current database More...
 
virtual unsigned short createDB (char *name)
 create a database More...
 
virtual unsigned short destroyDB (char *name)
 destroy a database More...
 
virtual unsigned short beginTA (unsigned long callingClientId, unsigned short readOnly=0)
 open transaction More...
 
virtual unsigned short commitTA (unsigned long callingClientId)
 commit current transaction More...
 
virtual unsigned short abortTA (unsigned long callingClientId)
 abort current transaction More...
 
virtual bool isTAOpen (unsigned long callingClientId)
 is transaction open currently? More...
 
virtual unsigned short executeQuery (unsigned long callingClientId, const char *query, ExecuteQueryRes &returnStructure)
 executes a retrieval query and prepares the result for transfer with {getNextMDD}. More...
 
virtual unsigned short getNextMDD (unsigned long callingClientId, r_Minterval &mddDomain, char *&typeName, char *&typeStructure, r_OId &oid, unsigned short &currentFormat)
 get the domain of the next MDD of the actual transfer collection More...
 
virtual unsigned short getNextElement (unsigned long callingClientId, char *&buffer, unsigned int &bufferSize)
 get the next scalar element in the actual transfer collection. More...
 
virtual unsigned short getMDDByOId (unsigned long callingClientId, r_OId &oid, r_Minterval &mddDomain, char *&typeName, char *&typeStructure, unsigned short &currentFormat)
 get an MDD by OId More...
 
virtual unsigned short getNextTile (unsigned long callingClientId, RPCMarray **rpcMarray)
 get next tile of the actual MDD of the actual transfer collection More...
 
virtual unsigned short endTransfer (unsigned long client)
 process the client's alive signal More...
 
virtual unsigned short initExecuteUpdate (unsigned long callingClientId)
 prepares transfer of MDD constants and execution of update query More...
 
virtual unsigned short executeUpdate (unsigned long callingClientId, const char *query, ExecuteUpdateRes &returnStructure)
 executes an update query More...
 
virtual unsigned short startInsertTransMDD (unsigned long callingClientId, r_Minterval &domain, unsigned long typeLength, const char *typeName)
 prepares an MDD (transient) for transfer of tiles More...
 
virtual unsigned short startInsertPersMDD (unsigned long callingClientId, const char *collName, r_Minterval &domain, unsigned long typeLength, const char *typeName, r_OId &oid)
 create a new persistent MDD object for tile based transfers More...
 
virtual unsigned short insertTile (unsigned long callingClientId, int isPersistent, RPCMarray *rpcMarray)
 insert a tile into a persistent MDD object More...
 
virtual unsigned short insertTileSplitted (unsigned long callingClientId, int isPersistent, RPCMarray *rpcMarray, r_Minterval *tileSize)
 
virtual unsigned short endInsertMDD (unsigned long callingClientId, int isPersistent)
 finnishes the MDD creation and inserts the MDD into the collection More...
 
virtual unsigned short insertMDD (unsigned long callingClientId, const char *collName, RPCMarray *rpcMarray, const char *typeName, r_OId &oid)
 insert object into collection More...
 
virtual unsigned short getCollByName (unsigned long callingClientId, const char *collName, char *&typeName, char *&typeStructure, r_OId &oid)
 prepare an MDD collection for transfer with getNextMDD() More...
 
virtual unsigned short getCollByOId (unsigned long callingClientId, r_OId &oid, char *&typeName, char *&typeStructure, char *&collName)
 prepare an MDD collection for transfer with getNextMDD() More...
 
virtual unsigned short getCollOIdsByName (unsigned long callingClientId, const char *collName, char *&typeName, char *&typeStructure, r_OId &oid, RPCOIdEntry *&oidTable, unsigned int &oidTableSize)
 gets oids of the collection specified by name More...
 
virtual unsigned short getCollOIdsByOId (unsigned long callingClientId, r_OId &oid, char *&typeName, char *&typeStructure, RPCOIdEntry *&oidTable, unsigned int &oidTableSize, char *&collName)
 gets oids of the collection specified by name More...
 
virtual unsigned short insertColl (unsigned long callingClientId, const char *collName, const char *typeName, r_OId &oid)
 create new MDD collection More...
 
virtual unsigned short deleteCollByName (unsigned long callingClientId, const char *collName)
 delete MDD collection More...
 
virtual unsigned short deleteObjByOId (unsigned long callingClientId, r_OId &oid)
 delete object by oid More...
 
virtual unsigned short removeObjFromColl (unsigned long callingClientId, const char *collName, r_OId &oid)
 remove object specified by oid from collection specified by name More...
 
virtual unsigned short getNewOId (unsigned long callingClientId, unsigned short objType, r_OId &oid)
 get new object identifier More...
 
virtual unsigned short getObjectType (unsigned long callingClientId, r_OId &oid, unsigned short &objType)
 get type of object by oid More...
 
virtual unsigned short getTypeStructure (unsigned long callingClientId, const char *typeName, unsigned short typeType, char *&typeStructure)
 get type structure of a type name More...
 
virtual unsigned short setTransferMode (unsigned long callingClientId, unsigned short format, const char *formatParams)
 set the data format used for transferring data to the client More...
 
virtual unsigned short setStorageMode (unsigned long callingClientId, unsigned short format, const char *formatParams)
 set the data format for storing data into the database More...
 

Static Public Attributes

static HttpServeractual_httpserver
 stores a pointer to the actual servercomm object, only one can exist at a time More...
 
- Static Public Attributes inherited from ServerComm
static std::list< ClientTblElt * > clientTbl
 the client table which holds information about the calling clients More...
 
static unsigned long clientCount
 last used client ID (this is increased by one to get the clientId for the next client) More...
 
static ServerCommactual_servercomm
 stores a pointer to the actual servercomm object, only one can exist at a time More...
 
static const char * HTTPCLIENT
 

Additional Inherited Members

- Public Attributes inherited from ServerComm
const unsigned long clientTimeout
 inactivity timeout in seconds after which pending client data is deleted More...
 
const unsigned long garbageCollectionInterval
 do a garbage collection every { garbageCollectionInterval} seconds (ONC RPC only) More...
 
unsigned long transactionActive
 flag for active o2 transaction (stores the clientID of the owner of the active transaction, or 0 if none open) More...
 
long memUsed
 memory used by malloc in ordinary blocks (set in dumpClientTable) More...
 
CallBackManager callback_mgr
 
- Static Protected Member Functions inherited from ServerComm
static int ensureTileFormat (r_Data_Format &hasFmt, r_Data_Format needFmt, const r_Minterval &dom, const BaseType *type, char *&data, unsigned long &size, int repack, int owner, const char *params=NULL)
 make sure a tile has the correct data format, converting if necessary More...
 
- Protected Attributes inherited from ServerComm
AdminIfadmin
 pointer to the actual administration interface object More...
 
char * errorText
 
unsigned long listenPort
 
char * rasmgrHost
 
unsigned int rasmgrPort
 
char * serverName
 
bool isHttpServer
 
- Static Protected Attributes inherited from ServerComm
static const int ENSURE_TILE_FORMAT_OK
 returns the following: More...
 
static const int ENSURE_TILE_FORMAT_BAD
 

Constructor & Destructor Documentation

HttpServer::HttpServer ( )

default constructor

HttpServer::HttpServer ( unsigned long  timeOut,
unsigned long  managementInterval,
unsigned long  listenPort,
char *  rasmgrHost,
unsigned int  rasmgrPort,
char *  serverName 
)
virtual HttpServer::~HttpServer ( )
virtual

destructor

Member Function Documentation

virtual ClientTblElt* HttpServer::getClientContext ( unsigned long  ClientId)
virtual

returns a pointer to the context of the calling client, 0 it there is no context

Executes a query and prepares the complete result for transfer via HTTP. The length of the result is returned. The first parameter is the unique client id for which the query should be executed. The second parameter The third parameter is the query itself represented as a string. { result} will contain a pointer to the result as needed for HTTP transfer. This pointer has to be freed by the caller using free.

Return values on Error: {tabular}{lll} -1 && parse errror\ -2 && execution error\ -3 && unknown error\ {tabular}

Question: How to transfer the result?

Reimplemented from ServerComm.

Reimplemented in RasServerEntry.

virtual void HttpServer::printServerStatus ( ostream &  s = cout)
virtual

print server status to { s}

Reimplemented from ServerComm.

virtual long HttpServer::processRequest ( unsigned long  callingClientId,
char *  baseName,
int  rascommand,
char *  query,
int  binDataSize,
char *  binData,
int  Endianess,
char *&  result,
char *  capability 
)
virtual

Executes a retrieval query and prepare the result for HTTP transer.

virtual void HttpServer::startRpcServer ( )
throw (r_Error
)
virtual

forces the server to listen for client calls

Reimplemented from ServerComm.

Reimplemented in RasServerEntry.

virtual void HttpServer::stopRpcServer ( )
virtual

stops the server

Reimplemented from ServerComm.

Reimplemented in RasServerEntry.

Member Data Documentation

HttpServer* HttpServer::actual_httpserver
static

stores a pointer to the actual servercomm object, only one can exist at a time


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