Index: branches/prototype-v0/zoo-project/HISTORY.txt
===================================================================
--- branches/prototype-v0/zoo-project/HISTORY.txt	(revision 907)
+++ branches/prototype-v0/zoo-project/HISTORY.txt	(revision 908)
@@ -1,3 +1,49 @@
 Version 1.7.0-dev
+  * Fix issue with UOM definitions in zcfg2sql
+  * Make callback and HPC support independent from each other
+  * Update SAGA-GIS support to version 7.2.0
+  * Add support for custom MapServer style definition for raster output
+  * Fix returned bbox definition #170 
+  * Store semaphore status in lenv section for future deletion 
+  * Update Windows support to newer compiler
+  * Fix issue with UpdateStatus function from the Mono ZOO-API
+  * Add logging functionality and other utility functions to the C-API
+  * Return an exception for every output for which nb_pixel or
+  nb_features is 0 
+  * Add a shared key to the security section to differentiate the
+  referenced data 
+  * Add MapServer output style definition depending on the geometry
+  type 
+  * Add ogr.tindex service
+  * Add support for literaldata input arrays and to call services
+  asyncrhonously from the JavaScript ZOO-API   
+  * Expose a sleep function to the JavaScript ZOO-API
+  * Provide FinalizeHPC and FinalizeHPC1 services using scontrol and
+  sacct respectively  
+  * Store md5sum of the cached file (so, local to the WPS server) to
+  compare before uploading (if different md5sum) on the HPC server 
+  * Add support for R language
+  * Add support for using "file://"  for referenced data input
+  * Add an optional ecookie key for returning third-party cookies
+  * Fix issue when parsing BoundingBox input #163 
+  * Add memory key to the main section to force the ZOO-Kernel to load
+  data into memory or use local file 
+  * Add the dialect input to the ogr2ogr service
+  * Store the list of generated mapfiles in a file (cf DeleteData service)
+  * Define the correct MS_IMAGEMODE in the generated mapfile 
+  * Option to use MapServer support to publish heatmap
+  * Add status_code key to the lenv for setting Status HTTP response header 
+  * Add the Creation Option inputs to the Gdal_Dem service
+  * Add prohibited key in the callback section to define a list of
+  services not requiring any invocation
+  * Produce zcfg for OTB applications using the correct default pixel type
+  * Add asynchronous callback invocation to send information about
+  the ongoing services to a third-party software
+  * Add mapsToJson, mapsToJson, and elementsToJson to the API 
+  * Provide a zcfg2sql tool to convert a zcfg metadata file to SQL script
+  * Add support to store service metadata information into a database
+  * Add HPC Support for remote execution of SBATCH scripts through Slurm
+  * Add cookie reference to _HINTERNET
+  * Support headers for GET requests from the js ZOO-API 
   * Pass all headers listed in the attributes parameter from the
   [security] section to the hosts listed in the hosts parameter of the
Index: branches/prototype-v0/zoo-project/zoo-api/mono/makefile.vc
===================================================================
--- branches/prototype-v0/zoo-project/zoo-api/mono/makefile.vc	(revision 908)
+++ branches/prototype-v0/zoo-project/zoo-api/mono/makefile.vc	(revision 908)
@@ -0,0 +1,9 @@
+!INCLUDE ../../zoo-kernel/nmake.opt
+
+all: ZMaps.dll
+
+ZMaps.dll: ZMaps.cs
+	$(MONO_DIR)\bin\mcs /target:library ZMaps.cs
+
+clean:
+	erase ZMaps.dll
Index: branches/prototype-v0/zoo-project/zoo-api/r/minimal.r
===================================================================
--- branches/prototype-v0/zoo-project/zoo-api/r/minimal.r	(revision 907)
+++ branches/prototype-v0/zoo-project/zoo-api/r/minimal.r	(revision 908)
@@ -4,4 +4,4 @@
 
 ZOOUpdateStatus <- function(a,b) {
-    .Call("ZOOUpdateStatus",a,b)
+    .Call("ZOOUpdateStatus",a,as.numeric(b))
 }
Index: branches/prototype-v0/zoo-project/zoo-kernel/Makefile.in
===================================================================
--- branches/prototype-v0/zoo-project/zoo-kernel/Makefile.in	(revision 907)
+++ branches/prototype-v0/zoo-project/zoo-kernel/Makefile.in	(revision 908)
@@ -123,11 +123,11 @@
 	g++ -shared  ${GDAL_CFLAGS} ${DEFAULT_OPTS} -fpic -o libzoo_service.${EXT} ${CFLAGS}  service_internal.o service.o sqlapi.o ${FCGI_LDFLAGS} ${GDAL_LIBS} ${ZOO_LDFLAGS} ${MACOS_LD_FLAGS}
 
