Changeset 897 for branches


Ignore:
Timestamp:
Mar 21, 2019, 4:14:14 PM (6 years ago)
Author:
djay
Message:

Add information abouut semaphore status for future deletion. Make sure to store on disk inputs passed by reference in case no specific memory=load has been set in the [main] section. Fix ticket #170. Add support for publishing raster applying a style definition found in the metadata (zcfg or database).

Location:
branches/prototype-v0/zoo-project/zoo-kernel
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/prototype-v0/zoo-project/zoo-kernel/makefile.vc

    r892 r897  
    7474        $(CPP) /c $(CFLAGS) service_internal_ruby.c
    7575
     76service_internal_mono.obj: service_internal_mono.c service_internal_mono.h service.h
     77        $(CPP) /c $(MONO_CLAGS) $(CFLAGS) service_internal_mono.c
     78
    7679service_internal_python.obj: service_internal_python.c service.h
    7780        $(CPP) /c $(CFLAGS) service_internal_python.c
     
    101104        link /dll /out:$(LIBZOO_SERVICE) ./service.obj ./service_internal.obj ./sqlapi.obj $(LDFLAGS) /FORCE:MULTIPLE
    102105
    103 $(PROGRAMNAME): version.h $(LIBZOO_SERVICE) zoo_loader.obj zoo_service_loader.obj service_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) $(PHP_FILE) ulinet.obj lex.cr.obj lex.sr.obj service_conf.tab.obj main_conf_read.tab.obj request_parser.obj response_print.obj server_internal.obj caching.obj service_json.obj service_callback.obj
    104         link zoo_loader.obj request_parser.obj response_print.obj server_internal.obj caching.obj service_json.obj service_callback.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) $(PHP_FILE) ulinet.obj main_conf_read.tab.obj lex.cr.obj service_conf.tab.obj lex.sr.obj  zoo_service_loader.obj ./libzoo_service.lib /out:$(PROGRAMNAME) $(LDFLAGS) $(LDFLAGSCGI) ..\..\thirds\sdk\release-1800-x64/lib/json-c.lib ..\..\thirds\sdk\release-1800-x64/lib/pthread_dll.lib ..\..\thirds\sdk\release-1800-x64/lib/libxslt.lib
     106$(PROGRAMNAME): version.h $(LIBZOO_SERVICE) zoo_loader.obj zoo_service_loader.obj service_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(MONO_FILE) $(RUBY_FILE) $(PHP_FILE) ulinet.obj lex.cr.obj lex.sr.obj service_conf.tab.obj main_conf_read.tab.obj request_parser.obj response_print.obj server_internal.obj caching.obj service_json.obj service_callback.obj
     107        link zoo_loader.obj request_parser.obj response_print.obj server_internal.obj caching.obj service_json.obj service_callback.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(MONO_FILE) $(RUBY_FILE) $(PHP_FILE) ulinet.obj main_conf_read.tab.obj lex.cr.obj service_conf.tab.obj lex.sr.obj  zoo_service_loader.obj ./libzoo_service.lib /out:$(PROGRAMNAME) $(LDFLAGS) $(LDFLAGSCGI) ..\..\thirds\sdk\release-1800-x64/lib/json-c.lib ..\..\thirds\sdk\release-1800-x64/lib/pthread_dll.lib ..\..\thirds\sdk\release-1800-x64/lib/libxslt.lib
    105108
    106 zcfg2yaml: version.h zcfg2yaml.obj zoo_service_loader.obj service_internal.obj caching.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) ulinet.obj lex.cr.obj lex.sr.obj service_conf.tab.obj main_conf_read.tab.obj
    107         link zcfg2yaml.obj server_internal.obj caching.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) $(PHP_FILE) ulinet.obj response_print.obj main_conf_read.tab.obj lex.cr.obj service_conf.tab.obj lex.sr.obj ./libzoo_service.lib /out:zcfg2yaml.exe $(LDFLAGS) $(LDFLAGSCGI)
     109zcfg2yaml: version.h zcfg2yaml.obj zoo_service_loader.obj service_internal.obj caching.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(MONO_FILE) $(RUBY_FILE) ulinet.obj lex.cr.obj lex.sr.obj service_conf.tab.obj main_conf_read.tab.obj
     110        link zcfg2yaml.obj server_internal.obj caching.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(MONO_FILE) $(RUBY_FILE) $(PHP_FILE) ulinet.obj response_print.obj main_conf_read.tab.obj lex.cr.obj service_conf.tab.obj lex.sr.obj ./libzoo_service.lib /out:zcfg2yaml.exe $(LDFLAGS) $(LDFLAGSCGI)
    108111
    109112clean:
  • branches/prototype-v0/zoo-project/zoo-kernel/nmake.opt

    r788 r897  
    8787!ENDIF
    8888
     89!IFDEF MONO_DIR
     90MONO_CFLAGS=-DUSE_MONO -I"$(MONO_DIR)"\msvc -I"$(MONO_DIR)"\msvc\include -I"$(MONO_DIR)"
     91MONO_LDFLAGS=/LIBPATH:"$(MONO_DIR)/msvc/build/sgen/x64/lib/Release" mono-2.0-sgen.lib
     92MONO_FILE=service_internal_mono.obj
     93!ENDIF
     94
    8995!IFNDEF ZOOK_DIR
    9096ZOOK_DIR=.
  • branches/prototype-v0/zoo-project/zoo-kernel/response_print.c

    r896 r897  
    28712871            geodatatype=getMap(tmpI->content,"geodatatype");
    28722872            if((nbFeatures!=NULL && atoi(nbFeatures->value)==0) ||
    2873                (geodatatype!=NULL && strcasecmp(geodatatype->value,"other")==0))
     2873               (geodatatype!=NULL && strcasecmp(geodatatype->value,"other")==0)){
    28742874              error=1;
    28752875              res=SERVICE_FAILED;
     2876            }
    28762877          }
    28772878        }
  • branches/prototype-v0/zoo-project/zoo-kernel/service_internal.c

    r896 r897  
    688688            }
    689689        }
     690        setMapInMaps(conf,"lenv","semaphore","Created");
    690691    } else if (errno == EEXIST) { /* someone else got it first */
    691692        int ready = 0;
     
    718719          return -1;
    719720        }
     721        setMapInMaps(conf,"lenv","semaphore","Acquired");
    720722    } else {
    721723        return sem_id; /* error, check errno */
  • branches/prototype-v0/zoo-project/zoo-kernel/service_internal_ms.c

    r890 r897  
    403403    extent=getMapArray(tmpI->content,options[proto][4],imyIndex);
    404404    memset(webService_url,0,strlen(webService_url));
    405     freeMap(&rformat);
     405     freeMap(&rformat);
    406406    free(rformat);
    407407    rformat=createMap("value","image/tiff");
     
    578578 
    579579    if(test!=NULL){
    580       sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",min.y,min.x,max.y,max.x);
     580      sprintf(tmpExtent,"%.15f,%.15f,%.15f,%.15f",min.y,min.x,max.y,max.x);
    581581      map* isGeo=getMapArray(output->content,"crs_isGeographic",imyIndex);
    582582#ifdef DEBUGMS
     
    584584#endif
    585585      if(isGeo!=NULL && strcasecmp("true",isGeo->value)==0){
    586         sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",min.y,min.x,max.y,max.x);
     586        sprintf(tmpExtent,"%.15f,%.15f,%.15f,%.15f",min.y,min.x,max.y,max.x);
    587587        setMapArray(output->content,"wgs84_extent",imyIndex,tmpExtent);
    588         sprintf(tmpExtent,"%f,%f,%f,%f", minY,minX, maxY, maxX);
     588        sprintf(tmpExtent,"%.15f,%.15f,%.15f,%.15f", minY,minX, maxY, maxX);
    589589      }else{
    590         sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",min.x,min.y,max.x,max.y);
     590        sprintf(tmpExtent,"%.15f,%.15f,%.15f,%.15f",min.x,min.y,max.x,max.y);
    591591        setMapArray(output->content,"wgs84_extent",imyIndex,tmpExtent);
    592592      }
    593593      setMapArray(output->content,"wms_extent",imyIndex,tmpExtent);
    594       sprintf(tmpSrsStr,"%.3f,%.3f,%.3f,%.3f",min.x,min.y,max.x,max.y);
     594      sprintf(tmpSrsStr,"%.15f,%.15f,%.15f,%.15f",min.x,min.y,max.x,max.y);
    595595      setMapArray(output->content,"wcs_extent",imyIndex,tmpExtent);
    596596    }else{
    597       sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",min.x,min.y,max.x,max.y);
     597      sprintf(tmpExtent,"%.15f,%.15f,%.15f,%.15f",min.x,min.y,max.x,max.y);
    598598      setMapArray(output->content,"wgs84_extent",imyIndex,tmpExtent);
    599       sprintf(tmpExtent,"%f,%f,%f,%f",minX, minY, maxX, maxY);
     599      sprintf(tmpExtent,"%.15f,%.15f,%.15f,%.15f",minX, minY, maxX, maxY);
    600600      map* isGeo=getMapArray(output->content,"crs_isGeographic",imyIndex);
    601601      if(isGeo!=NULL){
     
    604604#endif
    605605        if(isGeo!=NULL && strcasecmp("true",isGeo->value)==0)
    606           sprintf(tmpExtent,"%f,%f,%f,%f", minY,minX, maxY, maxX);
     606          sprintf(tmpExtent,"%.15f,%.15f,%.15f,%.15f", minY,minX, maxY, maxX);
    607607      }
    608608      setMapArray(output->content,"wms_extent",imyIndex,tmpExtent);
    609       sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",minX,minY,maxX,maxY);
     609      sprintf(tmpExtent,"%.15f,%.15f,%.15f,%.15f",minX,minY,maxX,maxY);
    610610      setMapArray(output->content,"wcs_extent",imyIndex,tmpExtent);
    611611    }
     
    754754  }
    755755
     756  setMapArray(output->content,"gdalType",imyIndex,OGR_Dr_GetName(OGR_DS_GetDriver(poDS))); 
    756757  setMapArray(output->content,"geodatatype",imyIndex,"vector");
    757758  int iLayer = 0;
     
    963964  int imyIndex=getPublishedId(output);
    964965  map* tmpMap=getMapArray(output->content,"storage",imyIndex);
     966  map* styleMap=getMap(output->content,"msStyle");
    965967  char *pszFilename=tmpMap->value;
    966968  GDALDatasetH hDataset;
     
    11121114    msInsertHashTable(&(myLayer->metadata), "ows_bandcount", nBands);
    11131115  }
    1114   if(nBandsI>=3)
    1115     if(nBandsI==4)
    1116       msLayerAddProcessing(myLayer,"BANDS=1,2,3,4");
     1116  if(styleMap==NULL || strstr(styleMap->value,"BANDS=")==NULL){
     1117    if(nBandsI>=3)
     1118      if(nBandsI==4)
     1119        msLayerAddProcessing(myLayer,"BANDS=1,2,3,4");
     1120      else
     1121        msLayerAddProcessing(myLayer,"BANDS=1,2,3");
     1122    else if(nBandsI>=2)
     1123      msLayerAddProcessing(myLayer,"BANDS=1,2");
    11171124    else
    1118       msLayerAddProcessing(myLayer,"BANDS=1,2,3");
    1119   else if(nBandsI>=2)
    1120     msLayerAddProcessing(myLayer,"BANDS=1,2");
    1121   else
    1122     msLayerAddProcessing(myLayer,"BANDS=1");
    1123  
     1125      msLayerAddProcessing(myLayer,"BANDS=1");
     1126  }
    11241127
    11251128  /**
     
    11621165      char tmpMm[100],tmpMp[100];
    11631166      sprintf(tmpMm,"%.3f %.3f",pdfMin,pdfMax);
    1164       if(pdfMin!=pdfMax)
    1165         sprintf(tmpMp,"SCALE_%d=%.3f,%.3f",iBand+1,pdfMean-(2*pdfStdDev),pdfMean+(2*pdfStdDev));
    1166       /*else
    1167         sprintf(tmpMp,"SCALE_%d=%.3f,%.3f",iBand+1,pdfMin,pdfMax);*/
     1167      if(pdfMin!=pdfMax && (styleMap==NULL || strstr(styleMap->value,"SCALE_")==NULL)){
     1168        sprintf(tmpNb,"%d",iBand+1);
     1169        if(styleMap==NULL || strstr(styleMap->value,"BANDS=")==NULL || strstr(strstr(styleMap->value,"BANDS="),tmpNb)!=NULL){
     1170          if(pdfMean-(2*pdfStdDev)<0)
     1171            sprintf(tmpMp,"SCALE_%d=%.3f,%.3f",iBand+1,0.0,pdfMean+(2*pdfStdDev));
     1172          else
     1173            sprintf(tmpMp,"SCALE_%d=%.3f,%.3f",iBand+1,pdfMean-(2*pdfStdDev),pdfMean+(2*pdfStdDev));
     1174          msLayerAddProcessing(myLayer,tmpMp);
     1175        }
     1176      }
    11681177      char tmpI[31];     
    11691178      sprintf(tmpI,"%s_interval",tmpN);
    11701179      msInsertHashTable(&(myLayer->metadata), tmpI, tmpMm);
    1171       //if(pdfMax>255)
    1172       msLayerAddProcessing(myLayer,tmpMp);
    11731180      map* test=getMap(output->content,"msClassify");
    11741181      if(test!=NULL && strncasecmp(test->value,"true",4)==0){
     
    12551262
    12561263  }
    1257   msLayerAddProcessing(myLayer,"RESAMPLE=BILINEAR");
    1258 
     1264  if(styleMap==NULL || strstr(styleMap->value,"RESAMPLE")==NULL)
     1265    msLayerAddProcessing(myLayer,"RESAMPLE=BILINEAR");
     1266 
     1267  if(styleMap!=NULL && strlen(styleMap->value)>9){
     1268    msUpdateLayerFromString(myLayer,styleMap->value,MS_FALSE);
     1269  }
     1270 
    12591271  m->layerorder[m->numlayers] = m->numlayers;
    12601272  m->numlayers++;
     
    12781290  int imyIndex=getPublishedId(outputs);
    12791291  map* mime=getMapArray(outputs->content,"mimeType",imyIndex);
     1292  map* msUrl=getMapFromMaps(conf,"main","mapserverAddress");
     1293  map* dataPath=getMapFromMaps(conf,"main","dataPath");
    12801294  char *ext="data";
    12811295  if(mime!=NULL)
     
    14821496  free(correspondance);
    14831497
     1498  map* sid=getMapFromMaps(conf,"lenv","usid");
     1499  char *mapPath=
     1500    (char*)malloc((14+strlen(sid->value)+strlen(outputs->name)+strlen(dataPath->value))*sizeof(char));
     1501  sprintf(mapPath,"%s/%s_%d_%s.map",dataPath->value,outputs->name,imyIndex,sid->value);
     1502  char *mapUrl=
     1503    (char*)malloc((6+strlen(mapPath)+strlen(msUrl->value))*sizeof(char));
     1504  sprintf(mapUrl,"%s?map=%s",msUrl->value,mapPath);
     1505
     1506  if (msInsertHashTable(&(myMap->web.metadata), "ows_onlineresource", mapUrl) == NULL){
     1507#ifdef DEBUGMS
     1508    fprintf(stderr,"Unable to add metadata");
     1509#endif
     1510    return;
     1511  }
    14841512
    14851513  if(tryOgr(conf,outputs,myMap)<0)
     
    14871515      return ;
    14881516
    1489   tmp1=getMapFromMaps(conf,"main","dataPath");
    1490   char *tmpPath=(char*)malloc((13+strlen(tmp1->value))*sizeof(char));
    1491   sprintf(tmpPath,"%s/symbols.sym",tmp1->value);
     1517  char *tmpPath=(char*)malloc((13+strlen(dataPath->value))*sizeof(char));
     1518  sprintf(tmpPath,"%s/symbols.sym",dataPath->value);
    14921519  msInitSymbolSet(&myMap->symbolset);
    14931520  myMap->symbolset.filename=zStrdup(tmpPath);
    14941521  free(tmpPath);
    14951522
    1496   map* sid=getMapFromMaps(conf,"lenv","usid");
    1497   char *mapPath=
    1498     (char*)malloc((14+strlen(sid->value)+strlen(outputs->name)+strlen(tmp1->value))*sizeof(char));
    1499   sprintf(mapPath,"%s/%s_%d_%s.map",tmp1->value,outputs->name,imyIndex,sid->value);
    15001523  msSaveMap(myMap,mapPath);
    15011524  saveMapNames(conf,outputs,mapPath);
  • branches/prototype-v0/zoo-project/zoo-kernel/sshapi.c

    r890 r897  
    33 * Author : Gérald FENOY
    44 *
    5  * Copyright 2017 GeoLabs SARL. All rights reserved.
     5 * Copyright 2017-2019 GeoLabs SARL. All rights reserved.
    66 *
    77 * This work was supported by public funds received in the framework of GEOSUD,
     
    322322 */
    323323bool ssh_copy(maps* conf,const char* localPath,const char* targetPath,int cnt){
    324   char mem[1024 * 1000];
     324  char mem[1024 * 16];
    325325  size_t nread;
    326326  size_t memuse=0;
    327327  time_t start;
    328328  long total = 0;
     329  int counter=0;
    329330  int duration;
    330331  int rc;
     
    391392      break;
    392393   
    393     if(memuse - rc) {
    394       memmove(&mem[0], &mem[rc], memuse - rc);
    395       memuse -= rc;
    396     }
    397     else
    398       memuse = 0;
     394    memuse = 0;
    399395   
    400396  } while (rc > 0);
     
    438434    }
    439435    if(!sessions[cnt]->sftp_session)
    440       zSleep(1);
     436      zSleep(10);
    441437  } while (!sessions[cnt]->sftp_session);
    442438  do {
     
    453449    }
    454450    if(!sftp_handle)
    455       zSleep(1);
     451      zSleep(10);
    456452  } while (!sftp_handle);
    457  
     453
    458454  int result=0;
     455  int counter=0;
    459456  do {
    460457    do {
    461       char* mem=(char*)malloc(16*1024*1024);
    462       rc = libssh2_sftp_read(sftp_handle, mem,16*1024*1024);
     458      char* mem=(char*)malloc(16*1024);
     459      rc = libssh2_sftp_read(sftp_handle, mem,16*1024);
    463460      if(rc > 0) {
    464461        fwrite(mem, rc, 1, local);
    465462      }
    466463      free(mem);
     464      if(counter%25==0)
     465        zSleep(10);
    467466    } while (rc > 0);
    468    
     467
    469468    if(rc != LIBSSH2_ERROR_EAGAIN) {
    470469      result=-1;
    471470      break;
    472471    }
    473    
     472
    474473    struct timeval timeout;
    475474    fd_set fd;
    476475    timeout.tv_sec = 10;
    477476    timeout.tv_usec = 0;
    478  
     477
    479478    FD_ZERO(&fd);
    480  
     479
    481480    FD_SET(sessions[cnt]->sock_id, &fd);
    482  
     481
    483482    rc = select(sessions[cnt]->sock_id+1, &fd, &fd, NULL, &timeout);
    484483    if(rc <= 0) {
     
    489488      return -1;
    490489    }
    491    
     490
     491    if(counter%50==0)
     492       zSleep(10);
     493    counter++;
     494
    492495  } while (1);
    493496  duration = (int)(time(NULL)-start);
  • branches/prototype-v0/zoo-project/zoo-kernel/ulinet.c

    r896 r897  
    504504#endif
    505505
    506   if(memUse==NULL || strcasecmp(memUse->value,"load")==0)
     506  if(memUse!=NULL && strcasecmp(memUse->value,"load")==0)
    507507    ldwFlags=INTERNET_FLAG_NO_CACHE_WRITE;
    508508 
  • branches/prototype-v0/zoo-project/zoo-kernel/zoo_service_loader.c

    r896 r897  
    13071307  registry* zooRegistry=NULL;
    13081308  if(reg!=NULL){
     1309#ifndef WIN32
    13091310    int saved_stdout = zDup (fileno (stdout));
    13101311    zDup2 (fileno (stderr), fileno (stdout));
     1312#endif
    13111313    if(createRegistry (m,&zooRegistry,reg->value)<0){
    13121314      map *message=getMapFromMaps(m,"lenv","message");
     
    13171319      return 0;
    13181320    }
     1321#ifndef WIN32
    13191322    zDup2 (saved_stdout, fileno (stdout));
    13201323    zClose(saved_stdout);
     1324#endif
    13211325  }
    13221326
     
    17701774                        free (REQUEST);
    17711775                        closedir (dirp);
    1772                         //xmlFreeDoc (doc);
     1776                        if (corig != NULL)
     1777                          free (corig);
     1778                        xmlFreeDoc (doc);
    17731779                        xmlCleanupParser ();
    17741780                        zooXmlCleanupNs ();
     
    17791785                    if (corig != NULL)
    17801786                      free (corig);
    1781                   }
     1787                  }               
    17821788              }
    17831789            closedir (dirp);
     
    20622068#endif
    20632069#endif
     2070
    20642071#ifdef DEBUG
    20652072          fprintf (stderr, "[ZOO: setenv (%s=%s)]\n", mapcs->name,
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png