Changeset 459


Ignore:
Timestamp:
Apr 1, 2014, 11:32:29 PM (10 years ago)
Author:
djay
Message:

Initial introduction of Value and Range in AllowedValues?, update zcfg documentation. Return valid Status code when returning ExceptionRepport?.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/services/zcfg-reference.txt

    r349 r459  
    131131A ``<LiteralData>`` node contains:
    132132
     133- one (optional) ``AllowedValues`` key containing all value allowed for this input
     134- one (optional) ``rangeMin`` (``rangeMin``) properties containing the minimum (maximum) value of this range
     135- one (optional) ``rangeSpacing`` properties containing the regular distance or spacing between value in this range
     136- one (optional) ``rangeClosure`` properties containing the closure type (``c``,``o``,``oc``,``co``)
    133137- one ``<Default>`` node,
    134138- zero or more ``<Supported>`` nodes depending on the existence or the number of supported Units Of Measure (UOM), and
     
    159163   </LiteralData>
    160164
     165
     166A typical ``<LiteralData>`` node, defining a ``float`` data type which
     167should take values contained in ``[0.0,100.0]``, looks like the following:
     168.. code-block:: guess
     169   :linenos:
     170   
     171   <LiteralData>
     172     dataType = float
     173     rangeMin = 0.0
     174     rangeMax = 100.0
     175     rangeClosure = c
     176     <Default />
     177   </LiteralData>
     178
     179A typical ``<LiteralData>`` node, defining a ``string`` data type which
     180support values ``hillshade``, ``slope``, ``aspect``, ``TRI``, ``TPI``
     181and ``roughness``, looks like the following:
     182.. code-block:: guess
     183   :linenos:
     184   
     185   <LiteralData>
     186     dataType = float
     187     AllowedValues = hillshade,slope,aspect,TRI,TPI,roughness
     188     <Default />
     189   </LiteralData>
     190
     191Properties``AllowedValues`` and ``range*`` can be conbined with both ``<Default>`` and
     192``<Supported>`` nodes in the same ``<LiteralData>`` node.
     193
    161194.. _BoundingBoxData:
    162195
  • trunk/zoo-project/zoo-kernel/Makefile.in

    r446 r459  
     1include ZOOMakefile.opts
     2
    13OS:=$(shell uname -s)
    24ifeq ($(OS),Darwin)
     
    1012JAVA_FILE=@JAVA_FILE@
    1113
    12 MS_CFLAGS=@MS_CFLAGS@
    13 MS_LDFLAGS=@MS_LIBS@
    14 MS_FILE=@MS_FILE@
    15 
    1614CFLAGS=-fpic ${MACOS_CFLAGS} ${MS_CFLAGS} -I../../thirds/cgic206 -I. -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF
    1715LDFLAGS=-lcurl -L../../thirds/cgic206 -lcgic ${GDAL_LIBS} ${XML2LDFLAGS} ${PYTHONLDFLAGS} ${PERLLDFLAGS}  ${PHPLDFLAGS} ${JAVALDFLAGS} ${JSLDFLAGS} -lfcgi -lcrypto ${MS_LDFLAGS} ${MACOS_LD_FLAGS}
     
    2220PHP_FILE=@PHP_FILE@
    2321
    24 
    25 PYTHONCFLAGS=@PYTHON_CPPFLAGS@
    26 PYTHONLDFLAGS=@PYTHON_LDFLAGS@
    27 PYTHON_ENABLED=@PYTHON_ENABLED@
    28 PYTHON_FILE=@PYTHON_FILE@
    29 
    30 JSCFLAGS=@JS_CPPFLAGS@
    31 JSLDFLAGS=@JS_LDFLAGS@
    32 JS_ENABLED=@JS_ENABLED@
    33 JS_FILE=@JS_FILE@
    34 
    35 XML2CFLAGS=@XML2_CPPFLAGS@
    36 XML2LDFLAGS=@XML2_LDFLAGS@
    37 
    38 GDAL_CFLAGS=@GDAL_CFLAGS@
    39 GDAL_LIBS=@GDAL_LIBS@
    4022
    4123PERLCFLAGS=@PERL_CPPFLAGS@
     
    8971        gcc -c ${XML2CFLAGS} ${PERLCFLAGS} ${CFLAGS}  ${PERL_ENABLED} service_internal_perl.c
    9072
    91 
    9273service_internal_java.o: service_internal_java.c service.h
    9374        gcc -c ${XML2CFLAGS} ${JAVACFLAGS} ${CFLAGS} ${JAVA_ENABLED} service_internal_java.c
     
    9677        gcc ${XML2CFLAGS} ${JSCFLAGS} ${CFLAGS} ${JS_ENABLED} -c service_internal_js.c
    9778
     79service_internal_ruby.o: service_internal_ruby.c service_internal_ruby.h
     80        g++ ${XML2CFLAGS} ${RUBYCFLAGS} ${CFLAGS} ${JSCFLAGS} ${JS_ENABLED} -c service_internal_ruby.c
    9881
    9982service_loader.o: service_loader.c service.h
     
    10386        g++ -g -O2 ${XML2CFLAGS} ${CFLAGS} ${PYTHONCFLAGS} ${JAVACFLAGS} ${JSCFLAGS} ${PERLCFLAGS} ${PHPCFLAGS} ${PYTHON_ENABLED} ${JS_ENABLED} ${PHP_ENABLED} ${PERL_ENABLED} ${JAVA_ENABLED} -c zoo_service_loader.c  -fno-common -DPIC -o zoo_service_loader.o
    10487
    105 zoo_loader.cgi: zoo_loader.c zoo_service_loader.o  ulinet.o service.h lex.sr.o service_conf.tab.o service_conf.y ulinet.o main_conf_read.tab.o lex.cr.o service_internal.o ${MS_FILE} ${PYTHON_FILE} ${PHP_FILE} ${JAVA_FILE} ${JS_FILE} ${PERL_FILE}
    106         g++ -g -O2 ${JSCFLAGS} ${PHPCFLAGS}  ${PERLCFLAGS}   ${JAVACFLAGS} ${XML2CFLAGS} ${PYTHONCFLAGS} ${CFLAGS} -c zoo_loader.c  -fno-common -DPIC -o zoo_loader.o
     88zoo_loader.cgi: zoo_loader.c zoo_service_loader.o  ulinet.o service.h lex.sr.o service_conf.tab.o service_conf.y ulinet.o main_conf_read.tab.o lex.cr.o service_internal.o ${MS_FILE} ${PYTHON_FILE} ${PHP_FILE} ${JAVA_FILE} ${JS_FILE} ${PERL_FILE} ${RUBY_FILE}
     89        g++ -g -O2 ${JSCFLAGS} ${PHPCFLAGS}  ${PERLCFLAGS} ${RUBYCFLAGS}  ${JAVACFLAGS} ${XML2CFLAGS} ${PYTHONCFLAGS} ${CFLAGS} -c zoo_loader.c  -fno-common -DPIC -o zoo_loader.o
    10790        g++  ${JSCFLAGS} ${GDAL_CFLAGS} ${XML2CFLAGS} ${PHPCFLAGS} ${PERLCFLAGS} ${JAVACFLAGS} ${PYTHONCFLAGS} ${CFLAGS} zoo_loader.o zoo_service_loader.o service_internal.o ${MS_FILE} ${PYTHON_FILE}  ${PERL_FILE} ${PHP_FILE}  ${JS_FILE} ${JAVA_FILE} ulinet.o lex.cr.o lex.sr.o service_conf.tab.o main_conf_read.tab.o -o zoo_loader.cgi ${LDFLAGS}
    10891
  • trunk/zoo-project/zoo-kernel/ZOOMakefile.opts.in

    r303 r459  
    1414PYTHONCFLAGS=@PYTHON_CPPFLAGS@
    1515PYTHONLDFLAGS=@PYTHON_LDFLAGS@
     16PYTHON_ENABLED=@PYTHON_ENABLED@
     17PYTHON_FILE=@PYTHON_FILE@
     18
     19RUBYCFLAGS=@RUBY_CPPFLAGS@
     20RUBYLDFLAGS=@RUBY_LDFLAGS@
     21RUBY_ENABLED=@RUBY_ENABLED@
     22RUBY_FILE=@RUBY_FILE@
    1623
    1724JS_ENABLED=@JS_ENABLED@
    1825JSCFLAGS=@JS_CPPFLAGS@
    1926JSLDFLAGS=@JS_LDFLAGS@
     27JS_FILE=@JS_FILE@
    2028ifeq ($(JS_ENABLED),-DUSE_JS)
    2129     JS_LDFLAGS=${ZRPATH}/zoo-kernel/ulinet.o ${ZRPATH}/zoo-kernel/service_internal_js.o -lcurl
    2230endif
    2331
     32MS_CFLAGS=@MS_CFLAGS@
     33MS_LDFLAGS=@MS_LIBS@
     34MS_FILE=@MS_FILE@
     35
    2436ZOO_CFLAGS=-I${ZRPATH}/../thirds/cgic206/ -I${ZRPATH}/zoo-kernel/
    2537ZOO_LDFLAGS=-lcrypto
  • trunk/zoo-project/zoo-kernel/configure.ac

    r435 r459  
    6666AC_SUBST([GDAL_CFLAGS])
    6767AC_SUBST([GDAL_LIBS])
     68
     69# ===========================================================================
     70# Detect if fastcgi is available
     71# ===========================================================================
     72
     73AC_ARG_WITH([fastcgi],
     74        [AS_HELP_STRING([--with-fastcgi=PATH], [specify an alternative location for the fastcgi library])],
     75        [FCGIPATH="$withval"], [FCGIPATH=""])
     76
     77# Extract the linker and include flags
     78FCGI_LDFLAGS="-L$FCGIPATH/lib"
     79FCGI_CPPFLAGS="-I$FCGIPATH/include"
     80
     81# Check headers file
     82CPPFLAGS_SAVE="$CPPFLAGS"
     83CPPFLAGS="$FCGI_CPPFLAGS"
     84AC_CHECK_HEADERS([fcgi_stdio.h],
     85                 [], [AC_MSG_ERROR([could not find headers include related to fastcgi])])
     86
     87AC_SUBST([FCGI_CPPFLAGS])
     88AC_SUBST([FCGI_LDFLAGS])
     89
     90# ===========================================================================
     91# Detect if proj is installed
     92# ===========================================================================
     93
     94AC_ARG_WITH([proj],
     95        [AS_HELP_STRING([--with-proj=PATH], [specify an alternative location for PROJ4 setup])],
     96        [PROJPATH="$withval"], [PROJPATH=""])
     97
     98# Extract the linker and include flags
     99PROJ_LDFLAGS="-L$PROJPATH/lib"
     100PROJ_CPPFLAGS="-I$PROJPATH/include"
     101
     102# Check headers file
     103CPPFLAGS_SAVE="$CPPFLAGS"
     104CPPFLAGS="$PROJ_CPPFLAGS"
     105AC_CHECK_HEADERS([proj_api.h],
     106                 [], [AC_MSG_ERROR([could not find headers include related to PROJ4])])
     107
     108AC_SUBST([PROJ_CPPFLAGS])
     109AC_SUBST([PROJ_LDFLAGS])
    68110
    69111# ===========================================================================
     
    154196
    155197# ===========================================================================
     198# Detect if ruby is installed
     199# ===========================================================================
     200AC_ARG_WITH([ruby],
     201        [AS_HELP_STRING([--with-ruby=PATH], [To enable ruby support or specify an alternative directory for ruby installation,  disabled by default])],
     202        [RUBY_PATH="$withval"; RUBY_ENABLED="-DUSE_RUBY"], [RUBY_ENABLED=""])
     203
     204AC_ARG_WITH([rvers],
     205        [AS_HELP_STRING([--with-rvers=NUM], [To use a specific ruby version])],
     206        [RUBY_VERS="$withval"], [RUBY_VERS=""])
     207
     208
     209if test -z "$RUBY_ENABLED"
     210then
     211        RUBY_FILE=""
     212else
     213        RUBY_FILE="service_internal_ruby.o"
     214
     215        # Extract the linker and include flags
     216        RUBY_LDFLAGS="-lruby"
     217        RUBY_CPPFLAGS="-I$RUBY_PATH -I$RUBY_PATH/x86_64-darwin13.0/ -DZRUBY_VERSION=$RUBY_VERS"
     218
     219        # Check headers file
     220        CPPFLAGS_SAVE="$CPPFLAGS"
     221        CPPFLAGS="$RUBY_CPPFLAGS"
     222        AC_CHECK_HEADERS([ruby.h],
     223                 [], [AC_MSG_ERROR([could not find headers include related to libruby])])
     224
     225        # Ensure we can link against libphp
     226        LIBS_SAVE="$LIBS"
     227        LIBS="$RUBY_LDFLAGS"
     228        # AC_CHECK_LIB([lruby], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
     229        AC_SUBST([RUBY_CPPFLAGS])
     230        AC_SUBST([RUBY_LDFLAGS])
     231fi
     232
     233AC_SUBST([RUBY_ENABLED])
     234AC_SUBST([RUBY_FILE])
     235
     236# ===========================================================================
    156237# Detect if python is installed
    157238# ===========================================================================
     
    187268        # Extract the linker and include flags
    188269        PYTHON_LDFLAGS=`$PYTHONCONFIG --ldflags`
    189         PYTHON_CPPFLAGS=`$PYTHONCONFIG --cflags`
     270        PYTHON_CPPFLAGS=`$PYTHONCONFIG --includes`
    190271
    191272        # Check headers file
  • trunk/zoo-project/zoo-kernel/service_internal.c

    r458 r459  
    883883
    884884void printFullDescription(elements *elem,const char* type,xmlNsPtr ns_ows,xmlNodePtr nc1){
    885   char *orderedFields[7];
     885  char *orderedFields[12];
    886886  orderedFields[0]="mimeType";
    887887  orderedFields[1]="encoding";
     
    891891  orderedFields[5]="CRS";
    892892  orderedFields[6]="value";
    893 
    894   xmlNodePtr nc2,nc3,nc4,nc5,nc6,nc7;
     893  orderedFields[7]="AllowedValues";
     894  orderedFields[8]="rangeMin";
     895  orderedFields[9]="rangeMax";
     896  orderedFields[10]="rangeClosure";
     897  orderedFields[11]="rangeSpace";
     898
     899  xmlNodePtr nc2,nc3,nc4,nc5,nc6,nc7,nc8;
    895900  elements* e=elem;
    896901  map* tmp1=NULL;
     
    956961      int dcnt=0;
    957962      int oI=0;
    958       for(oI=0;oI<7;oI++)
     963      for(oI=0;oI<12;oI++)
    959964        if((tmp1=getMap(_tmp->content,orderedFields[oI]))!=NULL){
    960965          //while(tmp1!=NULL){
     
    977982             strcasecmp(tmp1->name,"extension")!=0 &&
    978983             strcasecmp(tmp1->name,"value")!=0 &&
    979              strncasecmp(tmp1->name,"AllowedValues",13)!=0){
     984             strncasecmp(tmp1->name,"AllowedValues",13)!=0&&
     985             strncasecmp(tmp1->name,"range",5)!=0){
    980986            if(datatype!=1){
    981987              char *tmp2=zCapitalize1(tmp1->name);
     
    993999          }else
    9941000            if(strncmp(type,"Input",5)==0){
     1001
    9951002              if(strcmp(tmp1->name,"value")==0){
    9961003                nc7 = xmlNewNode(NULL, BAD_CAST "DefaultValue");
    9971004                xmlAddChild(nc7,xmlNewText(BAD_CAST tmp1->value));
    9981005                default1=1;
     1006                hasDefault=true;
    9991007              }
    10001008              if(strncasecmp(tmp1->name,"AllowedValues",13)==0){
    10011009                nc6 = xmlNewNode(ns_ows, BAD_CAST "AllowedValues");
    1002                 fprintf(stderr,"ALLOWED VALUE %s\n",tmp1->value);
    10031010                char *token,*saveptr1;
    10041011                token=strtok_r(tmp1->value,",",&saveptr1);
     
    10081015                  tmps[strlen(tmps)]=0;
    10091016                  xmlAddChild(nc7,xmlNewText(BAD_CAST tmps));
    1010                   fprintf(stderr,"strgin : %s\n",tmps);
    10111017                  xmlAddChild(nc6,nc7);
    10121018                  token=strtok_r(NULL,",",&saveptr1);
    10131019                }
     1020                if(getMap(_tmp->content,"rangeMin")!=NULL ||
     1021                   getMap(_tmp->content,"rangeMax")!=NULL ||
     1022                   getMap(_tmp->content,"rangeClosure")!=NULL )
     1023                  goto doRange;
    10141024                xmlAddChild(nc3,nc6);
    10151025                isAnyValue=-1;
    10161026              }
    1017               hasDefault=true;
     1027              if(strncasecmp(tmp1->name,"range",5)==0){
     1028                if(isAnyValue==1){
     1029                  nc6 = xmlNewNode(ns_ows, BAD_CAST "AllowedValues");
     1030                doRange:
     1031                  nc8 = xmlNewNode(ns_ows, BAD_CAST "Range");
     1032                  map *tmp0=getMap(tmp1,"rangeMin");
     1033                  if(tmp0!=NULL){
     1034                    nc7 = xmlNewNode(ns_ows, BAD_CAST "MinimumValue");
     1035                    xmlAddChild(nc7,xmlNewText(BAD_CAST tmp0->value));
     1036                    xmlAddChild(nc8,nc7);
     1037                  }else{
     1038                    nc7 = xmlNewNode(ns_ows, BAD_CAST "MinimumValue");
     1039                    xmlAddChild(nc8,nc7);
     1040                  }
     1041                  tmp0=getMap(tmp1,"rangeMax");
     1042                  if(tmp0!=NULL){
     1043                    nc7 = xmlNewNode(ns_ows, BAD_CAST "MaximumValue");
     1044                    xmlAddChild(nc7,xmlNewText(BAD_CAST tmp0->value));
     1045                    xmlAddChild(nc8,nc7);
     1046                  }else{
     1047                    nc7 = xmlNewNode(ns_ows, BAD_CAST "MaximumValue");
     1048                    xmlAddChild(nc8,nc7);
     1049                  }
     1050                  tmp0=getMap(tmp1,"rangeSpacing");
     1051                  if(tmp0!=NULL){
     1052                    nc7 = xmlNewNode(ns_ows, BAD_CAST "Spacing");
     1053                    xmlAddChild(nc7,xmlNewText(BAD_CAST tmp0->value));
     1054                    xmlAddChild(nc8,nc7);
     1055                  }
     1056                  tmp0=getMap(tmp1,"rangeClosure");
     1057                  if(tmp0!=NULL){
     1058                    char *tmp="closed";
     1059                    if(strcasecmp(tmp0->value,"co")==0)
     1060                      tmp="closed-open";
     1061                    else
     1062                      if(strcasecmp(tmp0->value,"oc")==0)
     1063                        tmp="open-closed";
     1064                      else
     1065                        if(strcasecmp(tmp0->value,"o")==0)
     1066                          tmp="open";
     1067                    xmlNewNsProp(nc8,ns_ows,BAD_CAST "rangeClosure",BAD_CAST tmp);
     1068                  }else
     1069                    xmlNewNsProp(nc8,ns_ows,BAD_CAST "rangeClosure",BAD_CAST "closed");
     1070                }
     1071                xmlAddChild(nc6,nc8);
     1072                xmlAddChild(nc3,nc6);
     1073                isAnyValue=-1;
     1074              }
    10181075            }
    10191076          tmp1=tmp1->next;
     
    10261083            xmlAddChild(nc3,nc5);
    10271084          }
    1028          
    10291085          if(strncmp(type,"Input",5)==0){
    1030             if(datatype==1 && isAnyValue==1 && avcnt==0){
    1031               xmlAddChild(nc3,xmlNewNode(ns_ows, BAD_CAST "AnyValue"));
    1032               hasDefault=true;
    1033               avcnt++;
    1034             }
    1035             if(datatype==1 && default1>0){
     1086            if(datatype==1 && isAnyValue==1 && default1>0){
    10361087              xmlAddChild(nc3,nc7);
    10371088            }
    10381089          }
    1039         }
     1090         
     1091        }
     1092      if(strncmp(type,"Input",5)==0){
     1093        if(datatype==1 && isAnyValue==1 && avcnt==0){
     1094          xmlAddChild(nc3,xmlNewNode(ns_ows, BAD_CAST "AnyValue"));
     1095          hasDefault=true;
     1096          avcnt++;
     1097        }
     1098      }
    10401099    }
    10411100
     
    11191178      xmlAddChild(nc3,nc4);
    11201179      xmlAddChild(nc2,nc3);
    1121     }else if(datatype!=2){
    1122       if(hasDefault!=true && strncmp(type,"Input",5)==0)
     1180    }/*else if(datatype!=2){
     1181      if(hasDefault!=true && strncmp(type,"Input",5)==0 && isAnyValue==1)
    11231182        xmlAddChild(nc3,xmlNewNode(ns_ows, BAD_CAST "AnyValue"));
    1124     }
     1183        }*/
    11251184   
    11261185    xmlAddChild(nc1,nc2);
     
    17721831  maps* tmpMap=getMaps(m,"main");
    17731832  char *encoding=getEncoding(tmpMap);
     1833  char *exceptionCode;
     1834 
     1835  map* tmp=getMap(s,"code");
     1836  if(tmp!=NULL){
     1837    if(strcmp(tmp->value,"OperationNotSupported")==0)
     1838      exceptionCode="501 Not Implemented";
     1839    else
     1840      if(strcmp(tmp->value,"MissingParameterValue")==0 ||
     1841         strcmp(tmp->value,"InvalidUpdateSequence")==0 ||
     1842         strcmp(tmp->value,"OptionNotSupported")==0 ||
     1843         strcmp(tmp->value,"VersionNegotiationFailed")==0 ||
     1844         strcmp(tmp->value,"InvalidParameterValue")==0)
     1845        exceptionCode="400 Bad request";
     1846      else
     1847        if(strcmp(tmp->value,"NoApplicableCode")==0)
     1848          exceptionCode="501 Internal Server Error";
     1849        else
     1850          exceptionCode="501 Internal Server Error";
     1851  }
     1852  else
     1853    exceptionCode="501 Internal Server Error";
     1854
    17741855  if(m!=NULL){
    17751856    map *tmpSid=getMapFromMaps(m,"lenv","sid");
     
    17771858      if( getpid()==atoi(tmpSid->value) ){
    17781859        printHeaders(m);
    1779         printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding);
     1860        printf("Content-Type: text/xml; charset=%s\r\nStatus: %s\r\n\r\n",encoding,exceptionCode);
    17801861      }
    17811862    }
    17821863    else{
    17831864      printHeaders(m);
    1784       printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding);
     1865      printf("Content-Type: text/xml; charset=%s\r\nStatus: %s\r\n\r\n",encoding,exceptionCode);
    17851866    }
    17861867  }else{
    1787     printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding);
     1868    printf("Content-Type: text/xml; charset=%s\r\nStatus: %s\r\n\r\n",encoding,exceptionCode);
    17881869  }
    17891870  n=createExceptionReportNode(m,s,1);
     
    18291910  else
    18301911    xmlNewProp(nc,BAD_CAST "exceptionCode",BAD_CAST "NoApplicableCode");
     1912
     1913  tmp=getMap(s,"locator");
     1914  if(tmp!=NULL && strcasecmp(tmp->value,"NULL")!=0)
     1915    xmlNewProp(nc,BAD_CAST "locator",BAD_CAST tmp->value);
     1916
    18311917
    18321918  tmp=getMap(s,"text");
     
    26302716    fcontent=(char*)malloc((res.nDataLen+1)*sizeof(char));
    26312717    if(fcontent == NULL){
    2632       return errorException(m, _("Unable to allocate memory."), "InternalError");
     2718      return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    26332719    }
    26342720    size_t dwRead;
     
    26392725  }
    26402726  if(fsize==0){
    2641     return errorException(m, _("Unable to download the file."), "InternalError");
     2727    return errorException(m, _("Unable to download the file."), "InternalError",NULL);
    26422728  }
    26432729
     
    26682754}
    26692755
    2670 int errorException(maps *m, const char *message, const char *errorcode)
     2756int errorException(maps *m, const char *message, const char *errorcode, const char *locator)
    26712757{
    26722758  map* errormap = createMap("text", message);
    26732759  addToMap(errormap,"code", errorcode);
     2760  if(locator!=NULL)
     2761    addToMap(errormap,"locator", locator);
     2762  else
     2763    addToMap(errormap,"locator", "NULL");
    26742764  printExceptionReportResponse(m,errormap);
    26752765  freeMap(&errormap);
  • trunk/zoo-project/zoo-kernel/service_internal.h

    r453 r459  
    132132  char* addDefaultValues(maps**,elements*,maps*,int);
    133133
    134   int errorException(maps *m, const char *message, const char *errorcode);
     134  int errorException(maps *, const char *, const char *, const char*);
    135135
    136136  int checkForSoapEnvelope(xmlDocPtr);
  • trunk/zoo-project/zoo-kernel/service_internal_ruby.c

    r453 r459  
    369369  if (istatus < 0 || istatus > 100){
    370370    fprintf(stderr,"Status must be a percentage.");
    371     return NULL;
     371    return Qnil;
    372372  }else{
    373373     char tmpStatus[4];
  • trunk/zoo-project/zoo-kernel/zoo_loader.c

    r458 r459  
    110110       }
    111111       if(res==NULL && (strQuery==NULL || strlen(strQuery)==0)){
    112          return errorException(NULL,"ZOO-Kernel failed to process your request cause the request was emtpty.","InternalError");
     112         return errorException(NULL,"ZOO-Kernel failed to process your request cause the request was emtpty.","InternalError",NULL);
    113113       }else{
    114114         if(strQuery==NULL || strlen(strQuery)==0)
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r458 r459  
    152152        char emsg[1024];
    153153        sprintf(emsg,_("You set maximum occurences for <%s> as %i but you tried to use it more than the limit you set. Please correct your ZCFG file or your request."),mi->name,atoi(testMap->value));
    154         errorException(m,emsg,"InternalError");
     154        errorException(m,emsg,"InternalError",NULL);
    155155        return -1;
    156156      }
     
    165165          map* tmpMap=getMap(mi->content,"length");
    166166          sprintf(emsg,_("ZOO-Kernel was unable to load your data for %s position %s."),mi->name,tmpMap->value);
    167           errorException(m,emsg,"InternalError");
     167          errorException(m,emsg,"InternalError",NULL);
    168168          return -1;
    169169        }
     
    172172        char emsg[1024];
    173173        sprintf(emsg,_("You set maximum occurences for <%s> to one but you tried to use it more than once. Please correct your ZCFG file or your request."),mi->name);
    174         errorException(m,emsg,"InternalError");
     174        errorException(m,emsg,"InternalError",NULL);
    175175        return -1;
    176176      }
     
    221221  }
    222222  sprintf(tmp,_("ZOO Kernel failed to process your request receiving signal %d = %s"),sig,ssig);
    223   errorException(NULL, tmp, "InternalError");
     223  errorException(NULL, tmp, "InternalError",NULL);
    224224#ifdef DEBUG
    225225  fprintf(stderr,"Not this time!\n");
     
    556556  m=(maps*)malloc(MAPS_SIZE);
    557557  if(m == NULL){
    558     return errorException(m, _("Unable to allocate memory."), "InternalError");
     558    return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    559559  }
    560560  char ntmp[1024];
     
    570570  snprintf(conf_file,10240,"%s/%s/main.cfg",ntmp,r_inputs->value);
    571571  if(conf_read(conf_file,m)==2){
    572     errorException(NULL, _("Unable to load the main.cfg file."),"InternalError");
     572    errorException(NULL, _("Unable to load the main.cfg file."),"InternalError",NULL);
    573573    free(m);
    574574    return 1;
     
    654654  r_inputs=getMap(request_inputs,"Request");
    655655  if(request_inputs==NULL || r_inputs==NULL){
    656     errorException(m, _("Parameter <request> was not specified"),"MissingParameterValue");
     656    errorException(m, _("Parameter <request> was not specified"),"MissingParameterValue","request");
    657657    freeMaps(&m);
    658658    free(m);
     
    664664       && strncasecmp(r_inputs->value,"DescribeProcess",15)!=0
    665665       && strncasecmp(r_inputs->value,"Execute",7)!=0){
    666       errorException(m, _("Unenderstood <request> value. Please check that it was set to GetCapabilities, DescribeProcess or Execute."), "InvalidParameterValue");
     666      errorException(m, _("Unenderstood <request> value. Please check that it was set to GetCapabilities, DescribeProcess or Execute."), "InvalidParameterValue","request");
    667667      freeMaps(&m);
    668668      free(m);
     
    674674  r_inputs=getMap(request_inputs,"Service");
    675675  if(r_inputs==NULLMAP){
    676     errorException(m, _("Parameter <service> was not specified"),"MissingParameterValue");
     676    errorException(m, _("Parameter <service> was not specified"),"MissingParameterValue","service");
    677677    freeMaps(&m);
    678678    free(m);
    679679    free(REQUEST);
    680680    return 1;
    681   }
    682   if(strncasecmp(REQUEST,"GetCapabilities",15)!=0){
    683     r_inputs=getMap(request_inputs,"Version");
    684     if(r_inputs==NULL){
    685       errorException(m, _("Parameter <version> was not specified"),"MissingParameterValue");
     681  }else{
     682    if(strcasecmp(r_inputs->value,"WPS")!=0){
     683      errorException(m, _("Unenderstood <service> value, WPS is the only acceptable value."), "InvalidParameterValue","service");
    686684      freeMaps(&m);
    687685      free(m);
     
    689687      return 1;
    690688    }
     689  }
     690  if(strncasecmp(REQUEST,"GetCapabilities",15)!=0){
     691    r_inputs=getMap(request_inputs,"Version");
     692    if(r_inputs==NULL){
     693      errorException(m, _("Parameter <version> was not specified"),"MissingParameterValue","version");
     694      freeMaps(&m);
     695      free(m);
     696      free(REQUEST);
     697      return 1;
     698    }else{
     699      if(strcasecmp(r_inputs->value,"1.0.0")!=0){
     700        errorException(m, _("Unenderstood <version> value, 1.0.0 is the only acceptable value."), "InvalidParameterValue","service");
     701        freeMaps(&m);
     702        free(m);
     703        free(REQUEST);
     704        return 1;
     705      }
     706    }
    691707  }
    692708
     
    726742    DIR *dirp = opendir(conf_dir);
    727743    if(dirp==NULL){
    728       return errorException(m, _("The specified path doesn't exist."),"InvalidParameterValue");
     744      return errorException(m, _("The specified path doesn't exist."),"InvalidParameterValue","metapath");
    729745    }
    730746    xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");
     
    748764        s1=(service*)malloc(SERVICE_SIZE);
    749765        if(s1 == NULL){
    750           return errorException(m, _("Unable to allocate memory."),"InternalError");
     766          return errorException(m, _("Unable to allocate memory."),"InternalError",NULL);
    751767        }
    752768#ifdef DEBUG
     
    779795    if(r_inputs==NULL
    780796       || strlen(r_inputs->name)==0 || strlen(r_inputs->value)==0){
    781       errorException(m, _("Mandatory <identifier> was not specified"),"MissingParameterValue");
     797      errorException(m, _("Mandatory <identifier> was not specified"),"MissingParameterValue","identifier");
    782798      freeMaps(&m);
    783799      free(m);
     
    790806    DIR *dirp = opendir(conf_dir);
    791807    if(dirp==NULL){
    792       errorException(m, _("The specified path path doesn't exist."),"InvalidParameterValue");
     808      errorException(m, _("The specified path path doesn't exist."),"InvalidParameterValue",conf_dir);
    793809      freeMaps(&m);
    794810      free(m);
     
    833849            if(s1 == NULL){
    834850              dup2(saved_stdout,fileno(stdout));
    835               return errorException(m, _("Unable to allocate memory."),"InternalError");
     851              return errorException(m, _("Unable to allocate memory."),"InternalError",NULL);
    836852            }
    837853#ifdef DEBUG
     
    863879    else
    864880      if(strncasecmp(REQUEST,"Execute",strlen(REQUEST))!=0){
    865         errorException(m, _("Unenderstood <request> value. Please check that it was set to GetCapabilities, DescribeProcess or Execute."), "InvalidParameterValue");
     881        errorException(m, _("Unenderstood <request> value. Please check that it was set to GetCapabilities, DescribeProcess or Execute."), "InvalidParameterValue","request");
    866882#ifdef DEBUG
    867883        fprintf(stderr,"No request found %s",REQUEST);
     
    885901    free(REQUEST);
    886902    free(SERVICE_URL);
    887     return errorException(m, _("Unable to allocate memory."),"InternalError");
     903    return errorException(m, _("Unable to allocate memory."),"InternalError",NULL);
    888904  }
    889905  r_inputs=getMap(request_inputs,"MetaPath");
     
    908924   
    909925    sprintf(tmpMsg,_("The value for <indetifier> seems to be wrong (%s). Please, ensure that the process exist using the GetCapabilities request."),r_inputs->value);
    910     errorException(m, tmpMsg, "InvalidParameterValue");
     926    errorException(m, tmpMsg, "InvalidParameterValue","identifier");
    911927    free(tmpMsg);
    912928    free(s1);
     
    982998      char** outputs_as_text=(char**)malloc(128*sizeof(char*));
    983999      if(outputs_as_text == NULL) {
    984         return errorException(m, _("Unable to allocate memory"), "InternalError");
     1000        return errorException(m, _("Unable to allocate memory"), "InternalError",NULL);
    9851001      }
    9861002      i=0;
     
    9931009        outputs_as_text[i]=(char*)malloc((strlen(pToken)+1)*sizeof(char));
    9941010        if(outputs_as_text[i] == NULL) {
    995           return errorException(m, _("Unable to allocate memory"), "InternalError");
     1011          return errorException(m, _("Unable to allocate memory"), "InternalError",NULL);
    9961012        }
    9971013        snprintf(outputs_as_text[i],strlen(pToken)+1,"%s",pToken);
     
    10101026              tmp_output=(maps*)malloc(MAPS_SIZE);
    10111027              if(tmp_output == NULL){
    1012                 return errorException(m, _("Unable to allocate memory."), "InternalError");
     1028                return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    10131029              }
    10141030              tmp_output->name=zStrdup(tmpc);
     
    10671083      snprintf(cursor_input,40960,"%s",r_inputs->value);
    10681084    else{
    1069       errorException(m, _("Parameter <DataInputs> was not specified"),"MissingParameterValue");
     1085      errorException(m, _("Parameter <DataInputs> was not specified"),"MissingParameterValue","DataInputs");
    10701086      freeMaps(&m);
    10711087      free(m);
     
    10951111    char** inputs_as_text=(char**)malloc(100*sizeof(char*));
    10961112    if(inputs_as_text == NULL){
    1097       return errorException(m, _("Unable to allocate memory."), "InternalError");
     1113      return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    10981114    }
    10991115    i=0;
     
    11091125      snprintf(inputs_as_text[i],strlen(pToken)+1,"%s",pToken);
    11101126      if(inputs_as_text[i] == NULL){
    1111         return errorException(m, _("Unable to allocate memory."), "InternalError");
     1127        return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    11121128      }
    11131129      pToken = strtok(NULL,";");
     
    11411157          tmpmaps=(maps*)malloc(MAPS_SIZE);
    11421158          if(tmpmaps == NULL){
    1143             return errorException(m, _("Unable to allocate memory."), "InternalError");
     1159            return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    11441160          }
    11451161          tmpmaps->name=zStrdup(tmpn);
     
    11951211                char emsg[1024];
    11961212                sprintf(emsg,_("Unable to find a valid protocol to download the remote file %s"),tmpv1+1);
    1197                 errorException(m,emsg,"InternalError");
     1213                errorException(m,emsg,"InternalError",NULL);
    11981214                freeMaps(&m);
    11991215                free(m);
     
    13121328              tmpmaps=(maps*)malloc(MAPS_SIZE);
    13131329              if(tmpmaps == NULL){
    1314                 return errorException(m, _("Unable to allocate memory."), "InternalError");
     1330                return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    13151331              }
    13161332              tmpmaps->name=zStrdup((char*)val);
     
    13301346              tmpmaps=(maps*)malloc(MAPS_SIZE);
    13311347              if(tmpmaps == NULL){
    1332                 return errorException(m, _("Unable to allocate memory."), "InternalError");
     1348                return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    13331349              }
    13341350              tmpmaps->name=zStrdup("missingIndetifier");
     
    14281444                    has=(char*)malloc((3+strlen((char*)val)+strlen(key))*sizeof(char));
    14291445                    if(has == NULL){
    1430                       return errorException(m, _("Unable to allocate memory."), "InternalError");
     1446                      return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    14311447                    }
    14321448                    snprintf(has,(3+strlen((char*)val)+strlen(key)),"%s: %s",key,(char*)val);
     
    14781494                    char* tmpContent = (char*)malloc((res.nDataLen+1)*sizeof(char));
    14791495                    if(tmpContent == NULL){
    1480                       return errorException(m, _("Unable to allocate memory."), "InternalError");
     1496                      return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    14811497                    }
    14821498                    size_t dwRead;
     
    15131529                      (char*)malloc((res1.nDataLen+1)*sizeof(char));
    15141530                    if(tmp == NULL){
    1515                       return errorException(m, _("Unable to allocate memory."), "InternalError");
     1531                      return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    15161532                    }
    15171533                    size_t bRead;
     
    15311547                      char* tmpContent = (char*)malloc((res.nDataLen+1)*sizeof(char));
    15321548                      if(tmpContent == NULL){
    1533                         return errorException(m, _("Unable to allocate memory."), "InternalError");
     1549                        return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    15341550                      }
    15351551                      size_t dwRead;
     
    17501766          tmpmaps=(maps*)malloc(MAPS_SIZE);
    17511767          if(tmpmaps == NULL){
    1752             return errorException(m, _("Unable to allocate memory."), "InternalError");
     1768            return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    17531769          }
    17541770          tmpmaps->name=zStrdup("unknownIdentifier");
     
    17921808              tmpmaps=(maps*)malloc(MAPS_SIZE);
    17931809              if(tmpmaps == NULL){
    1794                 return errorException(m, _("Unable to allocate memory."), "InternalError");
     1810                return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    17951811              }
    17961812              tmpmaps->name=zStrdup((char*)val);
     
    18291845              tmpmaps=(maps*)malloc(MAPS_SIZE);
    18301846              if(tmpmaps == NULL){
    1831                 return errorException(m, _("Unable to allocate memory."), "InternalError");
     1847                return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    18321848              }
    18331849              tmpmaps->name=zStrdup("missingIndetifier");
     
    18781894                  tmpmaps=(maps*)malloc(MAPS_SIZE);
    18791895                  if(tmpmaps == NULL){
    1880                     return errorException(m, _("Unable to allocate memory."), "InternalError");
     1896                    return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    18811897                  }
    18821898                  tmpmaps->name=zStrdup((char*)val);
     
    19011917                  tmpmaps=(maps*)malloc(MAPS_SIZE);
    19021918                  if(tmpmaps == NULL){
    1903                     return errorException(m, _("Unable to allocate memory."), "InternalError");
     1919                    return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);
    19041920                  }
    19051921                  tmpmaps->name=zStrdup("missingIndetifier");
     
    19631979  if(strcmp(dfv1,"")!=0 || strcmp(dfv,"")!=0){
    19641980    char tmps[1024];
     1981    map* tmpe=createMap("code","MissingParameterValue");
    19651982    if(strcmp(dfv,"")!=0){
    19661983      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);
     1984      addToMap(tmpe,"locator",dfv);
    19671985    }
    19681986    else if(strcmp(dfv1,"")!=0){
    19691987      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);
    1970     }
    1971     map* tmpe=createMap("text",tmps);
    1972     addToMap(tmpe,"code","MissingParameterValue");
     1988      addToMap(tmpe,"locator",dfv1);
     1989    }
     1990    addToMap(tmpe,"text",tmps);
    19731991    printExceptionReportResponse(m,tmpe);
    19741992    freeService(&s1);
     
    21162134  if(status!=NULL && strcmp(status->value,"true")==0 &&
    21172135     store!=NULL && strcmp(store->value,"false")==0){
    2118     errorException(m, _("Status cannot be set to true with storeExecuteResponse to false. Please, modify your request parameters."), "InvalidParameterValue");
     2136    errorException(m, _("Status cannot be set to true with storeExecuteResponse to false. Please, modify your request parameters."), "InvalidParameterValue","storeExecuteResponse");
    21192137    freeService(&s1);
    21202138    free(s1);
     
    23292347       */
    23302348      eres=-1;
    2331       errorException(m, _("Unable to run the child process properly"), "InternalError");
     2349      errorException(m, _("Unable to run the child process properly"), "InternalError",NULL);
    23322350    }
    23332351  }
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