-zoo_loader.cgi: version.h libzoo_service.${EXT} 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 request_parser.o response_print.o server_internal.o caching.o ${MS_FILE} ${PYTHON_FILE} ${PHP_FILE} ${JAVA_FILE} ${JS_FILE} ${PERL_FILE} ${RUBY_FILE} ${YAML_FILE} ${OTB_FILE} ${R_FILE} ${SAGA_FILE} ${HPC_FILES} ${METADB_FILE} ${JSON_FILE} service_callback.o
+zoo_loader.cgi: version.h libzoo_service.${EXT} 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 request_parser.o response_print.o server_internal.o caching.o ${MS_FILE} ${PYTHON_FILE} ${PHP_FILE} ${JAVA_FILE} ${JS_FILE} ${PERL_FILE} ${RUBY_FILE} ${YAML_FILE} ${OTB_FILE} ${R_FILE} ${SAGA_FILE} ${HPC_FILES} ${METADB_FILE} ${JSON_FILE} ${CALLBACK_FILE}
 	g++ -g -O2 ${JSON_CFLAGS} ${JSCFLAGS} ${PHPCFLAGS}  ${PERLCFLAGS} ${RUBYCFLAGS}  ${JAVACFLAGS} ${XML2CFLAGS} ${PYTHONCFLAGS} ${CFLAGS} -c zoo_loader.c  -fno-common -DPIC -o zoo_loader.o
-	g++  ${JSON_CFLAGS} ${JSCFLAGS} ${SAGA_CFLAGS} ${OTBCFLAGS} ${GDAL_CFLAGS} ${XML2CFLAGS} ${PHPCFLAGS} ${PERLCFLAGS} ${JAVACFLAGS} ${PYTHONCFLAGS} ${CFLAGS} zoo_loader.o zoo_service_loader.o ${MS_FILE} ${PYTHON_FILE}  ${PERL_FILE} ${PHP_FILE}  ${JS_FILE} ${JAVA_FILE} ${YAML_FILE} ${OTB_FILE} ${SAGA_FILE} ${MONO_FILE} ${HPC_FILES} ${METADB_FILE} ${JSON_FILE} ${R_FILE} service_callback.o response_print.o server_internal.o caching.o request_parser.o ulinet.o lex.cr.o lex.sr.o service_conf.tab.o main_conf_read.tab.o -o zoo_loader.cgi -L. ${LDFLAGS}
+	g++  ${JSON_CFLAGS} ${JSCFLAGS} ${SAGA_CFLAGS} ${OTBCFLAGS} ${GDAL_CFLAGS} ${XML2CFLAGS} ${PHPCFLAGS} ${PERLCFLAGS} ${JAVACFLAGS} ${PYTHONCFLAGS} ${CFLAGS} zoo_loader.o zoo_service_loader.o ${MS_FILE} ${PYTHON_FILE}  ${PERL_FILE} ${PHP_FILE}  ${JS_FILE} ${JAVA_FILE} ${YAML_FILE} ${OTB_FILE} ${SAGA_FILE} ${MONO_FILE} ${HPC_FILES} ${METADB_FILE} ${JSON_FILE} ${R_FILE} ${CALLBACK_FILE} response_print.o server_internal.o caching.o request_parser.o ulinet.o lex.cr.o lex.sr.o service_conf.tab.o main_conf_read.tab.o -o zoo_loader.cgi -L. ${LDFLAGS}
 
-zcfg2yaml: zcfg2yaml.c service.h lex.sr.o service_conf.tab.o service_conf.y main_conf_read.tab.o lex.cr.o response_print.o server_internal.o service_internal.o ${MS_FILE} ${YAML_FILE}
+zcfg2yaml: zcfg2yaml.c service.h lex.sr.o service_conf.tab.o service_conf.y main_conf_read.tab.o lex.cr.o response_print.o server_internal.o service_internal.o ${MS_FILE} ${YAML_FILE} ${CALLBACK_FILE}
 	g++ -g -O2 ${JSCFLAGS} ${RUBYCFLAGS} ${XML2CFLAGS} ${CFLAGS} -c zcfg2yaml.c  -fno-common -DPIC -o zcfg2yaml.o
-	g++  ${XML2CFLAGS} ${CFLAGS} zcfg2yaml.o caching.o ulinet.o service_callback.o server_internal.o service_internal.o ${MS_FILE} response_print.o lex.cr.o lex.sr.o service_conf.tab.o main_conf_read.tab.o  ${YAML_FILE} -o zcfg2yaml -L. ${LDFLAGS}
+	g++  ${XML2CFLAGS} ${CFLAGS} zcfg2yaml.o caching.o ulinet.o ${CALLBACK_FILE} server_internal.o service_internal.o ${MS_FILE} response_print.o lex.cr.o lex.sr.o service_conf.tab.o main_conf_read.tab.o  ${YAML_FILE} -o zcfg2yaml -L. ${LDFLAGS}
 
 install: zoo_loader.cgi
