Browse Source

Merge pull request #4803 from wangkx/h9850

HPCC-9935 Add SourceFormat to ESP FileSpray/SprayFixed request

Reviewed-By: Anthony Fishbeck <anthony.fishbeck@lexisnexis.com>
Reviewed-By: Attila Vamos <attila.vamos@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 11 years ago
parent
commit
716680aae9
2 changed files with 18 additions and 13 deletions
  1. 2 1
      esp/scm/ws_fs.ecm
  2. 16 12
      esp/services/ws_fs/ws_fsService.cpp

+ 2 - 1
esp/scm/ws_fs.ecm

@@ -279,6 +279,7 @@ ESPrequest [nil_remove] SprayFixed
     string sourceIP;
     string sourcePath;
     binary srcxml;
+    [min_ver("1.09")] string sourceFormat;
     int sourceRecordSize;
 
     string destGroup;
@@ -599,7 +600,7 @@ ESPresponse [exceptions_inline] UploadFilesResponse
 };
 
 ESPservice [
-    version("1.08"), default_client_version("1.08"),
+    version("1.09"), default_client_version("1.09"),
     exceptions_inline("./smc_xslt/exceptions.xslt")] FileSpray
 {
     ESPuses ESPstruct DFUWorkunit;

+ 16 - 12
esp/services/ws_fs/ws_fsService.cpp

@@ -1822,12 +1822,6 @@ bool CFileSprayEx::onSprayFixed(IEspContext &context, IEspSprayFixed &req, IEspS
                 throw MakeStringException(ECLWATCH_INVALID_INPUT, "Source file not specified.");
         }
 
-        bool nosplit = req.getNosplit();
-        int recordsize = req.getSourceRecordSize();
-        if(recordsize == 0 && !nosplit)             // -ve record sizes for blocked
-            throw MakeStringException(ECLWATCH_INVALID_INPUT, "Invalid record size"); 
-
-
         const char* destname = req.getDestLogicalName();
         if(!destname || !*destname)
             throw MakeStringException(ECLWATCH_INVALID_INPUT, "Destination file not specified.");
@@ -1881,24 +1875,34 @@ bool CFileSprayEx::onSprayFixed(IEspContext &context, IEspSprayFixed &req, IEspS
         }
 
         IDFUfileSpec *destination = wu->queryUpdateDestination();
-        if(recordsize > 0)
-            source->setRecordSize(recordsize);
-        else if (recordsize == RECFMVB_RECSIZE_ESCAPE) {
+        bool nosplit = req.getNosplit();
+        int recordsize = req.getSourceRecordSize();
+        const char* format = req.getSourceFormat();
+        if ((recordsize == RECFMVB_RECSIZE_ESCAPE) || (format && strieq(format, "recfmvb")))
+        {//recordsize may be set by dfuplus; format may be set by EclWatch
             source->setFormat(DFUff_recfmvb);
             destination->setFormat(DFUff_variable);
         }
-        else if (recordsize == RECFMV_RECSIZE_ESCAPE) {
+        else if ((recordsize == RECFMV_RECSIZE_ESCAPE) || (format && strieq(format, "recfmv")))
+        {
             source->setFormat(DFUff_recfmv);
             destination->setFormat(DFUff_variable);
         }
-        else if (recordsize == PREFIX_VARIABLE_RECSIZE_ESCAPE) {
+        else if ((recordsize == PREFIX_VARIABLE_RECSIZE_ESCAPE) || (format && strieq(format, "variable")))
+        {
             source->setFormat(DFUff_variable);
             destination->setFormat(DFUff_variable);
         }
-        else if (recordsize == PREFIX_VARIABLE_BIGENDIAN_RECSIZE_ESCAPE) {
+        else if((recordsize == PREFIX_VARIABLE_BIGENDIAN_RECSIZE_ESCAPE) || (format && strieq(format, "variablebigendian")))
+        {
             source->setFormat(DFUff_variablebigendian);
             destination->setFormat(DFUff_variable);
         }
+        else if(recordsize == 0 && !nosplit)             // -ve record sizes for blocked
+            throw MakeStringException(ECLWATCH_INVALID_INPUT, "Invalid record size");
+        else
+            source->setRecordSize(recordsize);
+
         destination->setLogicalName(destname);
         destination->setDirectory(destFolder.str());