Changeset 605


Ignore:
Timestamp:
Mar 9, 2015, 4:46:24 PM (9 years ago)
Author:
knut
Message:

Altered the path of stored response files from [tmpPath]/[serviceProvider]_[cpid].xml to [tmpPath]/[serviceName]_[cpid].xml. Added support for a new parameter, libPath, in the [main] block of main.cfg. The libPath parameter is interpreted as the absolute path of the directory containing library files. If the libPath parameter is set, it will override the metapath parameter such that library files are loaded from [libPath]/[serviceProvider] instead of [CWD]/[metapath]/[serviceProvider]. Added the option to disable the metapath parameter (for security reasons) at compile time: If the Zoo kernel is compiled with the preprocessor directive IGNORE_METAPATH, the metapath will be set to the empty string. Note however, that the libPath and IGNORE_METAPATH options so far only work for C and PHP; the functions for loading libraries written in other languages should be modified correspondingly before the documentation is updated. See also ticket no. 112 (http://www.zoo-project.org/trac/ticket/112). Fixed some spelling errors and modified the language in some of the messages returned by the Zoo kernel.

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

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/service_internal.c

    r601 r605  
    19431943  case SERVICE_SUCCEEDED:
    19441944    nc1 = xmlNewNode(ns, BAD_CAST "ProcessSucceeded");
    1945     sprintf(sMsg,_("Service \"%s\" run successfully."),serv->name);
     1945    sprintf(sMsg,_("The service \"%s\" ran successfully."),serv->name);
    19461946    nc3=xmlNewText(BAD_CAST sMsg);
    19471947    xmlAddChild(nc1,nc3);
     
    19511951    tmpStatus=getMapFromMaps(m,"lenv","status");
    19521952    xmlNewProp(nc1,BAD_CAST "percentCompleted",BAD_CAST tmpStatus->value);
    1953     sprintf(sMsg,_("ZOO Service \"%s\" is currently running. Please, reload this document to get the up-to-date status of the Service."),serv->name);
     1953    sprintf(sMsg,_("The ZOO service \"%s\" is currently running. Please reload this document to get the up-to-date status of the service."),serv->name);
    19541954    nc3=xmlNewText(BAD_CAST sMsg);
    19551955    xmlAddChild(nc1,nc3);
     
    19571957  case SERVICE_ACCEPTED:
    19581958    nc1 = xmlNewNode(ns, BAD_CAST "ProcessAccepted");
    1959     sprintf(sMsg,_("Service \"%s\" was accepted by the ZOO Kernel and it run as a background task. Please consult the statusLocation attribtue providen in this document to get the up-to-date document."),serv->name);
     1959    sprintf(sMsg,_("The service \"%s\" was accepted by the ZOO kernel and is running as a background task. Please access the URL in the statusLocation attribute provided in this document to get the up-to-date status and results."),serv->name);
    19601960    nc3=xmlNewText(BAD_CAST sMsg);
    19611961    xmlAddChild(nc1,nc3);
     
    20672067        /* If the file cannot be created return an ExceptionReport */
    20682068        char tmpMsg[1024];
    2069         sprintf(tmpMsg,_("Unable to create the file : \"%s\" for storing the ExecuteResponse."),stored_path);
     2069        sprintf(tmpMsg,_("Unable to create the file \"%s\" for storing the ExecuteResponse."),stored_path);
    20702070
    20712071        errorException(m,tmpMsg,"InternalError",NULL);
     
    22512251            nc3=xmlNewNode(ns_wps, BAD_CAST tmpV->value);
    22522252      else
    2253             nc3=xmlNewNode(ns_wps, BAD_CAST "LitteralData");
     2253            nc3=xmlNewNode(ns_wps, BAD_CAST "LiteralData");
    22542254    }
    22552255    tmp=m->content;
     
    27112711    if(teste==NULL){
    27122712      char tmpMsg[1024];
    2713       sprintf(tmpMsg,_("Unable to create the file : \"%s\" for storing the session maps."),session_file_path);
     2713      sprintf(tmpMsg,_("Unable to create the file \"%s\" for storing the session maps."),session_file_path);
    27142714      errorException(m,tmpMsg,"InternalError",NULL);
    27152715
     
    28042804            file_path=(char*)malloc((strlen(tmp1->value)+strlen(file_name)+2)*sizeof(char));
    28052805            sprintf(file_path,"%s/%s",tmp1->value,file_name);
    2806            
     2806   
    28072807                FILE *ofile=fopen(file_path,"wb");
    28082808            if(ofile==NULL){
    28092809              char tmpMsg[1024];
    2810               sprintf(tmpMsg,_("Unable to create the file : \"%s\" for storing the %s final result."),file_name,tmpI->name);
     2810              sprintf(tmpMsg,_("Unable to create the file \"%s\" for storing the %s final result."),file_name,tmpI->name);
    28112811              errorException(m,tmpMsg,"InternalError",NULL);
    28122812              free(file_name);
     
    28622862#endif
    28632863    printProcessResponse(m,request_inputs1,cpid,
    2864                          s,r_inputs->value,res,
     2864                //       s,r_inputs->value,res,
     2865                         s, s->name,res,  // replace serviceProvider with serviceName in stored response file name
    28652866                         request_inputs,
    28662867                         request_outputs);
     
    28932894      if(toto==NULL){
    28942895        char tmpMsg[1024];
    2895         sprintf(tmpMsg,_("Wrong RawDataOutput parameter, unable to fetch any result for the name your provided : \"%s\"."),tmpI->name);
     2896        sprintf(tmpMsg,_("Wrong RawDataOutput parameter: unable to fetch any result for the given parameter name: \"%s\"."),tmpI->name);
    28962897        errorException(m,tmpMsg,"InvalidParameterValue","RawDataOutput");
    28972898        return;
     
    38323833    free(tmp0);
    38333834    buffer[strlen(buffer)-1]=0;
    3834     if(i+1<level){
    3835       map* tmpMap=getMapFromMaps(conf,"lenv","metapath");
     3835    if(i+1<level){
     3836      #ifdef IGNORE_METAPATH
     3837        map* tmpMap = createMap("metapath", "");
     3838      #else 
     3839        map* tmpMap=getMapFromMaps(conf,"lenv","metapath");
     3840      #endif     
    38363841      if(tmpMap==NULL || strlen(tmpMap->value)==0){
    38373842        char *tmp01=zStrdup(tmp00->value);
     
    39823987    }
    39833988    if(hasValidValue<0){
    3984       char *replace=_("Ununderstood <%s> value, %s %s the only acceptable value.");
     3989      char *replace=_("The value <%s> was not recognized, %s %s the only acceptable value.");
    39853990      nb=0;
    39863991      char *vvalues=NULL;
  • trunk/zoo-project/zoo-kernel/service_internal_php.c

    r587 r605  
    186186  char ntmp[1024];
    187187  getcwd(ntmp,1024);
    188   map* tmp=getMap(request,"metapath");
    189 
     188   
     189  map* libp = getMapFromMaps(m, "main", "libPath"); // KLa 
    190190  int res=SERVICE_FAILED;
    191191
    192   tmp=getMap(s->content,"serviceProvider");
     192  map* tmp=getMap(s->content,"serviceProvider");
     193  if (tmp == NULL || tmp->value == NULL) {
     194          return errorException(m, "Missing serviceProvider (library file)", "NoApplicableCode", NULL);
     195  }
     196 
    193197  map* cwd=getMapFromMaps(m,"lenv","cwd");
    194   map* mp=getMap(request,"metapath");
     198#ifdef IGNORE_METAPATH
     199  map* mp = createMap("metapath", "");
     200#else 
     201  map* mp = getMap(request, "metapath");
     202#endif
    195203  char *scriptName;
    196   if(mp!=NULL && strlen(mp->value)>0){
    197     scriptName=(char*)malloc((strlen(cwd->value)+strlen(mp->value)+strlen(tmp->value)+3)*sizeof(char));
    198     sprintf(scriptName,"%s/%s/%s",cwd->value,mp->value,tmp->value);
    199   }else{
    200     scriptName=(char*)malloc((strlen(cwd->value)+strlen(tmp->value)+2)*sizeof(char));
    201     sprintf(scriptName,"%s/%s",cwd->value,tmp->value);
    202   }
     204 
     205  if (libp != NULL && libp->value != NULL) {
     206        scriptName = (char*) malloc((strlen(libp->value) + strlen(tmp->value) + 2)*sizeof(char));
     207    sprintf (scriptName, "%s/%s", libp->value, tmp->value);     
     208  }
     209  else {       
     210    if(mp!=NULL && strlen(mp->value)>0){
     211      scriptName=(char*)malloc((strlen(cwd->value)+strlen(mp->value)+strlen(tmp->value)+3)*sizeof(char));
     212      sprintf(scriptName,"%s/%s/%s",cwd->value,mp->value,tmp->value);
     213    }else{
     214      scriptName=(char*)malloc((strlen(cwd->value)+strlen(tmp->value)+2)*sizeof(char));
     215      sprintf(scriptName,"%s/%s",cwd->value,tmp->value);
     216    }
     217  }
    203218  zend_file_handle iscript;
    204219  iscript.type=ZEND_HANDLE_FD;
  • trunk/zoo-project/zoo-kernel/zoo_loader.c

    r601 r605  
    111111       delete[] buffer;
    112112       if(res==NULL && (strQuery==NULL || strlen(strQuery)==0)){
    113          return errorException(NULL,"ZOO-Kernel failed to process your request cause the request was emtpty.","InternalError",NULL);
     113         return errorException(NULL,"ZOO-Kernel failed to process your request because the request was empty.","InternalError",NULL);
    114114       }else{
    115115         if(strQuery==NULL || strlen(strQuery)==0)
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r601 r605  
    195195              char emsg[1024];
    196196              sprintf (emsg,
    197                        _("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."),
     197                       _("The maximum allowed occurrences for <%s> (%i) was exceeded."),
    198198                       mi->name, atoi (testMap->value));
    199199              errorException (m, emsg, "InternalError", NULL);
     
    227227              sprintf (emsg,
    228228                       _
    229                        ("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."),
     229                       ("The maximum allowed occurrences for <%s> is one."),
    230230                       mi->name);
    231231              errorException (m, emsg, "InternalError", NULL);
     
    371371{
    372372#ifdef DEBUG
    373   fprintf (stderr, "Signal %d after the ZOO-Kernel returned result !\n", sig);
     373  fprintf (stderr, "Signal %d after the ZOO-Kernel returned result!\n", sig);
    374374#endif
    375375  exit (0);
     
    407407  sprintf (tmp,
    408408           _
    409            ("ZOO Kernel failed to process your request receiving signal %d = %s"),
     409           ("ZOO Kernel failed to process your request, receiving signal %d = %s"),
    410410           sig, ssig);
    411411  errorException (NULL, tmp, "InternalError", NULL);
     
    439439  fflush (stderr);
    440440#endif
     441
     442  map* libp = getMapFromMaps(m, "main", "libPath");
     443 
    441444  if (strlen (r_inputs->value) == 1
    442445      && strncasecmp (r_inputs->value, "C", 1) == 0)
    443     {
    444       r_inputs = getMap (request_inputs, "metapath");
    445       if (r_inputs != NULL)
    446         sprintf (tmps1, "%s/%s", ntmp, r_inputs->value);
    447       else
    448         sprintf (tmps1, "%s/", ntmp);
    449       char *altPath = zStrdup (tmps1);
    450       r_inputs = getMap (s1->content, "ServiceProvider");
    451       sprintf (tmps1, "%s/%s", altPath, r_inputs->value);
    452       free (altPath);
     446  {
     447     if (libp != NULL && libp->value != NULL) {
     448            r_inputs = getMap (s1->content, "ServiceProvider");
     449                sprintf (tmps1, "%s/%s", libp->value, r_inputs->value);
     450         }
     451     else {     
     452        r_inputs = getMap (request_inputs, "metapath");
     453        if (r_inputs != NULL)
     454          sprintf (tmps1, "%s/%s", ntmp, r_inputs->value);
     455        else
     456          sprintf (tmps1, "%s/", ntmp);
     457         
     458        char *altPath = zStrdup (tmps1);
     459        r_inputs = getMap (s1->content, "ServiceProvider");
     460        sprintf (tmps1, "%s/%s", altPath, r_inputs->value);
     461        free (altPath);
     462         }
    453463#ifdef DEBUG
    454464      fprintf (stderr, "Trying to load %s\n", tmps1);
     
    613623              errstr = dlerror ();
    614624#endif
    615           sprintf (tmps, _("C Library can't be loaded %s"), errstr);
     625          sprintf (tmps, _("Unable to load C Library %s"), errstr);
    616626          errorException(m,tmps,"InternalError",NULL);
    617627          *eres = -1;
     
    739749  map *r_inputs = getMapFromMaps (m, "main", "tmpPath");
    740750  map *r_inputs1 = getMap (request_inputs, "metapath");
     751 
    741752  int hasIn = -1;
    742753  if (r_inputs1 == NULL)
     
    883894  map *r_inputs = NULL;
    884895  map *request_inputs = *inputs;
     896#ifdef IGNORE_METAPATH
     897  addToMap(request_inputs, "metapath", "");
     898#endif 
    885899  maps *m = NULL;
    886900  char *REQUEST = NULL;
     
    901915#endif
    902916  r_inputs = getMapOrFill (&request_inputs, "metapath", "");
    903 
    904917
    905918  char conf_file[10240];
     
    10931106    }
    10941107
    1095 
    10961108  maps *request_output_real_format = NULL;
    10971109  map *tmpm = getMapFromMaps (m, "main", "serverAddress");
     
    11121124  r_inputs = NULL;
    11131125  r_inputs = getMap (request_inputs, "metapath");
     1126 
    11141127  if (r_inputs != NULL)
    11151128    snprintf (conf_dir, 1024, "%s/%s", ntmp, r_inputs->value);
     
    11601173      if (dirp == NULL)
    11611174        {
    1162           errorException (m, _("The specified path path doesn't exist."),
     1175          errorException (m, _("The specified path path does not exist."),
    11631176                          "InvalidParameterValue", conf_dir);
    11641177          freeMaps (&m);
     
    13751388          errorException (m,
    13761389                          _
    1377                           ("Unenderstood <request> value. Please check that it was set to GetCapabilities, DescribeProcess or Execute."),
     1390                          ("The <request> value was not recognized. Allowed values are GetCapabilities, DescribeProcess, and Execute."),
    13781391                          "InvalidParameterValue", "request");
    13791392#ifdef DEBUG
     
    14411454      sprintf (tmpMsg,
    14421455               _
    1443                ("The value for <identifier> seems to be wrong (%s). Please, ensure that the process exist using the GetCapabilities request."),
     1456               ("The value for <identifier> seems to be wrong (%s). Please specify one of the processes in the list returned by a GetCapabilities request."),
    14441457               r_inputs->value);
    14451458      errorException (m, tmpMsg, "InvalidParameterValue", "identifier");
     
    27862799              snprintf (tmps, 1024,
    27872800                        _
    2788                         ("The <%s> parameter has a limited size (%sMB) defined in ZOO ServicesProvider configuration file but the reference you provided exceed this limitation (%fMB), please correct your query or the ZOO Configuration file."),
     2801                        ("The <%s> parameter has a size limit (%s MB) defined in the ZOO ServicesProvider configuration file, but the reference you provided exceeds this limit (%f MB)."),
    27892802                        ptr->name, tmp1->value, i);
    27902803              addToMap (tmpe, "locator", ptr->name);
     
    28302843            snprintf (tmps, 1024,
    28312844                      _
    2832                       ("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."),
     2845                      ("The <%s> argument was not specified in DataInputs but is required according to the ZOO ServicesProvider configuration file."),
    28332846                      errp->value);
    28342847            setMapArray (tmpe, "locator", nb , errp->value);
     
    28562869            snprintf (tmps, 1024,
    28572870                      _
    2858                       ("The <%s> argument was specified as %s identifier but not defined in the ZOO Configuration File. Please, correct your query or the ZOO Configuration File."),
     2871                      ("The <%s> argument specified as %s identifier was not recognized (not defined in the ZOO Configuration File)."),
    28592872                      errp->value,
    28602873                      ((getMap(request_inputs,"RawDataOutput")!=NULL)?"RawDataOutput":"ResponseDocument"));
     
    30513064      errorException (m,
    30523065                      _
    3053                       ("Status cannot be set to true with storeExecuteResponse to false. Please, modify your request parameters."),
     3066                      ("The status parameter cannot be set to true if storeExecuteResponse is set to false. Please modify your request parameters."),
    30543067                      "InvalidParameterValue", "storeExecuteResponse");
    30553068      freeService (&s1);
     
    32703283          int cpid = atoi (r_inputs->value);
    32713284          r_inputs = getMapFromMaps (m, "main", "tmpPath");
    3272           map *r_inputs1 = getMap (s1->content, "ServiceProvider");
     3285          //map *r_inputs1 = getMap (s1->content, "ServiceProvider");
     3286                  map* r_inputs1 = createMap("ServiceName", s1->name);
     3287
    32733288          fbkp =
    32743289            (char *)
     
    33573372                    cpid, m, eres);
    33583373  fflush (stdout);
     3374 
    33593375  /**
    33603376   * Ensure that if error occurs when freeing memory, no signal will return
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