Changeset 618 for trunk/zoo-project/zoo-kernel
- Timestamp:
- Mar 28, 2015, 12:58:00 AM (10 years ago)
- Location:
- trunk/zoo-project/zoo-kernel
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service.h
r607 r618 104 104 #include <string.h> 105 105 #ifndef WIN32 106 #include <ctype.h> 106 107 #ifndef bool 107 108 #define bool int … … 115 116 * Local false definition 116 117 */ 117 #define false -1118 #define false 0 118 119 #endif 119 120 #endif … … 1267 1268 */ 1268 1269 static void dumpService(service* s){ 1270 if(s==NULL) 1271 return; 1269 1272 fprintf(stderr,"++++++++++++++++++\nSERVICE [%s]\n++++++++++++++++++\n",s->name); 1270 1273 if(s->content!=NULL){ -
trunk/zoo-project/zoo-kernel/service_conf.l
r550 r618 22 22 #endif 23 23 24 char *lmsg ;24 char *lmsg=NULL; 25 25 int attentionImpossibleDeTrouverXMLDeclapres = 0 ; 26 26 … … 41 41 42 42 attname [a-zA-Z0-9._\-]+ 43 attvalue1 [ °²θé#\^\*\+,;@a-zA-Z0-9%_\-::.:" "\"\'/\\\(\)\t\|\$\&>\[\]]+43 attvalue1 [#°²θé\^\*\+,;@a-zA-Z0-9%_\-:\:.:" "\"\'/\\\(\)\t\|\$\&>\[\]]+ 44 44 45 45 attvalue \"[^"]*\"|\'[^']*\'\(\) -
trunk/zoo-project/zoo-kernel/service_conf.y
r607 r618 20 20 static bool wait_defaults=false; 21 21 static bool wait_supporteds=false; 22 static bool wait_outputs= -1;22 static bool wait_outputs=false; 23 23 static bool wait_data=false; 24 24 static service* my_service=NULL; … … 805 805 dumpElements(current_element); 806 806 #endif 807 if(wait_outputs >0&& current_element!=NULL && current_element->name!=NULL){807 if(wait_outputs && current_element!=NULL && current_element->name!=NULL){ 808 808 if(my_service->outputs==NULL){ 809 809 #ifdef DEBUG_SERVICE_CONF … … 834 834 current_element=NULL; 835 835 } 836 int contentOnly= -1;836 int contentOnly=false; 837 837 if(current_content!=NULL){ 838 838 if(my_service->content==NULL){ 839 839 addMapToMap(&my_service->content,current_content); 840 contentOnly=1; 840 contentOnly=true; 841 wait_maincontent=false; 841 842 } 842 843 freeMap(¤t_content); … … 848 849 dumpService(my_service); 849 850 #endif 850 if( contentOnly<0 && ((wait_outputs<0 && current_data==2 && my_service->outputs==NULL) || my_service==NULL || my_service->name==NULL || my_service->content==NULL)){851 if(wait_maincontent==true || (contentOnly==false && ((!wait_outputs && current_data==2 && my_service->outputs==NULL) || my_service==NULL || my_service->name==NULL || my_service->content==NULL))){ 851 852 setMapInMaps(conf,"lenv","message",srlval.chaine); 852 853 #ifndef WIN32 -
trunk/zoo-project/zoo-kernel/service_internal.c
r607 r618 2788 2788 map *ext=getMap(tmpI->content,"extension"); 2789 2789 char *file_path; 2790 2790 char file_ext[32]; 2791 2791 2792 2792 if( ext != NULL && ext->value != NULL) { 2793 2794 2795 2793 strncpy(file_ext, ext->value, 32); 2794 } 2795 else { 2796 2796 // Obtain default file extension (see mimetypes.h). 2797 2797 // If the MIME type is not recognized, txt is used as the default extension 2798 2798 map* mtype=getMap(tmpI->content,"mimeType"); 2799 2799 getFileExtension(mtype != NULL ? mtype->value : NULL, file_ext, 32); 2800 2800 } 2801 2801 2802 2802 file_name=(char*)malloc((strlen(s->name)+strlen(file_ext)+strlen(tmpI->name)+1024)*sizeof(char)); 2803 2803 int cpid0=cpid+time(NULL); 2804 2804 sprintf(file_name,"%s_%s_%i.%s",s->name,tmpI->name,cpid0,file_ext); 2805 2805 file_path=(char*)malloc((strlen(tmp1->value)+strlen(file_name)+2)*sizeof(char)); 2806 2806 sprintf(file_path,"%s/%s",tmp1->value,file_name); -
trunk/zoo-project/zoo-kernel/service_internal_otb.c
r580 r618 158 158 char tmp[1024]; 159 159 map* tmpVal=getMapFromMaps(outputs,paramKey.c_str(),"mimeType"); 160 maps* tmpMaps=getMaps(outputs,paramKey.c_str()); 160 161 if(test!=NULL && test->value!=NULL && strncasecmp(test->value,"true",4)==0){ 161 162 test=getMapFromMaps(inputs,paramKey.c_str(),"value"); … … 190 191 dynamic_cast<OutputImageParameter *> (param.GetPointer())->SetPixelType(outPixType); 191 192 }else{ 192 if(test->value!=NULL) 193 m_Application->SetParameterString(paramKey, test->value); 193 map* tmpVal=getMapFromMaps(inputs,paramKey.c_str(),"mimeType"); 194 char file_ext[32]; 195 getFileExtension(tmpVal != NULL ? tmpVal->value : NULL, file_ext, 32); 196 if(type == ParameterType_InputImageList){ 197 values.push_back(test->value); 198 map* tmpLength=getMapFromMaps(inputs,paramKey.c_str(),"length"); 199 if(tmpLength!=NULL){ 200 int len=atoi(tmpLength->value); 201 for(int k=1;k<len;k++){ 202 char *val=(char*)malloc((strlen(tmpPath->value)+strlen(s->name)+strlen(tmpSid->value)+strlen(file_ext)+13)*sizeof(char)); 203 sprintf(val,"%s/Input_%s_%s_%d.%s",tmpPath->value,s->name,tmpSid->value,k,file_ext); 204 FILE* of=fopen(val,"wb"); 205 int length=0; 206 map* tmpSize=getMap(test,"size"); 207 if(tmpSize!=NULL){ 208 length=atoi(tmpSize->value); 209 } 210 fwrite(test->value,sizeof(char),length,of); 211 fclose(of); 212 values.push_back(val); 213 free(val); 214 } 215 } 216 dynamic_cast<InputImageListParameter *> (param.GetPointer())->SetListFromFileName(values); 217 } 218 else 219 if(type == ParameterType_InputVectorData || type == ParameterType_InputImage 220 || type == ParameterType_ComplexInputImage || type == ParameterType_InputVectorData 221 || type == ParameterType_InputFilename){ 222 map* tmpPath=getMapFromMaps(m,"main","tmpPath"); 223 map* tmpSid=getMapFromMaps(m,"lenv","sid"); 224 char tmp[1024]; 225 char* ext="json"; 226 if(tmpVal!=NULL){ 227 char *val=(char*)malloc((strlen(tmpPath->value)+strlen(s->name)+strlen(tmpSid->value)+strlen(file_ext)+10)*sizeof(char)); 228 sprintf(val,"%s/Input_%s_%s.%s",tmpPath->value,s->name,tmpSid->value,file_ext); 229 FILE* of=fopen(val,"wb"); 230 int length=0; 231 map* tmpSize=getMap(test,"size"); 232 if(tmpSize!=NULL){ 233 length=atoi(tmpSize->value); 234 } 235 fwrite(test->value,sizeof(char),length,of); 236 fclose(of); 237 238 if(strncasecmp(tmpVal->value,"application/zip",14)==0){ 239 240 char tmpName[1024]; 241 sprintf(tmpName,"/vsizip/%s",val); 242 char **files=VSIReadDir(tmpName); 243 int nFiles = CSLCount( files ); 244 char tmpSSName[1024]; 245 sprintf(tmpSSName,"%s/Input_%s_%s",tmpPath->value,s->name,tmpSid->value); 246 mkdir(tmpSSName,0777); 247 248 char tmpSName[1024]; 249 for(int kk=0;kk<nFiles;kk++){ 250 sprintf(tmpSName,"%s/%s",tmpName,files[kk]); 251 VSILFILE* fmain=VSIFOpenL(tmpSName, "rb"); 252 if(fmain!=NULL){ 253 VSIFSeekL(fmain,0,SEEK_END); 254 long count=VSIFTellL(fmain); 255 VSIRewindL(fmain); 256 257 char *content=(char*) malloc((count+1)*sizeof(char)); 258 VSIFReadL(content,1,count*sizeof(char),fmain); 259 260 char tmpSSSName[1024]; 261 sprintf(tmpSSSName,"%s/%s",tmpSSName,files[kk]); 262 263 FILE* fx=fopen(tmpSSSName, "wb"); 264 fwrite(content,1,count,fx); 265 fclose(fx); 266 VSIFCloseL(fmain); 267 free(content); 268 std::string test1(tmpSSSName); 269 if(test1.find(".shp")!=std::string::npos){ 270 setMapInMaps(inputs,paramKey.c_str(),"cache_file",tmpSSSName); 271 test=getMapFromMaps(inputs,paramKey.c_str(),"cache_file"); 272 } 273 } 274 } 275 m_Application->SetParameterString(paramKey, test->value); 276 }else{ 277 m_Application->SetParameterString(paramKey, val); 278 } 279 free(val); 280 } 281 } 282 else 283 if(test->value!=NULL) 284 m_Application->SetParameterString(paramKey, test->value); 194 285 } 195 286 … … 316 407 || type == ParameterType_InputFilename){ 317 408 m_Application->SetParameterString(paramKey, test->value); 318 } 409 } 319 410 } 320 411 } -
trunk/zoo-project/zoo-kernel/service_internal_otb.h
r580 r618 34 34 #include "otbZooWatcher.h" 35 35 #include "service_internal.h" 36 #include "mimetypes.h" 36 37 #include "service.h" 37 38 #include "cgic.h"
Note: See TracChangeset
for help on using the changeset viewer.