Ticket #81: Status.patch

File Status.patch, 5.5 KB (added by djay, 11 years ago)

Status.patch

  • zoo-kernel/service_internal.c

     
    111111  lpszTmp = (LPWSTR) lpvMemG;
    112112  for(s=tmpMap->value;*s!=NULL;s++)
    113113    *lpszTmp++ = *s;
     114  *lpszTmp++ = '|';
     115  tmpMap=NULL;
     116  tmpMap=getMapFromMaps(conf,"lenv","message");
     117  if(tmpMap!=NULL)
     118    for(s=tmpMap->value;*s!=NULL;s++)
     119      *lpszTmp++ = *s;
    114120  *lpszTmp = '\0';
    115121}
    116122
     
    208214        for(s=tmpMap->value;*s!=NULL && *s!=0;s++){
    209215          *s1++=*s;
    210216        }
     217        *s1++='|';
     218        tmpMap=getMapFromMaps(conf,"lenv","message");
     219        if(tmpMap!=NULL)
     220          for(s=tmpMap->value;*s!=NULL && *s!=0;s++){
     221            *s1++=*s;
     222        }
    211223        *s1=NULL;
    212224        shmdt((void *)shm);
    213225      }
  • zoo-services/utils/status/service.c

     
    5454  __declspec(dllexport)
    5555#endif
    5656  int GetStatus(maps*& conf,maps*& inputs,maps*& outputs){
    57     const char *params[2 + 1];
     57    const char *params[4 + 1];
    5858    int xmlLoadExtDtdDefaultValue;
    5959    map* tmpMap=NULL,*tmpMmap=NULL, *tmpTmap=NULL;
     60
    6061    tmpMap=getMapFromMaps(inputs,"sid","value");
    6162    tmpTmap=getMapFromMaps(conf,"main","tmpPath");
    6263    tmpMmap=getMapFromMaps(conf,"main","dataPath");
     
    9899    cur = xsltParseStylesheetFile(BAD_CAST xslFileName);
    99100    doc = xmlParseFile(fileName);
    100101    if(cur!=NULL && doc!=NULL){
    101       params[0]="value";
    102       params[1]=getStatus(atoi(tmpMap->value));
    103       params[2]=NULL;
    104       res = xsltApplyStylesheet(cur, doc, params);
    105       xmlChar *xmlbuff;
    106       int buffersize;
    107       xmlDocDumpFormatMemory(res, &xmlbuff, &buffersize, 1);
    108       setMapInMaps(outputs,"Result","value",(char*)xmlbuff);
    109       xmlFree(xmlbuff);
     102      /**
     103       * Parse Status to extract Status / Message
     104       */
     105      char *tmpStr=getStatus(atoi(tmpMap->value));
     106      if(tmpStr!=NULL && strncmp(tmpStr,"-1",2)!=0){
     107        char *tmpStr1=strdup(tmpStr);
     108        char *tmpStr0=strdup(strstr(tmpStr,"|")+1);
     109        tmpStr1[strlen(tmpStr1)-strlen(tmpStr0)-1]='\0';
     110        char *tmpStrFinal=(char*)malloc((strlen(tmpStr0)+11)*sizeof(char));
     111        sprintf(tmpStrFinal,"string(\"%s\")",tmpStr0);
     112        params[0]="value";
     113        params[1]=tmpStr1;
     114        params[2]="message";
     115        params[3]=tmpStrFinal;
     116        params[4]=NULL;
     117        res = xsltApplyStylesheet(cur, doc, params);
     118        xmlChar *xmlbuff;
     119        int buffersize;
     120        xmlDocDumpFormatMemory(res, &xmlbuff, &buffersize, 1);
     121        setMapInMaps(outputs,"Result","value",(char*)xmlbuff);
     122        xmlFree(xmlbuff);
     123        fprintf(stderr,"+++++++++\n%s : %d \n",__FILE__,__LINE__);
     124        free(tmpStr1);
     125        fprintf(stderr,"+++++++++\n%s : %d \n",__FILE__,__LINE__);
     126        free(tmpStr0);
     127        fprintf(stderr,"+++++++++\n%s : %d \n",__FILE__,__LINE__);
     128        free(tmpStrFinal);
     129        fprintf(stderr,"+++++++++\n%s : %d \n",__FILE__,__LINE__);
     130      }else{
     131        xmlChar *xmlbuff;
     132        int buffersize;
     133        xmlDocDumpFormatMemory(doc, &xmlbuff, &buffersize, 1);
     134        setMapInMaps(outputs,"Result","value",(char*)xmlbuff);
     135        xmlFree(xmlbuff);
     136      }
    110137    }
    111138    else{
    112139      char tmp[1024];
     
    130157    int i=0;
    131158    while(i<100){
    132159      char tmp[4];
     160      char message[10];
    133161      sprintf(tmp,"%i",i);
    134162      map* tmpMap=NULL;
    135163      tmpMap=getMapFromMaps(conf,"lenv","sid");
    136164      if(tmpMap!=NULL)
    137165        fprintf(stderr,"Status %s %s\n",tmpMap->value,tmp);
     166      sprintf(message,"Step %d",i);
    138167      setMapInMaps(conf,"lenv","status",tmp);
     168      setMapInMaps(conf,"lenv","message",message);
    139169      updateStatus(conf);
    140170#ifndef WIN32
    141171      sleep(1);
  • zoo-services/utils/status/cgi-env/updateStatus.xsl

     
    66
    77  <xsl:output method="xml"/>
    88  <xsl:param name="value" select="string('-1')"/>
     9  <xsl:param name="message" select="string('-1')"/>
    910
    1011  <xsl:template match="@*|node()">
    1112    <xsl:copy>
     
    1314    </xsl:copy>
    1415  </xsl:template>
    1516
    16   <xsl:template match="/wps:ExecuteResponse/wps:Status/wps:ProcessStarted/@percentCompleted">
    17     <xsl:attribute name="percentCompleted">
    18       <xsl:value-of select="$value"/>
    19     </xsl:attribute>
     17  <xsl:template match="/wps:ExecuteResponse/wps:Status/wps:ProcessStarted">
     18    <xsl:copy>
     19      <xsl:attribute name="percentCompleted">
     20        <xsl:value-of select="$value"/>
     21      </xsl:attribute>
     22      <xsl:value-of select="$message" />
     23    </xsl:copy>
    2024  </xsl:template>
    2125
    2226</xsl:stylesheet>
  • zoo-services/utils/status/Makefile

     
    33CFLAGS=${ZOO_CFLAGS} ${XML2CFLAGS} ${GDAL_CFLAGS} ${PYTHONCFLAGS} -DLINUX_FREE_ISSUE #-DDEBUG
    44
    55cgi-env/wps_status.zo: service.c
    6         g++ ${CFLAGS} -shared -fpic -o cgi-env/wps_status.zo ./service.c ../../../zoo-kernel/service_internal.o ${JS_LDFLAGS} ${JSLDFLAGS} ${GDAL_LIBS} ${XML2LDFLAGS} ${MACOS_LD_FLAGS} ${ZOO_LDFLAGS} ${MACOS_LD_NET_FLAGS} `xslt-config --libs` -lfcgi
     6        g++ ${CFLAGS} -shared -fpic -o cgi-env/wps_status.zo ./service.c ../../../zoo-kernel/service_internal.o ${ZRPATH}/zoo-kernel/${MS_FILE} ${MS_LDFLAGS} ${JS_LDFLAGS} ${JSLDFLAGS} ${GDAL_LIBS} ${XML2LDFLAGS} ${MACOS_LD_FLAGS} ${ZOO_LDFLAGS} ${MACOS_LD_NET_FLAGS} `xslt-config --libs` -lfcgi
    77
    88clean:
    99        rm -f cgi-env/wps_status.zo

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