Ignore:
Timestamp:
Aug 17, 2013, 3:08:30 PM (11 years ago)
Author:
djay
Message:

Add message in complement to percentCompleted value.

Location:
trunk/zoo-project/zoo-services/utils/status
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-services/utils/status/Makefile

    r284 r440  
    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:
  • trunk/zoo-project/zoo-services/utils/status/cgi-env/updateStatus.xsl

    r32 r440  
    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()">
     
    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
  • trunk/zoo-project/zoo-services/utils/status/service.c

    r384 r440  
    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");
     
    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        free(tmpStr1);
     124        free(tmpStr0);
     125        free(tmpStrFinal);
     126      }else{
     127        xmlChar *xmlbuff;
     128        int buffersize;
     129        xmlDocDumpFormatMemory(doc, &xmlbuff, &buffersize, 1);
     130        setMapInMaps(outputs,"Result","value",(char*)xmlbuff);
     131        xmlFree(xmlbuff);
     132      }
    110133    }
    111134    else{
     
    131154    while(i<100){
    132155      char tmp[4];
     156      char message[10];
    133157      sprintf(tmp,"%i",i);
    134158      map* tmpMap=NULL;
     
    136160      if(tmpMap!=NULL)
    137161        fprintf(stderr,"Status %s %s\n",tmpMap->value,tmp);
     162      sprintf(message,"Step %d",i);
    138163      setMapInMaps(conf,"lenv","status",tmp);
     164      setMapInMaps(conf,"lenv","message",message);
    139165      updateStatus(conf);
    140166#ifndef WIN32
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