- Timestamp:
- Jan 5, 2011, 3:20:01 PM (14 years ago)
- Location:
- trunk/zoo-kernel
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-kernel/configure.ac
r46 r57 288 288 if test -d "$JDKHOME/jre/lib/i386"; 289 289 then 290 JAVA_LDFLAGS="-L$JDKHOME/jre/lib/i386/ server/ -ljvm -lpthread"290 JAVA_LDFLAGS="-L$JDKHOME/jre/lib/i386/client/ -ljvm -lpthread" 291 291 JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux" 292 292 else 293 JAVA_LDFLAGS="-L$JDKHOME/jre/lib/amd64/ server/ -ljvm -lpthread"293 JAVA_LDFLAGS="-L$JDKHOME/jre/lib/amd64/client/ -ljvm -lpthread" 294 294 JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux" 295 295 fi -
trunk/zoo-kernel/service.h
r56 r57 133 133 map* tmp=m; 134 134 while(tmp!=NULL){ 135 if(str len(tmp->name)==strlen(key) && strncasecmp(tmp->name,key,strlen(key))==0)135 if(strcasecmp(tmp->name,key)==0) 136 136 return true; 137 137 tmp=tmp->next; … … 146 146 maps* tmp=m; 147 147 while(tmp!=NULL){ 148 if(str len(tmp->name)==strlen(key) && strncasecmp(tmp->name,key,strlen(key))==0){148 if(strcasecmp(tmp->name,key)==0){ 149 149 return tmp; 150 150 } … … 157 157 map* tmp=m; 158 158 while(tmp!=NULL){ 159 if(str len(tmp->name)==strlen(key) && strncasecmp(tmp->name,key,strlen(key))==0){159 if(strcasecmp(tmp->name,key)==0){ 160 160 return tmp; 161 161 } … … 239 239 elements* tmp=e; 240 240 while(tmp!=NULL){ 241 if(str len(tmp->name)==strlen(key) && strncasecmp(key,tmp->name,strlen(key))==0)241 if(strcasecmp(key,tmp->name)==0) 242 242 return true; 243 243 tmp=tmp->next; … … 249 249 elements* tmp=m; 250 250 while(tmp!=NULL){ 251 if(str len(tmp->name)==strlen(key) && strncasecmp(tmp->name,key,strlen(tmp->name))==0)251 if(strcasecmp(tmp->name,key)==0) 252 252 return tmp; 253 253 tmp=tmp->next; … … 260 260 iotype* _cursor=*i; 261 261 if(_cursor!=NULL){ 262 freeMap(&_cursor->content);263 free(_cursor->content);264 262 if(_cursor->next!=NULL){ 265 263 freeIOType(&_cursor->next); 266 264 free(_cursor->next); 267 265 } 266 freeMap(&_cursor->content); 267 free(_cursor->content); 268 268 } 269 269 } … … 272 272 elements* tmp=*e; 273 273 if(tmp!=NULL){ 274 free(tmp->name); 274 if(tmp->name!=NULL) 275 free(tmp->name); 275 276 freeMap(&tmp->content); 276 free(tmp->content); 277 if(tmp->content!=NULL) 278 free(tmp->content); 277 279 freeMap(&tmp->metadata); 278 free(tmp->metadata); 279 free(tmp->format); 280 if(tmp->metadata!=NULL) 281 free(tmp->metadata); 282 if(tmp->format!=NULL) 283 free(tmp->format); 280 284 freeIOType(&tmp->defaults); 281 285 if(tmp->defaults!=NULL) 282 286 free(tmp->defaults); 283 287 freeIOType(&tmp->supported); 284 if(tmp->supported!=NULL) 288 if(tmp->supported!=NULL){ 285 289 free(tmp->supported); 290 } 286 291 freeElements(&tmp->next); 287 292 } … … 361 366 static void addMapToIoType(iotype** io,map* mi){ 362 367 iotype* tmp=*io; 363 while(tmp!=NULL){ 364 #ifdef DEBUG 365 fprintf(stderr,">> CURRENT MAP"); 366 dumpMap(tmp->content); 367 #endif 368 tmp=tmp->next; 369 } 370 #ifdef DEBUG 371 fprintf(stderr,">> %s %i\n",__FILE__,__LINE__); 372 fflush(stderr); 373 #endif 374 tmp=(iotype*)malloc(IOTYPE_SIZE); 375 #ifdef DEBUG 376 fprintf(stderr,">> %s %i\n",__FILE__,__LINE__); 377 fflush(stderr); 378 #endif 379 tmp->content=NULL; 380 #ifdef DEBUG 381 fprintf(stderr,">> %s %i\n",__FILE__,__LINE__); 382 fflush(stderr); 383 #endif 384 addMapToMap(&tmp->content,mi); 385 #ifdef DEBUG 386 fprintf(stderr,">> %s %i\n",__FILE__,__LINE__); 387 fflush(stderr); 388 #endif 389 dumpMap(tmp->content); 390 tmp->next=NULL; 391 } 392 368 while(tmp->next!=NULL){ 369 tmp=tmp->next; 370 } 371 tmp->next=(iotype*)malloc(IOTYPE_SIZE); 372 tmp->next->content=NULL; 373 addMapToMap(&tmp->next->content,mi); 374 tmp->next->next=NULL; 375 } 376 377 static bool contains(map* m,map* i){ 378 while(i!=NULL){ 379 if(strcasecmp(i->name,"value")!=0 && 380 strcasecmp(i->name,"xlink:href")!=0){ 381 map *tmp; 382 if(hasKey(m,i->name) && (tmp=getMap(m,i->name))!=NULL && 383 strcasecmp(i->value,tmp->value)!=0) 384 return false; 385 } 386 i=i->next; 387 } 388 return true; 389 } 390 391 static iotype* getIoTypeFromElement(elements* e,char *name, map* values){ 392 elements* cursor=e; 393 while(cursor!=NULL){ 394 if(strcasecmp(cursor->name,name)==0){ 395 if(contains(cursor->defaults->content,values)==true) 396 return cursor->defaults; 397 else{ 398 iotype* tmp=cursor->supported; 399 while(tmp!=NULL){ 400 if(contains(tmp->content,values)==true) 401 return tmp; 402 tmp=tmp->next; 403 } 404 } 405 } 406 cursor=cursor->next; 407 } 408 return NULL; 409 } 393 410 394 411 static maps* dupMaps(maps** mo){ … … 434 451 free(_ztmpm->value); 435 452 _ztmpm->value=strdup(value); 436 dumpMap(_ztmpm);437 453 }else{ 438 454 addToMap(_tmpm->content,subkey,value); … … 502 518 tmp->supported=(iotype*)malloc(IOTYPE_SIZE); 503 519 tmp->supported->content=NULL; 520 addMapToMap(&tmp->supported->content,e->supported->content); 504 521 tmp->supported->next=NULL; 505 addMapToMap(&tmp->supported->content,e->supported->content);506 iotype *etmp=*(&tmp->supported->next) ;507 522 iotype *tmp2=e->supported->next; 508 523 while(tmp2!=NULL){ 509 etmp=(iotype*)malloc(IOTYPE_SIZE); 510 etmp->content=NULL; 511 addMapToMap(&etmp->content,tmp2->content); 512 etmp->next=NULL; 524 addMapToIoType(&tmp->supported,tmp2->content); 513 525 #ifdef DEBUG 514 526 fprintf(stderr,">> %s %i\n",__FILE__,__LINE__); … … 516 528 #endif 517 529 tmp2=tmp2->next; 518 etmp=etmp->next;519 530 } 520 531 } … … 532 543 *m=dupElements(tmp); 533 544 }else{ 534 while(_cursor->next!=NULL) 535 _cursor=_cursor->next; 536 _cursor->next=dupElements(tmp); 545 addToElements(&(*m)->next,tmp); 537 546 } 538 547 } -
trunk/zoo-kernel/service_conf.l
r13 r57 109 109 110 110 111 <DANSBALISE>{Name} {srlval.chaine=strdup(yytext);return ID;}111 <DANSBALISE>{Name}{newline}* {memmove(srlval.chaine,yytext,(strlen(yytext)+1)*sizeof(char));return ID;} 112 112 113 113 -
trunk/zoo-kernel/service_conf.y
r20 r57 133 133 : STag contentetoile ETag 134 134 { 135 free($3);136 135 } 137 136 … … 210 209 my_service->inputs->next=NULL; 211 210 } 212 else 211 else if(current_element!=NULL && current_element->name!=NULL){ 213 212 addToElements(&my_service->inputs,current_element); 213 } 214 214 #ifdef DEBUG_SERVICE_CONF 215 215 fprintf(stderr,"CURRENT_ELEMENT\n"); … … 267 267 addMapToMap(¤t_element->metadata,current_content); 268 268 current_element->next=NULL; 269 current_element->format= $2;269 current_element->format=strdup($2); 270 270 current_element->defaults=NULL; 271 271 current_element->supported=NULL; … … 280 280 current_element->metadata=NULL; 281 281 current_element->next=NULL; 282 current_element->format= $2;282 current_element->format=strdup($2); 283 283 current_element->defaults=NULL; 284 284 current_element->supported=NULL; … … 297 297 if(wait_defaults==true){ 298 298 defaultsc++; 299 freeMap(¤t_content);300 current_content=NULL;299 /*freeMap(¤t_content); 300 current_content=NULL;*/ 301 301 } 302 302 current_data=5; … … 305 305 printf("* Identifiant : %s\n",$2); 306 306 #endif 307 /* et on renvoie l'identifiant de balise afin de pouvoir le comparer */308 /* avec la balise jumelle fermante ! */309 $$ = $2 ;310 307 } 311 308 ; … … 338 335 printf ("attribute : %s\n",$1) ; 339 336 #endif 340 free($1);341 337 } 342 338 ; … … 391 387 current_content=NULL; 392 388 current_element->supported=NULL; 389 current_element->next=NULL; 393 390 } 394 391 if(strcmp($3,"Supported")==0){ 395 392 current_data=previous_data; 396 393 if(current_element->supported==NULL){ 397 //addMapToIoType(¤t_element->supported,current_content); 398 current_element->supported=(iotype*)malloc(IOTYPE_SIZE); 399 current_element->supported->content=NULL; 400 addMapToMap(¤t_element->supported->content,current_content); 401 freeMap(¤t_content); 402 free(current_content); 403 current_element->supported->next=NULL; 404 current_content=NULL; 394 if(current_content!=NULL){ 395 current_element->supported=(iotype*)malloc(IOTYPE_SIZE); 396 current_element->supported->content=NULL; 397 addMapToMap(¤t_element->supported->content,current_content); 398 freeMap(¤t_content); 399 free(current_content); 400 current_element->supported->next=NULL; 401 current_content=NULL; 402 }else{ 403 current_element->supported=NULL; 404 current_element->next=NULL; 405 } 405 406 } 406 407 else{ 407 #ifdef DEBUG 408 // Currently we support only one supported format 408 #ifdef DEBUG_SERVICE_CONF 409 409 fprintf(stderr,"SECOND SUPPORTED FORMAT !!!!\n"); 410 410 #endif 411 //addMapToIoType(¤t_element->supported,current_content); 412 /*iotype* iotmp=*(¤t_element->supported); 413 while(iotmp!=NULL){ 414 dumpMap(iotmp->content); 415 iotmp=iotmp->next; 416 } 417 iotmp=(iotype*)malloc(IOTYPE_SIZE); 418 iotmp->content=NULL; 419 addMapToMap(&iotmp->content,current_content); 420 iotmp->next=NULL; 421 dumpElements(current_element); 422 fprintf(stderr,"SECOND SUPPORTED FORMAT MAP START !!!!\n"); 423 dumpMap(current_content); 424 fprintf(stderr,"SECOND SUPPORTED FORMAT MAP END !!!!\n");*/ 411 addMapToIoType(¤t_element->supported,current_content); 425 412 freeMap(¤t_content); 426 413 free(current_content); 427 414 current_content=NULL; 428 /*freeMap(&iotmp->content); 429 free(&iotmp->content); 430 free(iotype);*/ 431 #ifdef DEBUG 432 // Currently we support only one supported format 415 #ifdef DEBUG_SERVICE_CONF 416 dumpElements(current_element); 433 417 fprintf(stderr,"SECOND SUPPORTED FORMAT !!!!\n"); 434 418 #endif … … 436 420 current_content=NULL; 437 421 } 438 /* on renvoie l'identifiant de la balise pour pouvoir comparer les 2 */439 /* /!\ une balise fermante n'a pas d'attributs (c.f. : W3C) */440 $$ = $3;441 422 } 442 423 ; … … 610 591 if(current_data==2){ 611 592 if(wait_inputs==true){ 612 fprintf(stderr,"dup INPUTS\n"); 613 if(current_element->name!=NULL){ 593 if(current_element!=NULL && current_element->name!=NULL){ 614 594 if(my_service->inputs==NULL){ 615 595 my_service->inputs=dupElements(current_element); … … 661 641 } 662 642 wait_inputs=false; 663 dumpMap(current_content);664 643 current_content=NULL; 665 644 } … … 755 734 int resultatYYParse = srparse() ; 756 735 757 if(wait_outputs==true && current_element ->name!=NULL){736 if(wait_outputs==true && current_element!=NULL && current_element->name!=NULL){ 758 737 if(my_service->outputs==NULL){ 759 738 #ifdef DEBUG_SERVICE_CONF … … 762 741 my_service->outputs=dupElements(current_element); 763 742 my_service->outputs->next=NULL; 764 freeElements(¤t_element);765 free(current_element);766 current_element=NULL;767 743 } 768 744 else{ … … 778 754 free(current_element); 779 755 current_element=NULL; 756 #ifdef DEBUG_SERVICE_CONF 757 fprintf(stderr,"(DATAOUTPUTS - 631) FREE current_element\n"); 758 #endif 780 759 } 781 760 if(current_element!=NULL){ 782 761 freeElements(¤t_element); 783 fprintf(stderr,"LINE 709");784 762 free(current_element); 785 763 current_element=NULL; … … 787 765 if(current_content!=NULL){ 788 766 freeMap(¤t_content); 789 fprintf(stderr,"LINE 715");790 767 free(current_content); 791 768 current_content=NULL; -
trunk/zoo-kernel/service_internal.c
r52 r57 309 309 map* tmp2=tmp4->content; 310 310 while(tmp2!=NULL){ 311 if(strncasecmp(tmp2->name,"keywords",8)!=0 && 312 strncasecmp(tmp2->name,"serverAddress",13)!=0 && 313 strncasecmp(tmp2->name,"lang",4)!=0 && 314 strncasecmp(tmp2->name,"encoding",8)!=0 && 315 strncasecmp(tmp2->name,"version",7)!=0){ 311 if(strcasecmp(tmp2->name,"abstract")==0 || 312 strcasecmp(tmp2->name,"title")==0 || 313 strcasecmp(tmp2->name,"accessConstraints")==0 || 314 strcasecmp(tmp2->name,"fess")==0){ 316 315 tmp2->name[0]=toupper(tmp2->name[0]); 317 316 nc1 = xmlNewNode(ns_ows, BAD_CAST tmp2->name); … … 370 369 if(tmp4!=NULL){ 371 370 map* tmp2=tmp4->content; 371 char *tmpAddress[6]; 372 tmpAddress[0]="addressDeliveryPoint"; 373 tmpAddress[1]="addressCity"; 374 tmpAddress[2]="addressAdministrativeArea"; 375 tmpAddress[3]="addressPostalCode"; 376 tmpAddress[4]="addressCountry"; 377 tmpAddress[5]="addressElectronicMailAddress"; 378 char *tmpPhone[2]; 379 tmpPhone[0]="phoneVoice"; 380 tmpPhone[1]="phoneFacsimile"; 372 381 while(tmp2!=NULL){ 373 382 if(strcmp(tmp2->name,"keywords")!=0 && … … 395 404 else 396 405 if(strncmp(tmp2->name,"Phone",5)==0){ 397 char *toto=NULL; 398 char *toto1=tmp2->name; 399 toto=strstr(toto1,"Phone"); 400 nc1 = xmlNewNode(ns_ows, BAD_CAST toto1+5); 401 xmlAddChild(nc1,xmlNewText(BAD_CAST tmp2->value)); 402 xmlAddChild(nc5,nc1); 406 int j; 407 for(j=0;j<2;j++) 408 if(strlen(tmp2->name)==strlen(tmpPhone[j]) && strncasecmp(tmp2->name,tmpPhone[j],strlen(tmp2->name))==0){ 409 char *toto=NULL; 410 char *toto1=tmp2->name; 411 toto=strstr(toto1,"Phone"); 412 nc1 = xmlNewNode(ns_ows, BAD_CAST toto1+5); 413 xmlAddChild(nc1,xmlNewText(BAD_CAST tmp2->value)); 414 xmlAddChild(nc5,nc1); 415 } 403 416 } 404 417 else 405 418 if(strncmp(tmp2->name,"Address",7)==0){ 406 char *toto=NULL; 407 char *toto1=tmp2->name; 408 toto=strstr(toto1,"Address"); 409 nc1 = xmlNewNode(ns_ows, BAD_CAST toto1+7); 410 xmlAddChild(nc1,xmlNewText(BAD_CAST tmp2->value)); 411 xmlAddChild(nc6,nc1); 419 int j; 420 for(j=0;j<6;j++) 421 if(strlen(tmp2->name)==strlen(tmpAddress[j]) && strncasecmp(tmp2->name,tmpAddress[j],strlen(tmp2->name))==0){ 422 char *toto=NULL; 423 char *toto1=tmp2->name; 424 toto=strstr(toto1,"Address"); 425 nc1 = xmlNewNode(ns_ows, BAD_CAST toto1+7); 426 xmlAddChild(nc1,xmlNewText(BAD_CAST tmp2->value)); 427 xmlAddChild(nc6,nc1); 428 } 412 429 } 413 430 } … … 1084 1101 te=getMapFromMaps(m,"lenv","message"); 1085 1102 if(te!=NULL) 1086 addToMap(errorMap,"text", te->value);1103 addToMap(errorMap,"text",_ss(te->value)); 1087 1104 else 1088 1105 addToMap(errorMap,"text",_("No more information available")); … … 1364 1381 if(tmp1!=NULL){ 1365 1382 nc2 = xmlNewNode(ns_ows, BAD_CAST tmp2[j]); 1366 fprintf(stderr,"[%s] \n[%s]\n",tmp1->value,_ss(tmp1->value));1367 1383 xmlAddChild(nc2,xmlNewText(BAD_CAST _ss(tmp1->value))); 1368 1384 xmlAddChild(root,nc2); … … 1398 1414 1399 1415 void printExceptionReportResponse(maps* m,map* s){ 1400 1401 1416 int buffersize; 1402 1417 xmlDocPtr doc; … … 1425 1440 xmlFree(xmlbuff); 1426 1441 xmlCleanupParser(); 1442 zooXmlCleanupNs(); 1427 1443 } 1428 1444 … … 1436 1452 maps* tmpMap=getMaps(m,"main"); 1437 1453 1438 ns=xmlNewNs(NULL,BAD_CAST "http://www.opengis.net/ows/1.1",BAD_CAST "ows"); 1454 int nsid=zooXmlAddNs(NULL,BAD_CAST "http://www.opengis.net/ows/1.1",BAD_CAST "ows"); 1455 ns=usedNs[nsid]; 1439 1456 n = xmlNewNode(ns, BAD_CAST "ExceptionReport"); 1440 1457 … … 1493 1510 if(toto!=NULL && strcasecmp(toto->value,"true")==0){ 1494 1511 toto=getMap(request_outputs->content,"extension"); 1495 /* put gml extension if the extension is defined as .js and the result will be a gml file */1496 map* mtype=getMap(request_outputs->content,"mimeType");1497 if (strcasecmp(toto->value,"js")==0 && strcasecmp(mtype->value,"text/xml")==0) {1498 toto->value="gml";1499 }1500 1512 map *tmp1=getMapFromMaps(m,"main","tmpPath"); 1501 char *file_name=(char*)malloc((strlen(tmp1->value)+strlen(s->name)+strlen(toto->value)+13)*sizeof(char)); 1513 char *file_name; 1514 bool hasExt=true; 1515 if(toto==NULL){ 1516 // We can fallback to a default list of supported formats using 1517 // mimeType information if present here. Maybe we can add more formats 1518 // here. 1519 // If mimeType was not found, we then set txt as the default extension. 1520 map* mtype=getMap(request_outputs->content,"mimeType"); 1521 if(mtype!=NULL){ 1522 if(strcasecmp(mtype->value,"text/xml")==0) 1523 toto=createMap("extension","xml"); 1524 else 1525 toto=createMap("extension","txt"); 1526 } 1527 if(toto==NULL) 1528 toto=createMap("extension","txt"); 1529 hasExt=false; 1530 } 1531 file_name=(char*)malloc((strlen(tmp1->value)+strlen(s->name)+strlen(toto->value)+13)*sizeof(char)); 1502 1532 sprintf(file_name,"%s/%s_%i.%s",tmp1->value,s->name,cpid+100000,toto->value); 1503 1533 FILE *ofile=fopen(file_name,"w"); 1534 if(ofile==NULL) 1535 fprintf(stderr,"Unable to create file on disk implying segfault ! \n"); 1504 1536 map *tmp2=getMapFromMaps(m,"main","tmpUrl"); 1505 1537 map *tmp3=getMapFromMaps(m,"main","serverAddress"); 1506 char *file_url=(char*)malloc((strlen(tmp3->value)+strlen(tmp2->value)+strlen(s->name)+strlen(toto->value)+13)*sizeof(char)); 1538 char *file_url; 1539 file_url=(char*)malloc((strlen(tmp3->value)+strlen(tmp2->value)+strlen(s->name)+strlen(toto->value)+13)*sizeof(char)); 1507 1540 sprintf(file_url,"%s/%s/%s_%i.%s",tmp3->value,tmp2->value,s->name,cpid+100000,toto->value); 1508 1541 addToMap(request_outputs->content,"Reference",file_url); 1542 if(hasExt!=true){ 1543 freeMap(&toto); 1544 free(toto); 1545 } 1509 1546 toto=getMap(request_outputs->content,"value"); 1510 if(toto!=NULL )1511 fwrite(toto->value, sizeof(char),strlen(toto->value),ofile);1547 if(toto!=NULL && toto->value!=NULL) 1548 fwrite(toto->value,1,(strlen(toto->value)+1)*sizeof(char),ofile); 1512 1549 fclose(ofile); 1513 1550 free(file_name); … … 1601 1638 BIO_free_all(b64); 1602 1639 1603 fprintf(stderr,"BASE64 [%s] \n",buff);1604 1640 return buff; 1605 1641 } … … 1610 1646 while(tmpInputs!=NULL){ 1611 1647 maps *tmpMaps=getMaps(out1,tmpInputs->name); 1648 /*fprintf(stderr,"IN LOOP\n"); 1649 dumpElements(tmpInputs); 1650 dumpMaps(tmpMaps); 1651 fprintf(stderr,"/ IN LOOP\n");*/ 1612 1652 if(tmpMaps==NULL){ 1613 1653 map* tmpMap1=getMap(tmpInputs->content,"minOccurs"); … … 1617 1657 } 1618 1658 maps* tmpMaps2=(maps*)malloc(MAPS_SIZE); 1619 tmpMaps2->name=strdup( (char*)tmpInputs->name);1659 tmpMaps2->name=strdup(tmpInputs->name); 1620 1660 tmpMaps2->content=NULL; 1621 1661 tmpMaps2->next=NULL; … … 1625 1665 tmpIoType=tmpIoType->next; 1626 1666 } 1627 map *tmpMap=getMap(tmpMaps2->content,"value"); 1628 if(tmpMap==NULL) 1629 addToMap(tmpMaps2->content,"value","NULL"); 1667 if(strncmp(type,"outputs",7)==0){ 1668 map *tmpMap=getMap(tmpMaps2->content,"value"); 1669 if(tmpMap==NULL) 1670 addToMap(tmpMaps2->content,"value","NULL"); 1671 } 1630 1672 if(out1==NULL){ 1631 1673 *out=dupMaps(&tmpMaps2); … … 1638 1680 } 1639 1681 else{ 1640 map* tmpContent=tmpInputs->defaults->content; 1641 1642 map* cval=NULL; 1643 1644 while(tmpContent!=NULL){ 1645 if((cval=getMap(tmpMaps->content,tmpContent->name))==NULL){ 1646 #ifdef DEBUG 1647 fprintf(stderr,"addDefaultValues %s => %s\n",tmpContent->name,tmpContent->value); 1648 #endif 1649 if(tmpMaps->content==NULL) 1650 tmpMaps->content=createMap(tmpContent->name,tmpContent->value); 1651 else 1652 addToMap(tmpMaps->content,tmpContent->name,tmpContent->value); 1682 iotype* tmpIoType=getIoTypeFromElement(tmpInputs,tmpInputs->name, 1683 tmpMaps->content); 1684 if(tmpIoType!=NULL){ 1685 map* tmpContent=tmpIoType->content; 1686 map* cval=NULL; 1687 1688 while(tmpContent!=NULL){ 1689 if((cval=getMap(tmpMaps->content,tmpContent->name))==NULL){ 1690 #ifdef DEBUG 1691 fprintf(stderr,"addDefaultValues %s => %s\n",tmpContent->name,tmpContent->value); 1692 #endif 1693 if(tmpMaps->content==NULL) 1694 tmpMaps->content=createMap(tmpContent->name,tmpContent->value); 1695 else 1696 addToMap(tmpMaps->content,tmpContent->name,tmpContent->value); 1697 } 1698 tmpContent=tmpContent->next; 1653 1699 } 1654 tmpContent=tmpContent->next;1655 1700 } 1656 1701 } -
trunk/zoo-kernel/service_internal_java.c
r9 r57 104 104 fprintf(stderr,"Function successfully loaded\n"); 105 105 #endif 106 jclass scHashMapClass,scHashMap_class; 107 jmethodID scHashMap_constructor; 108 scHashMapClass = (*env)->FindClass(env, "java/util/HashMap"); 109 scHashMap_class = (*env)->NewGlobalRef(env, scHashMapClass); 110 scHashMap_constructor = (*env)->GetMethodID(env, scHashMap_class, "<init>", "()V"); 106 111 /** 107 112 * The 3 standard parameter for each services 108 113 */ 109 jobject arg1=HashMap_FromMaps(env,m );110 jobject arg2=HashMap_FromMaps(env,inputs );111 jobject arg3=HashMap_FromMaps(env,outputs );114 jobject arg1=HashMap_FromMaps(env,m,scHashMapClass,scHashMap_class,scHashMap_constructor); 115 jobject arg2=HashMap_FromMaps(env,inputs,scHashMapClass,scHashMap_class,scHashMap_constructor); 116 jobject arg3=HashMap_FromMaps(env,outputs,scHashMapClass,scHashMap_class,scHashMap_constructor); 112 117 jint pValue=0; 113 118 … … 115 120 if (pValue != NULL){ 116 121 res=pValue; 117 //inputs=mapsFromHashMap(env,arg2); 118 outputs=mapsFromHashMap(env,arg3); 122 m=mapsFromHashMap(env,arg1,scHashMapClass); 123 *main_conf=m; 124 outputs=mapsFromHashMap(env,arg3,scHashMapClass); 119 125 *real_outputs=outputs; 120 126 … … 123 129 dumpMaps(inputs); 124 130 dumpMaps(outputs); 125 /*fprintf(stderr,"printProcessResponse(%i,\"%s\",%i,inputs,outputs);",126 getpid(),tmp->value,PyInt_AsLong(pValue));*/127 131 #endif 128 132 }else{ … … 180 184 } 181 185 182 jobject HashMap_FromMaps(JNIEnv *env,maps* t){ 183 jclass scHashMapClass,scHashMap_class; 184 jmethodID scHashMap_constructor; 186 jobject HashMap_FromMaps(JNIEnv *env,maps* t,jclass scHashMapClass,jclass scHashMap_class,jmethodID scHashMap_constructor){ 185 187 jobject scObject,scObject1; 186 scHashMapClass = (*env)->FindClass(env, "java/util/HashMap");187 scHashMap_class = (*env)->NewGlobalRef(env, scHashMapClass);188 scHashMap_constructor = (*env)->GetMethodID(env, scHashMap_class, "<init>", "()V");189 188 if(scHashMap_constructor!=NULL){ 190 189 scObject = (*env)->NewObject(env, scHashMap_class, scHashMap_constructor); … … 204 203 (*env)->CallObjectMethod(env,scObject, put_mid, (*env)->NewStringUTF(env,tmp->name), scObject1); 205 204 tmp=tmp->next; 206 } 205 } 207 206 return scObject; 208 207 } … … 211 210 } 212 211 213 maps* mapsFromHashMap(JNIEnv *env,jobject t ){212 maps* mapsFromHashMap(JNIEnv *env,jobject t,jclass scHashMapClass){ 214 213 #ifdef DEBUG 215 214 fprintf(stderr,"mapsFromHashMap start\n"); … … 224 223 * } 225 224 */ 226 jclass scHashMap Class,scHashMap_class,scSetClass,scIteratorClass,scMapEntryClass,scSet_class,scMapClass;225 jclass scHashMap_class,scSetClass,scIteratorClass,scMapEntryClass,scSet_class,scMapClass; 227 226 jmethodID entrySet_mid,iterator_mid,hasNext_mid,next_mid,getKey_mid,getValue_mid; 228 227 jobject scObject,scObject1; 229 scHashMapClass=(*env)->GetObjectClass(env,t);230 //scMapClass=(*env)->FindClass(env, "java/util/HashMap");231 //scHashMapClass = (*env)->FindClass(env, "java/util/HashMap");232 228 if(scHashMapClass==NULL){ 233 229 fprintf(stderr,"Unable to load java.util.HashMap\n"); … … 276 272 maps* final_res=NULL; 277 273 map* res=NULL; 278 #ifdef DEBUG279 int i=0;280 #endif281 274 while((*env)->CallBooleanMethod(env,final_iterator,hasNext_mid)){ 282 #ifdef DEBUG283 fprintf(stderr,"mapsFromHashMap loop %d\n",i);284 i++;285 #endif286 275 jobject tmp=(*env)->CallObjectMethod(env,final_iterator,next_mid); 287 276 … … 289 278 jobject set=(*env)->CallObjectMethod(env,imap,entrySet_mid); 290 279 jobject iterator=(*env)->CallObjectMethod(env,set,iterator_mid); 291 #ifdef DEBUG 292 int j=0; 293 #endif 280 294 281 while((*env)->CallBooleanMethod(env,iterator,hasNext_mid)){ 295 #ifdef DEBUG296 fprintf(stderr,"mapsFromHashMap internal loop %d\n",j);297 j++;298 #endif299 282 jobject tmp1=(*env)->CallObjectMethod(env,iterator,next_mid); 300 283 jobject jk=(*env)->CallObjectMethod(env,tmp1,getKey_mid); … … 310 293 res=createMap((*env)->GetStringUTFChars(env, jk, NULL), 311 294 (*env)->GetStringUTFChars(env, jv, NULL)); 312 }else 295 }else{ 313 296 addToMap(res,(*env)->GetStringUTFChars(env, jk, NULL), 314 297 (*env)->GetStringUTFChars(env, jv, NULL)); 298 } 315 299 } 316 300 jobject jk=(*env)->CallObjectMethod(env,tmp,getKey_mid); 317 301 maps* cmap=(maps*)malloc(sizeof(maps)); 318 302 cmap->name=(*env)->GetStringUTFChars(env, jk, NULL); 303 #ifdef DEBUG 304 fprintf(stderr," / %s \n",cmap->name); 305 #endif 319 306 cmap->content=res; 320 307 cmap->next=NULL; 321 if(final_res==NULL) {308 if(final_res==NULL) 322 309 final_res=dupMaps(&cmap); 323 }else310 else 324 311 addMapsToMaps(&final_res,cmap); 325 final_res->next=NULL;326 312 freeMaps(&cmap); 327 313 free(cmap); -
trunk/zoo-kernel/service_internal_java.h
r1 r57 35 35 extern "C" { 36 36 #endif 37 jobject HashMap_FromMaps(JNIEnv*,maps* t);38 39 maps* mapsFromHashMap(JNIEnv*,jobject t);40 41 int zoo_java_support(maps**,map*,service*,maps**,maps**);37 jobject HashMap_FromMaps(JNIEnv*,maps*,jclass,jclass,jmethodID); 38 39 maps* mapsFromHashMap(JNIEnv*,jobject,jclass); 40 41 int zoo_java_support(maps**,map*,service*,maps**,maps**); 42 42 43 43 #ifdef __cplusplus -
trunk/zoo-kernel/service_internal_python.c
r45 r57 108 108 //*real_inputs=mapsFromPyDict(arg2); 109 109 //createMapsFromPyDict(real_outputs,arg3); 110 *main_conf=mapsFromPyDict(arg1); 110 111 *real_outputs=mapsFromPyDict(arg3); 111 112 #ifdef DEBUG -
trunk/zoo-kernel/zoo_service_loader.c
r53 r57 177 177 #endif 178 178 #ifdef DEBUG 179 #ifdef WIN32 <179 #ifdef WIN32 180 180 DWORD errstr; 181 181 errstr = GetLastError(); … … 340 340 *eres=-1; 341 341 } 342 *myMap=m; 342 343 *ioutputs=request_output_real_format; 343 344 } … … 850 851 free(REQUEST); 851 852 free(SERVICE_URL); 853 InternetCloseHandle(hInternet); 854 freeService(&s1); 855 free(s1); 852 856 return 0; 853 857 } … … 1788 1792 freeService(&s1); 1789 1793 free(s1); 1790 freeMaps(&m); 1794 //For Python language support only 1795 //freeMaps(&m); 1791 1796 free(m); 1792 1797
Note: See TracChangeset
for help on using the changeset viewer.