Ignore:
Timestamp:
Feb 25, 2019, 1:57:11 PM (5 years ago)
Author:
knut
Message:

Added some recent changes from trunk (r889), including some new utility functions and exception handling and new (conditional) definition of type bool. Added some new logic concerning Python and Mono environment and search paths. Fixed problem with Mono updateStatus function. Changed response_print.h to #include locale.h unconditionally and xlocale.h conditionally; xlocale.h is non-standard and can probably be dropped.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/prototype-v0/zoo-project/zoo-kernel/response_print.c

    r890 r896  
    17761776 * @param outputs the outputs generated by the service
    17771777 */
    1778 void printProcessResponse(maps* m,map* request, int pid,service* serv,const char* service,int status,maps* inputs,maps* outputs){
     1778void printProcessResponse(maps* m,map* request, int pid,service* serv,const char* service,int status,maps* inputs,maps* outputs){       
    17791779  xmlNsPtr ns,ns_ows,ns_xlink;
    17801780  xmlNodePtr nr,n,nc,nc1=NULL,nc3;
     
    17971797  char stored_path[1024];
    17981798  memset(stored_path,0,1024);
    1799    
     1799 
    18001800  if(vid==0){
    18011801    char tmp[256];
     
    19821982    }
    19831983  }
    1984 
     1984 
    19851985  /**
    19861986   * Display the process output only when requested !
     
    19931993    maps* mcursor=outputs;
    19941994    elements* scursor=serv->outputs;
    1995     map* testResponse=getMap(request,"RawDataOutput");
     1995    map* testResponse=getMap(request,"RawDataOutput"); 
    19961996    if(testResponse==NULL)
    19971997      testResponse=getMap(request,"ResponseDocument");
    1998     while(mcursor!=NULL){
     1998    while(mcursor!=NULL){               
    19991999      map* tmp0=getMap(mcursor->content,"inRequest");
    2000       scursor=getElements(serv->outputs,mcursor->name);
    2001       if(scursor!=NULL){
    2002         if(testResponse==NULL || tmp0==NULL){
     2000      scursor=getElements(serv->outputs,mcursor->name);   
     2001      if(scursor!=NULL){                 
     2002        if(testResponse==NULL || tmp0==NULL){           
    20032003          if(vid==0)
    20042004            printIOType(doc,nc,ns,ns_ows,ns_xlink,scursor,mcursor,"Output",vid);
     
    20072007        }
    20082008        else
    2009           if(tmp0!=NULL && strncmp(tmp0->value,"true",4)==0){
     2009          if(tmp0!=NULL && strncmp(tmp0->value,"true",4)==0){             
    20102010            if(vid==0)
    20112011              printIOType(doc,nc,ns,ns_ows,ns_xlink,scursor,mcursor,"Output",vid);
    20122012            else
    20132013              printIOType(doc,n,ns,ns_ows,ns_xlink,scursor,mcursor,"Output",vid);
    2014           }
     2014          }     
    20152015      }else
    20162016        /**
     
    20232023          printIOType(doc,n,ns,ns_ows,ns_xlink,scursor,mcursor,"Output",vid);
    20242024      mcursor=mcursor->next;
    2025     }
     2025    }   
    20262026    if(vid==0)
    20272027      xmlAddChild(n,nc);
    2028   }
    2029 
     2028  } 
    20302029  if(vid==0 &&
    20312030     hasStoredExecuteResponse==true
     
    21762175 * @param type the type
    21772176 */
    2178 void printIOType(xmlDocPtr doc,xmlNodePtr nc,xmlNsPtr ns_wps,xmlNsPtr ns_ows,xmlNsPtr ns_xlink,elements* e,maps* m,const char* type,int vid){
    2179 
     2177void printIOType(xmlDocPtr doc,xmlNodePtr nc,xmlNsPtr ns_wps,xmlNsPtr ns_ows,xmlNsPtr ns_xlink,elements* e,maps* m,const char* type,int vid){   
    21802178  xmlNodePtr nc1,nc2,nc3;
    21812179  nc1=xmlNewNode(ns_wps, BAD_CAST type);
     
    21842182    tmp=e->content;
    21852183  else
    2186     tmp=m->content;
    2187 
     2184    tmp=m->content; 
    21882185  if(vid==0){
    21892186    nc2=xmlNewNode(ns_ows, BAD_CAST "Identifier");
     
    22252222    xmlNewProp(nc1,BAD_CAST "id",BAD_CAST (e!=NULL?e->name:m->name));
    22262223  }
    2227 
     2224 
    22282225  // IO type nested outputs
    2229   if(m->child!=NULL){
     2226  if(m->child!=NULL){     
    22302227    maps* curs=m->child;
    22312228    elements* ecurs=getElements(e,(e!=NULL?e->name:m->name));
     
    22412238    }
    22422239  }
    2243   else{
     2240  else{   
    22442241    map *tmpMap=getMap(m->content,"Reference");
    2245     if(tmpMap==NULL){
     2242    if(tmpMap==NULL){           
    22462243      nc2=xmlNewNode(ns_wps, BAD_CAST "Data");
    2247       if(e!=NULL && e->format!=NULL){
    2248         if(strncasecmp(e->format,"LiteralOutput",strlen(e->format))==0)
    2249           nc3=xmlNewNode(ns_wps, BAD_CAST "LiteralData");
     2244      if(e!=NULL && e->format!=NULL){             
     2245                  if (strncasecmp(e->format, "LiteralOutput", strlen(e->format)) == 0)                                   
     2246                          nc3 = xmlNewNode(ns_wps, BAD_CAST "LiteralData");               
    22502247        else
    22512248          if(strncasecmp(e->format,"ComplexOutput",strlen(e->format))==0)
     
    22542251            nc3=xmlNewNode(ns_wps, BAD_CAST "BoundingBoxData");
    22552252          else
    2256             nc3=xmlNewNode(ns_wps, BAD_CAST e->format);
    2257       }
    2258       else {
    2259         map* tmpV=getMapFromMaps(m,"format","value");
     2253            nc3=xmlNewNode(ns_wps, BAD_CAST e->format);           
     2254      }
     2255      else {             
     2256        map* tmpV=getMapFromMaps(m,"format","value");   
    22602257        if(tmpV!=NULL)
    22612258          nc3=xmlNewNode(ns_wps, BAD_CAST tmpV->value);
     
    22632260          nc3=xmlNewNode(ns_wps, BAD_CAST "LiteralData");
    22642261      }
    2265       tmp=m->content;
    2266      
     2262      tmp=m->content;     
     2263
    22672264      while(tmp!=NULL){
    22682265        if(strcasecmp(tmp->name,"mimeType")==0 ||
     
    22702267           strcasecmp(tmp->name,"schema")==0 ||
    22712268           strcasecmp(tmp->name,"datatype")==0 ||
    2272            strcasecmp(tmp->name,"uom")==0) {
    2273          
     2269           strcasecmp(tmp->name,"uom")==0) {   
    22742270          if(vid==0)
    22752271            xmlNewProp(nc3,BAD_CAST tmp->name,BAD_CAST tmp->value);
     
    22822278          }
    22832279        }
     2280
    22842281        if(vid==0)
    22852282          xmlAddChild(nc2,nc3);
    2286         tmp=tmp->next;
     2283        tmp=tmp->next; 
    22872284      }
    22882285      if(e!=NULL && e->format!=NULL && strcasecmp(e->format,"BoundingBoxData")==0) {
     
    22952292        }
    22962293      }
    2297       else {
    2298         if(e!=NULL)
    2299           tmp=getMap(e->defaults->content,"mimeType");
     2294      else {             
     2295                  //if (e != NULL) {
     2296                  if (e != NULL && e->defaults != NULL) { // knut: add extra NULL pointer check in case user omits <Default> block in config file                         
     2297                          tmp = getMap(e->defaults->content, "mimeType");
     2298                  }
    23002299        else
    2301           tmp=NULL;
    2302        
     2300          tmp=NULL;     
    23032301        map* tmp1=getMap(m->content,"encoding");
    23042302        map* tmp2=getMap(m->content,"mimeType");
     
    26402638  dumpMaps(request_outputs);
    26412639  fprintf(stderr,"printProcessResponse\n");
    2642 #endif
     2640#endif 
    26432641  map* toto=getMap(request_inputs1,"RawDataOutput");
    26442642  int asRaw=0;
     
    27272725  }
    27282726
    2729   if(res!=SERVICE_SUCCEEDED){
     2727  if(res!=SERVICE_SUCCEEDED){     
    27302728    printProcessResponse(m,request_inputs1,cpid,
    27312729                         s, s->name,res,  // replace serviceProvider with serviceName in stored response file name
     
    27342732    return;
    27352733  }
    2736    
    2737        
     2734     
    27382735  map *tmp1=getMapFromMaps(m,"main","tmpPath");
    27392736  if(asRaw==0){
     
    27572754#endif
    27582755      map *gfile=getMap(tmpI->content,"generated_file");
    2759       char *file_name=NULL;
     2756      char *file_name=NULL;       
    27602757      if(gfile!=NULL){
    27612758        gfile=getMap(tmpI->content,"expected_generated_file");
     
    27652762        readGeneratedFile(m,tmpI->content,gfile->value);
    27662763        file_name=zStrdup((gfile->value)+strlen(tmp1->value));
    2767       }
     2764      }   
    27682765      toto=getMap(tmpI->content,"asReference");
    27692766#ifdef USE_MS
     
    27762773        if(toto!=NULL && strcasecmp(toto->value,"true")==0)
    27772774#endif
    2778           {
     2775          {             
    27792776            elements* in=getElements(s->outputs,tmpI->name);
    27802777            if(in==NULL && s->outputs->child!=NULL){
     
    27912788              addToMap(tmpI->content,"encoding","UTF-8");
    27922789              addToMap(tmpI->content,"schema","http://schemas.opengis.net/ows/1.1.0/owsCommon.xsd");
    2793             }
    2794 
     2790            }           
    27952791            char *file_path=NULL;
    27962792            if(gfile==NULL) {
     
    28802876          }
    28812877        }
    2882 #endif
     2878#endif 
    28832879      if(file_name!=NULL){
    28842880        free(file_name);
     
    28962892    fprintf(stderr,"SERVICE : %s\n",s->name);
    28972893    dumpMaps(m);
    2898 #endif
     2894#endif 
    28992895    if(error<0)
    29002896      printProcessResponse(m,request_inputs1,cpid,
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