Ticket #81: Status.patch
File Status.patch, 5.5 KB (added by djay, 11 years ago) |
---|
Status.patch |
-
zoo-kernel/service_internal.c
111 111 lpszTmp = (LPWSTR) lpvMemG; 112 112 for(s=tmpMap->value;*s!=NULL;s++) 113 113 *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; 114 120 *lpszTmp = '\0'; 115 121 } 116 122 … … 208 214 for(s=tmpMap->value;*s!=NULL && *s!=0;s++){ 209 215 *s1++=*s; 210 216 } 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 } 211 223 *s1=NULL; 212 224 shmdt((void *)shm); 213 225 } -
zoo-services/utils/status/service.c
54 54 __declspec(dllexport) 55 55 #endif 56 56 int GetStatus(maps*& conf,maps*& inputs,maps*& outputs){ 57 const char *params[ 2+ 1];57 const char *params[4 + 1]; 58 58 int xmlLoadExtDtdDefaultValue; 59 59 map* tmpMap=NULL,*tmpMmap=NULL, *tmpTmap=NULL; 60 60 61 tmpMap=getMapFromMaps(inputs,"sid","value"); 61 62 tmpTmap=getMapFromMaps(conf,"main","tmpPath"); 62 63 tmpMmap=getMapFromMaps(conf,"main","dataPath"); … … 98 99 cur = xsltParseStylesheetFile(BAD_CAST xslFileName); 99 100 doc = xmlParseFile(fileName); 100 101 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 } 110 137 } 111 138 else{ 112 139 char tmp[1024]; … … 130 157 int i=0; 131 158 while(i<100){ 132 159 char tmp[4]; 160 char message[10]; 133 161 sprintf(tmp,"%i",i); 134 162 map* tmpMap=NULL; 135 163 tmpMap=getMapFromMaps(conf,"lenv","sid"); 136 164 if(tmpMap!=NULL) 137 165 fprintf(stderr,"Status %s %s\n",tmpMap->value,tmp); 166 sprintf(message,"Step %d",i); 138 167 setMapInMaps(conf,"lenv","status",tmp); 168 setMapInMaps(conf,"lenv","message",message); 139 169 updateStatus(conf); 140 170 #ifndef WIN32 141 171 sleep(1); -
zoo-services/utils/status/cgi-env/updateStatus.xsl
6 6 7 7 <xsl:output method="xml"/> 8 8 <xsl:param name="value" select="string('-1')"/> 9 <xsl:param name="message" select="string('-1')"/> 9 10 10 11 <xsl:template match="@*|node()"> 11 12 <xsl:copy> … … 13 14 </xsl:copy> 14 15 </xsl:template> 15 16 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> 20 24 </xsl:template> 21 25 22 26 </xsl:stylesheet> -
zoo-services/utils/status/Makefile
3 3 CFLAGS=${ZOO_CFLAGS} ${XML2CFLAGS} ${GDAL_CFLAGS} ${PYTHONCFLAGS} -DLINUX_FREE_ISSUE #-DDEBUG 4 4 5 5 cgi-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` -lfcgi6 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 7 7 8 8 clean: 9 9 rm -f cgi-env/wps_status.zo