Ignore:
Timestamp:
Jan 5, 2011, 3:20:01 PM (13 years ago)
Author:
djay
Message:

Adding contains and getIoTypeFromElement functions in service.h. Remove memory leaks from the Service Configuration Parser, add the support for multiple supported formats as before. Small modification of the ZOO-Kernel Java Support, adding the capability to access the modified main_conf HashMap? from the Kernel to let lenv message map pass when an error occurs and it is handled in the Service code. Adding same capability for the ZOO-Kernel Python Support. Use strcasecmp in service.h rather than strlen+strncasecmp. Ensure that only OWS compliant informations are available for Contact.Phone and Contact.Adress. Remove memory leak in createExceptionReportNode. Correction of the addDefaultValues function to add the default format using the informations from DataInputs? if present, this should correct the behavior of the ZOO-Kernel when choosing the extension value which should now point to the corresponding zcfg value if present. Don't set the NULL value for inputs not provided in the DataInputs?, still set NULL as default value for outputs. Avoid segfault in freeElements when some zcfg values was not set correctly. Link against the client libjvm.so file rather than the server one.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-kernel/service.h

    r56 r57  
    133133    map* tmp=m;
    134134    while(tmp!=NULL){
    135       if(strlen(tmp->name)==strlen(key) && strncasecmp(tmp->name,key,strlen(key))==0)
     135      if(strcasecmp(tmp->name,key)==0)
    136136        return true;
    137137      tmp=tmp->next;
     
    146146    maps* tmp=m;
    147147    while(tmp!=NULL){
    148       if(strlen(tmp->name)==strlen(key) && strncasecmp(tmp->name,key,strlen(key))==0){
     148      if(strcasecmp(tmp->name,key)==0){
    149149        return tmp;
    150150      }
     
    157157    map* tmp=m;
    158158    while(tmp!=NULL){
    159       if(strlen(tmp->name)==strlen(key) && strncasecmp(tmp->name,key,strlen(key))==0){
     159      if(strcasecmp(tmp->name,key)==0){
    160160        return tmp;
    161161      }
     
    239239    elements* tmp=e;
    240240    while(tmp!=NULL){
    241       if(strlen(tmp->name)==strlen(key) && strncasecmp(key,tmp->name,strlen(key))==0)
     241      if(strcasecmp(key,tmp->name)==0)
    242242        return true;
    243243      tmp=tmp->next;
     
    249249    elements* tmp=m;
    250250    while(tmp!=NULL){
    251       if(strlen(tmp->name)==strlen(key) && strncasecmp(tmp->name,key,strlen(tmp->name))==0)
     251      if(strcasecmp(tmp->name,key)==0)
    252252        return tmp;
    253253      tmp=tmp->next;
     
    260260    iotype* _cursor=*i;
    261261    if(_cursor!=NULL){
    262       freeMap(&_cursor->content);
    263       free(_cursor->content);
    264262      if(_cursor->next!=NULL){
    265263        freeIOType(&_cursor->next);
    266264        free(_cursor->next);
    267265      }
     266      freeMap(&_cursor->content);
     267      free(_cursor->content);
    268268    }
    269269  }
     
    272272    elements* tmp=*e;
    273273    if(tmp!=NULL){
    274       free(tmp->name);
     274      if(tmp->name!=NULL)
     275        free(tmp->name);
    275276      freeMap(&tmp->content);
    276       free(tmp->content);
     277      if(tmp->content!=NULL)
     278        free(tmp->content);
    277279      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);
    280284      freeIOType(&tmp->defaults);
    281285      if(tmp->defaults!=NULL)
    282286        free(tmp->defaults);
    283287      freeIOType(&tmp->supported);
    284       if(tmp->supported!=NULL)
     288      if(tmp->supported!=NULL){
    285289        free(tmp->supported);
     290      }
    286291      freeElements(&tmp->next);
    287292    }
     
    361366  static void addMapToIoType(iotype** io,map* mi){
    362367    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  }
    393410
    394411  static maps* dupMaps(maps** mo){
     
    434451        free(_ztmpm->value);
    435452        _ztmpm->value=strdup(value);
    436         dumpMap(_ztmpm);
    437453      }else{
    438454        addToMap(_tmpm->content,subkey,value);
     
    502518        tmp->supported=(iotype*)malloc(IOTYPE_SIZE);
    503519        tmp->supported->content=NULL;
     520        addMapToMap(&tmp->supported->content,e->supported->content);
    504521        tmp->supported->next=NULL;
    505         addMapToMap(&tmp->supported->content,e->supported->content);
    506         iotype *etmp=*(&tmp->supported->next) ;
    507522        iotype *tmp2=e->supported->next;
    508523        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);
    513525#ifdef DEBUG
    514526          fprintf(stderr,">> %s %i\n",__FILE__,__LINE__);
     
    516528#endif
    517529          tmp2=tmp2->next;
    518           etmp=etmp->next;
    519530        }
    520531      }
     
    532543      *m=dupElements(tmp);
    533544    }else{
    534       while(_cursor->next!=NULL)
    535         _cursor=_cursor->next;
    536       _cursor->next=dupElements(tmp);
     545      addToElements(&(*m)->next,tmp);
    537546    }
    538547  }
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