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

#include <servercomm.hh>

Inheritance diagram for ServerComm:
HttpServer RasServerEntry

Classes

class  ClientTblElt
 the class defines an entry of the client table More...
 

Public Member Functions

 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...
 
virtual void startRpcServer () throw ( r_Error )
 forces the server to listen for client calls More...
 
virtual void stopRpcServer ()
 stops the server 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 printServerStatus (ostream &s=cout)
 print server status with client table content to { s} More...
 
virtual void getServerStatus (ServerStatRes &returnStruct)
 get server status More...
 
virtual ClientTblEltgetClientContext (unsigned long ClientId)
 returns a pointer to the context of the calling client, 0 it there is no context 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...
 

Public Attributes

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 Public Attributes

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
 

Static Protected Member Functions

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

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

static const int ENSURE_TILE_FORMAT_OK
 returns the following: More...
 
static const int ENSURE_TILE_FORMAT_BAD
 

Constructor & Destructor Documentation

ServerComm::ServerComm ( )

default constructor

ServerComm::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

virtual ServerComm::~ServerComm ( )
virtual

destructor

Member Function Documentation

void ServerComm::abortEveryThingNow ( )

Deletes the entry of the client table corresponding to the given client id. If no corresponding id is found, false is returned.

virtual unsigned short ServerComm::abortTA ( unsigned long  callingClientId)
virtual

abort current transaction

The return value has the following meaning: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ {tabular}

void ServerComm::addClientTblEntry ( ClientTblElt context)
throw (r_Error
)

adds an entry to the client table (used in RasServerEntry)

virtual unsigned short ServerComm::aliveSignal ( unsigned long  client)
virtual

process the client's alive signal

virtual unsigned short ServerComm::beginTA ( unsigned long  callingClientId,
unsigned short  readOnly = 0 
)
virtual

open transaction

void ServerComm::clearExtendedErrorInfo ( )
void ServerComm::clientEndRequest ( )
virtual unsigned short ServerComm::closeDB ( unsigned long  callingClientId)
virtual

close current database

The method opens the database with { dbName}. The return value means the following:

{tabular}{lll} 0 && database successfully opened\ 1 && client context not found\ 2 && database does not exist\ 3 && database is already open\ {tabular}

virtual unsigned short ServerComm::commitTA ( unsigned long  callingClientId)
virtual

commit current transaction

The return value has the following meaning: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ 2 && other transaction already active\ {tabular}

virtual unsigned short ServerComm::createDB ( char *  name)
virtual

create a database

The return value has the following meaning: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ {tabular}

unsigned short ServerComm::deleteClientTblEntry ( unsigned long  ClientId)

deletes an entry of the client table (must be public because it is used in the global garbage collection function)

Adds the context entry passed to the client table. Throws an exception if context==NULL.

virtual unsigned short ServerComm::deleteCollByName ( unsigned long  callingClientId,
const char *  collName 
)
virtual

delete MDD collection

Creates a new MDD collection.

Parameters {tabular}{lll} { callingClientId} && unique client id of the calling client\ { collName} && name of the collection to be created\ { typeName} && name of the collection type\ { oid} && object identifier\ {tabular}

Return values: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ 2 && collection type name not found\ 3 && collection name exists already in the db {tabular}

virtual unsigned short ServerComm::deleteObjByOId ( unsigned long  callingClientId,
r_OId oid 
)
virtual

delete object by oid

Deletes an MDD collection. The first parameter is the unique client id for which the collection should be deleted. The second parameter is the name for the collection to be deleted.

Return values: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ 2 && collection with name does not exist\ {tabular}

virtual unsigned short ServerComm::destroyDB ( char *  name)
virtual

destroy a database

virtual unsigned short ServerComm::endInsertMDD ( unsigned long  callingClientId,
int  isPersistent 
)
virtual

finnishes the MDD creation and inserts the MDD into the collection

Splits and inserts a tile into the current MDD object.

Parameters {tabular}{lll} { callingClientId} && unique client id of the calling client\ { isPersistent} && determines wheather it is a persistent or a transient tile\ { rpcMarray} && RPC representation of the tile\ { tileSize} && r_Minterval specifying the tile-size\ {tabular}

Return values: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ 2 && base type name of inserting tile is not supported\ {tabular}

virtual unsigned short ServerComm::endTransfer ( unsigned long  client)
virtual

process the client's alive signal

The Method gets the next tile of the actual MDD of the actual transfer collection. The first parameter is the unique client id. The second parameter is the RPC representation of the Marray representing the tile. If a tile is too large to be transferred in one piece, the data is split. To get the rest of the data, consecutively use this method.

