summaryrefslogtreecommitdiffstats
path: root/server/rasserver_entry.hh
blob: 8869d030502faa6c843c195e8fc3cc79dc382872 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*
* This file is part of rasdaman community.
*
* Rasdaman community is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Rasdaman community is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with rasdaman community.  If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
rasdaman GmbH.
*
* For more information please see <http://www.rasdaman.org>
* or contact Peter Baumann via <baumann@rasdaman.com>.
*/
#ifndef RASSERVER_ENTRY_HH
#define RASSERVER_ENTRY_HH

/* 
  This class is the entry point of the rasdaman server. It's the interface of the server to the outside world
  It's functions are called by the communication level.
  
  For now the class inherites HttpServer which inherites ServerComm, but only to have nice acces to the stuff
  found there. Later we will drop both of them and make the life easier.
*/

#include "servercomm/httpserver.hh"


/**
  * \ingroup Servers
  */
class RasServerEntry : public HttpServer
  {
    private:
      RasServerEntry();
      static RasServerEntry* myself;
    public:
      static RasServerEntry& getInstance();

      ~RasServerEntry();
      
      //### inherited stuff - we have to keep them for now
      void startRpcServer() throw( r_Error );
      void stopRpcServer();
      //###
	
	void compat_connectToDBMS() throw( r_Error );
	
	// All "compat_" functions use old ServerComm and HttpServer stuff to do their job
	// Later, the new functions will do the job proper and this old functions will be dropped!
	void compat_connectNewClient(const char *capability);
	    unsigned long currentClientIdx;
	    ClientTblElt* getClientContext( unsigned long ClientId ); // inherited...
	    ClientTblElt* currentClientContext;

	void compat_disconnectClient();	
	
	void compat_openDB(const char* databaseName);
	
	void compat_closeDB();
	
	void compat_beginTA(bool rw);
	
	void compat_commitTA();
	
	void compat_abortTA();
	
	bool compat_isOpenTA();
	
	// provided for temporary compatibility with the encoding of the java interface
	// resultBuffer will be allocated and it's address stored in the given pointer
	// result is the length of the result
	int compat_executeQueryHttp(const char* httpParams, int httpParamsLen, char*& resultBuffer);
	
	r_OId compat_getNewOId(unsigned short objType); // 1 - mddType, 2 -collType
	
	int  compat_executeQueryRpc(const char* query, ExecuteQueryRes &queryResult);

	int  compat_getNextElement(char* &buffer, unsigned int  &bufferSize );
	
	int  compat_endTransfer();
        
	int  compat_getNextMDD(r_Minterval &mddDomain, char* &typeName, char* &typeStructure, r_OId &oid,unsigned short &currentFormat);

        int  compat_getNextTile(RPCMarray** rpcMarray);

	int  compat_ExecuteUpdateQuery(const char *query, ExecuteUpdateRes &returnStructure);

	int  compat_InitUpdate();
        
	int  compat_StartInsertTransMDD(const char *domain, int typeLength, const char *typeName);
	
        int  compat_InsertTile(int persistent, RPCMarray*);
	
        int  compat_EndInsertMDD(int persistent);
        
	int  compat_GetTypeStructure(const char *typeName, int typeType, char* &typeStructure);
	
        int  compat_StartInsertPersMDD(const char *collName, r_Minterval &mddDomain, int typeLength, const char *typeName, r_OId &oid);
        
	int  compat_InsertMDD(const char *collName, RPCMarray *rpcMarray, const char *typeName, r_OId &oid);
	
	int  compat_InsertCollection(const char *collName, const char *typeName, r_OId &oid);

        int  compat_DeleteCollByName(const char *collName);
	
        int  compat_DeleteObjByOId(r_OId &oid);
	
        int  compat_RemoveObjFromColl(const char *collName, r_OId &oid);
	
	int  compat_GetCollectionByName(const char* collName, char* &typeName, char* &typeStructure, r_OId &oid);
	
	int  compat_GetCollectionByName(r_OId oid, char* &typeName, char* &typeStructure, char* &collName);	

	int  compat_GetCollectionOidsByName(const char* collName, char* &typeName, char* &typeStructure, r_OId &oid, RPCOIdEntry* &oidTable, unsigned int &oidTableSize);
	
	int  compat_GetCollectionOidsByOId(r_OId oid, char* &typeName, char* &typeStructure, RPCOIdEntry* &oidTable, unsigned int &oidTableSize, char* &collName);
	
	int  compat_GetObjectType(r_OId &oid, unsigned short &objType);

	int  compat_SetTransferFormat(int format, const char* params);
    
        int  compat_SetStorageFormat(int format, const char* params);
	
	
	r_OId createCollection(const char* collName, const char* collTypeName);
	
	r_OId createMDD(const char* collName, const char* mddTypeName, const char* definitionDomain, const char* tileDomain, bool rcindex);
	
	void  extendMDD(r_OId mddOId, const char *stripeDomain, const char* tileDomain);
	
	vector<r_Minterval> getTileDomains(r_OId mddOId, const char *stripeDomain);

   };
#endif