Index: trunk/docker/oas.cfg
===================================================================
--- trunk/docker/oas.cfg (revision 985)
+++ trunk/docker/oas.cfg (revision 986)
@@ -3,10 +3,10 @@
rootUrl=http://localhost/ogc-api
links=/,/api,/conformance,/processes,/jobs
-paths=/root,/api,/conformance,/processes,/processes/{id},/jobs,/jobs/{jobID},/jobs/{jobID}/results
-parameters=id,jobID,resultID
+paths=/root,/api,/conformance,/processes,/processes/{processID},/jobs,/jobs/{jobID},/jobs/{jobID}/results
+parameters=processID,jobID,resultID
version=3.0.2
license_name=OGC license
-license_url=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/LICENSE
-full_html_support=false
+license_url=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/LICENSE
+full_html_support=true
partial_html_support=true
wsUrl=ws://localhost:8888/
@@ -84,5 +84,6 @@
type=text/hml
-[processes/{id}]
+[processes/{processID}]
+length=2
method=get
title=retrieve a process description
@@ -92,22 +93,5 @@
schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ProcessDescription.yaml
ecode=404
-parameters=/components/parameters/id
-
-
-[/processes/{id}/jobs]
-rel=canonical
-type=application/json
-title=Process Description
-
-[processes/{id}/jobs]
-length=2
-method=get
-title=retrieve a list of jobs run
-abstract=A list of jobs run.
-tags=JobList
-tags_description=
-schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/JobList.yaml
-parameters=/components/parameters/id
-ecode=404,500
+parameters=/components/parameters/processID
method_1=post
title_1=execute a job
@@ -116,16 +100,15 @@
tags_description_1=
schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteSync.yaml
-parameters_1=/components/parameters/id
+parameters_1=/components/parameters/processID
ecode_1=400,404,500
eschema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteAsync.yaml
-ep=,/components/parameters/oas-header1
[/jobs]
rel=canonical
type=application/json
-title=Execute Endpoint
+title=Job Management
[jobs]
-length=2
+length=1
method=get
title=retrieve a list of jobs run
@@ -156,27 +139,4 @@
type=text/hml
-[/processes/{id}/jobs/{jobID}]
-rel=canonical
-type=application/json
-title=Status
-
-[processes/{id}/jobs/{jobID}]
-length=2
-method=get
-title=The status of a job.
-abstract=The status of a job.
-tags=GetStatus
-tags_description=
-schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Status.yaml
-parameters=/components/parameters/id,/components/parameters/jobID
-method_1=delete
-title_1=Cancel a job
-abstract_1=Cancel the job execution.
-tags_1=Dismiss
-tags_description_1=Cencel a job execution
-schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Status.yaml
-parameters_1=/components/parameters/id,/components/parameters/jobID
-ecode_1=404,500
-
[/jobs/{jobID}]
rel=canonical
@@ -202,21 +162,4 @@
ecode_1=404,500
-
-[/processes/{id}/jobs/{jobID}/results]
-rel=canonical
-type=application/json
-title=Get Result
-
-[processes/{id}/jobs/{jobID}/results]
-method=get
-title=The result of a job execution.
-abstract=The result of a job execution.
-tags=GetResult
-tags_description=
-schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Results.yaml
-parameters=/components/parameters/id,/components/parameters/jobID
-ecode=404,500
-ep=,/components/parameters/oas-header2
-
[/jobs/{jobID}/results]
rel=canonical
@@ -235,21 +178,5 @@
ep=,/components/parameters/oas-header2
-[/processes/{id}/jobs/{jobID}/result/{resultID}]
-rel=canonical
-type=application/json
-title=Get Result
-
-[processes/{id}/jobs/{jobID}/result/{resultID}]
-method=get
-title=The result of a job execution.
-abstract=The result of a job execution.
-tags=GetResult
-tags_description=
-schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/valueType.yaml
-parameters=/components/parameters/id,/components/parameters/jobID,/components/parameters/resultID
-ep=,/components/parameters/oas-header2
-
-
-[{id}]
+[{processID}]
type=string
title=The id of a process
@@ -334,7 +261,7 @@
schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/statusInfo.yaml
type_1=application/json
-title_1=Results received successfully
+title_1=Status received successfully
state_2=jobFailed
-uri_2=failedUrii
+uri_2=failedUri
schema_2=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/exception.yaml
type_2=application/json
Index: trunk/zoo-project/HISTORY.txt
===================================================================
--- trunk/zoo-project/HISTORY.txt (revision 985)
+++ trunk/zoo-project/HISTORY.txt (revision 986)
@@ -1,4 +1,5 @@
Version 1.8.1
- * Make all demos running within docker
+ * Move jobs to root and use /processes/{processID} as execute endpopint
+ * Make all demos running within docker (including SAGA and OTB)
* Deploy demo HTML UI from github from the Dockerfile
* Add demo ZOO-Services build in the Dockerfile
Index: trunk/zoo-project/zoo-kernel/oas.cfg
===================================================================
--- trunk/zoo-project/zoo-kernel/oas.cfg (revision 985)
+++ trunk/zoo-project/zoo-kernel/oas.cfg (revision 986)
@@ -1,16 +1,15 @@
[openapi]
use_content=false
-rootUrl=https://myserver/ogc-api
-links=/,/api,/conformance,/processes
-paths=/root,/api,/conformance,/processes,/processes/{id},/processes/{id}/jobs,/processes/{id}/jobs/{jobID},/processes/{id}/jobs/{jobID}/results
-parameters=id,jobID,resultID
+rootUrl=http://localhost/ogc-api
+links=/,/api,/conformance,/processes,/jobs
+paths=/root,/api,/conformance,/processes,/processes/{processID},/jobs,/jobs/{jobID},/jobs/{jobID}/results
+parameters=processID,jobID,resultID
version=3.0.2
license_name=OGC license
-license_url=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/LICENSE
-full_html_support=false
+license_url=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/LICENSE
+full_html_support=true
partial_html_support=true
-wsUrl=wss://demo.mapmint.com:4430/
-publisherUrl=http://127.0.0.1/cgi-bin3/publish.py?jobid=
-io_as_array=true
+wsUrl=ws://localhost:8888/
+publisherUrl=http://localhost/cgi-bin/publish.py?jobid=
[/]
@@ -25,5 +24,5 @@
tags=Home
tags_description=
-schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/LandingPage.yaml
+schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/LandingPage.yaml
[/index.html]
@@ -41,5 +40,5 @@
[api.html]
-href=https://demo.mapmint.com/swagger-ui/ogc-api-processes/
+href=http://localhost/swagger-ui/oapip/
[api]
@@ -62,5 +61,5 @@
tags=Conformance
tags_description=
-schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ConformanceDeclaration.yaml
+schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ConformanceDeclaration.yaml
[/conformance.html]
@@ -79,5 +78,5 @@
tags=GetCapabilities
tags_description=
-schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ProcessList.yaml
+schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ProcessList.yaml
[/processes.html]
@@ -85,5 +84,6 @@
type=text/hml
-[processes/{id}]
+[processes/{processID}]
+length=2
method=get
title=retrieve a process description
@@ -91,24 +91,7 @@
tags=ProcessDescription
tags_description=
-schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ProcessDescription.yaml
+schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ProcessDescription.yaml
ecode=404
-parameters=/components/parameters/id
-
-
-[/processes/{id}/jobs]
-rel=canonical
-type=application/json
-title=Process Description
-
-[processes/{id}/jobs]
-length=2
-method=get
-title=retrieve a list of jobs run
-abstract=A list of jobs run.
-tags=JobList
-tags_description=
-schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/JobList.yaml
-parameters=/components/parameters/id
-ecode=404,500
+parameters=/components/parameters/processID
method_1=post
title_1=execute a job
@@ -116,8 +99,33 @@
tags_1=Execute Endpoint
tags_description_1=
-schema_1=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ExecuteSync.yaml
-parameters_1=/components/parameters/id
+schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteSync.yaml
+parameters_1=/components/parameters/processID
ecode_1=400,404,500
-eschema_1=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ExecuteAsync.yaml
+eschema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteAsync.yaml
+
+[/jobs]
+rel=canonical
+type=application/json
+title=Job Management
+
+[jobs]
+length=1
+method=get
+title=retrieve a list of jobs run
+abstract=A list of jobs run.
+tags=JobList
+tags_description=
+schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/JobList.yaml
+parameters=
+ecode=404,500
+method_1=post
+title_1=execute a job
+abstract_1=An execute endpoint.
+tags_1=ExecuteEndpoint
+tags_description_1=
+schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteSync.yaml
+parameters_1=
+ecode_1=400,404,500
+eschema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteAsync.yaml
ep=,/components/parameters/oas-header1
@@ -125,12 +133,16 @@
abstract=Mandatory execute request in JSON format
type=application/json
-schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/execute.yaml
-
-[/processes/{id}/jobs/{jobID}]
+schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/execute.yaml
+
+[/jobs.html]
+rel=alternate
+type=text/hml
+
+[/jobs/{jobID}]
rel=canonical
type=application/json
title=Status
-[processes/{id}/jobs/{jobID}]
+[jobs/{jobID}]
length=2
method=get
@@ -139,22 +151,21 @@
tags=GetStatus
tags_description=
-schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/Status.yaml
-parameters=/components/parameters/id,/components/parameters/jobID
+schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Status.yaml
+parameters=/components/parameters/jobID
method_1=delete
title_1=Cancel a job
abstract_1=Cancel the job execution.
tags_1=Dismiss
-tags_description_1=Cencel a job execution
-schema_1=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/Status.yaml
-parameters_1=/components/parameters/id,/components/parameters/jobID
+tags_description_1=Cancel a job execution
+schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Status.yaml
+parameters_1=/components/parameters/jobID
ecode_1=404,500
-
-[/processes/{id}/jobs/{jobID}/results]
+[/jobs/{jobID}/results]
rel=canonical
type=application/json
title=Get Result
-[processes/{id}/jobs/{jobID}/results]
+[jobs/{jobID}/results]
method=get
title=The result of a job execution.
@@ -162,26 +173,10 @@
tags=GetResult
tags_description=
-schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/Results.yaml
-parameters=/components/parameters/id,/components/parameters/jobID
+schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Results.yaml
+parameters=/components/parameters/jobID
ecode=404,500
ep=,/components/parameters/oas-header2
-[/processes/{id}/jobs/{jobID}/result/{resultID}]
-rel=canonical
-type=application/json
-title=Get Result
-
-[processes/{id}/jobs/{jobID}/result/{resultID}]
-method=get
-title=The result of a job execution.
-abstract=The result of a job execution.
-tags=GetResult
-tags_description=
-schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/valueType.yaml
-parameters=/components/parameters/id,/components/parameters/jobID,/components/parameters/resultID
-ep=,/components/parameters/oas-header2
-
-
-[{id}]
+[{processID}]
type=string
title=The id of a process
@@ -214,5 +209,5 @@
[conformsTo]
-rootUrl=http://www.opengis.net/spec/ogcapi-processes/1.0/conf/
+rootUrl=http://www.opengis.net/spec/ogcapi-processes/1.0/req/
rootUrl0=http://www.opengis.net/spec/WPS/2.0/req/service/binding/rest-json/
link=core
@@ -222,32 +217,34 @@
link_4=dismiss
link_5=callback
-length=6
+link_6=ogc-process-description
+link_7=html
+length=8
[exception]
abstract=Exception
type=application/json
-schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/NotFound.yaml
-default_schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ServerError.yaml
+schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/responses/NotFound.yaml
+default_schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ServerError.yaml
[responses]
length=5
code=404
-schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/NotFound.yaml
+schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/NotFound.yaml
type=application/json
title=NotFound
code_1=500
-schema_1=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ServerError.yaml
+schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ServerError.yaml
type_1=application/json
title_1=ServerError
code_2=400
-schema_2=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/InvalidParameter.yaml
+schema_2=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/InvalidParameter.yaml
type_2=appliction/json
title_2=InvalidParameter
code_3=405
-schema_3=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/NotAllowed.yaml
+schema_3=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/NotAllowed.yaml
type_3=appliction/json
title_3=NotAllowed
code_4=406
-schema_4=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/NotSupported.yaml
+schema_4=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/NotSupported.yaml
type_4=appliction/json
title_4=NotSupported
@@ -257,15 +254,15 @@
state=jobSuccess
uri=successUri
-schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/result.yaml
+schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/result.yaml
type=application/json
title=Results received successfully
state_1=jobInProgress
uri_1=inProgressUri
-schema_1=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/statusInfo.yaml
+schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/statusInfo.yaml
type_1=application/json
-title_1=Results received successfully
+title_1=Status received successfully
state_2=jobFailed
-uri_2=failedUrii
-schema_2=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/exception.yaml
+uri_2=failedUri
+schema_2=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/exception.yaml
type_2=application/json
title_2=Exception received successfully
Index: trunk/zoo-project/zoo-kernel/service_json.c
===================================================================
--- trunk/zoo-project/zoo-kernel/service_json.c (revision 985)
+++ trunk/zoo-project/zoo-kernel/service_json.c (revision 986)
@@ -533,28 +533,31 @@
json_object *res3=json_object_new_object();
map* pmTmp=getMapFromMaps(m,"lenv","requestType");
- if(pmTmp!=NULL && strncasecmp(pmTmp->value,"desc",4)==0)
+ if(pmTmp!=NULL && strncasecmp(pmTmp->value,"desc",4)==0){
json_object_object_add(res2,"rel",json_object_new_string("process-desc"));
+ }
else{
json_object_object_add(res2,"rel",json_object_new_string("execute"));
- json_object_object_add(res3,"rel",json_object_new_string("alternate"));
- json_object_object_add(res3,"type",json_object_new_string("text/html"));
- }
+ }
+ json_object_object_add(res3,"rel",json_object_new_string("alternate"));
+ json_object_object_add(res3,"type",json_object_new_string("text/html"));
json_object_object_add(res2,"type",json_object_new_string("application/json"));
- json_object_object_add(res2,"title",json_object_new_string("Process Description"));
map* tmpUrl=getMapFromMaps(m,"openapi","rootUrl");
char* tmpStr=(char*) malloc((strlen(tmpUrl->value)+strlen(rUrl)+13)*sizeof(char));
- sprintf(tmpStr,"%s/processes/%s/",tmpUrl->value,rUrl);
- if(doc==NULL){
+ sprintf(tmpStr,"%s/processes/%s",tmpUrl->value,rUrl);
+ if(pmTmp!=NULL && strncasecmp(pmTmp->value,"desc",4)!=0){
json_object_object_add(res2,"title",json_object_new_string("Execute End Point"));
json_object_object_add(res3,"title",json_object_new_string("Execute End Point"));
- char* tmpStr1=zStrdup(tmpStr);
+ /*char* tmpStr1=zStrdup(tmpStr);
tmpStr=(char*) realloc(tmpStr,(strlen(tmpStr)+6)*sizeof(char));
sprintf(tmpStr,"%sjobs",tmpStr1);
- free(tmpStr1);
- char* tmpStr3=(char*) malloc((strlen(tmpStr)+6)*sizeof(char));
- sprintf(tmpStr3,"%s.html",tmpStr);
- json_object_object_add(res3,"href",json_object_new_string(tmpStr3));
- free(tmpStr3);
- }
+ free(tmpStr1);*/
+ }else{
+ json_object_object_add(res2,"title",json_object_new_string("Process Description"));
+ json_object_object_add(res3,"title",json_object_new_string("Process Description"));
+ }
+ char* tmpStr3=(char*) malloc((strlen(tmpStr)+6)*sizeof(char));
+ sprintf(tmpStr3,"%s.html",tmpStr);
+ json_object_object_add(res3,"href",json_object_new_string(tmpStr3));
+ free(tmpStr3);
json_object_object_add(res2,"href",json_object_new_string(tmpStr));
free(tmpStr);
Index: trunk/zoo-project/zoo-kernel/zoo_service_loader.c
===================================================================
--- trunk/zoo-project/zoo-kernel/zoo_service_loader.c (revision 985)
+++ trunk/zoo-project/zoo-kernel/zoo_service_loader.c (revision 986)
@@ -2061,5 +2061,5 @@
errorException (NULL, _("Unable to load the oas.cfg file."),
"InternalError", NULL);
- free (m);
+ free (m1);
return 1;
}
@@ -2089,5 +2089,19 @@
setMapInMaps(m,"headers","Content-Type","application/json;charset=UTF-8");
/* - Root url */
- if(cgiContentLength==1){
+ if((strncasecmp(cgiRequestMethod,"post",4)==0 &&
+ (strstr(cgiQueryString,"/processes/")==NULL ||
+ strlen(cgiQueryString)<=11))
+ ||
+ (strncasecmp(cgiRequestMethod,"DELETE",6)==0 &&
+ (strstr(cgiQueryString,"/jobs/")==NULL || strlen(cgiQueryString)<=6)) ){
+ setMapInMaps(m,"lenv","status_code","405");
+ map* error=createMap("code","InvalidMethod");
+ addToMap(error,"message",_("The request method used to access the current path is not supported."));
+ printExceptionReportResponseJ(m,error);
+ json_object_put(res);
+ // TODO: cleanup memory
+ return 1;
+ }
+ else if(cgiContentLength==1){
if(strncasecmp(cgiRequestMethod,"GET",3)!=0){
setMapInMaps(m,"lenv","status_code","405");
@@ -2205,17 +2219,9 @@
else if(strstr(cgiQueryString,"/processes")==NULL && (strstr(cgiQueryString,"/jobs")!=NULL || strstr(cgiQueryString,"/jobs/")!=NULL)){
/* - /jobs url */
- fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
- fflush(stderr);
if(strncasecmp(cgiRequestMethod,"DELETE",6)==0) {
- fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
- fflush(stderr);
char* jobId=zStrdup(strstr(cgiQueryString,"/jobs/")+6);
setMapInMaps(m,"lenv","gs_usid",jobId);
setMapInMaps(m,"lenv","file.statusFile",json_getStatusFilePath(m));
- fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
- fflush(stderr);
runDismiss(m,jobId);
- fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
- fflush(stderr);
map* pmError=getMapFromMaps(m,"lenv","error");
if(pmError!=NULL && strncasecmp(pmError->value,"true",4)==0){
@@ -2227,6 +2233,4 @@
res=createStatus(m,SERVICE_DISMISSED);
}
- fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
- fflush(stderr);
}
else if(strcasecmp(cgiRequestMethod,"get")==0){
@@ -2262,10 +2266,6 @@
//char* jobId=zStrdup(strstr(cgiQueryString,"/jobs/")+6);
jobId[strlen(jobId)-8]=0;
- fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,jobId);
- fflush(stderr);
char *sid=getStatusId(m,jobId);
if(sid==NULL){
- fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,jobId);
- fflush(stderr);
map* error=createMap("code","NoSuchJob");
addToMap(error,"message",_("The JobID from the request does not match any of the Jobs running on this server"));
@@ -2273,6 +2273,4 @@
return 1;
}else{
- fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,jobId);
- fflush(stderr);
if(isRunning(m,jobId)>0){
map* error=createMap("code","ResultNotReady");
@@ -2281,16 +2279,8 @@
return 1;
}else{
- fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,jobId);
- fflush(stderr);
char *Url0=getResultPath(m,jobId);
- fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,Url0);
- fflush(stderr);
- //map *cIdentifier = getMapFromMaps (m, "lenv", "oIdentifier");
zStatStruct f_status;
int s=zStat(Url0, &f_status);
if(s==0 && f_status.st_size>0){
- fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,Url0);
- fflush(stderr);
-
if(f_status.st_size>15){
json_object* pjoTmp=json_readFile(m,Url0);
@@ -2358,6 +2348,22 @@
}
- }else if(strcasecmp(cgiRequestMethod,"post")==0 && (strcmp(cgiQueryString,"/jobs")==0 || strcmp(cgiQueryString,"/jobs/")==0)){
- /* - /jobs Execution (POST) */
+ }
+ }
+ else{
+ service* s1=NULL;
+ int t=0;
+ if(strstr(cgiQueryString,"/processes/")==NULL){
+ map* error=createMap("code","BadRequest");
+ addToMap(error,"message",_("The ressource is not available"));
+ //setMapInMaps(conf,"lenv","status_code","404 Bad Request");
+ printExceptionReportResponseJ(m,error);
+ freeMaps (&m);
+ free (m);
+ free (REQUEST);
+ xmlCleanupParser ();
+ zooXmlCleanupNs ();
+ return 1;
+ }else if(strcasecmp(cgiRequestMethod,"post")==0){
+ /* - /processes/{processId} Execution (POST) */
eres = SERVICE_STARTED;
initAllEnvironment(m,request_inputs,ntmp,"jrequest");
@@ -2400,14 +2406,10 @@
if(json_object_object_get_ex(jobj,"id",&json_io)!=FALSE){
cIdentifier=zStrdup(json_object_get_string(json_io));
+ }else{
+ if(strstr(cgiQueryString,"/processes/")!=NULL && strlen(cgiQueryString)>11)
+ cIdentifier=zStrdup(strstr(cgiQueryString,"/processes/")+11);
}
- fprintf(stderr,"%s %d \n", __FILE__,__LINE__);
- fflush(stderr);
fetchService(zooRegistry,m,&s1,request_inputs,ntmp,cIdentifier,printExceptionReportResponseJ);
- fprintf(stderr,"%s %d \n", __FILE__,__LINE__);
- fflush(stderr);
- //maps* inputs_real_format=NULL, *outputs_real_format= NULL;
parseJRequest(m,s1,jobj,request_inputs,&request_input_real_format,&request_output_real_format);
- fprintf(stderr,"%s %d \n", __FILE__,__LINE__);
- fflush(stderr);
map* preference=getMapFromMaps(m,"renv","HTTP_PREFER");
map* mode=getMap(request_inputs,"mode");
@@ -2593,21 +2595,5 @@
}//else error
-
- }
- else{
- service* s1=NULL;
- int t=0;
- if(strstr(cgiQueryString,"/processes/")==NULL){
- map* error=createMap("code","BadRequest");
- addToMap(error,"message",_("The ressource is not available"));
- //setMapInMaps(conf,"lenv","status_code","404 Bad Request");
- printExceptionReportResponseJ(m,error);
- freeMaps (&m);
- free (m);
- free (REQUEST);
- xmlCleanupParser ();
- zooXmlCleanupNs ();
- return 1;
- } else
+ else
if(strstr(cgiQueryString,"/jobs")==NULL && strstr(cgiQueryString,"/jobs/")==NULL){
/* - /processes/{id}/ */
@@ -2647,9 +2633,5 @@
}
- fprintf(stderr,"%s %d \n", __FILE__,__LINE__);
- fflush(stderr);
fetchService(zooRegistry,m,&s1,request_inputs,ntmp,cIdentifier,printExceptionReportResponseJ);
- fprintf(stderr,"%s %d \n", __FILE__,__LINE__);
- fflush(stderr);
@@ -3032,111 +3014,4 @@
fetchService(zooRegistry,m,&s1,request_inputs,ntmp,r_inputs->value,printExceptionReportResponse);
- /*
- //*****************
- // Fetch S1
- //*****************
- map* import = getMapFromMaps (m, IMPORTSERVICE, r_inputs->value);
- if (import != NULL && import->value != NULL) {
- strncpy(tmps1, import->value, 1024);
- setMapInMaps (m, "lenv", "Identifier", r_inputs->value);
- setMapInMaps (m, "lenv", "oIdentifier", r_inputs->value);
- }
- else {
- snprintf (tmps1, 1024, "%s/%s.zcfg", conf_dir, r_inputs->value);
-#ifdef DEBUG
- fprintf (stderr, "Trying to load %s\n", tmps1);
-#endif
- if (strstr (r_inputs->value, ".") != NULL)
- {
- char *identifier = zStrdup (r_inputs->value);
- parseIdentifier (m, conf_dir, identifier, tmps1);
- map *tmpMap = getMapFromMaps (m, "lenv", "metapath");
- if (tmpMap != NULL)
- addToMap (request_inputs, "metapath", tmpMap->value);
- free (identifier);
- }
- else
- {
- setMapInMaps (m, "lenv", "Identifier", r_inputs->value);
- setMapInMaps (m, "lenv", "oIdentifier", r_inputs->value);
- }
- }
-
- r_inputs = getMapFromMaps (m, "lenv", "Identifier");
-
-#ifdef META_DB
- int metadb_id=_init_sql(m,"metadb");
- //FAILED CONNECTING DB
- if(getMapFromMaps(m,"lenv","dbIssue")!=NULL || metadb_id<0){
- fprintf(stderr,"ERROR CONNECTING METADB\n");
- }
- if(metadb_id>=0)
- s1=extractServiceFromDb(m,r_inputs->value,0);
- //close_sql(m,0);
- if(s1!=NULL){
- inheritance(zooRegistry,&s1);
-#ifdef USE_HPC
- addNestedOutputs(&s1);
-#endif
- if(zooRegistry!=NULL){
- freeRegistry(&zooRegistry);
- free(zooRegistry);
- }
- }else /* Not found in MetaDB /{
-#endif
- s1 = createService();
- if (s1 == NULL)
- {
- freeMaps (&m);
- free (m);
- if(zooRegistry!=NULL){
- freeRegistry(&zooRegistry);
- free(zooRegistry);
- }
- free (REQUEST);
- free (SERVICE_URL);
- return errorException (m, _("Unable to allocate memory"),
- "InternalError", NULL);
- }
-
- int saved_stdout = zDup (fileno (stdout));
- zDup2 (fileno (stderr), fileno (stdout));
- t = readServiceFile (m, tmps1, &s1, r_inputs->value);
- if(t>=0){
- inheritance(zooRegistry,&s1);
-#ifdef USE_HPC
- addNestedOutputs(&s1);
-#endif
- }
- if(zooRegistry!=NULL){
- freeRegistry(&zooRegistry);
- free(zooRegistry);
- }
- fflush (stdout);
- zDup2 (saved_stdout, fileno (stdout));
- if (t < 0)
- {
- char *tmpMsg = (char *) malloc (2048 + strlen (r_inputs->value));
- sprintf (tmpMsg,
- _
- ("The value for Inputs
@@ -360,5 +372,5 @@
$printRel($openapi["links_title"],$values["links"][$i]["rel"])
$printRel($openapi["links_title"],$values["links"][$i+1]["rel"])
#end if @@ -410,5 +422,5 @@ *#