Return values: {tabular}{lll} 0 && operation was successful, no further MDDs are left\ 1 && operation was successful, at least one MDD is left in the transfer collection\ 2 && operation was successful, at least one tile is left in the actual MDD\ 3 && operation was successful, at least one block is left in the actual tile\ 4 && client context not found, no tiles in the MDD object, no actual transfer collection \ && or nothing left in the collection\ {tabular}

Examples of valid return value chains: {itemize} To be transferred: 1 MDD consisting of 1 tile (which is too large)\ {verbatim} 3 ->...-> 3 -> 0 {verbatim} To be transferred: 1 MDD consisting of 2 tiles (the first is too large)\ {verbatim} 3 ->...-> 3 -> 2 -> 0 |--------——| | 1st tile 2nd tile {verbatim} To be transferred: 2 MDDs, each consisting of 1 tile (none too large)\ {verbatim} 1 -> 0 {verbatim} To be transferred: 3 MDDs, the first (A) consisting of 1 tile (not too large),\ the second (B) consisting of 2 tiles (B1, B2, of which the first is too large), the third (C) consisting of 2 tiles (C1, C2, of which the second is too large), {verbatim} 1 -> 3 ->...-> 3 -> 2 -> 1 -> 2 -> 3 ->...-> 3 -> 0 | |--------——| | | |--------——| | B1 B2 C1 C2 | |-------------——| |-------------——| A B C {verbatim} {itemize}

static int ServerComm::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 
)
staticprotected

make sure a tile has the correct data format, converting if necessary

virtual unsigned short ServerComm::executeQuery ( unsigned long  callingClientId,
const char *  query,
ExecuteQueryRes returnStructure 
)
virtual

executes a retrieval query and prepares the result for transfer with {getNextMDD}.

virtual unsigned short ServerComm::executeUpdate ( unsigned long  callingClientId,
const char *  query,
ExecuteUpdateRes returnStructure 
)
virtual

executes an update query

Return values: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ {tabular}

Communication protocol {tabular}{lll} {initExecuteUpdate} && \ -> && {startInsertTransMDD} \ && -> && {insertTile} \ && && :\ && {endInsertMDD}\ && :\ {executeUpdate} && \ {tabular}

Note: Method {executeUpdate} can be invoked without the {initExecuteUpdate} prolog in case of no constant MDD objects.

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

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

return values exactly like setTransferMode()

Reimplemented in HttpServer, and RasServerEntry.

virtual unsigned short ServerComm::getCollByName ( unsigned long  callingClientId,
const char *  collName,
char *&  typeName,
char *&  typeStructure,
r_OId oid 
)
virtual

prepare an MDD collection for transfer with getNextMDD()

Inserts an object into an MDD collection. It is transfered in one piece.

Parameters {tabular}{lll} { callingClientId} && unique client id of the calling client\ { collName} && name of the collection to insert the MDD object\ { rpcMarray} && RPC representation of the MDD object\ { typeName} && type structure as string representation\ { oid} && object identifier\ {tabular}

Return values: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ 2 && MDD type name not found\ 3 && types of MDD and collection are incompatible\ 4 && MDD and its type are incompatible\ 5 && collection does not exist\ 6 && creation of persistent object failed\ {tabular}

virtual unsigned short ServerComm::getCollByOId ( unsigned long  callingClientId,
r_OId oid,
char *&  typeName,
char *&  typeStructure,
char *&  collName 
)
virtual

prepare an MDD collection for transfer with getNextMDD()

ATTENTION: This function is not used at the moment. It hast to be adapted to transferData.

Prepares an MDD collection for transfer with getNextMDD().

Parameters {tabular}{lll} { callingClientId} && unique client id of the calling client\ { collName} && name of the collection to be got\ { typeName} && returns name of the collection type\ { typeStructure} && returns structure of the collection type\ { oid} && returns oid of the collection\ {tabular}

The first parameter is the unique client id. The second parameter is the name of the collection to get. { typeName} returns the name of the collection type and { typeStructure} its type structure.

Return values: {tabular}{lll} 0 && operation was successful - collection has some elements\ 1 && operation was successful - collection has no elements\ 2 && collection is not known\ 3 && client context not found\ {tabular}

virtual unsigned short ServerComm::getCollOIdsByName ( unsigned long  callingClientId,
const char *  collName,
char *&  typeName,
char *&  typeStructure,
r_OId oid,
RPCOIdEntry *&  oidTable,
unsigned int &  oidTableSize 
)
virtual

gets oids of the collection specified by name

ATTENTION: This function is not used at the moment. It hast to be adapted to transferData.