Index: branches/prototype-v0/zoo-project/zoo-kernel/caching.c
===================================================================
--- branches/prototype-v0/zoo-project/zoo-kernel/caching.c	(revision 907)
+++ branches/prototype-v0/zoo-project/zoo-kernel/caching.c	(revision 908)
@@ -29,5 +29,8 @@
 #include "service_internal.h"
 #include "response_print.h"
-
+#ifdef MS_FORCE_LOCAL_FILE_USE
+#include "ogr_api.h"
+#include "mapserver.h"
+#endif
 /**
  * Compute md5
@@ -677,5 +680,5 @@
   char *mimeType=NULL;
   char *origin=NULL;
-  int fsize=0;
+  long long fsize=0;
   map* memUse=getMapFromMaps(*m,"main","memory");
 
@@ -756,5 +759,5 @@
   
   char ltmp1[256];
-  sprintf(ltmp1,"%d",fsize);
+  sprintf(ltmp1,"%ld",fsize);
   addToMap(*content,"size",ltmp1);
   if(cached==NULL){
@@ -782,7 +785,10 @@
     }
   }
-  free(fcontent);
-  free(mimeType);
-  free(cached);
+  if(fcontent!=NULL)
+    free(fcontent);
+  if(mimeType!=NULL)
+    free(mimeType);
+  if(cahced!:NULL)
+    free(cached);
   return 0;
 }
Index: branches/prototype-v0/zoo-project/zoo-kernel/request_parser.c
===================================================================
--- branches/prototype-v0/zoo-project/zoo-kernel/request_parser.c	(revision 907)
+++ branches/prototype-v0/zoo-project/zoo-kernel/request_parser.c	(revision 908)
@@ -28,4 +28,5 @@
 #include "response_print.h"
 #include "caching.h"
+#include "cgic.h"
 
 /**
Index: branches/prototype-v0/zoo-project/zoo-kernel/response_print.c
===================================================================
--- branches/prototype-v0/zoo-project/zoo-kernel/response_print.c	(revision 907)
+++ branches/prototype-v0/zoo-project/zoo-kernel/response_print.c	(revision 908)
@@ -672,4 +672,5 @@
     }
     nc3=NULL;
+    map* sType=getMap(serv->content,"serviceType");
     for(;i<limit;i+=2){
       if(capabilities[vid][i]==NULL)
@@ -687,6 +688,10 @@
 	    xmlNewNsProp(nc1,ns,BAD_CAST capabilities[vid][i],BAD_CAST tmp1->value);
 	}
-	else
-	  xmlNewNsProp(nc1,ns,BAD_CAST capabilities[vid][i],BAD_CAST capabilities[vid][i+1]);
+	else{
+	  if(i==3 && vid==1 && sType!=NULL && strstr(sType->value,"HPC")!=NULL)
+	    xmlNewNsProp(nc1,ns,BAD_CAST capabilities[vid][i],BAD_CAST "async-execute dismiss");
+	  else
+	    xmlNewNsProp(nc1,ns,BAD_CAST capabilities[vid][i],BAD_CAST capabilities[vid][i+1]);
+	}
       }
     }
@@ -718,6 +723,7 @@
  * @param content the servive main content created from the zcfg file
  * @param vid the version identifier (0 for 1.0.0 and 1 for 2.0.0)
- */
-void attachAttributes(xmlNodePtr n,xmlNsPtr ns,map* content,int vid){
+ * @param serviceType string containing the current service type
+ */
+void attachAttributes(xmlNodePtr n,xmlNsPtr ns,map* content,int vid,map* serviceType){
   int limit=7;
   for(int i=1;i<limit;i+=2){
@@ -738,8 +744,11 @@
     }
     else{
-      if(vid==0 && i>=2)
-	xmlNewProp(n,BAD_CAST capabilities[vid][i],BAD_CAST capabilities[vid][i+1]);
+      if(i==3 && vid==1 && serviceType!=NULL && strstr(serviceType->value,"HPC")!=NULL)
+	xmlNewNsProp(n,ns,BAD_CAST capabilities[vid][i],BAD_CAST "async-execute dismiss");
       else
-	xmlNewNsProp(n,ns,BAD_CAST capabilities[vid][i],BAD_CAST capabilities[vid][i+1]);
+	if(vid==0 && i>=2)
+	  xmlNewProp(n,BAD_CAST capabilities[vid][i],BAD_CAST capabilities[vid][i+1]);
+	else
+	  xmlNewNsProp(n,ns,BAD_CAST capabilities[vid][i],BAD_CAST capabilities[vid][i+1]);
     }
   }
@@ -1024,5 +1033,5 @@
   if(vid==0){
     nc = xmlNewNode(NULL, BAD_CAST "ProcessDescription");
-    attachAttributes(nc,ns,serv->content,vid);
+    attachAttributes(nc,ns,serv->content,vid,NULL);
   }
   else{
@@ -1041,5 +1050,5 @@
       }
     }
