rasdaman complete source
httpserver.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 /
33 #ifndef _HTTPSERVER_
34 #define _HTTPSERVER_
35 
36 #include "servercomm/servercomm.hh"
37 
38 //@ManMemo: Module: {\bf servercomm}
39 
40 /*@Doc:
41  The class HttpServer describes the one and only server communication object
42  that can exist in a RasDaMan server. It manages listening for clients and
43  maps incoming calls to the respective procedures (which reside in the
44  file manager.cc).
45 
46  This class implements the functions useful for HTTP communication
47  and is based on a copy of servercomm.hh (Version 1.48).
48 */
49 
50 
51 class HttpServer : public ServerComm
52 {
53 public:
54 
57  {
58  public:
59 
64  char *domain;
65  char *tileSize;
66  char *oidString;
67  int dataSize;
68  char *binData;
70 
72  MDDEncoding();
73 
75  ~MDDEncoding();
76 
77  // set objectType
78  void setObjectType(int type);
79 
80  // set objectTypeName
81  void setObjectTypeName(char *name);
82 
83  // set typeStructure
84  void setTypeStructure(char* type);
85 
86  // set typeLength
87  void setTypeLength(int len);
88 
89  // set domain
90  void setDomain(char *dom);
91 
92  // set oid
93  void setOID(char *o);
94 
95  // set tile size
96  void setTileSize(char *size);
97 
98  // set dataSize
99  void setDataSize(int size);
100 
101  // set binData
102  void setBinData(char *data);
103 
104  // print Values
105  const char* toString();
106  };
107 
108 
111 
112  // the class uses the class ClientTblElt from ServerComm because it is used
113  // in some other files of the server, e.g., qlparser/qtmddaccess.cc or
114  // qlparser/qtcommand.cc or qlparser/qtinsert.cc all include servercomm.hh
115 
117  HttpServer();
118 
119  // the acual constructor
120  HttpServer( unsigned long timeOut, unsigned long managementInterval , unsigned long listenPort, char* rasmgrHost, unsigned int rasmgrPort,char* serverName);
121 
123  virtual ~HttpServer();
124 
126  virtual void startRpcServer() throw( r_Error );
127 
129  virtual void stopRpcServer();
130 
132  virtual void printServerStatus( ostream& s=cout );
133 
135  virtual long processRequest( unsigned long callingClientId, char* baseName,
136  int rascommand, char* query, int binDataSize, char *binData,
137  int Endianess, char* &result, char *capability );
157  virtual ClientTblElt* getClientContext( unsigned long ClientId );
163 private:
164  int doIt_httpserver( int argc, char *argv[] );
165 
166 
167  bool flagInformRasMgr; // used to trigger informRasMGR(SERVERAVAILABLE)
168 
169 };
170 
171 #include "httpserver.icc"
172 
173 #endif
char * typeStructure
Definition: httpserver.hh:62
void setBinData(char *data)
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.
~MDDEncoding()
destructor
char * objectTypeName
Definition: httpserver.hh:61
HttpServer()
default constructor
void setTileSize(char *size)
virtual void printServerStatus(ostream &s=cout)
print server status to { s}
virtual void stopRpcServer()
stops the server
char * domain
Definition: httpserver.hh:64
Definition: error.hh:88
MDDEncoding()
default constructor
char * serverName
Definition: servercomm.hh:1073
void setObjectTypeName(char *name)
virtual ClientTblElt * getClientContext(unsigned long ClientId)
returns a pointer to the context of the calling client, 0 it there is no context
the class defines an entry of the client table
Definition: servercomm.hh:86
char * tileSize
Definition: httpserver.hh:65
int typeLength
Definition: httpserver.hh:63
static HttpServer * actual_httpserver
stores a pointer to the actual servercomm object, only one can exist at a time
Definition: httpserver.hh:110
int objectType
Definition: httpserver.hh:60
void setDataSize(int size)
char * rasmgrHost
Definition: servercomm.hh:1071
void setObjectType(int type)
Definition: httpserver.hh:51
unsigned long listenPort
Definition: servercomm.hh:1070
const char * toString()
unsigned int rasmgrPort
Definition: servercomm.hh:1072
virtual void startRpcServer()
forces the server to listen for client calls
char * oidString
Definition: httpserver.hh:66
char * binData
Definition: httpserver.hh:68
void setTypeLength(int len)
void setDomain(char *dom)
char * stringRepresentation
Definition: httpserver.hh:69
the class represents an MDD in HTTP transfer encoding
Definition: httpserver.hh:56
virtual ~HttpServer()
destructor
void setTypeStructure(char *type)
int dataSize
Definition: httpserver.hh:67
Definition: servercomm.hh:81