Changeset 301
- Timestamp:
- Aug 5, 2011, 3:02:43 PM (13 years ago)
- Location:
- branches/branch-1.2
- Files:
-
- 25 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1.2
-
branches/branch-1.2/thirds/cgic206/Makefile
r78 r301 1 1 OS:=$(shell uname -s) 2 2 ifeq ($(OS),Darwin) 3 MACOS_CFLAGS=-arch i386 -arch ppc -arch x86_643 MACOS_CFLAGS=-arch $(shell uname -m) 4 4 LIBS= -L./ -lcgic /usr/lib/libfcgi.dylib 5 5 else -
branches/branch-1.2/zoo-api/js/ZOO-api.js
r217 r301 6067 6067 * needs to be interpreted. 6068 6068 */ 6069 Execute: function(inputs ) {6069 Execute: function(inputs,outputs) { 6070 6070 if (this.identifier == null) 6071 6071 return null; 6072 var body = new XML('<wps:Execute service="WPS" version="1.0.0" xmlns:wps="'+this.namespaces['wps']+'" xmlns:ows="'+this.namespaces['ows']+'" xmlns:xlink="'+this.namespaces['xlink']+'" xmlns:xsi="'+this.namespaces['xsi']+'" xsi:schemaLocation="'+this.schemaLocation+'"><ows:Identifier>'+this.identifier+'</ows:Identifier>'+this.buildDataInputsNode(inputs)+ '</wps:Execute>');6072 var body = new XML('<wps:Execute service="WPS" version="1.0.0" xmlns:wps="'+this.namespaces['wps']+'" xmlns:ows="'+this.namespaces['ows']+'" xmlns:xlink="'+this.namespaces['xlink']+'" xmlns:xsi="'+this.namespaces['xsi']+'" xsi:schemaLocation="'+this.schemaLocation+'"><ows:Identifier>'+this.identifier+'</ows:Identifier>'+this.buildDataInputsNode(inputs)+this.buildDataOutputsNode(outputs)+'</wps:Execute>'); 6073 6073 body = body.toXMLString(); 6074 6074 var response = ZOO.Request.Post(this.url,body,['Content-Type: text/xml; charset=UTF-8']); 6075 6075 return response; 6076 6076 }, 6077 /** 6078 * Property: buildInput 6079 * Object containing methods to build WPS inputs. 6080 */ 6081 buildInput: { 6082 /** 6083 * Method: buildInput.complex 6084 * Given an E4XElement representing the WPS complex data input. 6077 buildOutput:{ 6078 /** 6079 * Method: buildOutput.ResponseDocument 6080 * Given an E4XElement representing the WPS ResponseDocument output. 6085 6081 * 6086 6082 * Parameters: … … 6091 6087 * {E4XElement} A WPS Input node. 6092 6088 */ 6089 'ResponseDocument': function(identifier,obj) { 6090 var output = new XML('<wps:ResponseForm xmlns:wps="'+this.namespaces['wps']+'"><wps:ResponseDocument><wps:Output'+(obj["mimeType"]?' mimeType="'+obj["mimeType"]+'" ':'')+(obj["encoding"]?' encoding="'+obj["encoding"]+'" ':'')+(obj["asReference"]?' asReference="'+obj["asReference"]+'" ':'')+'><ows:Identifier xmlns:ows="'+this.namespaces['ows']+'">'+identifier+'</ows:Identifier></wps:Output></wps:ResponseDocument></wps:ResponseForm>'); 6091 if (obj.encoding) 6092 output.*::Data.*::ComplexData.@encoding = obj.encoding; 6093 if (obj.schema) 6094 output.*::Data.*::ComplexData.@schema = obj.schema; 6095 output = output.toXMLString(); 6096 return output; 6097 }, 6098 'RawDataOutput': function(identifier,obj) { 6099 var output = new XML('<wps:ResponseForm xmlns:wps="'+this.namespaces['wps']+'"><wps:RawDataOutput><wps:Output '+(obj["mimeType"]?' mimeType="'+obj["mimeType"]+'" ':'')+(obj["encoding"]?' encoding="'+obj["encoding"]+'" ':'')+'><ows:Identifier xmlns:ows="'+this.namespaces['ows']+'">'+identifier+'</ows:Identifier></wps:Output></wps:RawDataOutput></wps:ResponseForm>'); 6100 if (obj.encoding) 6101 output.*::Data.*::ComplexData.@encoding = obj.encoding; 6102 if (obj.schema) 6103 output.*::Data.*::ComplexData.@schema = obj.schema; 6104 output = output.toXMLString(); 6105 return output; 6106 } 6107 6108 }, 6109 /** 6110 * Property: buildInput 6111 * Object containing methods to build WPS inputs. 6112 */ 6113 buildInput: { 6114 /** 6115 * Method: buildInput.complex 6116 * Given an E4XElement representing the WPS complex data input. 6117 * 6118 * Parameters: 6119 * identifier - {String} the input indetifier 6120 * data - {Object} A WPS complex data input. 6121 * 6122 * Returns: 6123 * {E4XElement} A WPS Input node. 6124 */ 6093 6125 'complex': function(identifier,data) { 6094 var input = new XML('<wps:Input xmlns:wps="'+this.namespaces['wps']+'"><ows:Identifier xmlns:ows="'+this.namespaces['ows']+'">'+identifier+'</ows:Identifier><wps:Data><wps:ComplexData> '+data.value+'</wps:ComplexData></wps:Data></wps:Input>');6095 input.*::Data.*::ComplexData.@mimeType = data.mimetype ? data.mimetype : ' text/plain';6126 var input = new XML('<wps:Input xmlns:wps="'+this.namespaces['wps']+'"><ows:Identifier xmlns:ows="'+this.namespaces['ows']+'">'+identifier+'</ows:Identifier><wps:Data><wps:ComplexData><![CDATA['+data.value+']]></wps:ComplexData></wps:Data></wps:Input>'); 6127 input.*::Data.*::ComplexData.@mimeType = data.mimetype ? data.mimetype : 'application/json'; 6096 6128 if (data.encoding) 6097 6129 input.*::Data.*::ComplexData.@encoding = data.encoding; … … 6160 6192 return '<wps:DataInputs xmlns:wps="'+this.namespaces['wps']+'">'+inputsArray.join('\n')+'</wps:DataInputs>'; 6161 6193 }, 6194 6195 buildDataOutputsNode:function(outputs){ 6196 var data, builder, outputsArray=[]; 6197 for (var attr in outputs) { 6198 data = outputs[attr]; 6199 builder = this.buildOutput[data.type]; 6200 outputsArray.push(builder.apply(this,[attr,data])); 6201 } 6202 return outputsArray.join('\n'); 6203 }, 6204 6162 6205 CLASS_NAME: "ZOO.Process" 6163 6206 }); -
branches/branch-1.2/zoo-kernel/Makefile.in
r217 r301 2 2 ifeq ($(OS),Darwin) 3 3 MACOS_LD_FLAGS=-lintl -framework SystemConfiguration -framework CoreFoundation 4 MACOS_CFLAGS=-arch i386 -arch ppc -arch x86_644 MACOS_CFLAGS=-arch $(shell uname -m) 5 5 endif 6 6 -
branches/branch-1.2/zoo-kernel/configure.ac
r217 r301 122 122 [PYTHON_PATH="$withval"; PYTHON_ENABLED="-DUSE_PYTHON"], [PYTHON_ENABLED=""]) 123 123 124 AC_ARG_WITH([pyvers], 125 [AS_HELP_STRING([--with-pyvers=NUM], [To use a specific python version])], 126 [PYTHON_VERS="$withval"], [PYTHON_VERS=""]) 127 124 128 125 129 if test -z "$PYTHON_ENABLED" … … 127 131 PYTHON_FILE="" 128 132 else 129 PYTHONCONFIG="$PYTHON_PATH/bin/python -config"133 PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config" 130 134 PYTHON_FILE="service_internal_python.o" 131 135 if test "$PYTHON_PATH" = "yes" 132 136 then 133 137 # PHP was not specified, so search within the current path 134 AC_PATH_PROG([PYTHONCONFIG], [python -config])135 else 136 PYTHONCONFIG="$PYTHON_PATH/bin/python -config"138 AC_PATH_PROG([PYTHONCONFIG], [python${PYTHON_VERS}-config]) 139 else 140 PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config" 137 141 fi 138 142 … … 314 318 JS_FILE="" 315 319 else 320 JS_FILE="service_internal_js.o" 316 321 if test "$JSHOME" = "yes" 317 322 then 318 JS_FILE="service_internal_js.o"319 323 320 324 #on teste si on est sous debian like 321 325 if test -f "/usr/bin/dpkg" 322 326 then 323 if test -n "`dpkg -l | grep libmozjs -dev`"327 if test -n "`dpkg -l | grep libmozjs185-dev`" 324 328 then 325 JS_CPPFLAGS="-I/usr/include/ mozjs/"326 JS_LDFLAGS="-L/usr/lib -lmozjs -lm"327 JS_LIB="mozjs "329 JS_CPPFLAGS="-I/usr/include/js/" 330 JS_LDFLAGS="-L/usr/lib -lmozjs185 -lm" 331 JS_LIB="mozjs185" 328 332 else 329 XUL_VERSION="`dpkg -l | grep xulrunner | grep dev | awk '{print $3;}' | sed -e 's/\([[0-9]]\{1,2\}\.[[0-9]]\{1,2\}\.[[0-9]]\{1,2\}\.[[0-9]]\{1,2\}\).*/\1/'`"333 XUL_VERSION="`dpkg -l | grep xulrunner | grep dev | head -1| awk '{print $3;}' | cut -d'+' -f1`" 330 334 if test -n "$XUL_VERSION" 331 335 then … … 334 338 JS_LIB="mozjs" 335 339 else 336 AC_MSG_ERROR([You must install libmozjs -dev or xulrunner-dev ])340 AC_MSG_ERROR([You must install libmozjs185-dev or xulrunner-dev ]) 337 341 fi 338 342 fi 339 343 else 340 AC_MSG_ERROR([You must specify your custom install of lib js])344 AC_MSG_ERROR([You must specify your custom install of libmozjs185]) 341 345 fi 342 346 else 343 JS_CPPFLAGS="-I$JSHOME/include/ "344 JS_LDFLAGS="-L$JSHOME/lib -lmozjs -lm"345 JS_LIB="mozjs "347 JS_CPPFLAGS="-I$JSHOME/include/js/" 348 JS_LDFLAGS="-L$JSHOME/lib -lmozjs185 -lm" 349 JS_LIB="mozjs185" 346 350 347 351 fi … … 356 360 LIBS="$JS_LDFLAGS" 357 361 358 AC_CHECK_LIB([$JS_LIB], [JS_C allFunctionName], [], [AC_MSG_ERROR([could not find $JS_LIB])], [])362 AC_CHECK_LIB([$JS_LIB], [JS_CompileFile,JS_CallFunctionName], [], [AC_MSG_ERROR([could not find $JS_LIB])], []) 359 363 360 364 AC_SUBST([JS_CPPFLAGS]) … … 366 370 367 371 AC_CONFIG_FILES([Makefile]) 372 AC_CONFIG_FILES([ZOOMakefile.opts]) 368 373 AC_OUTPUT -
branches/branch-1.2/zoo-kernel/service.h
r268 r301 203 203 } 204 204 205 205 206 static map* getLastMap(map* m){ 206 207 map* tmp=m; … … 497 498 } 498 499 500 static map* getMapOrFill(map* m,const char *key,char* value){ 501 map* tmp=m; 502 map* tmpMap=getMap(tmp,key); 503 if(tmpMap==NULL){ 504 if(tmp!=NULL) 505 addToMap(tmp,key,value); 506 else 507 tmp=createMap(key,value); 508 tmpMap=getMap(tmp,key); 509 } 510 return tmpMap; 511 } 512 499 513 static bool contains(map* m,map* i){ 500 514 while(i!=NULL){ -
branches/branch-1.2/zoo-kernel/service_internal.c
r268 r301 258 258 259 259 JSBool 260 JSUpdateStatus(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)260 JSUpdateStatus(JSContext *cx, uintN argc, jsval *argv1) 261 261 { 262 jsval *argv = JS_ARGV(cx,argv1); 262 263 JS_MaybeGC(cx); 263 264 char *sid; … … 280 281 } 281 282 if(getMapFromMaps(conf,"lenv","status")!=NULL){ 282 if(status!=NULL) 283 fprintf(stderr,"STATUS RETURNED : %s\n",status); 284 if(status!=NULL){ 283 285 setMapInMaps(conf,"lenv","status",status); 286 free(status); 287 } 284 288 else 285 289 setMapInMaps(conf,"lenv","status","15"); … … 367 371 #endif 368 372 int currId=-1; 373 int currNode=-1; 369 374 if(nbNs==0){ 370 375 nbNs++; … … 399 404 } 400 405 nbNs=0; 406 } 407 408 xmlNodePtr soapEnvelope(maps* conf,xmlNodePtr n){ 409 map* soap=getMapFromMaps(conf,"main","isSoap"); 410 if(soap!=NULL && strcasecmp(soap->value,"true")==0){ 411 int lNbNs=nbNs; 412 nsName[lNbNs]=strdup("soap"); 413 usedNs[lNbNs]=xmlNewNs(NULL,BAD_CAST "http://www.w3.org/2003/05/soap-envelope",BAD_CAST "soap"); 414 nbNs++; 415 xmlNodePtr nr = xmlNewNode(usedNs[lNbNs], BAD_CAST "Envelope"); 416 nsName[nbNs]=strdup("soap"); 417 usedNs[nbNs]=xmlNewNs(nr,BAD_CAST "http://www.w3.org/2003/05/soap-envelope",BAD_CAST "soap"); 418 nbNs++; 419 nsName[nbNs]=strdup("xsi"); 420 usedNs[nbNs]=xmlNewNs(nr,BAD_CAST "http://www.w3.org/2001/XMLSchema-instance",BAD_CAST "xsi"); 421 nbNs++; 422 xmlNsPtr ns_xsi=usedNs[nbNs-1]; 423 xmlNewNsProp(nr,ns_xsi,BAD_CAST "schemaLocation",BAD_CAST "http://www.w3.org/2003/05/soap-envelope http://www.w3.org/2003/05/soap-envelope"); 424 xmlNodePtr nr1 = xmlNewNode(usedNs[lNbNs], BAD_CAST "Body"); 425 xmlAddChild(nr1,n); 426 xmlAddChild(nr,nr1); 427 return nr; 428 }else 429 return n; 401 430 } 402 431 … … 715 744 xmlAddChild(n,nc1); 716 745 717 xmlDocSetRootElement(doc, n); 746 xmlNodePtr fn=soapEnvelope(m,n); 747 xmlDocSetRootElement(doc, fn); 718 748 //xmlFreeNs(ns); 719 749 free(SERVICE_URL); … … 775 805 addLangAttr(n,m); 776 806 777 xmlDocSetRootElement(doc, n); 807 xmlNodePtr fn=soapEnvelope(m,n); 808 xmlDocSetRootElement(doc, fn); 778 809 779 810 return n; … … 1003 1034 } 1004 1035 } 1036 1005 1037 _tmp=e->supported; 1038 if(_tmp==NULL && (getMap(e->defaults->content,"uom")!=NULL || datatype!=1)) 1039 _tmp=e->defaults; 1040 1006 1041 int hasSupported=-1; 1007 1042 while(_tmp!=NULL){ … … 1082 1117 if(hasDefault!=true && strncmp(type,"Input",5)==0) 1083 1118 xmlAddChild(nc3,xmlNewNode(ns_ows, BAD_CAST "AnyValue")); 1084 xmlFreeNodeList(nc5);1085 xmlFreeNodeList(nc4);1086 1119 } 1087 1120 … … 1093 1126 1094 1127 void printProcessResponse(maps* m,map* request, int pid,service* serv,const char* service,int status,maps* inputs,maps* outputs){ 1095 xmlNsPtr ns,ns _ows,ns_xlink,ns_xsi;1128 xmlNsPtr ns,ns1,ns_ows,ns_xlink,ns_xsi; 1096 1129 xmlNodePtr nr,n,nc,nc1,nc2,nc3,pseudor; 1097 1130 xmlDocPtr doc; … … 1100 1133 time_t time1; 1101 1134 time(&time1); 1135 nr=NULL; 1102 1136 /** 1103 1137 * Create the document and its temporary root. … … 1106 1140 int wpsId=zooXmlAddNs(NULL,"http://www.opengis.net/wps/1.0.0","wps"); 1107 1141 ns=usedNs[wpsId]; 1108 1142 1109 1143 n = xmlNewNode(ns, BAD_CAST "ExecuteResponse"); 1144 xmlNewNs(n,BAD_CAST "http://www.opengis.net/wps/1.0.0",BAD_CAST "wps"); 1110 1145 int owsId=zooXmlAddNs(n,"http://www.opengis.net/ows/1.1","ows"); 1111 1146 ns_ows=usedNs[owsId]; … … 1114 1149 int xsiId=zooXmlAddNs(n,"http://www.w3.org/2001/XMLSchema-instance","xsi"); 1115 1150 ns_xsi=usedNs[xsiId]; 1116 xmlNewNs(n,BAD_CAST "http://www.opengis.net/wps/1.0.0",BAD_CAST "wps"); 1117 1151 1118 1152 xmlNewNsProp(n,ns_xsi,BAD_CAST "schemaLocation",BAD_CAST "http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd"); 1119 1153 … … 1159 1193 sprintf(currentSid,"%s",tmp_lenv->value); 1160 1194 if(tmpm==NULL || strcasecmp(tmpm->value,"false")==0){ 1161 sprintf(url,"%s /?request=Execute&service=WPS&version=1.0.0&Identifier=GetStatus&DataInputs=sid=%s&RawDataOutput=Result",tmpm1->value,currentSid);1195 sprintf(url,"%s?request=Execute&service=WPS&version=1.0.0&Identifier=GetStatus&DataInputs=sid=%s&RawDataOutput=Result",tmpm1->value,currentSid); 1162 1196 }else{ 1163 1197 if(strlen(tmpm->value)>0) … … 1176 1210 } 1177 1211 if(tmpm1!=NULL) 1178 sprintf(tmp,"%s /",tmpm1->value);1212 sprintf(tmp,"%s",tmpm1->value); 1179 1213 tmpm1=getMapFromMaps(m,"main","TmpPath"); 1180 1214 sprintf(stored_path,"%s/%s_%i.xml",tmpm1->value,service,pid); … … 1312 1346 while(mcursor!=NULL){ 1313 1347 scursor=getElements(serv->outputs,mcursor->name); 1314 printIOType(doc,nc,ns,ns_ows,ns_xlink,scursor,mcursor,"Output"); 1348 if(scursor!=NULL){ 1349 printIOType(doc,nc,ns,ns_ows,ns_xlink,scursor,mcursor,"Output"); 1350 } 1315 1351 mcursor=mcursor->next; 1316 1352 } … … 1320 1356 fprintf(stderr,"printProcessResponse 1 202\n"); 1321 1357 #endif 1322 xmlDocSetRootElement(doc, n); 1358 nr=soapEnvelope(m,n); 1359 xmlDocSetRootElement(doc, nr); 1360 1323 1361 if(hasStoredExecuteResponse==true){ 1324 1362 /* We need to write the ExecuteResponse Document somewhere */ … … 1525 1563 || (tmp2!=NULL && (strncmp(tmp2->value,"image/",6)==0 || 1526 1564 (strncmp(tmp2->value,"application/",12)==0) && 1527 strncmp(tmp2->value,"application/json",16)!=0))) { 1565 strncmp(tmp2->value,"application/json",16)!=0&& 1566 strncmp(tmp2->value,"application/vnd.google-earth.kml",32)!=0) 1567 )) { 1528 1568 map* rs=getMap(m->content,"size"); 1529 1569 bool isSized=true; … … 1531 1571 char tmp1[1024]; 1532 1572 sprintf(tmp1,"%d",strlen(toto->value)); 1533 rs=createMap(" z",tmp1);1573 rs=createMap("size",tmp1); 1534 1574 isSized=false; 1535 1575 } … … 1541 1581 } 1542 1582 } 1543 else if(tmp !=NULL){1544 if(strncmp(tmp ->value,"text/js",4)==0 ||1545 strncmp(tmp ->value,"application/js",14)==0)1583 else if(tmp2!=NULL){ 1584 if(strncmp(tmp2->value,"text/js",7)==0 || 1585 strncmp(tmp2->value,"application/json",16)==0) 1546 1586 xmlAddChild(nc3,xmlNewCDataBlock(doc,BAD_CAST toto->value,strlen(toto->value))); 1547 else 1548 xmlAddChild(nc3,xmlNewText(BAD_CAST toto->value)); 1587 else{ 1588 if(strncmp(tmp2->value,"text/xml",8)==0 || 1589 strncmp(tmp2->value,"application/vnd.google-earth.kml",32)!=0){ 1590 xmlDocPtr doc = 1591 xmlParseMemory(BAD_CAST toto->value,strlen(BAD_CAST toto->value)); 1592 xmlNodePtr ir = xmlDocGetRootElement(doc); 1593 xmlAddChild(nc3,ir); 1594 } 1595 else 1596 xmlAddChild(nc3,xmlNewText(BAD_CAST toto->value)); 1597 } 1549 1598 xmlAddChild(nc2,nc3); 1550 1599 } … … 1764 1813 else if(strcasecmp(mtype->value,"application/json")==0) 1765 1814 ext=createMap("extension","js"); 1815 else if(strncmp(mtype->value,"application/vnd.google-earth.kml",32)!=0) 1816 ext=createMap("extension","kml"); 1766 1817 else 1767 1818 ext=createMap("extension","txt"); … … 1953 2004 elements* tmpInputs=in; 1954 2005 maps* out1=*out; 2006 if(type==1){ 2007 while(out1!=NULL){ 2008 if(getElements(in,out1->name)==NULL) 2009 return out1->name; 2010 out1=out1->next; 2011 } 2012 out1=*out; 2013 } 1955 2014 while(tmpInputs!=NULL){ 1956 2015 maps *tmpMaps=getMaps(out1,tmpInputs->name); … … 2082 2141 else 2083 2142 addToMap(tmpMaps->content,"inRequest","true"); 2143 2084 2144 } 2085 2145 tmpInputs=tmpInputs->next; … … 2236 2296 2237 2297 } 2298 2299 2300 unsigned char* getMd5(char* url){ 2301 EVP_MD_CTX md5ctx; 2302 unsigned char* fresult=(char*)malloc((EVP_MAX_MD_SIZE+1)*sizeof(char)); 2303 unsigned char result[EVP_MAX_MD_SIZE]; 2304 unsigned int len; 2305 EVP_DigestInit(&md5ctx, EVP_md5()); 2306 EVP_DigestUpdate(&md5ctx, url, strlen(url)); 2307 EVP_DigestFinal_ex(&md5ctx,result,&len); 2308 EVP_MD_CTX_cleanup(&md5ctx); 2309 int i; 2310 for(i = 0; i < len; i++){ 2311 if(i>0){ 2312 char *tmp=strdup(fresult); 2313 sprintf(fresult,"%s%02x", tmp,result[i]); 2314 free(tmp); 2315 } 2316 else 2317 sprintf(fresult,"%02x",result[i]); 2318 } 2319 return fresult; 2320 } 2321 2322 /** 2323 * Cache a file for a given request 2324 */ 2325 void addToCache(maps* conf,char* request,char* content,int length){ 2326 map* tmp=getMapFromMaps(conf,"main","cacheDir"); 2327 if(tmp!=NULL){ 2328 unsigned char* md5str=getMd5(request); 2329 char* fname=(char*)malloc(sizeof(char)*(strlen(tmp->value)+strlen(md5str)+6)); 2330 sprintf(fname,"%s/%s.zca",tmp->value,md5str); 2331 #ifdef DEBUG 2332 fprintf(stderr,"Cache list : %s\n",fname); 2333 fflush(stderr); 2334 #endif 2335 FILE* fo=fopen(fname,"w+"); 2336 fwrite(content,sizeof(char),length,fo); 2337 fclose(fo); 2338 free(md5str); 2339 free(fname); 2340 } 2341 } 2342 2343 char* isInCache(maps* conf,char* request){ 2344 map* tmpM=getMapFromMaps(conf,"main","cacheDir"); 2345 if(tmpM!=NULL){ 2346 unsigned char* md5str=getMd5(request); 2347 #ifdef DEBUG 2348 fprintf(stderr,"MD5STR : (%s)\n\n",md5str); 2349 #endif 2350 char* fname=(char*)malloc(sizeof(char)*(strlen(tmpM->value)+38)); 2351 sprintf(fname,"%s/%s.zca",tmpM->value,md5str); 2352 struct stat f_status; 2353 int s=stat(fname, &f_status); 2354 if(s==0 && f_status.st_size>0){ 2355 free(md5str); 2356 return fname; 2357 } 2358 free(md5str); 2359 free(fname); 2360 } 2361 return NULL; 2362 } 2363 2364 /** 2365 * loadRemoteFile: 2366 * Try to load file from cache or download a remote file if not in cache 2367 */ 2368 void loadRemoteFile(maps* m,map* content,HINTERNET hInternet,char *url){ 2369 HINTERNET res; 2370 char* fcontent; 2371 char* cached=isInCache(m,url); 2372 int fsize; 2373 if(cached!=NULL){ 2374 struct stat f_status; 2375 int s=stat(cached, &f_status); 2376 if(s==0){ 2377 fcontent=(char*)malloc(sizeof(char)*(f_status.st_size+1)); 2378 FILE* f=fopen(cached,"r"); 2379 fread(fcontent,sizeof(char),f_status.st_size,f); 2380 fsize=f_status.st_size; 2381 } 2382 }else{ 2383 res=InternetOpenUrl(hInternet,url,NULL,0,INTERNET_FLAG_NO_CACHE_WRITE,0); 2384 fcontent=(char*)calloc((res.nDataLen+1),sizeof(char)); 2385 if(fcontent == NULL){ 2386 return errorException(m, _("Unable to allocate memory."), "InternalError"); 2387 } 2388 size_t dwRead; 2389 InternetReadFile(res, (LPVOID)fcontent, res.nDataLen, &dwRead); 2390 fcontent[res.nDataLen]=0; 2391 fsize=res.nDataLen; 2392 } 2393 map* tmpMap=getMapOrFill(content,"value",""); 2394 free(tmpMap->value); 2395 tmpMap->value=(char*)malloc((fsize+1)*sizeof(char)); 2396 memcpy(tmpMap->value,fcontent,(fsize)*sizeof(char)); 2397 char ltmp1[256]; 2398 sprintf(ltmp1,"%d",fsize); 2399 addToMap(content,"size",ltmp1); 2400 if(cached==NULL) 2401 addToCache(m,url,fcontent,fsize); 2402 free(fcontent); 2403 free(cached); 2404 } 2405 2406 int errorException(maps *m, const char *message, const char *errorcode) 2407 { 2408 map* errormap = createMap("text", message); 2409 addToMap(errormap,"code", errorcode); 2410 printExceptionReportResponse(m,errormap); 2411 freeMap(&errormap); 2412 free(errormap); 2413 return -1; 2414 } -
branches/branch-1.2/zoo-kernel/service_internal.h
r268 r301 53 53 #include "service.h" 54 54 #include <openssl/sha.h> 55 #include <openssl/md5.h> 55 56 #include <openssl/hmac.h> 56 57 #include <openssl/evp.h> … … 59 60 60 61 #include "cgic.h" 62 #include "ulinet.h" 61 63 62 64 extern int getServiceFromFile(const char*,service**); … … 72 74 #endif 73 75 #include <libxml/parser.h> 76 #include <libxml/xpath.h> 77 74 78 static char* SERVICE_URL; 75 static xmlNsPtr usedNs[ 5];76 static char* nsName[ 5];79 static xmlNsPtr usedNs[10]; 80 static char* nsName[10]; 77 81 static int nbNs=0; 78 82 … … 83 87 #ifdef USE_JS 84 88 char* JSValToChar(JSContext*,jsval*); 85 JSBool JSUpdateStatus(JSContext*, JSObject*,uintN,jsval *,jsval *);89 JSBool JSUpdateStatus(JSContext*,uintN,jsval *); 86 90 #endif 87 91 … … 118 122 char* addDefaultValues(maps**,elements*,maps*,int); 119 123 120 /*defined in zoo_loader.c*/121 124 int errorException(maps *m, const char *message, const char *errorcode); 122 125 126 int checkForSoapEnvelope(xmlDocPtr); 127 128 void addToCache(maps*,char*,char*,int); 129 char* isInCache(maps*,char*); 130 void loadRemoteFile(maps*,map*,HINTERNET,char*); 131 123 132 #ifdef __cplusplus 124 133 } -
branches/branch-1.2/zoo-kernel/service_internal_js.c
r42 r301 27 27 static char dbg[1024]; 28 28 29 JSBool 30 JSAlert(JSContext *cx, uintN argc, jsval *argv1) 31 { 32 jsval *argv = JS_ARGV(cx,argv1); 33 int i=0; 34 JS_MaybeGC(cx); 35 for(i=0;i<argc;i++){ 36 JSString* jsmsg = JS_ValueToString(cx,argv[i]); 37 fprintf(stderr,"[ZOO-API:JS] %s\n",JS_EncodeString(cx,jsmsg)); 38 } 39 JS_MaybeGC(cx); 40 41 return JS_TRUE; 42 } 43 29 44 int zoo_js_support(maps** main_conf,map* request,service* s, 30 45 maps **inputs,maps **outputs) … … 57 72 return 1; 58 73 } 59 JS_SetOptions(cx, JSOPTION_VAROBJFIX );74 JS_SetOptions(cx, JSOPTION_VAROBJFIX | JSOPTION_JIT );//| JSOPTION_METHODJIT); 60 75 JS_SetVersion(cx, JSVERSION_LATEST); 61 76 JS_SetErrorReporter(cx, reportError); 62 77 63 78 /* Create the global object. */ 64 global = JS_NewObject(cx, &global_class, NULL, NULL); 65 if (global == NULL){ 66 return 1; 67 } 79 //global = JS_NewCompartmentAndGlobalObject(cx, &global_class, NULL); 80 global = JS_NewObject(cx, &global_class, NULL,NULL); 68 81 69 82 /* Populate the global object with the standard globals, … … 72 85 return 1; 73 86 } 87 74 88 if (!JS_DefineFunction(cx, global, "ZOORequest", JSRequest, 4, 0)) 75 89 return 1; 76 90 if (!JS_DefineFunction(cx, global, "ZOOUpdateStatus", JSUpdateStatus, 2, 0)) 91 return 1; 92 if (!JS_DefineFunction(cx, global, "alert", JSAlert, 2, 0)) 77 93 return 1; 78 94 … … 86 102 char api0[strlen(tmpm1->value)+strlen(ntmp)+15]; 87 103 sprintf(api0,"%s/%sZOO-proj4js.js",ntmp,tmpm1->value); 104 #ifdef JS_DEBUG 88 105 fprintf(stderr,"Trying to load %s\n",api0); 89 JSScript *api_script1=loadZooApiFile(cx,global,api0); 106 #endif 107 JSObject *api_script1=loadZooApiFile(cx,global,api0); 90 108 fflush(stderr); 91 109 92 110 char api1[strlen(tmpm1->value)+strlen(ntmp)+11]; 93 111 sprintf(api1,"%s/%sZOO-api.js",ntmp,tmpm1->value); 112 #ifdef JS_DEBUG 94 113 fprintf(stderr,"Trying to load %s\n",api1); 95 JSScript *api_script2=loadZooApiFile(cx,global,api1); 114 #endif 115 JSObject *api_script2=loadZooApiFile(cx,global,api1); 96 116 fflush(stderr); 97 117 … … 106 126 sprintf(filename,"%s/%s%s",ntmp,tmpm1->value,tmpm2->value); 107 127 filename[strlen(tmpm1->value)+strlen(tmpm2->value)+strlen(ntmp)+1]=0; 128 #ifdef JS_DEBUG 108 129 fprintf(stderr,"FILENAME %s\n",filename); 130 #endif 109 131 struct stat file_status; 110 132 stat(filename, &file_status); … … 112 134 uint16 lineno; 113 135 jsval rval; 114 FILE *jsfile=fopen(filename,"r");115 136 JSBool ok ; 116 JS Script *script = JS_CompileFileHandle(cx, global, filename,jsfile);137 JSObject *script = JS_CompileFile(cx, global, filename); 117 138 if(script!=NULL){ 118 139 (void)JS_ExecuteScript(cx, global, script, &rval); … … 127 148 JS_DestroyRuntime(rt); 128 149 JS_ShutDown(); 129 fclose(jsfile);130 150 exit(-1); 131 151 } … … 161 181 if(strlen(dbg)==0) 162 182 sprintf(dbg,"No result was found after the function call"); 163 sprintf(tmp1,"Unable to run %s from the JavScript file %s : \n %s",s->name,filename,dbg); 183 sprintf(tmp1,"Unable to run %s from the JavaScript file %s : \n %s",s->name,filename,dbg); 184 #ifdef JS_DEBUG 164 185 fprintf(stderr,"%s",tmp1); 186 #endif 165 187 map* err=createMap("text",tmp1); 166 188 addToMap(err,"code","NoApplicableCode"); … … 211 233 jsval tmp2; 212 234 JSBool hasElement=JS_GetProperty(cx,d,"outputs",&tmp2); 235 #ifdef JS_DEBUG 213 236 if(!hasElement) 214 237 fprintf(stderr,"No outputs property returned\n"); … … 217 240 else 218 241 fprintf(stderr,"outputs is not an array as expected\n"); 242 #endif 219 243 *outputs=mapsFromJSObject(cx,tmp2); 220 244 #ifdef JS_DEBUG 221 dumpMaps(out );245 dumpMaps(outputs); 222 246 #endif 223 247 } 224 248 225 249 /* Cleanup. */ 226 JS_DestroyScript(cx, script); 227 JS_DestroyScript(cx, api_script1); 228 JS_DestroyScript(cx, api_script2); 229 //JS_MaybeGC(cx); 230 // If we use the DestroyContext as requested to release memory then we get 231 // issue getting back the main configuration maps after coming back to the 232 // runRequest function ... 233 //JS_DestroyContext(cx); 250 JS_DestroyContext(cx); 234 251 JS_DestroyRuntime(rt); 235 252 JS_ShutDown(); … … 240 257 } 241 258 242 JS Script * loadZooApiFile(JSContext *cx,JSObject *global, char* filename){259 JSObject * loadZooApiFile(JSContext *cx,JSObject *global, char* filename){ 243 260 struct stat api_status; 244 261 int s=stat(filename, &api_status); 245 262 if(s==0){ 246 263 jsval rval; 247 FILE *jsfile=fopen(filename,"r");248 264 JSBool ok ; 249 JS Script *script = JS_CompileFileHandle(cx, global, filename,jsfile);265 JSObject *script = JS_CompileFile(cx, JS_GetGlobalObject(cx), filename); 250 266 if(script!=NULL){ 251 (void)JS_ExecuteScript(cx, global, script, &rval); 267 (void)JS_ExecuteScript(cx, JS_GetGlobalObject(cx), script, &rval); 268 #ifdef JS_DEBUG 252 269 fprintf(stderr,"**************\n%s correctly loaded\n**************\n",filename); 270 #endif 253 271 return script; 254 272 } 273 #ifdef JS_DEBUG 255 274 else 256 275 fprintf(stderr,"\n**************\nUnable to run %s\n**************\n",filename); 257 } 276 #endif 277 } 278 #ifdef JS_DEBUG 258 279 else 259 280 fprintf(stderr,"\n**************\nUnable to load %s\n**************\n",filename); 281 #endif 260 282 return NULL; 261 283 } … … 288 310 map* tmpm=t; 289 311 while(tmpm!=NULL){ 290 jsval jsstr = STRING_TO_JSVAL(JS_NewString (cx,tmpm->value,strlen(tmpm->value)));312 jsval jsstr = STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpm->value,strlen(tmpm->value))); 291 313 JS_SetProperty(cx, res, tmpm->name,&jsstr); 292 314 #ifdef JS_DEBUG … … 335 357 fprintf(stderr,"Properties length : %d \n",idp->length); 336 358 #endif 359 tres=(maps*)malloc(MAPS_SIZE); 360 tres->name=NULL; 361 tres->content=NULL; 362 tres->next=NULL; 363 337 364 for (index=0,argNum=idp->length;index<argNum;index++) { 338 365 jsval id = idp->vector[index]; … … 346 373 len1 = JS_GetStringLength(jsmsg); 347 374 #ifdef JS_DEBUG 348 fprintf(stderr,"Enumerate id : %d => %s\n",oi,JS_ GetStringBytes(jsmsg));375 fprintf(stderr,"Enumerate id : %d => %s\n",oi,JS_EncodeString(cx,jsmsg)); 349 376 #endif 350 377 jsval nvp=JSVAL_NULL; 351 if((JS_GetProperty(cx, JSVAL_TO_OBJECT(tmp1), JS_GetStringBytes(jsmsg), &nvp)==JS_FALSE)) 352 #ifdef JS_DEBUG 353 fprintf(stderr,"Enumerate id : %d => %s => No more value\n",oi,JS_GetStringBytes(jsmsg)); 354 #endif 378 if((JS_GetProperty(cx, JSVAL_TO_OBJECT(tmp1), JS_EncodeString(cx,jsmsg), &nvp)==JS_FALSE)){ 379 #ifdef JS_DEBUG 380 fprintf(stderr,"Enumerate id : %d => %s => No more value\n",oi,JS_EncodeString(cx,jsmsg)); 381 #endif 382 } 383 355 384 if(JSVAL_IS_OBJECT(nvp)){ 356 385 #ifdef JS_DEBUG … … 358 387 #endif 359 388 } 360 #ifdef JS_DEBUG 361 else 362 fprintf(stderr,"JSVAL NVP IS NOT OBJECT !!\n"); 363 #endif 364 JSObject *nvp1; 389 390 JSObject *nvp1=JSVAL_NULL; 365 391 JS_ValueToObject(cx,nvp,&nvp1); 366 392 jsval nvp1j=OBJECT_TO_JSVAL(nvp1); 367 393 if(JSVAL_IS_OBJECT(nvp1j)){ 368 #ifdef JS_DEBUG 369 fprintf(stderr,"JSVAL NVP1J IS OBJECT\n"); 370 #endif 371 tres=(maps*)malloc(MAPS_SIZE); 372 tres->name=strdup(JS_GetStringBytes(jsmsg)); 373 tres->content=mapFromJSObject(cx,nvp1j); 374 tres->next=NULL; 375 #ifdef JS_DEBUG 376 dumpMaps(res); 377 #endif 378 if(res==NULL) 379 res=dupMaps(&tres); 394 JSString *jsmsg1; 395 JSObject *nvp2=JSVAL_NULL; 396 jsmsg1 = JS_ValueToString(cx,nvp1j); 397 len1 = JS_GetStringLength(jsmsg1); 398 #ifdef JS_DEBUG 399 fprintf(stderr,"JSVAL NVP1J IS OBJECT %s = %s\n",JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1)); 400 #endif 401 if(strcasecmp(JS_EncodeString(cx,jsmsg1),"[object Object]")==0){ 402 tres->name=strdup(JS_EncodeString(cx,jsmsg)); 403 tres->content=mapFromJSObject(cx,nvp1j); 404 } 380 405 else 381 addMapsToMaps(&res,tres); 382 freeMaps(&tres); 383 free(tres); 384 tres=NULL; 385 #ifdef JS_DEBUG 386 dumpMaps(res); 387 #endif 406 if(strcasecmp(JS_EncodeString(cx,jsmsg),"name")==0){ 407 tres->name=strdup(JS_EncodeString(cx,jsmsg1)); 408 } 409 else{ 410 if(tres->content==NULL) 411 tres->content=createMap(JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1)); 412 else 413 addToMap(tres->content,JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1)); 414 } 388 415 } 389 416 #ifdef JS_DEBUG … … 391 418 fprintf(stderr,"JSVAL NVP1J IS NOT OBJECT !!\n"); 392 419 #endif 420 393 421 } 422 #ifdef JS_DEBUG 423 dumpMaps(tres); 424 #endif 425 if(res==NULL) 426 res=dupMaps(&tres); 427 else 428 addMapsToMaps(&res,tres); 429 freeMaps(&tres); 430 free(tres); 431 tres=NULL; 432 394 433 } 395 434 } … … 423 462 len = JS_GetStringLength(jsmsg); 424 463 jsval nvp; 425 JS_GetProperty(cx, JSVAL_TO_OBJECT(t), JS_ GetStringBytes(jsmsg), &nvp);464 JS_GetProperty(cx, JSVAL_TO_OBJECT(t), JS_EncodeString(cx,jsmsg), &nvp); 426 465 jsmsg1 = JS_ValueToString(cx,nvp); 427 466 len1 = JS_GetStringLength(jsmsg1); 428 467 #ifdef JS_DEBUG 429 fprintf(stderr,"Enumerate id : %d [ %s => %s ]\n",index,JS_ GetStringBytes(jsmsg),JS_GetStringBytes(jsmsg1));468 fprintf(stderr,"Enumerate id : %d [ %s => %s ]\n",index,JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1)); 430 469 #endif 431 470 if(res!=NULL){ 432 471 #ifdef JS_DEBUG 433 fprintf(stderr,"%s - %s\n",JS_ GetStringBytes(jsmsg),JS_GetStringBytes(jsmsg1));434 #endif 435 addToMap(res,JS_ GetStringBytes(jsmsg),JS_GetStringBytes(jsmsg1));472 fprintf(stderr,"%s - %s\n",JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1)); 473 #endif 474 addToMap(res,JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1)); 436 475 } 437 476 else{ 438 res=createMap(JS_ GetStringBytes(jsmsg),JS_GetStringBytes(jsmsg1));477 res=createMap(JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1)); 439 478 res->next=NULL; 440 479 } -
branches/branch-1.2/zoo-kernel/service_internal_js.h
r42 r301 52 52 int zoo_js_support(maps**,map*,service*,maps **,maps **); 53 53 54 JS Script *loadZooApiFile(JSContext*,JSObject*,char*);54 JSObject *loadZooApiFile(JSContext*,JSObject*,char*); 55 55 56 56 #ifdef __cplusplus -
branches/branch-1.2/zoo-kernel/service_internal_python.c
r217 r301 74 74 free(pythonpath); 75 75 76 PyThreadState *mainstate; 77 PyEval_InitThreads(); 76 78 Py_Initialize(); 79 mainstate = PyThreadState_Swap(NULL); 80 PyEval_ReleaseLock(); 81 PyGILState_STATE gstate; 82 gstate = PyGILState_Ensure(); 77 83 PyObject *pName, *pModule, *pFunc; 78 84 tmp=getMap(s->content,"serviceProvider"); … … 119 125 dumpMaps(outputs); 120 126 #endif 121 Py_DECREF(arg1);122 Py_DECREF(arg2);123 Py_DECREF(arg3);124 Py_DECREF(pArgs);125 Py_DECREF(pValue);126 Py_XDECREF(pFunc);127 Py_DECREF(pModule);128 127 }else{ 129 128 PyObject *ptype,*pvalue, *ptraceback; … … 159 158 addToMap(err,"code","NoApplicableCode"); 160 159 printExceptionReportResponse(m,err); 161 Py_DECREF(arg1); 162 Py_DECREF(arg2); 163 Py_DECREF(arg3); 164 Py_XDECREF(pFunc); 165 Py_DECREF(pArgs); 166 Py_DECREF(pModule); 167 Py_DECREF(ptraceback); 168 Py_DECREF(ptype); 169 Py_DECREF(pValue); 170 #if not(defined(macintosh)) && not(defined(__MACH__) && defined(__APPLE__)) 171 Py_Finalize(); 172 #endif 173 exit(-1); 160 res=-1; 174 161 } 175 162 } 176 163 else{ 177 164 char tmpS[1024]; 178 sprintf(tmpS, "Cannot find the %s function in tthe %s file.\n", s->name, tmp->value);165 sprintf(tmpS, "Cannot find the %s function in the %s file.\n", s->name, tmp->value); 179 166 map* tmps=createMap("text",tmpS); 180 167 printExceptionReportResponse(m,tmps); 181 Py_XDECREF(pFunc); 182 Py_DECREF(pModule); 183 exit(-1); 168 res=-1; 184 169 } 185 170 } else{ … … 190 175 if (PyErr_Occurred()) 191 176 PyErr_Print(); 192 exit(-1); 177 PyErr_Clear(); 178 res=-1; 179 //exit(-1); 193 180 } 194 #if not(defined(macintosh)) && not(defined(__MACH__) && defined(__APPLE__)) 181 PyGILState_Release(gstate); 182 PyEval_AcquireLock(); 183 PyThreadState_Swap(mainstate); 195 184 Py_Finalize(); 196 #endif197 185 return res; 198 186 } … … 202 190 maps* tmp=t; 203 191 while(tmp!=NULL){ 204 PyObject* subc=(PyObject*)PyDict_FromMap(tmp->content); 205 if(PyDict_SetItem(res,PyString_FromString(tmp->name),subc)<0){ 206 fprintf(stderr,"Unable to parse params..."); 207 exit(1); 208 } 209 Py_DECREF(subc); 192 PyObject* value=(PyObject*)PyDict_FromMap(tmp->content); 193 PyObject* name=PyString_FromString(tmp->name); 194 if(PyDict_SetItem(res,name,value)<0){ 195 fprintf(stderr,"Unable to set map value ..."); 196 return NULL; 197 } 198 Py_DECREF(name); 210 199 tmp=tmp->next; 211 200 } … … 223 212 PyObject* value=PyString_FromStringAndSize(tmp->value,atoi(size->value)); 224 213 if(PyDict_SetItem(res,name,value)<0){ 225 fprintf(stderr,"Unable to parse params..."); 226 Py_DECREF(value); 227 exit(1); 214 fprintf(stderr,"Unable to set key value pair..."); 215 return NULL; 228 216 } 229 Py_DECREF(value);230 217 } 231 218 else{ 232 219 PyObject* value=PyString_FromString(tmp->value); 233 220 if(PyDict_SetItem(res,name,value)<0){ 234 fprintf(stderr,"Unable to parse params..."); 235 Py_DECREF(value); 236 exit(1); 221 fprintf(stderr,"Unable to set key value pair..."); 222 return NULL; 237 223 } 238 Py_DECREF(value);239 224 } 240 225 } … … 242 227 PyObject* value=PyString_FromString(tmp->value); 243 228 if(PyDict_SetItem(res,name,value)<0){ 244 fprintf(stderr,"Unable to parse params..."); 245 Py_DECREF(value); 246 exit(1); 247 } 248 Py_DECREF(value); 229 fprintf(stderr,"Unable to set key value pair..."); 230 return NULL; 231 } 249 232 } 250 233 Py_DECREF(name); … … 272 255 cursor=(maps*)malloc(MAPS_SIZE); 273 256 cursor->name=PyString_AsString(key); 274 #ifdef DEBUG275 dumpMap(mapFromPyDict((PyDictObject*)value));276 #endif277 257 cursor->content=mapFromPyDict((PyDictObject*)value); 258 #ifdef DEBUG 259 dumpMap(cursor->content); 260 #endif 278 261 cursor->next=NULL; 279 262 if(res==NULL) … … 284 267 free(cursor->content); 285 268 free(cursor); 286 Py_DECREF(value);287 Py_DECREF(key);288 269 #ifdef DEBUG 289 270 dumpMaps(res); … … 291 272 #endif 292 273 } 293 Py_DECREF(list);294 274 return res; 295 275 } … … 330 310 res=createMap(PyString_AsString(key),PyString_AsString(value)); 331 311 } 332 Py_DECREF(key); 333 } 334 Py_DECREF(list); 312 } 335 313 return res; 336 314 } -
branches/branch-1.2/zoo-kernel/ulinet.c
r93 r301 385 385 jsmsg = JS_ValueToString(context,*arg); 386 386 len = JS_GetStringLength(jsmsg); 387 tmp = JS_ GetStringBytes(jsmsg);387 tmp = JS_EncodeString(context,jsmsg); 388 388 c = (char*)malloc((len+1)*sizeof(char)); 389 389 c[len] = '\0'; … … 435 435 436 436 JSBool 437 JSRequest(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)437 JSRequest(JSContext *cx, uintN argc, jsval *argv1) 438 438 { 439 jsval *argv = JS_ARGV(cx,argv1); 439 440 HINTERNET hInternet; 440 441 char *url; … … 488 489 fprintf(stderr,"content downloaded (%d) (%s) \n",dwRead,tmpValue); 489 490 #endif 490 *rval=STRING_TO_JSVAL(JS_NewString(cx,tmpValue,strlen(tmpValue)));491 JS_SET_RVAL(cx, argv1,STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpValue,strlen(tmpValue)))); 491 492 free(url); 492 493 if(argc>=2) -
branches/branch-1.2/zoo-kernel/ulinet.h
r1 r301 138 138 139 139 #ifdef USE_JS 140 JSBool JSRequest(JSContext*, JSObject*, uintN, jsval*, jsval*);140 JSBool JSRequest(JSContext*, uintN, jsval*); 141 141 #endif 142 142 -
branches/branch-1.2/zoo-kernel/zoo_loader.c
r217 r301 48 48 } 49 49 50 #include "service_internal.h" 51 50 52 xmlXPathObjectPtr extractFromDoc(xmlDocPtr,const char*); 51 53 int runRequest(map*); 52 54 53 55 using namespace std; 54 55 /* ************************************************************************* */56 57 int errorException(maps *m, const char *message, const char *errorcode)58 {59 map* errormap = createMap("text", message);60 addToMap(errormap,"code", errorcode);61 printExceptionReportResponse(m,errormap);62 freeMap(&errormap);63 free(errormap);64 return -1;65 }66 67 /* ************************************************************************* */68 69 56 70 57 #define TRUE 1 … … 85 72 #ifdef DEBUG 86 73 fprintf (stderr, "Addr:%s\n", cgiRemoteAddr); 87 fprintf (stderr, "RequestMethod: %s\n", cgiRequestMethod);74 fprintf (stderr, "RequestMethod: (%s) %d %d\n", cgiRequestMethod,strncasecmp(cgiRequestMethod,"post",4),strncmp(cgiContentType,"text/xml",8)==0 || strncasecmp(cgiRequestMethod,"post",4)==0); 88 75 fprintf (stderr, "Request: %s\n", cgiQueryString); 89 76 #endif … … 93 80 if(strncmp(cgiContentType,"text/xml",8)==0 || 94 81 strncasecmp(cgiRequestMethod,"post",4)==0){ 95 char *buffer=new char[cgiContentLength+1]; 96 if(fread(buffer,1,cgiContentLength,cgiIn)){ 97 buffer[cgiContentLength]=0; 98 tmpMap=createMap("request",buffer); 82 if(cgiContentLength==NULL){ 83 cgiContentLength=0; 84 char *buffer=new char[2]; 85 char *res=NULL; 86 int r=0; 87 while(r=fread(buffer,sizeof(char),1,cgiIn)){ 88 cgiContentLength+=r; 89 if(res==NULL){ 90 res=(char*)malloc(1*sizeof(char)); 91 sprintf(res,"%s",buffer); 92 } 93 else{ 94 res=(char*)realloc(res,(cgiContentLength+1)*sizeof(char)); 95 char *tmp=strdup(res); 96 sprintf(res,"%s%s",tmp,buffer); 97 free(tmp); 98 } 99 } 100 if(res==NULL){ 101 return errorException(NULL,"ZOO-Kernel failed to process your request cause the request was emtpty.","InternalError"); 102 }else 103 tmpMap=createMap("request",res); 99 104 }else{ 100 char **array, **arrayStep; 101 if (cgiFormEntries(&array) != cgiFormSuccess) { 102 return 1; 103 } 104 arrayStep = array; 105 while (*arrayStep) { 106 char *value=new char[cgiContentLength]; 107 cgiFormStringNoNewlines(*arrayStep, value, cgiContentLength); 108 char* tmpValueFinal=(char*) malloc((strlen(*arrayStep)+strlen(value)+1)*sizeof(char)); 109 sprintf(tmpValueFinal,"%s=%s",*arrayStep,value); 110 tmpMap=createMap("request",tmpValueFinal); 111 free(tmpValueFinal); 112 #ifdef DEBUG 113 fprintf(stderr,"(( \n %s \n %s \n ))",*arrayStep,value); 114 #endif 115 delete[]value; 116 arrayStep++; 117 } 118 } 119 delete[]buffer; 105 char *buffer=new char[cgiContentLength+1]; 106 if(fread(buffer,sizeof(char),cgiContentLength,cgiIn)){ 107 buffer[cgiContentLength]=0; 108 tmpMap=createMap("request",buffer); 109 }else{ 110 buffer[0]=0; 111 char **array, **arrayStep; 112 if (cgiFormEntries(&array) != cgiFormSuccess) { 113 return 1; 114 } 115 arrayStep = array; 116 while (*arrayStep) { 117 char *ivalue=new char[cgiContentLength]; 118 cgiFormStringNoNewlines(*arrayStep, ivalue, cgiContentLength); 119 char* tmpValueFinal=(char*) malloc((strlen(*arrayStep)+strlen(ivalue)+1)*sizeof(char)); 120 sprintf(tmpValueFinal,"%s=%s",*arrayStep,ivalue); 121 if(strlen(buffer)==0){ 122 sprintf(buffer,"%s",tmpValueFinal); 123 }else{ 124 char *tmp=strdup(buffer); 125 sprintf(buffer,"%s&%s",tmp,tmpValueFinal); 126 free(tmp); 127 } 128 129 sprintf(tmpValueFinal,"%s=%s",*arrayStep,ivalue); 130 free(tmpValueFinal); 131 #ifdef DEBUG 132 fprintf(stderr,"(( \n %s \n %s \n ))",*arrayStep,ivalue); 133 #endif 134 delete[]ivalue; 135 arrayStep++; 136 } 137 tmpMap=createMap("request",buffer); 138 } 139 delete[]buffer; 140 } 120 141 } 121 142 else{ … … 162 183 xmlInitParser(); 163 184 xmlDocPtr doc = xmlParseMemory(t1->value,cgiContentLength); 185 186 187 { 188 xmlXPathObjectPtr reqptr=extractFromDoc(doc,"/*[local-name()='Envelope']/*[local-name()='Body']/*"); 189 if(reqptr!=NULL){ 190 xmlNodeSet* req=reqptr->nodesetval; 191 if(req!=NULL && req->nodeNr==1){ 192 addToMap(tmpMap,"soap","true"); 193 int k=0; 194 for(k;k < req->nodeNr;k++){ 195 xmlNsPtr ns=xmlNewNs(req->nodeTab[k],BAD_CAST "http://www.w3.org/2001/XMLSchema-instance",BAD_CAST "xsi"); 196 xmlDocSetRootElement(doc, req->nodeTab[k]); 197 xmlChar *xmlbuff; 198 int buffersize; 199 xmlDocDumpFormatMemoryEnc(doc, &xmlbuff, &buffersize, "utf-8", 1); 200 addToMap(tmpMap,"xrequest",(char*)xmlbuff); 201 char *tmp=(char*)xmlbuff; 202 fprintf(stderr,"%s\n",tmp); 203 xmlFree(xmlbuff); 204 } 205 } 206 } 207 } 208 164 209 xmlNodePtr cur = xmlDocGetRootElement(doc); 165 210 char *tval; … … 172 217 if(tval!=NULL) 173 218 addToMap(tmpMap,"language",tval); 174 175 const char* requests[3]; 176 requests[0]="GetCapabilities"; 177 requests[1]="DescribeProcess"; 178 requests[2]="Execute"; 219 const char* requests[3]={"GetCapabilities","DescribeProcess","Execute"}; 179 220 for(int j=0;j<3;j++){ 180 char tt[ 35];221 char tt[128]; 181 222 sprintf(tt,"/*[local-name()='%s']",requests[j]); 182 223 xmlXPathObjectPtr reqptr=extractFromDoc(doc,tt); -
branches/branch-1.2/zoo-kernel/zoo_service_loader.c
r268 r301 452 452 _getcwd(ntmp,1024); 453 453 #endif 454 r_inputs=getMap(request_inputs,"metapath"); 455 if(r_inputs==NULL){ 456 if(request_inputs==NULL) 457 request_inputs=createMap("metapath",""); 458 else 459 addToMap(request_inputs,"metapath",""); 460 #ifdef DEBUG 461 fprintf(stderr,"ADD METAPATH\n"); 462 dumpMap(request_inputs); 463 #endif 464 r_inputs=getMap(request_inputs,"metapath"); 465 } 454 r_inputs=getMapOrFill(request_inputs,"metapath",""); 455 466 456 char conf_file[10240]; 467 457 snprintf(conf_file,10240,"%s/%s/main.cfg",ntmp,r_inputs->value); … … 493 483 textdomain("zoo-services"); 494 484 485 map* lsoap=getMap(request_inputs,"soap"); 486 if(lsoap!=NULL && strcasecmp(lsoap->value,"true")==0) 487 setMapInMaps(m,"main","isSoap","true"); 488 else 489 setMapInMaps(m,"main","isSoap","false"); 495 490 496 491 /** … … 1013 1008 lmap->value=strdup(tmpValue); 1014 1009 free(tmpValue); 1015 dumpMap(tmpmaps->content);1016 1010 tmpc=strtok(NULL,"@"); 1017 1011 continue; … … 1042 1036 fprintf(stderr,"REQUIRE TO DOWNLOAD A FILE FROM A SERVER : url(%s)\n",tmpv1+1); 1043 1037 #endif 1038 char *tmpx=url_encode(tmpv1+1); 1039 addToMap(tmpmaps->content,tmpn1,tmpx); 1040 1044 1041 #ifndef WIN32 1045 1042 if(CHECK_INET_HANDLE(hInternet)) 1046 1043 #endif 1047 1044 { 1048 res=InternetOpenUrl(hInternet,tmpv1+1,NULL,0, 1049 INTERNET_FLAG_NO_CACHE_WRITE,0); 1050 #ifdef DEBUG 1051 fprintf(stderr,"(%s) content-length : %d,,res.nDataAlloc %d \n", 1052 tmpv1+1,res.nDataAlloc,res.nDataLen); 1053 #endif 1054 char* tmpContent=(char*)calloc((res.nDataLen+1),sizeof(char)); 1055 if(tmpContent == NULL){ 1056 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1057 } 1058 size_t dwRead; 1059 InternetReadFile(res, (LPVOID)tmpContent,res.nDataLen, &dwRead); 1060 map* tmpMap=getMap(tmpmaps->content,"value"); 1061 if(tmpMap!=NULL){ 1062 free(tmpMap->value); 1063 tmpMap->value=(char*)malloc((res.nDataLen+1)*sizeof(char)); 1064 memmove(tmpMap->value,tmpContent,(res.nDataLen)*sizeof(char)); 1065 tmpMap->value[res.nDataLen]=0; 1066 if(strlen(tmpContent)!=res.nDataLen){ 1067 char tmp[256]; 1068 sprintf(tmp,"%d",res.nDataLen*sizeof(char)); 1069 addToMap(tmpmaps->content,"size",tmp); 1070 } 1071 } 1072 free(tmpContent); 1045 loadRemoteFile(m,tmpmaps->content,hInternet,tmpv1+1); 1073 1046 } 1074 char *tmpx =url_encode(tmpv1+1);1075 addToMap(tmpmaps->content,tmpn1,tmpx );1076 free(tmpx );1047 char *tmpx1=url_encode(tmpv1+1); 1048 addToMap(tmpmaps->content,tmpn1,tmpx1); 1049 free(tmpx1); 1077 1050 addToMap(tmpmaps->content,"Reference",tmpv1+1); 1078 dumpMap(tmpmaps->content);1079 1051 } 1080 1052 tmpc=strtok(NULL,"@"); … … 1193 1165 fprintf(stderr,"REFERENCE\n"); 1194 1166 #endif 1195 const char *refs[5]; 1196 refs[0]="mimeType"; 1197 refs[1]="encoding"; 1198 refs[2]="schema"; 1199 refs[3]="method"; 1200 refs[4]="href"; 1167 const char *refs[5]={"mimeType","encoding","schema","method","href"}; 1201 1168 for(int l=0;l<5;l++){ 1202 1169 #ifdef DEBUG … … 1213 1180 if(!(ltmp!=NULL && strcmp(ltmp->value,"POST")==0) 1214 1181 && CHECK_INET_HANDLE(hInternet)){ 1215 res=InternetOpenUrl(hInternet,(char*)val,NULL,0, 1216 INTERNET_FLAG_NO_CACHE_WRITE,0); 1217 char* tmpContent= 1218 (char*)calloc((res.nDataLen+1),sizeof(char)); 1219 if(tmpContent == NULL){ 1220 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1221 } 1222 size_t dwRead; 1223 InternetReadFile(res, (LPVOID)tmpContent, 1224 res.nDataLen, &dwRead); 1225 tmpContent[res.nDataLen]=0; 1226 addToMap(tmpmaps->content,"value",tmpContent); 1182 loadRemoteFile(m,tmpmaps->content,hInternet,(char*)val); 1227 1183 } 1228 1184 } … … 1415 1371 else 1416 1372 tmpmaps->content=createMap(list[l],(char*)val); 1373 #ifdef DEBUG 1374 fprintf(stderr,"%s\n",val); 1375 #endif 1417 1376 } 1418 #ifdef DEBUG1419 fprintf(stderr,"%s\n",val);1420 #endif1421 1377 xmlFree(val); 1422 free(list[l]); 1378 free(list[l]); 1423 1379 } 1424 1380 } … … 1428 1384 * mimeType, encoding, schema 1429 1385 */ 1430 const char *coms[3]; 1431 coms[0]="mimeType"; 1432 coms[1]="encoding"; 1433 coms[2]="schema"; 1386 const char *coms[3]={"mimeType","encoding","schema"}; 1434 1387 for(int l=0;l<3;l++){ 1435 1388 #ifdef DEBUG 1436 fprintf(stderr,"*** ComplexData %s *** ",coms[l]);1389 fprintf(stderr,"*** ComplexData %s ***\n",coms[l]); 1437 1390 #endif 1438 1391 xmlChar *val=xmlGetProp(cur4,BAD_CAST coms[l]); … … 1442 1395 else 1443 1396 tmpmaps->content=createMap(coms[l],(char*)val); 1397 #ifdef DEBUG 1398 fprintf(stderr,"%s\n",val); 1399 #endif 1444 1400 } 1445 #ifdef DEBUG1446 fprintf(stderr,"%s\n",val);1447 #endif1448 1401 xmlFree(val); 1449 1402 } 1450 1403 } 1404 1451 1405 map* test=getMap(tmpmaps->content,"encoding"); 1452 if(test==NULL || strcasecmp(test->value,"base64")!=0){ 1406 if(test==NULL){ 1407 if(tmpmaps->content!=NULL) 1408 addToMap(tmpmaps->content,"encoding","utf-8"); 1409 else 1410 tmpmaps->content=createMap("encoding","utf-8"); 1411 test=getMap(tmpmaps->content,"encoding"); 1412 } 1413 1414 if(strcasecmp(test->value,"base64")!=0){ 1453 1415 xmlChar* mv=xmlNodeListGetString(doc,cur4->xmlChildrenNode,1); 1454 if(mv==NULL){ 1416 map* ltmp=getMap(tmpmaps->content,"mimeType"); 1417 if(mv==NULL || 1418 (xmlStrcasecmp(cur4->name, BAD_CAST "ComplexData")==0 && 1419 (ltmp==NULL || strncasecmp(ltmp->value,"text/xml",8)==0) )){ 1455 1420 xmlDocPtr doc1=xmlNewDoc(BAD_CAST "1.0"); 1456 1421 int buffersize; 1457 xmlDocSetRootElement(doc1,cur4->xmlChildrenNode); 1422 xmlNodePtr cur5=cur4->children; 1423 while(cur5!=NULL &&cur5->type!=XML_ELEMENT_NODE) 1424 cur5=cur5->next; 1425 xmlDocSetRootElement(doc1,cur5); 1458 1426 xmlDocDumpFormatMemoryEnc(doc1, &mv, &buffersize, "utf-8", 1); 1459 1427 char size[1024]; … … 1556 1524 * storeExecuteResponse, lineage, status 1557 1525 */ 1558 const char *ress[3]; 1559 ress[0]="storeExecuteResponse"; 1560 ress[1]="lineage"; 1561 ress[2]="status"; 1526 const char *ress[3]={"storeExecuteResponse","lineage","status"}; 1562 1527 xmlChar *val; 1563 1528 for(int l=0;l<3;l++){ … … 1580 1545 xmlNodePtr cur1=cur->children; 1581 1546 while(cur1){ 1582 if(xmlStrncasecmp(cur1->name,BAD_CAST "Output",xmlStrlen(cur1->name))==0){ 1547 /** 1548 * Indentifier 1549 */ 1550 if(xmlStrncasecmp(cur1->name,BAD_CAST "Identifier",xmlStrlen(cur1->name))==0){ 1551 xmlChar *val= 1552 xmlNodeListGetString(doc,cur1->xmlChildrenNode,1); 1553 if(tmpmaps==NULL){ 1554 tmpmaps=(maps*)calloc(1,MAPS_SIZE); 1555 if(tmpmaps == NULL){ 1556 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1557 } 1558 tmpmaps->name=strdup((char*)val); 1559 tmpmaps->content=NULL; 1560 tmpmaps->next=NULL; 1561 } 1562 else 1563 tmpmaps->name=strdup((char*)val);; 1564 xmlFree(val); 1565 } 1566 /** 1567 * Title, Asbtract 1568 */ 1569 else if(xmlStrncasecmp(cur1->name,BAD_CAST "Title",xmlStrlen(cur1->name))==0 || 1570 xmlStrncasecmp(cur1->name,BAD_CAST "Abstract",xmlStrlen(cur1->name))==0){ 1571 xmlChar *val= 1572 xmlNodeListGetString(doc,cur1->xmlChildrenNode,1); 1573 if(tmpmaps==NULL){ 1574 tmpmaps=(maps*)calloc(1,MAPS_SIZE); 1575 if(tmpmaps == NULL){ 1576 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1577 } 1578 tmpmaps->name=strdup("missingIndetifier"); 1579 tmpmaps->content=createMap((char*)cur1->name,(char*)val); 1580 tmpmaps->next=NULL; 1581 } 1582 else{ 1583 if(tmpmaps->content!=NULL) 1584 addToMap(tmpmaps->content, 1585 (char*)cur1->name,(char*)val); 1586 else 1587 tmpmaps->content= 1588 createMap((char*)cur1->name,(char*)val); 1589 } 1590 xmlFree(val); 1591 } 1592 else if(xmlStrncasecmp(cur1->name,BAD_CAST "Output",xmlStrlen(cur1->name))==0){ 1583 1593 /** 1584 1594 * Get every attribute from a Output node 1585 1595 * mimeType, encoding, schema, uom, asReference 1586 1596 */ 1587 const char *outs[5]; 1588 outs[0]="mimeType"; 1589 outs[1]="encoding"; 1590 outs[2]="schema"; 1591 outs[3]="uom"; 1592 outs[4]="asReference"; 1597 const char *outs[5]={"mimeType","encoding","schema","uom","asReference"}; 1593 1598 for(int l=0;l<5;l++){ 1594 1599 #ifdef DEBUG … … 1632 1637 * Title, Asbtract 1633 1638 */ 1634 if(xmlStrncasecmp(cur2->name,BAD_CAST "Title",xmlStrlen(cur2->name))==0 ||1639 else if(xmlStrncasecmp(cur2->name,BAD_CAST "Title",xmlStrlen(cur2->name))==0 || 1635 1640 xmlStrncasecmp(cur2->name,BAD_CAST "Abstract",xmlStrlen(cur2->name))==0){ 1636 1641 xmlChar *val= … … 1684 1689 dumpMaps(request_output_real_format); 1685 1690 dumpMap(request_inputs); 1691 fprintf(stderr,"\n%i\n",i); 1686 1692 #endif 1687 1693 … … 1691 1697 */ 1692 1698 char *dfv=addDefaultValues(&request_input_real_format,s1->inputs,m,0); 1693 if(strcmp(dfv,"")!=0){ 1699 char *dfv1=addDefaultValues(&request_output_real_format,s1->outputs,m,1); 1700 if(strcmp(dfv1,"")!=0 || strcmp(dfv,"")!=0){ 1694 1701 char tmps[1024]; 1695 snprintf(tmps,1024,_("The <%s> argument was not specified in DataInputs but defined as requested in ZOO ServicesProvider configuration file, please correct your query or the ZOO Configuration file."),dfv); 1702 if(strcmp(dfv,"")!=0){ 1703 snprintf(tmps,1024,_("The <%s> argument was not specified in DataInputs but defined as requested in ZOO ServicesProvider configuration file, please correct your query or the ZOO Configuration file."),dfv); 1704 } 1705 else if(strcmp(dfv1,"")!=0){ 1706 snprintf(tmps,1024,_("The <%s> argument was specified as Output identifier but not defined in the ZOO Configuration File. Please, correct your query or the ZOO Configuration File."),dfv1); 1707 } 1696 1708 map* tmpe=createMap("text",tmps); 1697 1709 addToMap(tmpe,"code","MissingParameterValue"); … … 1713 1725 return 1; 1714 1726 } 1715 addDefaultValues(&request_output_real_format,s1->outputs,m,1);1716 1727 1717 1728 ensureDecodedBase64(&request_input_real_format); … … 1807 1818 addToMap(_tmpMaps->content,"status","0"); 1808 1819 addToMap(_tmpMaps->content,"cwd",ntmp); 1820 map* ltmp=getMap(request_inputs,"soap"); 1821 if(ltmp!=NULL) 1822 addToMap(_tmpMaps->content,"soap",ltmp->value); 1823 else 1824 addToMap(_tmpMaps->content,"soap","false"); 1809 1825 if(cgiCookie!=NULL && strlen(cgiCookie)>0){ 1810 1826 addToMap(_tmpMaps->content,"sessid",strstr(cgiCookie,"=")+1); … … 1824 1840 if(istat==0 && file_status.st_size>0){ 1825 1841 conf_read(session_file_path,tmpSess); 1826 dumpMaps(tmpSess);1827 1842 addMapsToMaps(&m,tmpSess); 1828 1843 freeMaps(&tmpSess); … … 1849 1864 addToMap(request_inputs,"status","true"); 1850 1865 status=getMap(request_inputs,"status"); 1851 dumpMap(request_inputs);1852 1866 fprintf(stderr,"cgiSID : %s",cgiSid); 1853 1867 } -
branches/branch-1.2/zoo-services/cgal/Makefile
r217 r301 1 CFLAGS=-I../../zoo-kernel/ -I./ `xml2-config --cflags` `python-config --cflags` -DLINUX_FREE_ISSUE #-DDEBUG 1 ZRPATH=../../.. 2 include ${ZRPATH}/zoo-kernel/ZOOMakefile.opts 3 CFLAGS=${ZOO_CFLAGS} ${XML2CFLAGS} ${GDAL_CFLAGS} ${PYTHONCFLAGS} -DLINUX_FREE_ISSUE #-DDEBUG 2 4 CC=gcc 3 5 4 6 cgi-env/cgal_service.zo: service.c 5 g++ ${CFLAGS} -shared -fpic -o cgi-env/cgal_service.zo ./service.c -lgdal-lCGAL7 g++ ${CFLAGS} -shared -fpic -o cgi-env/cgal_service.zo ./service.c ${GDAL_LIBS} ${MACOS_LD_FLAGS} -lCGAL 6 8 7 9 clean: 8 rm -f cgi-env/*.zo *.o *.tab.c *.tab.h *.sr.c* service_loader lex.* *.lreg *.sibling 9 rm -rf service_loader.dSYM 10 rm -f cgi-env/*.zo -
branches/branch-1.2/zoo-services/gdal/grid/Makefile
r1 r301 1 CFLAGS=-I../../../zoo-kernel-svn/ -I./ `xml2-config --cflags` `python-config --cflags` -DLINUX_FREE_ISSUE #-DDEBUG 1 ZRPATH=../../.. 2 include ${ZRPATH}/zoo-kernel/ZOOMakefile.opts 3 CFLAGS=${ZOO_CFLAGS} ${XML2CFLAGS} ${GDAL_CFLAGS} ${PYTHONCFLAGS} -DLINUX_FREE_ISSUE #-DDEBUG 2 4 CC=gcc 3 5 4 6 cgi-env/service.zo: service.c 5 g++ -DZOO_SERVICE ${CFLAGS} -shared -fpic -o cgi-env/gdal_grid_service.zo ./service.c -lgdal7 g++ -DZOO_SERVICE ${CFLAGS} -shared -fpic -o cgi-env/gdal_grid_service.zo ./service.c ${GDAL_LIBS} ${MACOS_LD_FLAGS} 6 8 7 9 clean: -
branches/branch-1.2/zoo-services/gdal/grid/service.c
r1 r301 879 879 char *ext=new char[4]; 880 880 ext="tif"; 881 if(str cmp(mtoupper((char*)pszFormat),"AAIGRID")==0)881 if(strncasecmp(pszFormat,"AAIGRID",7)==0) 882 882 ext="csv"; 883 883 else 884 if(str cmp(mtoupper((char*)pszFormat),"PNG")==0)884 if(strncasecmp(pszFormat,"PNG",3)==0) 885 885 ext="png"; 886 886 else 887 if(str cmp(mtoupper((char*)pszFormat),"GIF")==0)887 if(strncasecmp(pszFormat,"GIF",3)==0) 888 888 ext="gif"; 889 889 else 890 if(str cmp(mtoupper((char*)pszFormat),"JPEG")==0)890 if(strncasecmp(pszFormat,"JPEG",4)==0) 891 891 ext="jpg"; 892 892 sprintf((char*)pszDest,"%s/%s.%s",tempPath,tmpMap->value,ext); -
branches/branch-1.2/zoo-services/gdal/profile/Makefile
r50 r301 1 CFLAGS=-I../../../zoo-kernel/ -I./ `xml2-config --cflags` `python-config --cflags` -DLINUX_FREE_ISSUE #-DDEBUG 1 ZRPATH=../../.. 2 include ${ZRPATH}/zoo-kernel/ZOOMakefile.opts 3 CFLAGS=${ZOO_CFLAGS} ${XML2CFLAGS} ${GDAL_CFLAGS} ${PYTHONCFLAGS} -DLINUX_FREE_ISSUE #-DDEBUG 2 4 CC=gcc 3 5 4 6 cgi-env/gdal_profile_service.zo: service.c 5 g++ -DZOO_SERVICE ${CFLAGS} -shared -fpic -o cgi-env/gdal_profile_service.zo ./service.c -lgdal7 g++ -DZOO_SERVICE ${CFLAGS} -shared -fpic -o cgi-env/gdal_profile_service.zo ./service.c ${GDAL_LIBS} ${MACOS_LD_FLAGS} 6 8 7 9 clean: -
branches/branch-1.2/zoo-services/gdal/translate/Makefile
r1 r301 1 CFLAGS=-I../../../zoo-kernel-svn/ -I./ `xml2-config --cflags` `python-config --cflags` -DLINUX_FREE_ISSUE #-DDEBUG 1 ZRPATH=../../.. 2 include ${ZRPATH}/zoo-kernel/ZOOMakefile.opts 3 CFLAGS=${ZOO_CFLAGS} ${XML2CFLAGS} ${GDAL_CFLAGS} ${PYTHONCFLAGS} -DLINUX_FREE_ISSUE #-DDEBUG 2 4 CC=gcc 3 5 4 6 cgi-env/service.zo: service.c 5 g++ ${CFLAGS} -shared -fpic -o cgi-env/service.zo ./service.c -lgdal7 g++ ${CFLAGS} -shared -fpic -o cgi-env/service.zo ./service.c ${GDAL_LIBS} ${MACOS_LD_FLAGS} 6 8 7 9 clean: 8 rm -f *.zo *.o *.tab.c *.tab.h *.sr.c* service_loader lex.* *.lreg *.sibling 9 rm -rf service_loader.dSYM 10 rm -f cgi-env/*.zo -
branches/branch-1.2/zoo-services/gdal/translate/cgi-env/Gdal_Translate.zcfg
r106 r301 8 8 serviceProvider = gdal_service.zo 9 9 <MetaData> 10 Test= My Demo10 title = My Demo 11 11 </MetaData> 12 12 <DataInputs> … … 19 19 DataType = string 20 20 <Default> 21 value = AAIGrid21 value = demo.tif 22 22 </Default> 23 23 </LiteralData> -
branches/branch-1.2/zoo-services/gdal/translate/service.c
r1 r301 133 133 char *ext=new char[4]; 134 134 ext="tif"; 135 if(str cmp(mtoupper((char*)pszFormat),"AAIGRID")==0)135 if(strncasecmp(pszFormat,"AAIGRID",7)==0) 136 136 ext="csv"; 137 137 else 138 if(str cmp(mtoupper((char*)pszFormat),"PNG")==0)138 if(strncasecmp(pszFormat,"PNG",3)==0) 139 139 ext="png"; 140 140 else 141 if(str cmp(mtoupper((char*)pszFormat),"GIF")==0)141 if(strncasecmp(pszFormat,"GIF",3)==0) 142 142 ext="gif"; 143 143 else 144 if(str cmp(mtoupper((char*)pszFormat),"JPEG")==0)144 if(strncasecmp(pszFormat,"JPEG",4)==0) 145 145 ext="jpg"; 146 146 sprintf((char*)pszDest,"%s/%s.%s",tempPath,tmpMap->value,ext); -
branches/branch-1.2/zoo-services/ogr/base-vect-ops/Makefile
r106 r301 1 CFLAGS=-I../../../zoo-kernel/ -I./ `geos-config --cflags` `xml2-config --cflags` `gdal-config --cflags` -DLINUX_FREE_ISSUE #-DDEBUG 2 # if JS_ENABLED flag is set to true in your ZOO-Kernel Makefile then you'll have 3 # uncomment the following line 4 # JS_LDFLAGS=../../../zoo-kernel/ulinet.o ../../../zoo-kernel/service_internal_js.o 1 ZRPATH=../../.. 2 include ${ZRPATH}/zoo-kernel/ZOOMakefile.opts 3 CFLAGS=${ZOO_CFLAGS} ${JSCFLAGS} ${XML2CFLAGS} ${GDAL_CFLAGS} `geos-config --cflags` -DLINUX_FREE_ISSUE #-DDEBUG 5 4 6 5 cgi-env/ogr_service.zo: service.c 7 g++ ${CFLAGS} -shared -fpic -o cgi-env/ogr_service.zo ./service.c ../../../zoo-kernel/service_internal.o ${JS_LDFLAGS} `xml2-config --libs` `gdal-config --libs``geos-config --libs`6 g++ ${CFLAGS} -shared -fpic -o cgi-env/ogr_service.zo ./service.c ../../../zoo-kernel/service_internal.o ${JS_LDFLAGS} ${JSLDFLAGS} ${GDAL_LIBS} ${XML2LDFLAGS} ${MACOS_LD_FLAGS} ${ZOO_LDFLAGS} ${MACOS_LD_NET_FLAGS} `geos-config --libs` 8 7 9 8 clean: -
branches/branch-1.2/zoo-services/ogr/base-vect-ops/service.c
r217 r301 44 44 void printExceptionReportResponse(maps*,map*); 45 45 char *base64(const char *input, int length); 46 int errorException(maps *m, const char *message, const char *errorcode); 46 47 47 48 OGRGeometryH createGeometryFromGML(maps* conf,char* inputStr){ -
branches/branch-1.2/zoo-services/utils/status/Makefile
r268 r301 1 CFLAGS=-I../../../thirds/cgic206/ -I../../../zoo-kernel/ -I./ `xslt-config --cflags` `xml2-config --cflags` -lintl -lfcgi -lcrypto -DLINUX_FREE_ISSUE #-DDEBUG 2 # if JS_ENABLED flag is set to true in your ZOO-Kernel Makefile then you'll have 3 # uncomment the following line 4 # JS_LDFLAGS=../../../zoo-kernel/ulinet.o ../../../zoo-kernel/service_internal_js.o 1 ZRPATH=../../.. 2 include ${ZRPATH}/zoo-kernel/ZOOMakefile.opts 3 CFLAGS=${ZOO_CFLAGS} ${XML2CFLAGS} ${GDAL_CFLAGS} ${PYTHONCFLAGS} -DLINUX_FREE_ISSUE #-DDEBUG 5 4 6 5 cgi-env/wps_status.zo: service.c 7 g++ ${CFLAGS} -shared -fpic -o cgi-env/wps_status.zo ./service.c ../../../zoo-kernel/service_internal.o ${JS_LDFLAGS} `xml2-config --libs` `xslt-config --libs`6 g++ ${CFLAGS} -shared -fpic -o cgi-env/wps_status.zo ./service.c ../../../zoo-kernel/service_internal.o ${JS_LDFLAGS} ${JSLDFLAGS} ${GDAL_LIBS} ${XML2LDFLAGS} ${MACOS_LD_FLAGS} ${ZOO_LDFLAGS} ${MACOS_LD_NET_FLAGS} `xslt-config --libs` -lfcgi 8 7 9 8 clean:
Note: See TracChangeset
for help on using the changeset viewer.