Changeset 961 for trunk/zoo-project
- Timestamp:
- Sep 8, 2020, 4:51:09 PM (4 years ago)
- Location:
- trunk/zoo-project
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/HISTORY.txt
r960 r961 1 1 Version 1.8.0-dev 2 * Produce value string only when memory=load for Python support. 3 * Make local files uris usable when cache is used 4 * Make GDAL/prilfe service usable in case memory=protect 2 5 * Add Dockerfile and docker-compose environment with pgbouncer, see #177 3 6 * Add documentation on how to use asyncrhonous execution using the Javascript -
trunk/zoo-project/zoo-kernel/caching.c
r955 r961 403 403 if(strncasecmp(request,"file://",7)==0){ 404 404 char* tmpStr=zStrdup(request+7); 405 fprintf(stderr,"**** %s %d %s \n",__FILE__,__LINE__,tmpStr);405 setMapInMaps(conf,"lenv",tmpStr,"local"); 406 406 return tmpStr; 407 407 } … … 709 709 unlockFile(*m,lck); 710 710 } 711 cached[strlen(cached)-1]='m'; 712 s=zStat(cached, &f_status); 713 if(s==0){ 714 zooLock* lck=lockFile(*m,cached,'r'); 715 if(lck==NULL) 716 return -1; 717 mimeType=(char*)malloc(sizeof(char)*(f_status.st_size+1)); 718 FILE* f=fopen(cached,"rb"); 719 fread(mimeType,f_status.st_size,1,f); 720 mimeType[f_status.st_size]=0; 721 fclose(f); 722 unlockFile(*m,lck); 723 } 724 cached[strlen(cached)-1]='p'; 725 s=zStat(cached, &f_status); 726 if(s==0){ 727 zooLock* lck=lockFile(*m,cached,'r'); 728 if(lck==NULL) 729 return -1; 730 origin=(char*)malloc(sizeof(char)*(f_status.st_size+1)); 731 FILE* f=fopen(cached,"rb"); 732 fread(origin,f_status.st_size,1,f); 733 mimeType[f_status.st_size]=0; 734 fclose(f); 735 unlockFile(*m,lck); 736 } 711 map* isLocalFile=getMapFromMaps(*m,"lenv",cached); 712 if(isLocalFile==NULL){ 713 cached[strlen(cached)-1]='m'; 714 s=zStat(cached, &f_status); 715 if(s==0){ 716 zooLock* lck=lockFile(*m,cached,'r'); 717 if(lck==NULL) 718 return -1; 719 mimeType=(char*)malloc(sizeof(char)*(f_status.st_size+1)); 720 FILE* f=fopen(cached,"rb"); 721 fread(mimeType,f_status.st_size,1,f); 722 mimeType[f_status.st_size]=0; 723 fclose(f); 724 unlockFile(*m,lck); 725 } 726 cached[strlen(cached)-1]='p'; 727 s=zStat(cached, &f_status); 728 if(s==0){ 729 zooLock* lck=lockFile(*m,cached,'r'); 730 if(lck==NULL) 731 return -1; 732 origin=(char*)malloc(sizeof(char)*(f_status.st_size+1)); 733 FILE* f=fopen(cached,"rb"); 734 fread(origin,f_status.st_size,1,f); 735 mimeType[f_status.st_size]=0; 736 fclose(f); 737 unlockFile(*m,lck); 738 } 739 } 737 740 }else{ 738 741 addRequestToQueue(m,hInternet,url,true); -
trunk/zoo-project/zoo-kernel/main_conf_read.y
r917 r961 162 162 freeMap(¤t_content); 163 163 free(current_content); 164 }else{ 165 current_maps->next=NULL; 164 166 } 165 167 if(curr_key!=NULL){ -
trunk/zoo-project/zoo-kernel/server_internal.c
r921 r961 373 373 return ; 374 374 } 375 fseek(file, 0, SEEK_END);376 375 zStatStruct f_status; 377 376 int s=zStat(filename, &f_status); 378 377 sprintf(rsize,"%lld",f_status.st_size); 379 rewind(file);380 378 if(getMap(content,"storage")==NULL){ 381 379 map* memUse=getMapFromMaps(m,"main","memory"); … … 390 388 if(tmpMap1->value==NULL){ 391 389 setMapInMaps(m,"lenv","message","Unable to allocate the memory required to read the produced file."); 390 return; 392 391 } 393 392 fread(&tmpMap1->value,1,f_status.st_size,file); … … 395 394 } 396 395 } 397 fclose(file); 398 addToMap(content,"size",rsize); 396 fclose(file); 397 if(content!=NULL) 398 addToMap(content,"size",rsize); 399 399 } 400 400 -
trunk/zoo-project/zoo-kernel/service.c
r957 r961 328 328 fprintf(stderr,"freeMap\n"); 329 329 #endif 330 free(_cursor->name); 331 free(_cursor->value); 330 if(_cursor->name!=NULL) 331 free(_cursor->name); 332 if(_cursor->value!=NULL) 333 free(_cursor->value); 332 334 if(_cursor->next!=NULL){ 333 335 freeMap(&_cursor->next); 334 free(_cursor->next); 336 if(_cursor->next!=NULL) 337 free(_cursor->next); 335 338 } 336 339 } … … 825 828 else{ 826 829 maps* tmp1=getMaps(*mo,tmp->name); 827 while(_cursor->next!=NULL)828 _cursor=_cursor->next;829 830 if(tmp1==NULL){ 831 while(_cursor->next!=NULL) 832 _cursor=_cursor->next; 830 833 _cursor->next=dupMaps(&tmp); 831 834 if(tmp->child!=NULL) -
trunk/zoo-project/zoo-kernel/service_internal_python.c
r943 r961 468 468 while(tmp!=NULL){ 469 469 PyObject* name=PyString_FromString(tmp->name); 470 if(strcasecmp(tmp->name,"value")==0 ) {470 if(strcasecmp(tmp->name,"value")==0 && strlen(tmp->value)>0) { 471 471 if(isArray!=NULL){ 472 472 map* len=getMap(tmp,"length"); -
trunk/zoo-project/zoo-services/gdal/profile/service.c
r945 r961 35 35 #include "cpl_conv.h" 36 36 #include "ogr_api.h" 37 #if GDAL_VERSION_MAJOR >= 2 38 #include <gdal_priv.h> 39 #endif 37 40 38 41 #ifdef ZOO_SERVICE … … 87 90 GDALComputeRasterMinMax( hBand, TRUE, adfMinMax ); 88 91 #ifdef ZOO_SERVICE 92 OGRGeometryH geometry=NULL; 93 // Verify if there is a cache file for this input, use it if available 94 tmp1=getMapFromMaps(inputs,"Geometry","cache_file"); 95 if(tmp1!=NULL){ 96 #if GDAL_VERSION_MAJOR >= 2 97 char* pszDataSource=strdup(tmp1->value); 98 GDALDatasetH poDS 99 = GDALOpenEx( pszDataSource, 100 GDAL_OF_READONLY | GDAL_OF_VECTOR, 101 NULL, NULL, NULL ); 102 #endif 103 for( int iLayer = 0; iLayer < OGR_DS_GetLayerCount(poDS) ; 104 iLayer++ ) 105 { 106 OGRLayerH poLayer = OGR_DS_GetLayer(poDS,iLayer); 107 108 if( poLayer == NULL ) 109 { 110 fprintf( stderr, "FAILURE: Couldn't fetch advertised layer %d!\n", 111 iLayer ); 112 char tmp[1024]; 113 sprintf(tmp,"Couldn't fetch advertised layer %d!",iLayer); 114 setMapInMaps(conf,"lenv","message",tmp); 115 return SERVICE_FAILED; 116 } 117 OGRFeatureH poFeature; 118 int nFeaturesInTransaction = 0; 119 int fCount=0; 120 OGR_L_ResetReading(poLayer); 121 while( TRUE ) 122 { 123 poFeature = OGR_L_GetNextFeature(poLayer); 124 if( poFeature == NULL ){ 125 break; 126 } 127 geometry=OGR_G_Clone(OGR_F_GetGeometryRef(poFeature)); 128 OGR_F_Destroy( poFeature ); 129 } 130 131 } 132 } 133 else{ 89 134 tmp1=getMapFromMaps(inputs,"Geometry","value"); 90 OGRGeometryH geometry=OGR_G_CreateGeometryFromJson(tmp1->value); 135 geometry=OGR_G_CreateGeometryFromJson(tmp1->value); 136 } 91 137 #else 92 138 OGRGeometryH geometry=OGR_G_CreateGeometryFromJson(argv[2]);
Note: See TracChangeset
for help on using the changeset viewer.