Prepares an MDD collection for transfer with {getNextMDD}.

Parameters {tabular}{lll} { callingClientId} && unique client id of the calling client\ { oid} && oid of the collection to be got\ { typeName} && returns name of the collection type\ { typeStructure} && returns structure of the collection type\ { collName} && returns name of collection\ {tabular}

Return values: {tabular}{lll} 0 && operation was successful - collection has some elements\ 1 && operation was successful - collection has no elements\ 2 && collection is not known\ 3 && client context not found\ {tabular}

virtual unsigned short ServerComm::getCollOIdsByOId ( unsigned long  callingClientId,
r_OId oid,
char *&  typeName,
char *&  typeStructure,
RPCOIdEntry *&  oidTable,
unsigned int &  oidTableSize,
char *&  collName 
)
virtual

gets oids of the collection specified by name

Gets the collection of oids of the collection with { collName}.

Parameters {tabular}{lll} { callingClientId} && unique client id of the calling client\ { collName} && name of the collection to be got\ { typeName} && returns name of the collection type\ { typeStructure} && returns structure of the collection type\ { oid} && returns object identifier\ { oidTable} && returns an array of pointers to oids\ { oidTableSize} && returns the no of elements in the table\ {tabular}

Return values: {tabular}{lll} 0 && operation was successful - collection has some elements\ 1 && operation was successful - collection has no elements\ 2 && collection is not known\ 3 && client context not found\ {tabular}

const char* ServerComm::getExtendedErrorInfo ( )

Returns a pointer to the context of the calling client. This is done by searching the client table maintained by the server for the given client id. If there is no context corresponding to the client id, 0 is returned.

Attention: After a client context was successfully received it has to be released using its member function release();

virtual unsigned short ServerComm::getMDDByOId ( unsigned long  callingClientId,
r_OId oid,
r_Minterval mddDomain,
char *&  typeName,
char *&  typeStructure,
unsigned short &  currentFormat 
)
virtual

get an MDD by OId

The Method gets the next non-MDD element in the actual transfer collection. The first parameter is the unique client id. The second parameter returns a pointer to the memory occupied by the next element and the third one delivers the size of the buffer.

Return values: {tabular}{lll} 0 && operation was successful, at least one element is left in the transfer collection\ 1 && operation succesful, nothing left in the transfer collection\ 2 && client context not found, no tiles in the MDD object, no actual transfer collection \ {tabular}

virtual unsigned short ServerComm::getNewOId ( unsigned long  callingClientId,
unsigned short  objType,
r_OId oid 
)
virtual

get new object identifier

The method removes the object with {\t oid} from collection with { collName}. The first parameter is the unique client id for which the object should be removed.

Return values: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ 2 && specified collection does not exist\ 3 && specified object does not exist in the collection\ {tabular}

virtual unsigned short ServerComm::getNextElement ( unsigned long  callingClientId,
char *&  buffer,
unsigned int &  bufferSize 
)
virtual

get the next scalar element in the actual transfer collection.

The Method gets the domain of the next MDD of the actual transfer collection. The first parameter is the unique client id. The second parameter returns the domain of the MDD to be transfered. { typeName} returns the name of the MDD type and its structure. Transfer of MDD data is tile-based using the method {getNextTile}.

Return values: {tabular}{lll} 0 && operation was successful, at least one MDD is left in the transfer collection\ 1 && nothing left in the transfer collection\ 2 && client context not found, no tiles in the MDD object, no actual transfer collection \ {tabular}

virtual unsigned short ServerComm::getNextMDD ( unsigned long  callingClientId,
r_Minterval mddDomain,
char *&  typeName,
char *&  typeStructure,
r_OId oid,
unsigned short &  currentFormat 
)
virtual

get the domain of the next MDD of the actual transfer collection

Executes a query and puts the result in the actual transfer collection. The first parameter is the unique client id for which the query should be executed. The second parameter is the query itself represented as a string.

Return values {tabular}{lll} 0 && operation was successful - result collection holds MDD elements\ 1 && operation was successful - result collection holds non-MDD elements\ 2 && operation was successful - result collection has no elements\ 3 && client context not found\ 4 && parse errror\ 5 && execution error\ {tabular}

Communication protocol (return value = 0) {tabular}{lll} {executeQuery} && \ -> && {getNextMDD} \ && -> && {getNextTile} \ && && : \ && :\ {endTransfer} \ {tabular}

Communication protocol (return value = 1) {tabular}{lll} {executeQuery} && \ -> && {getNextElement} \ && :\ {endTransfer} \ {tabular}

virtual unsigned short ServerComm::getNextTile ( unsigned long  callingClientId,
RPCMarray **  rpcMarray 
)
virtual

