Ignore:
Timestamp:
May 1, 2014, 1:28:14 AM (10 years ago)
Author:
djay
Message:

Support metapath embedded in service name. Add support for accessing ZOO-Kernel path subdirectories for full list of available services. Fix issue #98.

Location:
trunk/zoo-project/zoo-kernel
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/service.h

    r466 r469  
    430430      map *tmp=getMap(m,n);
    431431      if(tmp->value!=NULL)
    432         free(tmp->value);
     432        free(tmp->value);
    433433      tmp->value=zStrdup(v);
    434434    }
     
    450450        while(_cursor->next!=NULL)
    451451          _cursor=_cursor->next;
    452         map* tmp1=getMap(_cursor,tmp->name);
    453         if(tmp1==NULL)
     452        map* tmp1=getMap(*mo,tmp->name);
     453        if(tmp1==NULL){
    454454          _cursor->next=createMap(tmp->name,tmp->value);
     455        }
    455456        else{
    456           free(tmp1->value);
     457          if(tmp1->value!=NULL)
     458            free(tmp1->value);
    457459          tmp1->value=zStrdup(tmp->value);
    458460        }
     
    567569      }
    568570      else{
    569         maps* tmp1=getMaps(*mo,tmp->name);
    570571        while(_cursor->next!=NULL)
    571572          _cursor=_cursor->next;
     573        maps* tmp1=getMaps(*mo,tmp->name);
    572574        if(tmp1==NULL)
    573575          _cursor->next=dupMaps(&tmp);
     
    687689        _ztmpm->value=zStrdup(value);
    688690      }else{
    689         addToMap(_tmpm->content,subkey,value);
     691        maps *tmp=(maps*)malloc(MAPS_SIZE);
     692        tmp->name=zStrdup(key);
     693        tmp->content=createMap(subkey,value);
     694        tmp->next=NULL;
     695        addMapsToMaps(&_tmpm,tmp);
     696        freeMaps(&tmp);
     697        free(tmp);
    690698      }
    691699    }else{
  • trunk/zoo-project/zoo-kernel/service_conf.y

    r465 r469  
    204204        dumpService(my_service);
    205205#endif 
    206         if(my_service->inputs==NULL){
     206        if(my_service->inputs==NULL && current_element!=NULL && current_element->name!=NULL){
    207207          my_service->inputs=dupElements(current_element);
    208208          my_service->inputs->next=NULL;
     209          freeElements(&current_element);
    209210        }
    210211        else if(current_element!=NULL && current_element->name!=NULL){
    211212          addToElements(&my_service->inputs,current_element);
     213          freeElements(&current_element);
    212214        }
    213215#ifdef DEBUG_SERVICE_CONF
     
    218220        fprintf(stderr,"(DATAOUTPUTS) FREE current_element\n");
    219221#endif
    220         freeElements(&current_element);
    221222        free(current_element);
    222223        current_element=NULL;
     
    848849  dumpService(my_service);
    849850#endif
    850   if(wait_outputs<0 || my_service==NULL || my_service->name==NULL || my_service->content==NULL || my_service->inputs==NULL || my_service->outputs==NULL){
     851  if(wait_outputs<0 || my_service==NULL || my_service->name==NULL || my_service->content==NULL || my_service->outputs==NULL){
    851852    setMapInMaps(conf,"lenv","message",srlval.chaine);
    852853#ifndef WIN32
  • trunk/zoo-project/zoo-kernel/service_internal.c

    r467 r469  
    756756}
    757757
     758void addPrefix(maps* conf,map* level,service* serv){
     759  if(level!=NULL){
     760    char key[25];
     761    char* prefix=NULL;
     762    int clevel=atoi(level->value);
     763    int cl=0;
     764    for(cl=0;cl<clevel;cl++){
     765      sprintf(key,"sprefix_%d",cl);
     766      map* tmp2=getMapFromMaps(conf,"lenv",key);
     767      if(tmp2!=NULL){
     768        if(prefix==NULL)
     769          prefix=zStrdup(tmp2->value);
     770        else{
     771          int plen=strlen(prefix);
     772          prefix=(char*)realloc(prefix,(plen+strlen(tmp2->value)+2)*sizeof(char));
     773          memcpy(prefix+plen,tmp2->value,strlen(tmp2->value)*sizeof(char));
     774          prefix[plen+strlen(tmp2->value)]=0;
     775        }
     776      }
     777    }
     778    if(prefix!=NULL){
     779      char* tmp0=strdup(serv->name);
     780      free(serv->name);
     781      serv->name=(char*)malloc((strlen(prefix)+strlen(tmp0)+1)*sizeof(char));
     782      sprintf(serv->name,"%s%s",prefix,tmp0);
     783      free(tmp0);
     784      free(prefix);
     785      prefix=NULL;
     786    }
     787  }
     788}
     789
    758790void printGetCapabilitiesForProcess(maps* m,xmlNodePtr nc,service* serv){
    759791  xmlNsPtr ns,ns_ows,ns_xlink;
     
    776808    if(tmp1!=NULL)
    777809      xmlNewNsProp(nc1,ns,BAD_CAST "processVersion",BAD_CAST tmp1->value);
     810    map* tmp3=getMapFromMaps(m,"lenv","level");
     811    addPrefix(m,tmp3,serv);
    778812    printDescription(nc1,ns_ows,serv->name,serv->content);
    779813    tmp1=serv->metadata;
     
    816850}
    817851
    818 void printDescribeProcessForProcess(maps* m,xmlNodePtr nc,service* serv,int sc){
     852void printDescribeProcessForProcess(maps* m,xmlNodePtr nc,service* serv){
    819853  xmlNsPtr ns,ns_ows,ns_xlink,ns_xsi;
    820854  xmlNodePtr nr,n,nc1,nc2,nc3,nc4,nc5,nc6,pseudor;
     
    851885  }
    852886 
     887  tmp1=getMapFromMaps(m,"lenv","level");
     888  addPrefix(m,tmp1,serv);
    853889  printDescription(nc,ns_ows,serv->name,serv->content);
    854890
     
    18601896void printDescription(xmlNodePtr root,xmlNsPtr ns_ows,const char* identifier,map* amap){
    18611897  xmlNodePtr nc2 = xmlNewNode(ns_ows, BAD_CAST "Identifier");
     1898 
    18621899  xmlAddChild(nc2,xmlNewText(BAD_CAST identifier));
    18631900  xmlAddChild(root,nc2);
     
    19041941
    19051942void printExceptionReportResponse(maps* m,map* s){
     1943  if(getMapFromMaps(m,"lenv","hasPrinted")!=NULL)
     1944    return;
    19061945  int buffersize;
    19071946  xmlDocPtr doc;
     
    19581997  xmlCleanupParser();
    19591998  zooXmlCleanupNs();
     1999  setMapInMaps(m,"lenv","hasPrinted","true");
    19602000}
    19612001
     
    19692009  maps* tmpMap=getMaps(m,"main");
    19702010
    1971   int nsid=zooXmlAddNs(NULL,"http://www.opengis.net/ows/1.1","ows");
     2011  int nsid=zooXmlAddNs(NULL,"http://www.opengis.net/ows","ows");
    19722012  ns=usedNs[nsid];
    19732013  n = xmlNewNode(ns, BAD_CAST "ExceptionReport");
    19742014
    19752015  if(use_ns==1){
    1976     ns_ows=xmlNewNs(n,BAD_CAST "http://www.opengis.net/ows/1.1",BAD_CAST "ows");
     2016    ns_ows=xmlNewNs(n,BAD_CAST "http://www.opengis.net/ows/1.1.0",BAD_CAST "ows");
    19772017    int xsiId=zooXmlAddNs(n,"http://www.w3.org/2001/XMLSchema-instance","xsi");
    19782018    ns_xsi=usedNs[xsiId];
     2019    ns_xsi=xmlNewNs(n,BAD_CAST "http://www.w3.org/2001/XMLSchema-instance",BAD_CAST "xsi");
     2020    xmlNewNsProp(n,ns_xsi,BAD_CAST "schemaLocation",BAD_CAST "http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd");
    19792021    int xlinkId=zooXmlAddNs(n,"http://www.w3.org/1999/xlink","xlink");
    19802022    ns_xlink=usedNs[xlinkId];
    1981     xmlNewNsProp(n,ns_xsi,BAD_CAST "schemaLocation",BAD_CAST "http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd");
    19822023  }
    19832024  addLangAttr(n,m);
     
    28482889  return -1;
    28492890}
     2891
     2892#ifdef USE_MS
     2893char *readVSIFile(maps* conf,const char* dataSource){
     2894    VSILFILE * fichier=VSIFOpenL(dataSource,"rb");
     2895    VSIStatBufL file_status;
     2896    VSIStatL(dataSource, &file_status);
     2897    if(fichier==NULL){
     2898      char tmp[1024];
     2899      sprintf(tmp,"Failed to open file %s for reading purpose. File seems empty %d.",
     2900              dataSource,file_status.st_size);
     2901      setMapInMaps(conf,"lenv","message",tmp);
     2902      return NULL;
     2903    }
     2904    char *res1=(char *)malloc(file_status.st_size*sizeof(char));
     2905    VSIFReadL(res1,1,(file_status.st_size)*sizeof(char),fichier);
     2906    VSIFCloseL(fichier);
     2907    VSIUnlink(dataSource);
     2908    return res1;
     2909}
     2910#endif
     2911
     2912void parseIdentifier(maps* conf,char* conf_dir,char *identifier,char* buffer){
     2913  char *saveptr1;
     2914  char *tmps1=strtok_r(identifier,".",&saveptr1);
     2915  int level=0;
     2916  char key[25];
     2917  char levels[18];
     2918  while(tmps1!=NULL){
     2919    char *test=zStrdup(tmps1);
     2920    char* tmps2=(char*)malloc((strlen(test)+2)*sizeof(char));
     2921    sprintf(key,"sprefix_%d",level);
     2922    sprintf(tmps2,"%s.",test);
     2923    sprintf(levels,"%d",level);
     2924    setMapInMaps(conf,"lenv","level",levels);
     2925    setMapInMaps(conf,"lenv",key,tmps2);
     2926    free(tmps2);
     2927    level++;
     2928    tmps1=strtok_r(NULL,".",&saveptr1);
     2929  }
     2930  int i=0;
     2931  sprintf(buffer,"%s",conf_dir);
     2932  for(i=0;i<level;i++){
     2933    char *tmp0=zStrdup(buffer);
     2934    sprintf(key,"sprefix_%d",i);
     2935    map* tmp00=getMapFromMaps(conf,"lenv",key);
     2936    sprintf(buffer,"%s/%s",tmp0,tmp00->value);
     2937    free(tmp0);
     2938    buffer[strlen(buffer)-1]=0;
     2939    if(i+1<level){
     2940      map* tmpMap=getMapFromMaps(conf,"lenv","metapath");
     2941      if(tmpMap==NULL || strlen(tmpMap->value)==0){
     2942        char *tmp01=zStrdup(tmp00->value);
     2943        tmp01[strlen(tmp01)-1]=0;
     2944        setMapInMaps(conf,"lenv","metapath",tmp01);
     2945        free(tmp01);
     2946      }
     2947      else{
     2948        char *value=(char*)malloc((strlen(tmp00->value)+strlen(tmpMap->value)+2)*sizeof(char));
     2949        sprintf(value,"%s/%s",tmpMap->value,tmp00->value);
     2950        value[strlen(value)-1]=0;
     2951        setMapInMaps(conf,"lenv","metapath",value);
     2952        free(value);
     2953      }
     2954    }else{
     2955      char *tmp0=zStrdup(tmp00->value);
     2956      tmp0[strlen(tmp0)-1]=0;
     2957      setMapInMaps(conf,"lenv","Identifier",tmp0);
     2958      free(tmp0);
     2959    }
     2960  }
     2961  char *tmp0=zStrdup(buffer);
     2962  sprintf(buffer,"%s.zcfg",tmp0);
     2963  free(tmp0);
     2964}
     2965
  • trunk/zoo-project/zoo-kernel/service_internal.h

    r467 r469  
    3838#include <sys/stat.h>
    3939#include <sys/types.h>
     40#include "cgic.h"
    4041#ifndef WIN32
    4142#include <sys/ipc.h>
    4243#include <sys/shm.h>
    4344#else
    44 #include "cgic.h"
    4545#include <direct.h>
    4646#endif
     
    5656#include <xlocale.h>
    5757#endif
     58#include <dirent.h>
    5859#include "service.h"
    5960#include <openssl/sha.h>
     
    118119  void printGetCapabilitiesForProcess(maps*,xmlNodePtr,service*);
    119120  xmlNodePtr printDescribeProcessHeader(xmlDocPtr,const char*,maps*);
    120   void printDescribeProcessForProcess(maps*,xmlNodePtr,service*,int);
     121  void printDescribeProcessForProcess(maps*,xmlNodePtr,service*);
    121122  void printFullDescription(elements*,const char*,xmlNsPtr,xmlNodePtr);
    122123  void printDocument(maps*,xmlDocPtr,int);
     
    144145  int loadRemoteFile(maps*,map*,HINTERNET,char*);
    145146
     147#ifdef USE_MS
     148  char *readVSIFile(maps*,const char*);
     149#endif
     150  void parseIdentifier(maps*,char*,char*,char*);
     151
    146152#ifdef __cplusplus
    147153}
  • trunk/zoo-project/zoo-kernel/service_internal_python.c

    r465 r469  
    289289#if PY_MAJOR_VERSION < 3
    290290  PyGILState_Release(gstate);
    291   PyEval_AcquireLock();
     291  PyEval_ReleaseLock();
    292292#endif
    293293  PyThreadState_Swap(mainstate);
  • trunk/zoo-project/zoo-kernel/service_internal_python.h

    r376 r469  
    2828#pragma once
    2929
    30 #include "service.h"
    3130#include "service_internal.h"
    3231#include <Python.h>
     32#include "cgic.h"
    3333#ifdef WIN32
    3434#include <windows.h>
  • trunk/zoo-project/zoo-kernel/zcfg2yaml.c

    r467 r469  
    3030int main(int argc, char** argv){
    3131  service* s1=NULL;
    32   maps *m;
     32  maps *m=NULL;
    3333  char conf_file[1024];
    3434  snprintf(conf_file,1024,"%s",argv[1]);
     
    3737    return errorException(m, _("Unable to allocate memory."),"InternalError",NULL);
    3838  }
    39   int t=getServiceFromFile(conf,file,service);
     39  int t=getServiceFromFile(m,conf_file,&s1);
    4040  if(t>=0)
    4141    dumpServiceAsYAML(s1);
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r467 r469  
    189189  }
    190190  return 0;
     191}
     192
     193int recursReaddirF(maps* m,xmlNodePtr n,char *conf_dir,char *prefix,int saved_stdout,int level,void (func) (maps*,xmlNodePtr,service*)){
     194  struct dirent *dp;
     195  int scount=0;
     196
     197  if(conf_dir==NULL)
     198    return 1;
     199  DIR *dirp = opendir(conf_dir);
     200  if(dirp==NULL){
     201    dup2(saved_stdout,fileno(stdout));
     202    errorException(m, _("The specified path doesn't exist."),"InvalidParameterValue","metapath");
     203    return -1;
     204  }
     205  char tmp1[25];
     206  sprintf(tmp1,"sprefix_%d",level);
     207  char levels[17];
     208  sprintf(levels,"%d",level);
     209  setMapInMaps(m,"lenv","level",levels);
     210  while ((dp = readdir(dirp)) != NULL)
     211    if((dp->d_type==DT_DIR || dp->d_type==DT_LNK) && dp->d_name[0]!='.' && strstr(dp->d_name,".")==NULL){
     212
     213      char *tmp=(char*)malloc((strlen(conf_dir)+strlen(dp->d_name)+2)*sizeof(char));
     214      sprintf(tmp,"%s/%s",conf_dir,dp->d_name);
     215
     216      if(prefix!=NULL){
     217        free(prefix);
     218        prefix=NULL;
     219      }
     220      prefix=(char*)malloc((strlen(dp->d_name)+2)*sizeof(char));
     221      sprintf(prefix,"%s.",dp->d_name);
     222     
     223      map* tmpMap=getMapFromMaps(m,"lenv",tmp1);
     224     
     225      int res;
     226      if(prefix!=NULL){
     227        setMapInMaps(m,"lenv",tmp1,prefix);
     228        char *cprefix=zStrdup(prefix);
     229        char levels1[17];
     230        sprintf(levels1,"%d",level+1);
     231        setMapInMaps(m,"lenv","level",levels1);
     232        res=recursReaddirF(m,n,tmp,cprefix,saved_stdout,level+1,func);
     233        sprintf(levels1,"%d",level);
     234        setMapInMaps(m,"lenv","level",levels1);
     235        free(prefix);
     236        prefix=NULL;
     237      }
     238      free(tmp);
     239      if(res<0){
     240        return res;
     241      }
     242    }
     243    else{
     244      char* tmp0=strdup(dp->d_name);
     245      if(dp->d_name[0]!='.' && strstr(dp->d_name,".zcfg")!=0){
     246        int t;
     247        char tmps1[1024];
     248        memset(tmps1,0,1024);
     249        snprintf(tmps1,1024,"%s/%s",conf_dir,dp->d_name);
     250        service* s1=(service*)malloc(SERVICE_SIZE);
     251        if(s1 == NULL){
     252          dup2(saved_stdout,fileno(stdout));
     253          errorException(m, _("Unable to allocate memory."),"InternalError",NULL);
     254          return -1;
     255        }
     256#ifdef DEBUG
     257        fprintf(stderr,"#################\n%s\n#################\n",tmps1);
     258#endif
     259        t=readServiceFile(m,tmps1,&s1,dp->d_name);
     260        if(t<0){
     261          dumpMaps(m);
     262          map* tmp00=getMapFromMaps(m,"lenv","message");
     263          char tmp01[1024];
     264          if(tmp00!=NULL)
     265            sprintf(tmp01,_("Unable to parse the ZCFG file: %s (%s)"),dp->d_name,tmp00->value);
     266          else
     267            sprintf(tmp01,_("Unable to parse the ZCFG file: %s."),dp->d_name);
     268          dup2(saved_stdout,fileno(stdout));
     269          errorException(m, tmp01,"InternalError",NULL);
     270          freeMaps(&m);
     271          free(m);
     272          return -1;
     273        }
     274#ifdef DEBUG
     275        dumpService(s1);
     276        fflush(stdout);
     277        fflush(stderr);
     278#endif
     279        func(m,n,s1);
     280        freeService(&s1);
     281        free(s1);
     282        scount++;
     283      }
     284    }
     285  (void)closedir(dirp);
     286  return 1;
    191287}
    192288
     
    277373    void* so = dlopen(tmps1, RTLD_LAZY);
    278374#endif
    279 #ifdef DEBUG
    280375#ifdef WIN32
    281376    DWORD errstr;
     
    285380    char *errstr;
    286381    errstr = dlerror();
    287 #endif
    288382#endif
    289383    if( so != NULL ) {
     
    346440#endif
    347441#endif
    348         r_inputs=getMap(request_inputs,"Identifier");
     442        r_inputs=getMapFromMaps(m,"lenv","Identifier");
    349443#ifdef DEBUG
    350444        fprintf(stderr,"Try to load function %s\n",r_inputs->value);
     
    356450        execute_t execute=(execute_t)dlsym(so,r_inputs->value);
    357451#endif
     452
     453        if(execute==NULL){
     454#ifdef WIN32
     455          errstr = GetLastError();
     456#else
     457          errstr = dlerror();
     458#endif
     459          char *tmpMsg=(char*)malloc(2048+strlen(r_inputs->value));
     460          sprintf(tmpMsg,_("Error occured while running the %s function: %s"),r_inputs->value,errstr);
     461          errorException(m, tmpMsg, "InternalError",NULL);
     462          free(tmpMsg);
     463          fprintf(stderr,"Function %s error %s\n",r_inputs->value,errstr);
     464          return;
     465        }
    358466
    359467#ifdef DEBUG
     
    758866    dumpMap(r_inputs);
    759867#endif
    760     DIR *dirp = opendir(conf_dir);
    761     if(dirp==NULL){
    762       return errorException(m, _("The specified path doesn't exist."),"InvalidParameterValue","metapath");
    763     }
    764868    xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");
    765869    r_inputs=NULL;
     
    776880    int saved_stdout = dup(fileno(stdout));
    777881    dup2(fileno(stderr),fileno(stdout));
    778     while ((dp = readdir(dirp)) != NULL)
    779       if(strstr(dp->d_name,".zcfg")!=0){
    780         int t;
    781         memset(tmps1,0,1024);
    782         snprintf(tmps1,1024,"%s/%s",conf_dir,dp->d_name);
    783         s1=(service*)malloc(SERVICE_SIZE);
    784         if(s1 == NULL){
    785           return errorException(m, _("Unable to allocate memory."),"InternalError",NULL);
    786         }
    787 #ifdef DEBUG
    788         fprintf(stderr,"#################\n%s\n#################\n",tmps1);
    789 #endif
    790         t=readServiceFile(m,tmps1,&s1,dp->d_name);
    791         if(t<0){
    792           dumpMaps(m);
    793           map* tmp00=getMapFromMaps(m,"lenv","message");
    794           char tmp01[1024];
    795           sprintf(tmp01,_("Unable to parse the ZCFG file: %s (%s)"),dp->d_name,tmp00->value);
    796           dup2(saved_stdout,fileno(stdout));
    797           errorException(m, tmp01,"InternalError",NULL);
    798           freeMaps(&m);
    799           free(m);
    800           return 1;
    801         }
    802 
    803 #ifdef DEBUG
    804         dumpService(s1);
    805         fflush(stdout);
    806         fflush(stderr);
    807 #endif
    808         printGetCapabilitiesForProcess(m,n,s1);
    809         freeService(&s1);
    810         free(s1);
    811         scount++;
    812       }
    813     (void)closedir(dirp);
    814     fflush(stdout);
     882    if(int res=recursReaddirF(m,n,conf_dir,NULL,saved_stdout,0,printGetCapabilitiesForProcess)<0)
     883      return res;
    815884    dup2(saved_stdout,fileno(stdout));
    816885    printDocument(m,doc,getpid());
     
    860929      r_inputs=getMap(request_inputs,"Identifier");
    861930     
    862       char *saveptr;
    863931      char *orig=zStrdup(r_inputs->value);
    864       char *tmps=strtok_r(orig,",",&saveptr);
    865      
    866       char buff[256];
    867       char buff1[1024];
     932
    868933      int saved_stdout = dup(fileno(stdout));
    869934      dup2(fileno(stderr),fileno(stdout));
    870       while(tmps){
    871         memset(buff,0,256);
    872         snprintf(buff,256,"%s.zcfg",tmps);
    873         memset(buff1,0,1024);
    874 #ifdef DEBUG
    875         printf("\n#######%s\n########\n",buff);
    876 #endif
    877         while ((dp = readdir(dirp)) != NULL)
    878           if((strcasecmp("all.zcfg",buff)==0 && strstr(dp->d_name,".zcfg")>0)
    879              || strcasecmp(dp->d_name,buff)==0){
    880             memset(buff1,0,1024);
    881             snprintf(buff1,1024,"%s/%s",conf_dir,dp->d_name);
     935      if(strcasecmp("all",orig)==0){
     936        if(int res=recursReaddirF(m,n,conf_dir,NULL,saved_stdout,0,printDescribeProcessForProcess)<0)
     937          return res;
     938      }
     939      else{
     940        char *saveptr;
     941        char *tmps=strtok_r(orig,",",&saveptr);
     942       
     943        char buff[256];
     944        char buff1[1024];
     945        while(tmps!=NULL){
     946          char *corig=strdup(tmps);
     947          if(strstr(corig,".")!=NULL){
     948            parseIdentifier(m,conf_dir,corig,buff1);
    882949            s1=(service*)malloc(SERVICE_SIZE);
    883             if(s1 == NULL){
    884               dup2(saved_stdout,fileno(stdout));
    885               return errorException(m, _("Unable to allocate memory."),"InternalError",NULL);
    886             }
    887 #ifdef DEBUG
    888             printf("#################\n(%s) %s\n#################\n",r_inputs->value,buff1);
    889 #endif
    890             char *tmp0=zStrdup(dp->d_name);
    891             tmp0[strlen(tmp0)-5]=0;
    892             t=readServiceFile(m,buff1,&s1,tmp0);
    893             free(tmp0);
     950            t=readServiceFile(m,buff1,&s1,corig);
    894951            if(t<0){
    895952              map* tmp00=getMapFromMaps(m,"lenv","message");
     
    908965            dumpService(s1);
    909966#endif
    910             printDescribeProcessForProcess(m,n,s1,1);
     967            printDescribeProcessForProcess(m,n,s1);
    911968            freeService(&s1);
    912969            free(s1);
    913970            s1=NULL;
    914971            scount++;
     972            setMapInMaps(m,"lenv","level","0");
    915973          }
    916         rewinddir(dirp);
    917         tmps=strtok_r(NULL,",",&saveptr);
     974         
     975          memset(buff,0,256);
     976          snprintf(buff,256,"%s.zcfg",tmps);
     977          memset(buff1,0,1024);
     978#ifdef DEBUG
     979          printf("\n#######%s\n########\n",buff);
     980#endif
     981          while ((dp = readdir(dirp)) != NULL)
     982            if( (strcasecmp("all.zcfg",buff)==0 && strstr(dp->d_name,".zcfg")>0)
     983                || strcasecmp(dp->d_name,buff)==0 ){
     984              memset(buff1,0,1024);
     985              snprintf(buff1,1024,"%s/%s",conf_dir,dp->d_name);
     986              s1=(service*)malloc(SERVICE_SIZE);
     987              if(s1 == NULL){
     988                dup2(saved_stdout,fileno(stdout));
     989                return errorException(m, _("Unable to allocate memory."),"InternalError",NULL);
     990              }
     991#ifdef DEBUG
     992              printf("#################\n(%s) %s\n#################\n",r_inputs->value,buff1);
     993#endif
     994              char *tmp0=zStrdup(dp->d_name);
     995              tmp0[strlen(tmp0)-5]=0;
     996              t=readServiceFile(m,buff1,&s1,tmp0);
     997              free(tmp0);
     998              if(t<0){
     999                map* tmp00=getMapFromMaps(m,"lenv","message");
     1000                char tmp01[1024];
     1001                if(tmp00!=NULL)
     1002                  sprintf(tmp01,_("Unable to parse the ZCFG file: %s (%s)"),dp->d_name,tmp00->value);
     1003                else
     1004                  sprintf(tmp01,_("Unable to parse the ZCFG file: %s."),dp->d_name);
     1005                dup2(saved_stdout,fileno(stdout));
     1006                errorException(m, tmp01,"InternalError",NULL);
     1007                freeMaps(&m);
     1008                free(m);
     1009                return 1;
     1010              }
     1011#ifdef DEBUG
     1012              dumpService(s1);
     1013#endif
     1014              printDescribeProcessForProcess(m,n,s1);
     1015              freeService(&s1);
     1016              free(s1);
     1017              s1=NULL;
     1018              scount++;
     1019            }
     1020          rewinddir(dirp);
     1021          tmps=strtok_r(NULL,",",&saveptr);
     1022        }
    9181023      }
    9191024      closedir(dirp);
     
    9671072  fprintf(stderr,"Trying to load %s\n", tmps1);
    9681073#endif
     1074  if(strstr(r_inputs->value,".")!=NULL){
     1075    char *identifier=zStrdup(r_inputs->value);
     1076    parseIdentifier(m,conf_dir,identifier,tmps1);
     1077    map* tmpMap=getMapFromMaps(m,"lenv","metapath");
     1078    if(tmpMap!=NULL)
     1079      addToMap(request_inputs,"metapath",tmpMap->value);
     1080    free(identifier);
     1081  }else
     1082    setMapInMaps(m,"lenv","Identifier",r_inputs->value);
    9691083  int saved_stdout = dup(fileno(stdout));
    9701084  dup2(fileno(stderr),fileno(stdout));
     
    9741088  if(t<0){
    9751089    char *tmpMsg=(char*)malloc(2048+strlen(r_inputs->value));
    976    
    9771090    sprintf(tmpMsg,_("The value for <indetifier> seems to be wrong (%s). Please, ensure that the process exist using the GetCapabilities request."),r_inputs->value);
    9781091    errorException(m, tmpMsg, "InvalidParameterValue","identifier");
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