-    attachAttributes(nc2,NULL,serv->content,vid);
+    attachAttributes(nc2,NULL,serv->content,vid,serviceType);
     map* level=getMap(serv->content,"level");
     if(level!=NULL && strcasecmp(level->value,"generic")==0)
Index: branches/prototype-v0/zoo-project/zoo-kernel/server_internal.c
===================================================================
--- branches/prototype-v0/zoo-project/zoo-kernel/server_internal.c	(revision 907)
+++ branches/prototype-v0/zoo-project/zoo-kernel/server_internal.c	(revision 908)
@@ -374,6 +374,7 @@
   }
   fseek(file, 0, SEEK_END);
-  long count = ftell(file);
-  sprintf(rsize,"%lld",ftell(file));
+  zStatStruct f_status;
+  int s=zStat(filename, &f_status);
+  sprintf(rsize,"%lld",file_status.st_size);
   rewind(file);
   if(getMap(content,"storage")==NULL){
Index: branches/prototype-v0/zoo-project/zoo-kernel/service_internal_hpc.c
===================================================================
--- branches/prototype-v0/zoo-project/zoo-kernel/service_internal_hpc.c	(revision 907)
+++ branches/prototype-v0/zoo-project/zoo-kernel/service_internal_hpc.c	(revision 908)
@@ -34,5 +34,4 @@
 #include "mimetypes.h"
 #include <sys/un.h>
-#include "cgic.h"
 
 typedef struct {
Index: branches/prototype-v0/zoo-project/zoo-kernel/service_internal_python.h
===================================================================
--- branches/prototype-v0/zoo-project/zoo-kernel/service_internal_python.h	(revision 907)
+++ branches/prototype-v0/zoo-project/zoo-kernel/service_internal_python.h	(revision 908)
@@ -28,12 +28,11 @@
 #pragma once 
 
+#include <Python.h>
 #include "service_internal.h"
 #include "response_print.h"
-#include <Python.h>
 #ifdef WIN32
 #include <windows.h>
 #include <direct.h>
 #endif
-#include "cgic.h"
 
 PyDictObject* PyDict_FromMaps(maps* t);
Index: branches/prototype-v0/zoo-project/zoo-kernel/xslt/updateExecute.xsl
===================================================================
--- branches/prototype-v0/zoo-project/zoo-kernel/xslt/updateExecute.xsl	(revision 908)
+++ branches/prototype-v0/zoo-project/zoo-kernel/xslt/updateExecute.xsl	(revision 908)
@@ -0,0 +1,63 @@
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:ows="http://www.opengis.net/ows/1.1"
+                xmlns:ns14="http://www.opengis.net/wps/2.0"
+                xmlns:wps="http://www.opengis.net/wps/2.0"
+                xmlns:xlink="http://www.w3.org/1999/xlink">
+
+  <!--
+      This template is used by the ZOO-Kernel to generate a specific
+      OGC WPS Execute request in case of rest service callback use.
+      In such a case the ZOO-Kernel replace every input provided by
+      value in the initial request and replace the data section by the
+      reference to the published ressource.
+      So, this template is basically made to replace any input provided
+      by value to the corresponding local WCS/WFS OGC web service
+      references.
+      --> 
+  <xsl:output method="xml"/>
+  <xsl:param name="value" select="string('-1')"/>
+  <xsl:param name="attr" select="string('-1')"/>
+  <xsl:param name="cnt" select="string('-1')"/>
+  <xsl:param name="index" select="0"/>
+
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+
+  
+  <xsl:template match="/wps:Execute/wps:Input">
+    <xsl:choose>
+      <xsl:when test="@id=$attr">
+        <xsl:copy>
+          <xsl:attribute name="id">
+            <xsl:value-of select="@id"/>
+          </xsl:attribute>
+          <ns14:Reference>
+            <xsl:attribute name="xlink:href">
+              <xsl:value-of select="$value"/>
+            </xsl:attribute>
+            <xsl:if test="./wps:Data[@mimeType!='']">
+              <xsl:attribute name="mimeType">
+                <xsl:value-of select="./wps:Data[@mimeType]"/>
+              </xsl:attribute>
+              <xsl:attribute name="encoding">
+                <xsl:value-of select="./wps:Data[@encoding]"/>
+              </xsl:attribute>
+              <xsl:attribute name="schema">
+                <xsl:value-of select="./wps:Data[@schema]"/>
+              </xsl:attribute>
+            </xsl:if>
+          </ns14:Reference>
+        </xsl:copy>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="."/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  
+</xsl:stylesheet>
