Changeset 384
- Timestamp:
- Jan 9, 2013, 11:52:44 PM (12 years ago)
- Location:
- trunk/zoo-project
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/makefile.vc
r366 r384 62 62 63 63 zoo_loader.cgi: zoo_loader.obj zoo_service_loader.obj service_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) ulinet.obj lex.cr.obj lex.sr.obj service_conf.tab.obj main_conf_read.tab.obj dirent.obj 64 link zoo_loader.obj dirent.obj service_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) ulinet.obj main_conf_read.tab.obj lex.cr.obj service_conf.tab.obj lex.sr.obj zoo_service_loader.obj /out:zoo_loader.cgi $(LDFLAGS) 64 link zoo_loader.obj dirent.obj service_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) ulinet.obj main_conf_read.tab.obj lex.cr.obj service_conf.tab.obj lex.sr.obj zoo_service_loader.obj /out:zoo_loader.cgi $(LDFLAGS) $(LDFLAGSCGI) 65 65 66 66 clean: -
trunk/zoo-project/zoo-kernel/nmake.opt
r375 r384 38 38 CFLAGS=$(CFLAGS1) /nologo /MD /W3 /EHsc /Ox /D_CRT_SECURE_NO_WARNINGS /DWIN32 $(CJFLAGS) -I$(ZOOK_DIR) -I./ $(JAVA_CFLAGS) $(MS_CFLAGS) -I$(TROOT)\..\..\thirds\dirent-win32 -I$(INTL_DIR) -I$(CURL_DIR)\include -I$(XML2_DIR)\include -I$(GDAL_DIR)\port $(JS_CFLAGS) -I$(GDAL_DIR)\ogr -I$(GDAL_DIR)\gcore -I$(GD_DIR) -I$(ICONV_DIR) -I$(TROOT)\..\..\thirds\include -I$(TROOT)\..\..\thirds\cgic206 -I$(PYTHON_CPATH)\include -I$(SSL_DIR)/inc32 -I$(FCGI_DIR)\include $(PY_CFLAGS) -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF 39 39 40 LDFLAGS=$(FCGI_LIBRARY) $(CURL_LIBRARY) $(PY_LDFLAGS) $(XML2_LIBRARY) $(TROOT)/../../thirds/cgic206/libcgic.lib $(SSL_DIR)/out32dll/libeay32.lib $(JAVA_LDFLAGS) $(SSL_DIR)/out32dll/ssleay32.lib $(MS_LDFLAGS) $(INTL_DIR)/intl.lib $(XML2_DIR)/win32/bin.msvc/libxml2.lib $(GDAL_DIR)/gdal_i.lib $(CURL_DIR)/lib/libcurl.lib $(JS_LDFLAGS) /machine:i386 40 LDFLAGSCGI=$(TROOT)/../../thirds/cgic206/libcgic.lib 41 LDFLAGS=$(FCGI_DIR)/libfcgi/Release/libfcgi.lib $(CURL_LIBRARY) $(PY_LDFLAGS) $(XML2_LIBRARY) $(SSL_DIR)/out32dll/libeay32.lib $(JAVA_LDFLAGS) $(SSL_DIR)/out32dll/ssleay32.lib $(MS_LDFLAGS) $(INTL_DIR)/intl.lib $(XML2_DIR)/win32/bin.msvc/libxml2.lib $(GDAL_DIR)/gdal_i.lib $(CURL_DIR)/lib/libcurl.lib $(JS_LDFLAGS) /machine:i386 -
trunk/zoo-project/zoo-kernel/service_internal.c
r383 r384 78 78 79 79 void updateStatus(maps *conf){ 80 fprintf(stderr,"OK Final 1 \n"); 81 fflush(stderr); 82 LPWSTR lpszTmp; 83 BOOL fInit; 84 char *s=NULL; 85 map *tmpMap=getMapFromMaps(conf,"lenv","sid"); 86 fprintf(stderr,"OK Final 11 \n"); 87 fflush(stderr); 88 if(hMapObjectG==NULL) 89 hMapObjectG = CreateFileMapping( 90 INVALID_HANDLE_VALUE, // use paging file 91 NULL, // default security attributes 92 PAGE_READWRITE, // read/write access 93 0, // size: high 32-bits 94 SHMEMSIZE, // size: low 32-bits 95 TEXT(tmpMap->value)); // name of map object 96 if (hMapObjectG == NULL){ 97 fprintf(stderr,"Unable to create share memory segment %s !! \n",tmpMap->value); 98 return ; 99 } 100 fprintf(stderr,"OK Final 2 \n"); 101 fflush(stderr); 102 fInit = (GetLastError() != ERROR_ALREADY_EXISTS); 103 if(lpvMemG==NULL) 104 lpvMemG = MapViewOfFile( 105 hMapObjectG, // object to map view of 106 FILE_MAP_WRITE, // read/write access 107 0, // high offset: map from 108 0, // low offset: beginning 109 0); // default: map entire file 110 if (lpvMemG == NULL){ 111 fprintf(stderr,"Unable to create or access the shared memory segment %s !! \n",tmpMap->value); 112 return ; 113 } 114 fprintf(stderr,"OK Final 3 \n"); 115 fflush(stderr); 116 if (fInit) 117 memset(lpvMemG, '\0', SHMEMSIZE); 118 fprintf(stderr,"OK Final 4 \n"); 119 fflush(stderr); 120 tmpMap=getMapFromMaps(conf,"lenv","status"); 121 lpszTmp = (LPWSTR) lpvMemG; 122 for(s=tmpMap->value;*s!=NULL;s++) 123 *lpszTmp++ = *s; 124 *lpszTmp = '\0'; 80 LPWSTR lpszTmp; 81 BOOL fInit; 82 char *s=NULL; 83 map *tmpMap=getMapFromMaps(conf,"lenv","sid"); 84 if(hMapObjectG==NULL) 85 hMapObjectG = CreateFileMapping( 86 INVALID_HANDLE_VALUE, // use paging file 87 NULL, // default security attributes 88 PAGE_READWRITE, // read/write access 89 0, // size: high 32-bits 90 SHMEMSIZE, // size: low 32-bits 91 TEXT(tmpMap->value)); // name of map object 92 if (hMapObjectG == NULL){ 93 fprintf(stderr,"Unable to create share memory segment %s !! \n",tmpMap->value); 94 return ; 95 } 96 fInit = (GetLastError() != ERROR_ALREADY_EXISTS); 97 if(lpvMemG==NULL) 98 lpvMemG = MapViewOfFile( 99 hMapObjectG, // object to map view of 100 FILE_MAP_WRITE, // read/write access 101 0, // high offset: map from 102 0, // low offset: beginning 103 0); // default: map entire file 104 if (lpvMemG == NULL){ 105 fprintf(stderr,"Unable to create or access the shared memory segment %s !! \n",tmpMap->value); 106 return ; 107 } 108 if (fInit) 109 memset(lpvMemG, '\0', SHMEMSIZE); 110 tmpMap=getMapFromMaps(conf,"lenv","status"); 111 lpszTmp = (LPWSTR) lpvMemG; 112 for(s=tmpMap->value;*s!=NULL;s++) 113 *lpszTmp++ = *s; 114 *lpszTmp = '\0'; 125 115 } 126 116 … … 159 149 return "-1"; 160 150 lpszTmp = (LPWSTR) lpvMem; 161 while (*lpszTmp!=NULL) 162 *lpszBuf++ = *lpszTmp++; 163 *lpszBuf = '\0'; 164 fIgnore = UnmapViewOfFile(lpvMem); 165 fIgnore = CloseHandle(hMapObject); 166 return (char*)lpszBuf; 151 return (char*)lpszTmp; 167 152 } 168 153 … … 1391 1376 char *encoding=getEncoding(m); 1392 1377 if(pid==getpid()){ 1378 printHeaders(m); 1393 1379 printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); 1394 1380 } … … 1745 1731 xmlNodePtr n; 1746 1732 1747 printHeaders(m);1748 1733 doc = xmlNewDoc(BAD_CAST "1.0"); 1749 1734 maps* tmpMap=getMaps(m,"main"); … … 1752 1737 map *tmpSid=getMapFromMaps(m,"lenv","sid"); 1753 1738 if(tmpSid!=NULL){ 1754 if( getpid()==atoi(tmpSid->value) ) 1739 if( getpid()==atoi(tmpSid->value) ){ 1740 printHeaders(m); 1755 1741 printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); 1756 } 1757 else 1742 } 1743 } 1744 else{ 1745 printHeaders(m); 1758 1746 printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); 1747 } 1759 1748 }else 1760 1749 printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); … … 1862 1851 } 1863 1852 1864 printHeaders(m);1865 1866 1853 if(asRaw==0){ 1867 1854 #ifdef DEBUG … … 2007 1994 if(rs!=NULL) 2008 1995 printf("Content-Length: %s\r\n",rs->value); 2009 1996 printHeaders(m); 2010 1997 char mime[1024]; 2011 1998 map* mi=getMap(tmpI->content,"mimeType"); -
trunk/zoo-project/zoo-kernel/service_internal_js.c
r383 r384 103 103 104 104 /* Create a context. */ 105 cx = JS_NewContext(rt,8192 0);105 cx = JS_NewContext(rt,8192); 106 106 if (cx == NULL){ 107 107 return 1; -
trunk/zoo-project/zoo-kernel/zoo_service_loader.c
r381 r384 431 431 } 432 432 433 433 434 #ifdef WIN32 434 435 /** … … 449 450 char *dataInputsKVP=getMapsAsKVP(inputs,cgiContentLength,0); 450 451 char *dataOutputsKVP=getMapsAsKVP(outputs,cgiContentLength,1); 452 #ifdef DEBUG 451 453 fprintf(stderr,"DATAINPUTSKVP %s\n",dataInputsKVP); 452 454 fprintf(stderr,"DATAOUTPUTSKVP %s\n",dataOutputsKVP); 455 #endif 453 456 map *sid=getMapFromMaps(m,"lenv","sid"); 454 457 map* r_inputs=getMapFromMaps(m,"main","tmpPath"); 455 map* r_inputs1=getMap(s1->content,"ServiceProvider"); 458 map* r_inputs1=getMap(request_inputs,"metapath"); 459 int hasIn=-1; 460 if(r_inputs1==NULL){ 461 r_inputs1=createMap("metapath",""); 462 hasIn=1; 463 } 456 464 map* r_inputs2=getMap(s1->content,"ResponseDocument"); 457 465 if(r_inputs2==NULL) … … 460 468 461 469 if(r_inputs2!=NULL){ 462 sprintf(tmp,"\" request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s&%s=%s&cgiSid=%s\"",req->value,id->value,dataInputsKVP,r_inputs2->name,r_inputs2->value,sid->value);463 sprintf(tmpq,"request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s&%s=%s",req->value,id->value,dataInputsKVP,r_inputs2->name,dataOutputsKVP);470 sprintf(tmp,"\"metapath=%s&request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s&%s=%s&cgiSid=%s\"",r_inputs1->value,req->value,id->value,dataInputsKVP,r_inputs2->name,r_inputs2->value,sid->value); 471 sprintf(tmpq,"metapath=%s&request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s&%s=%s",r_inputs1->value,req->value,id->value,dataInputsKVP,r_inputs2->name,dataOutputsKVP); 464 472 } 465 473 else{ 466 sprintf(tmp,"\"request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s&cgiSid=%s\"",req->value,id->value,dataInputsKVP,sid->value); 467 sprintf(tmpq,"request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s",req->value,id->value,dataInputsKVP,sid->value); 468 } 469 474 sprintf(tmp,"\"metapath=%s&request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s&cgiSid=%s\"",r_inputs1->value,req->value,id->value,dataInputsKVP,sid->value); 475 sprintf(tmpq,"metapath=%s&request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s",r_inputs1->value,req->value,id->value,dataInputsKVP,sid->value); 476 } 477 478 if(hasIn>0){ 479 freeMap(&r_inputs1); 480 free(r_inputs1); 481 } 470 482 char *tmp1=strdup(tmp); 471 483 sprintf(tmp,"zoo_loader.cgi %s \"%s\"",tmp1,sid->value); 472 484 473 485 free(dataInputsKVP); 474 486 free(dataOutputsKVP); 487 //printf("REQUEST IS : %s \n",tmp); 488 #ifdef DEBUG 475 489 fprintf(stderr,"REQUEST IS : %s \n",tmp); 490 #endif 476 491 SetEnvironmentVariable("CGISID",TEXT(sid->value)); 477 492 SetEnvironmentVariable("QUERY_STRING",TEXT(tmpq)); … … 492 507 ) 493 508 { 509 //printf("CreateProcess failed (%d).\n",GetLastError() ); 510 #ifdef DEBUG 494 511 fprintf( stderr, "CreateProcess failed (%d).\n", GetLastError() ); 512 #endif 495 513 return ; 496 514 }else{ 515 //printf("CreateProcess successfull (%d).\n",GetLastError() ); 516 #ifdef DEBUG 497 517 fprintf( stderr, "CreateProcess successfull (%d).\n\n\n\n", GetLastError() ); 518 #endif 498 519 } 499 520 CloseHandle( pi.hProcess ); 500 521 CloseHandle( pi.hThread ); 522 //printf("CreateProcess finished !\n"); 523 #ifdef DEBUG 501 524 fprintf(stderr,"CreateProcess finished !\n"); 525 #endif 502 526 } 503 527 #endif … … 1701 1725 } 1702 1726 /** 1703 * Get every attribute from a LiteralData node 1704 * storeExecuteResponse, lineage, status 1727 * Get every attribute: storeExecuteResponse, lineage, status 1705 1728 */ 1706 1729 const char *ress[3]={"storeExecuteResponse","lineage","status"}; … … 1742 1765 tmpmaps->next=NULL; 1743 1766 } 1744 else 1745 tmpmaps->name=strdup((char*)val);; 1767 else{ 1768 //free(tmpmaps->name); 1769 tmpmaps->name=strdup((char*)val); 1770 } 1746 1771 xmlFree(val); 1747 1772 } … … 1764 1789 else{ 1765 1790 if(tmpmaps->content!=NULL) 1766 addToMap(tmpmaps->content, 1767 (char*)cur1->name,(char*)val); 1791 addToMap(tmpmaps->content,(char*)cur1->name,(char*)val); 1768 1792 else 1769 tmpmaps->content= 1770 createMap((char*)cur1->name,(char*)val); 1793 tmpmaps->content=createMap((char*)cur1->name,(char*)val); 1771 1794 } 1772 1795 xmlFree(val); … … 1795 1818 } 1796 1819 xmlNodePtr cur2=cur1->children; 1820 while(cur2!=NULL && cur2->type != XML_ELEMENT_NODE) 1821 cur2=cur2->next; 1797 1822 while(cur2){ 1798 1823 /** … … 2125 2150 if(test1!=NULL){ 2126 2151 cgiSid=test1->value; 2127 }2128 if(cgiSid!=NULL){2129 2152 addToMap(request_inputs,"storeExecuteResponse","true"); 2130 2153 addToMap(request_inputs,"status","true"); 2154 setMapInMaps(m,"lenv","sid",test1->value); 2131 2155 status=getMap(request_inputs,"status"); 2132 //fprintf(stderr,"cgiSID : %s",cgiSid); 2133 } 2134 #endif 2156 printf("cgiSid %s\n",cgiSid); 2157 } 2158 #endif 2159 int hrstd=-1; 2160 char *fbkp,*fbkp1; 2161 FILE *f0,*f1; 2135 2162 if(status!=NULL) 2136 2163 if(strcasecmp(status->value,"false")==0) … … 2149 2176 #else 2150 2177 if(cgiSid==NULL){ 2151 addToMap(request_inputs,"cgSid",cgiSid);2152 2178 createProcess(m,request_inputs,s1,NULL,cpid,request_input_real_format,request_output_real_format); 2153 2179 pid = cpid; … … 2155 2181 pid=0; 2156 2182 cpid=atoi(cgiSid); 2157 } 2158 fflush(stderr); 2183 printf("cgiSid %s\n",cgiSid); 2184 } 2185 //printf("pid cpid %d %d\n",pid,cpid); 2186 //fflush(stderr); 2159 2187 #endif 2160 2188 if (pid > 0) { … … 2174 2202 r_inputs=getMapFromMaps(m,"main","tmpPath"); 2175 2203 map* r_inputs1=getMap(s1->content,"ServiceProvider"); 2176 char* fbkp=(char*)malloc((strlen(r_inputs->value)+strlen(r_inputs1->value)+100)*sizeof(char));2204 fbkp=(char*)malloc((strlen(r_inputs->value)+strlen(r_inputs1->value)+1024)*sizeof(char)); 2177 2205 sprintf(fbkp,"%s/%s_%d.xml",r_inputs->value,r_inputs1->value,cpid); 2178 char* flog=(char*)malloc((strlen(r_inputs->value)+strlen(r_inputs1->value)+10 0)*sizeof(char));2206 char* flog=(char*)malloc((strlen(r_inputs->value)+strlen(r_inputs1->value)+1024)*sizeof(char)); 2179 2207 sprintf(flog,"%s/%s_%d_error.log",r_inputs->value,r_inputs1->value,cpid); 2180 2208 #ifdef DEBUG … … 2184 2212 #endif 2185 2213 freopen(flog,"w+",stderr); 2186 f reopen(fbkp , "w+", stdout);2214 f0=freopen(fbkp , "w+", stdout); 2187 2215 fclose(stdin); 2188 free(fbkp);2189 2216 free(flog); 2190 2217 /** … … 2194 2221 * this way the data will be updated at the end of the process run. 2195 2222 */ 2196 updateStatus(m);2197 2223 printProcessResponse(m,request_inputs,cpid, 2198 2224 s1,r_inputs1->value,SERVICE_STARTED, … … 2202 2228 fflush(stdout); 2203 2229 rewind(stdout); 2204 #endif 2205 2230 #else 2231 #endif 2232 fbkp1=(char*)malloc((strlen(r_inputs->value)+strlen(r_inputs1->value)+1024)*sizeof(char)); 2233 sprintf(fbkp1,"%s/%s_final_%d.xml",r_inputs->value,r_inputs1->value,cpid); 2234 f1=freopen(fbkp1 , "w+", stdout); 2206 2235 loadServiceAndRun(&m,s1,request_inputs,&request_input_real_format,&request_output_real_format,&eres); 2207 2208 2236 } else { 2209 2237 /** … … 2242 2270 fclose(stderr); 2243 2271 unhandleStatus(m); 2272 /** 2273 * Dump back the final file fbkp1 to fbkp 2274 */ 2275 fclose(f0); 2276 fclose(f1); 2277 FILE* f2=fopen(fbkp1,"rb"); 2278 FILE* f3=fopen(fbkp,"wb+"); 2279 free(fbkp); 2280 free(fbkp1); 2281 fseek(f2,0,SEEK_END); 2282 long flen=ftell(f2); 2283 fseek(f2,0,SEEK_SET); 2284 char *tmps1=(char*)malloc((flen+1)*sizeof(char)); 2285 fread(tmps1,flen,1,f2); 2286 fwrite(tmps1,1,flen,f3); 2287 fclose(f2); 2288 fclose(f3); 2244 2289 } 2245 2290 -
trunk/zoo-project/zoo-services/utils/status/makefile.vc
r216 r384 1 ZOODIR=../../../zoo-kernel 2 THIRDSDIR=../../../thirds 3 !INCLUDE $(ZOODIR)/nmake.opt 4 CFLAGS=-DWIN32 -I$(THIRDSDIR)/dirent-win32 -I$(GEODIR)/include -I$(TPATH)/include -I$(ZOODIR)/ -I./ -DLINUX_FREE_ISSUE -DDEBUG 5 CPP=cl /TP 1 TROOT= $(ZOOK_DIR) 2 !INCLUDE $(ZOOK_DIR)/nmake.opt 3 4 FILES=$(ZOOK_DIR)/dirent.obj $(ZOOK_DIR)/service_internal.obj $(ZOOK_DIR)/ulinet.obj 5 !IFDEF JS_DIR 6 FILES=$(FILES) $(ZOOK_DIR)$(JS_FILE) 7 !ENDIF 8 !IFDEF JDK_DIR 9 FILES=$(FILES) $(ZOOK_DIR)$(JAVA_FILE) 10 !ENDIF 11 !IFDEF PY_DIR 12 FILES=$(FILES) $(ZOOK_DIR)$(PY_FILE) 13 !ENDIF 14 !IFDEF MS_DIR 15 FILES=$(FILES) $(ZOOK_DIR)$(MS_FILE) 16 !ENDIF 6 17 7 18 cgi-env/wps_status.zo: service.c 8 $(CPP) $(CFLAGS) /c service.c9 link /dll /out:cgi-env/wps_status.zo $( ZOODIR)/service_internal.obj $(ZOODIR)/dirent.obj ./service.obj -L$(TPATH)/lib/libssl32.dll.a $(TPATH)/lib/libxslt.lib $(TPATH)/lib/libxml2.lib $(TPATH)/lib/libeay32.dll.a $(TPATH)/lib/libcrypto.a $(TOOLS)/lib/libssl32.dll.a $(LIBINTL_CPATH)/lib/libintl.lib19 $(CPP) /D_CRT_NONSTDC_NO_DEPRECATE -DWIN32 -DZOO_SERVICE $(CFLAGS) /c service.c 20 link /dll /out:cgi-env/wps_status.zo $(FILES) ./service.obj $(LDFLAGS) $(XSLT_DIR)\win32\bin.msvc\libxslt.lib /FORCE:MULTIPLE 10 21 11 22 clean: 12 del /f cgi-env\wps* 23 erase cgi-env\*_status.* 24 erase *.obj -
trunk/zoo-project/zoo-services/utils/status/service.c
r348 r384 24 24 25 25 #include "service.h" 26 #ifdef WIN32 27 #include <windows.h> 28 #endif 26 #include "service_internal.h" 29 27 30 28 extern "C" { … … 40 38 41 39 #include <dirent.h> 42 #include "service_internal.h"43 40 44 41 /** … … 76 73 fprintf(stderr,"File : %s searched : %s\n",dp->d_name,tmp); 77 74 #endif 78 if(strstr(dp->d_name, tmp)!=0){75 if(strstr(dp->d_name,"final_")==0 && strstr(dp->d_name,tmp)!=0){ 79 76 sprintf(fileName,"%s/%s",tmpTmap->value,dp->d_name); 80 77 hasFile=1; 78 break; 81 79 } 82 80 } … … 109 107 xmlDocDumpFormatMemory(res, &xmlbuff, &buffersize, 1); 110 108 setMapInMaps(outputs,"Result","value",(char*)xmlbuff); 111 setMapInMaps(outputs,"Result","mimeType","text/xml");112 setMapInMaps(outputs,"Result","encoding","UTF-8");113 109 xmlFree(xmlbuff); 114 110 }
Note: See TracChangeset
for help on using the changeset viewer.