Ignore:
Timestamp:
Oct 21, 2020, 6:31:09 PM (13 months ago)
Author:
djay
Message:

Update OGC API - Processes documentation and implementation, providing a browsable User Interface to Processes.

File:
1 edited

Legend:

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

    r961 r962  
    952952      free(res);
    953953    }
    954   else
    955     addToMap(statusInfo,"Status","Failed"); 
     954  else{
     955    addToMap(statusInfo,"Status","Failed");
     956    addToMap(statusInfo,"NotFound",pid);
     957  }
    956958  free(fbkpid);
    957959}
     
    992994void runGetStatus(maps* conf,char* pid,char* req){
    993995  map* r_inputs = getMapFromMaps (conf, "main", "tmpPath");
     996  map* e_type = getMapFromMaps (conf, "lenv", "executionType");
    994997  char *sid=getStatusId(conf,pid);
    995998  if(sid==NULL){
    996     errorException (conf, _("The JobID from the request does not match any of the Jobs running on this server"),
    997                     "NoSuchJob", pid);
     999    if(e_type==NULL || strncasecmp(e_type->value,"json",4)!=0)
     1000      errorException (conf, _("The JobID from the request does not match any of the Jobs running on this server"),
     1001                      "NoSuchJob", pid);
     1002    else{
     1003      setMapInMaps(conf,"lenv","error","true");
     1004      setMapInMaps(conf,"lenv","code","NoSuchJob");
     1005      setMapInMaps(conf,"lenv","message",_("The JobID from the request does not match any of the Jobs running on this server"));
     1006    }
    9981007  }else{
    9991008    map* statusInfo=createMap("JobID",pid);
    1000     if(isRunning(conf,pid)>0){         
     1009    if(isRunning(conf,pid)>0){
    10011010      if(strncasecmp(req,"GetResult",strlen(req))==0){
    1002         errorException (conf, _("The result for the requested JobID has not yet been generated. The service is currently running."),
    1003                         "ResultNotReady", pid);
     1011        if(e_type==NULL || strncasecmp(e_type->value,"json",4)!=0)
     1012          errorException (conf, _("The result for the requested JobID has not yet been generated. The service is currently running."),
     1013                          "ResultNotReady", pid);
     1014        else{
     1015          setMapInMaps(conf,"lenv","error","true");
     1016          setMapInMaps(conf,"lenv","code","ResultNotReady");
     1017          setMapInMaps(conf,"lenv","message",_("The result for the requested JobID has not yet been generated. The service is currently running."));
     1018        }
    10041019        return;
    10051020      }
    1006       else
     1021      else{
    10071022        if(strncasecmp(req,"GetStatus",strlen(req))==0){
    10081023          addToMap(statusInfo,"Status","Running");
     1024          setMapInMaps(conf,"lenv","status","Running");
    10091025          char* tmpStr=_getStatus(conf,pid);
    10101026          if(tmpStr!=NULL && strncmp(tmpStr,"-1",2)!=0){
     
    10151031            addToMap(statusInfo,"PercentCompleted",tmpStr1);
    10161032            addToMap(statusInfo,"Message",tmpStr0);
     1033            setMapInMaps(conf,"lenv","PercentCompleted",tmpStr1);
     1034            setMapInMaps(conf,"lenv","Message",tmpStr0);
    10171035            free(tmpStr0);
    10181036            free(tmpStr1);
    10191037          }
    10201038        }
     1039      }
    10211040    }
    10221041    else{
     
    10431062        if(strncasecmp(req,"GetStatus",strlen(req))==0){
    10441063          readFinalRes(conf,pid,statusInfo);
     1064          if(e_type==NULL || strncasecmp(e_type->value,"json",4)==0){
     1065            map* pmStatus=getMap(statusInfo,"status");     
     1066            if(pmStatus!=NULL)
     1067              setMapInMaps(conf,"lenv","status",pmStatus->value);   
     1068          }
    10451069          char* tmpStr=_getStatus(conf,pid);
    10461070          if(tmpStr!=NULL && strncmp(tmpStr,"-1",2)!=0){
     
    10511075            addToMap(statusInfo,"PercentCompleted",tmpStr1);
    10521076            addToMap(statusInfo,"Message",tmpStr0);
     1077            setMapInMaps(conf,"lenv","PercentCompleted",tmpStr1);
     1078            setMapInMaps(conf,"lenv","Message",tmpStr0);
    10531079            free(tmpStr0);
    10541080            free(tmpStr1);
     
    10571083    }
    10581084    free(sid);
    1059     printStatusInfo(conf,statusInfo,req);
     1085    if(e_type==NULL || strncasecmp(e_type->value,"json",4)!=0)
     1086      printStatusInfo(conf,statusInfo,req);
     1087    else
     1088      setMapInMaps(conf,"lenv","error","false");
    10601089    freeMap(&statusInfo);
    10611090    free(statusInfo);
     
    10721101void runDismiss(maps* conf,char* pid){
    10731102  map* r_inputs = getMapFromMaps (conf, "main", "tmpPath");
     1103  map* e_type = getMapFromMaps (conf, "lenv", "executionType");
    10741104  char *sid=getStatusId(conf,pid);
    10751105  if(sid==NULL){
    1076     errorException (conf, _("The JobID from the request does not match any of the Jobs running on this server"),
    1077                     "NoSuchJob", pid);
     1106    if(e_type==NULL || strncasecmp(e_type->value,"json",4)!=0)
     1107      errorException (conf, _("The JobID from the request does not match any of the Jobs running on this server"),
     1108                      "NoSuchJob", pid);
     1109    else{
     1110      setMapInMaps(conf,"lenv","error","true");
     1111      setMapInMaps(conf,"lenv","code","NoSuchJob");
     1112      setMapInMaps(conf,"lenv","message",_("The JobID from the request does not match any of the Jobs running on this server"));
     1113    }
     1114    return;
    10781115  }else{
    10791116    // We should send the Dismiss request to the target host if it differs
     
    11151152          sprintf(fileName,"%s/%s",r_inputs->value,dp->d_name);
    11161153          if(zUnlink(fileName)!=0){
    1117             errorException (conf,
    1118                             _("The job cannot be removed, a file cannot be removed"),
    1119                             "NoApplicableCode", NULL);
     1154            if(e_type==NULL || strncasecmp(e_type->value,"json",4)!=0)
     1155              errorException (conf,
     1156                              _("The job cannot be removed, a file cannot be removed"),
     1157                              "NoApplicableCode", NULL);
     1158            else{
     1159                    setMapInMaps(conf,"lenv","error","true");
     1160                    setMapInMaps(conf,"lenv","code","NoApplicableCode");
     1161                    setMapInMaps(conf,"lenv","message",_("The job cannot be removed, a file cannot be removed"));
     1162            }
    11201163            return;
    11211164          }
    1122         }
    1123       }
    1124     }
     1165         
     1166        }
     1167      }
     1168    }
     1169    map* pmStatusFile=getMapFromMaps(conf,"lenv","file.statusFile");
     1170    if(pmStatusFile!=NULL && zUnlink(pmStatusFile->value)!=0){
     1171        if(e_type==NULL || strncasecmp(e_type->value,"json",4)!=0)
     1172          errorException (conf,
     1173                          _("The job cannot be removed, a file cannot be removed"),
     1174                          "NoApplicableCode", NULL);
     1175        else{
     1176          setMapInMaps(conf,"lenv","error","true");
     1177                    setMapInMaps(conf,"lenv","code","NoApplicableCode");
     1178                    setMapInMaps(conf,"lenv","message",_("The job cannot be removed, a file cannot be removed"));
     1179        }
     1180        return;
     1181      }
    11251182#ifdef RELY_ON_DB
    11261183    removeService(conf,pid);
    11271184#endif
    1128     /* No need to call 7_1 when an execution is dismissed.
    1129       fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
    1130       invokeCallback(conf,NULL,NULL,7,1);
    1131       fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
    1132     */
    1133     map* statusInfo=createMap("JobID",pid);
    1134     addToMap(statusInfo,"Status","Dismissed");
    1135     printStatusInfo(conf,statusInfo,"Dismiss");
    1136     free(statusInfo);
     1185    if(e_type==NULL || strncasecmp(e_type->value,"json",4)!=0){
     1186      /* No need to call 7_1 when an execution is dismissed.
     1187         fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
     1188         invokeCallback(conf,NULL,NULL,7,1);
     1189         fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
     1190      */
     1191      map* statusInfo=createMap("JobID",pid);
     1192      addToMap(statusInfo,"Status","Dismissed");
     1193      printStatusInfo(conf,statusInfo,"Dismiss");
     1194      free(statusInfo);
     1195    }else{
     1196      setMapInMaps(conf,"lenv","error","false");
     1197    }
    11371198  }
    11381199  return;
     
    12491310}
    12501311
     1312/**
     1313 * Create a string containing the basic error message.
     1314 *
     1315 * @param pmConf the main configuration maps pointer
     1316 * @return a new char* containing the error message (ressource should be freed)
     1317 */
     1318char* produceErrorMessage(maps* pmConf){
     1319  char *pacTmp;
     1320  map *pmLenv=getMapFromMaps(pmConf,"lenv","message");
     1321  if(pmLenv!=NULL){
     1322    pacTmp=(char*)malloc((strlen(pmLenv->value)+strlen(_("Unable to run the Service. The message returned back by the Service was the following: "))+1)*sizeof(char));
     1323    sprintf(pacTmp,_("Unable to run the Service. The message returned back by the Service was the following: %s"),pmLenv->value);
     1324  }
     1325  else{
     1326    pacTmp=(char*)malloc((strlen(_("Unable to run the Service. No more information was returned back by the Service."))+1)*sizeof(char));
     1327    sprintf(pacTmp,"%s",_("Unable to run the Service. No more information was returned back by the Service."));
     1328  }
     1329  return pacTmp;
     1330}
     1331
    12511332#ifdef WIN32
    12521333/**
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