get next tile of the actual MDD of the actual transfer collection

The Method gets an MDD by OId { oid}. If the MDD is found, it is initialized as transfer object and can be picked up by {getNextTile} calls (tile-based transfer).

Additionally, the method returns domain, type name, and type structure of the found MDD object by reference parameters.

Return values: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ 2 && object with this oid not found\ 3 && object has no tiles {tabular}

Communication protocol {tabular}{lll} {getMDDByOId} \ -> && {getNextTile} \ && : \ {endTransfer} \ {tabular}

virtual unsigned short ServerComm::getObjectType ( unsigned long  callingClientId,
r_OId oid,
unsigned short &  objType 
)
virtual

get type of object by oid

Creates a new oid and gives it back by the refernce parameter { oid}. { objType} determines the type of object for which that oid is allocated. The folowing values are supported: 1 = MDD, 2 = Collection.

Return values: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ 2 && error while creating oid\ {tabular}

virtual void ServerComm::getServerStatus ( ServerStatRes returnStruct)
virtual

get server status

virtual unsigned short ServerComm::getTypeStructure ( unsigned long  callingClientId,
const char *  typeName,
unsigned short  typeType,
char *&  typeStructure 
)
virtual

get type structure of a type name

Determines the type of the object indicated by { oid}. The type is returned by the reference parameter { objType}. The folowing types are supported: 1 = MDD, 2 = Collection.

Return values: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ 2 && oid not found\ {tabular}

void ServerComm::informRasMGR ( int  )
virtual unsigned short ServerComm::initExecuteUpdate ( unsigned long  callingClientId)
virtual

prepares transfer of MDD constants and execution of update query

The method terminates a transfer session and releases all transfer structures.

Return values: {tabular}{lll} 0 && operation was successfull\ 1 && client context not found\ {tabular}

virtual unsigned short ServerComm::insertColl ( unsigned long  callingClientId,
const char *  collName,
const char *  typeName,
r_OId oid 
)
virtual

create new MDD collection

Gets the collection of oids of the collection with { collName}.

Parameters {tabular}{lll} { callingClientId} && unique client id of the calling client\ { oid} && oid of the collection to be got\ { typeName} && returns name of the collection type\ { typeStructure} && returns structure of the collection type\ { oidTable} && returns an array of pointers to oids\ { oidTableSize} && returns the no of elements in the table\ { collName} && returns name of collection\ {tabular}

Return values: {tabular}{lll} 0 && operation was successful - collection has some elements\ 1 && operation was successful - collection has no elements\ 2 && collection is not known\ 3 && client context not found\ {tabular}

virtual unsigned short ServerComm::insertMDD ( unsigned long  callingClientId,
const char *  collName,
RPCMarray rpcMarray,
const char *  typeName,
r_OId oid 
)
virtual

insert object into collection

Parameters {tabular}{lll} { callingClientId} && unique client id of the calling client\ { isPersistent} && determines wheather it is a persistent or a transient MDD\ {tabular}

virtual unsigned short ServerComm::insertTile ( unsigned long  callingClientId,
int  isPersistent,
RPCMarray rpcMarray 
)
virtual

insert a tile into a persistent MDD object

Creates an object for tile based transfer with method {insertTile} to be inserted into the specified MDD collection.

Parameters {tabular}{lll} { callingClientId} && unique client id of the calling client\ { collName} && name of the collection to insert the MDD object\ { domain} && spatial domain\ { typeLength} && size of base type in bytes\ { typeName} && type structure as string representation\ { oid} && object identifier\ {tabular}

Return values {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ 2 && MDD type name not found\ 3 && types of MDD and collection are incompatible\ 4 && MDD and its type are incompatible\ 5 && collection does not exist\ 6 && creation of persistent object failed\ {tabular}

Communication protocol {tabular}{lll} {startInsertPersMDD} && \ -> && {insertTile} \ && :\ {endInsertMDD} && \ {tabular}

virtual unsigned short ServerComm::insertTileSplitted ( unsigned long  callingClientId,
int  isPersistent,
RPCMarray rpcMarray,
r_Minterval tileSize 
)
virtual

Inserts a tile into the current MDD object.

Parameters {tabular}{lll} { callingClientId} && unique client id of the calling client\ { isPersistent} && determines wheather it is a persistent or a transient tile\ { rpcMarray} && RPC representation of the tile\ {tabular}

Return values: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ 2 && base type name of inserting tile is not supported\ {tabular}

virtual bool ServerComm::isTAOpen ( unsigned long  callingClientId)
virtual

is transaction open currently?

The return value has the following meaning: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ {tabular} The return value has the following meaning: {tabular}{lll} true && a transaction is open\ false && no transaction is open\ {tabular}

virtual unsigned short ServerComm::openDB ( unsigned long  callingClientId,
const char *  dbName,
const char *  userName 
)
virtual

open database

The method take the alive signal of a client and updates the last action time.

Return values: {tabular}{lll} 0 && operation was successfull\ 1 && client context not found\ {tabular}

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

print server status with client table content to { s}

Reimplemented in HttpServer.

virtual unsigned short ServerComm::removeObjFromColl ( unsigned long  callingClientId,
const char *  collName,
r_OId oid 
)
virtual

remove object specified by oid from collection specified by name

Deletes the object with { oid}. The first parameter is the unique client id for which the object should be deleted.

Return values: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ 2 && object with oid does not exist\ {tabular}

void ServerComm::setExtendedErrorInfo ( const char *  )
virtual unsigned short ServerComm::setStorageMode ( unsigned long  callingClientId,
unsigned short  format,
const char *  formatParams 
)
virtual

set the data format for storing data into the database

Sets the data format used by the server to transfer data to the client to format which is of type r_Data_Format.

Return values: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ 2 && unknown or unsupported data format\ {tabular}

virtual unsigned short ServerComm::setTransferMode ( unsigned long  callingClientId,
unsigned short  format,
const char *  formatParams 
)
virtual

set the data format used for transferring data to the client

Determines the type structure of the type specified by { typeName}. The type either can be a set type (typeType=1), an mdd type (typeType=2), or a base type (typeType = 3).

   Return values:
   \begin{tabular}{lll}
   0 && operation was successful\\
   1 && client context not found\\
   2 && type name not found\\
   \end{tabular}
virtual unsigned short ServerComm::startInsertPersMDD ( unsigned long  callingClientId,
const char *  collName,
r_Minterval domain,
unsigned long  typeLength,
const char *  typeName,
r_OId oid 
)
virtual

create a new persistent MDD object for tile based transfers

Creates an object for tile based transfer with method {insertTile}.

The first parameter is the unique client id for which the MDD should be created. The second parameter is the name of the collection to insert the MDD object. The third parameter holds the spatial domain of the following MDD object and { typeLength} specifies the size of the base type in bytes. The last one gives the type structure as string representation.

Return values: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ 2 && MDD type name not found\ 3 && MDD and its type are incompatible\ {tabular}

virtual unsigned short ServerComm::startInsertTransMDD ( unsigned long  callingClientId,
r_Minterval domain,
unsigned long  typeLength,
const char *  typeName 
)
virtual

prepares an MDD (transient) for transfer of tiles

Executes an update query. The first parameter is the unique client id for which the query should be executed. The second parameter is the query itself represented as a string.

Return values: {tabular}{lll} 0 && operation was successful\ 1 && client context not found\ 2 && parse errror\ 3 && execution error\ {tabular}

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

forces the server to listen for client calls

Reimplemented in HttpServer, and RasServerEntry.

virtual void ServerComm::stopRpcServer ( )
virtual

stops the server

Reimplemented in HttpServer, and RasServerEntry.

Member Data Documentation

ServerComm* ServerComm::actual_servercomm
static

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

AdminIf* ServerComm::admin
protected

pointer to the actual administration interface object

CallBackManager ServerComm::callback_mgr

the callback manager object for garbage collection, license check, ... Always instantiated with default size, resized on startup if required.

unsigned long ServerComm::clientCount
static

last used client ID (this is increased by one to get the clientId for the next client)

std::list<ClientTblElt*> ServerComm::clientTbl
static

the client table which holds information about the calling clients

const unsigned long ServerComm::clientTimeout

inactivity timeout in seconds after which pending client data is deleted

const int ServerComm::ENSURE_TILE_FORMAT_BAD
staticprotected
const int ServerComm::ENSURE_TILE_FORMAT_OK
staticprotected

returns the following:

char* ServerComm::errorText
protected
const unsigned long ServerComm::garbageCollectionInterval

do a garbage collection every { garbageCollectionInterval} seconds (ONC RPC only)

const char* ServerComm::HTTPCLIENT
static
bool ServerComm::isHttpServer
protected
unsigned long ServerComm::listenPort
protected
long ServerComm::memUsed

memory used by malloc in ordinary blocks (set in dumpClientTable)

char* ServerComm::rasmgrHost
protected
unsigned int ServerComm::rasmgrPort
protected
char* ServerComm::serverName
protected
unsigned long ServerComm::transactionActive

flag for active o2 transaction (stores the clientID of the owner of the active transaction, or 0 if none open)


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