Ignore:
Timestamp:
Dec 19, 2016, 6:01:06 PM (7 years ago)
Author:
djay
Message:

Add support for nested inputs and outputs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/server_internal.c

    r789 r790  
    583583  map *res=*err;
    584584  elements* tmpInputs=in;
     585  elements* tmpInputss=NULL;
    585586  maps* out1=*out;
     587  maps* out1s=NULL;
    586588  char *result=NULL;
    587589  int nb=0;
     590  int inb=0;
     591 loopOnInputs:
    588592  if(type==1){
    589593    while(out1!=NULL){
     
    597601        result=out1->name;
    598602      }
     603      inb++;
    599604      out1=out1->next;
    600605    }
    601606    if(res!=NULL){
     607      fflush(stderr);
    602608      *err=res;
    603609      return result;
    604610    }
    605     out1=*out;
     611    if(out1==NULL && inb>=1)
     612      out1=*out;
    606613  }
    607614  while(tmpInputs!=NULL){
    608615    maps *tmpMaps=getMaps(out1,tmpInputs->name);
    609616    if(tmpMaps==NULL){
    610       maps* tmpMaps2=(maps*)malloc(MAPS_SIZE);
    611       tmpMaps2->name=strdup(tmpInputs->name);
    612       tmpMaps2->content=NULL;
    613       tmpMaps2->next=NULL;
    614      
     617      maps* tmpMaps2=createMaps(tmpInputs->name);
    615618      if(type==0){
    616619        map* tmpMapMinO=getMap(tmpInputs->content,"minOccurs");
     
    651654        }
    652655      }
    653 
     656     
    654657      if(res==NULL){
    655658        iotype* tmpIoType=tmpInputs->defaults;
     
    685688    }
    686689    else{
    687       iotype* tmpIoType=getIoTypeFromElement(tmpInputs,tmpInputs->name,
    688                                              tmpMaps->content);
    689       if(type==0) {
    690         /**
    691          * In case of an Input maps, then add the minOccurs and maxOccurs to the
    692          * content map.
    693          */
    694         map* tmpMap1=getMap(tmpInputs->content,"minOccurs");
    695         if(tmpMap1!=NULL){
    696           if(tmpMaps->content==NULL)
    697             tmpMaps->content=createMap("minOccurs",tmpMap1->value);
    698           else
    699             addToMap(tmpMaps->content,"minOccurs",tmpMap1->value);
    700         }
    701         map* tmpMaxO=getMap(tmpInputs->content,"maxOccurs");
    702         if(tmpMaxO!=NULL){
    703           if(tmpMaps->content==NULL)
    704             tmpMaps->content=createMap("maxOccurs",tmpMaxO->value);
    705           else
    706             addToMap(tmpMaps->content,"maxOccurs",tmpMaxO->value);
    707         }
    708         map* tmpMaxMB=getMap(tmpInputs->content,"maximumMegabytes");
    709         if(tmpMaxMB!=NULL){
    710           if(tmpMaps->content==NULL)
    711             tmpMaps->content=createMap("maximumMegabytes",tmpMaxMB->value);
    712           else
    713             addToMap(tmpMaps->content,"maximumMegabytes",tmpMaxMB->value);
    714         }
    715         /**
    716          * Parsing BoundingBoxData, fill the following map and then add it to
    717          * the content map of the Input maps:
    718          * lowerCorner, upperCorner, srs and dimensions
    719          * cf. parseBoundingBox
    720          */
    721         if(tmpInputs->format!=NULL && strcasecmp(tmpInputs->format,"BoundingBoxData")==0){
    722           maps* tmpI=getMaps(*out,tmpInputs->name);
    723           if(tmpI!=NULL){
    724             map* tmpV=getMap(tmpI->content,"value");
    725             if(tmpV!=NULL){
    726               char *tmpVS=strdup(tmpV->value);
    727               map* tmp=parseBoundingBox(tmpVS);
    728               free(tmpVS);
    729               map* tmpC=tmp;
    730               while(tmpC!=NULL){
    731                 addToMap(tmpMaps->content,tmpC->name,tmpC->value);
    732                 tmpC=tmpC->next;
     690      iotype* tmpIoType=NULL;
     691      if(tmpMaps->content!=NULL){
     692        tmpIoType=getIoTypeFromElement(tmpInputs,tmpInputs->name,
     693                                       tmpMaps->content);
     694        if(type==0) {
     695          /**
     696           * In case of an Input maps, then add the minOccurs and maxOccurs to the
     697           * content map.
     698           */
     699          map* tmpMap1=getMap(tmpInputs->content,"minOccurs");
     700          if(tmpMap1!=NULL){
     701            if(tmpMaps->content==NULL)
     702              tmpMaps->content=createMap("minOccurs",tmpMap1->value);
     703            else
     704              addToMap(tmpMaps->content,"minOccurs",tmpMap1->value);
     705          }
     706          map* tmpMaxO=getMap(tmpInputs->content,"maxOccurs");
     707          if(tmpMaxO!=NULL){
     708            if(tmpMaps->content==NULL)
     709              tmpMaps->content=createMap("maxOccurs",tmpMaxO->value);
     710            else
     711              addToMap(tmpMaps->content,"maxOccurs",tmpMaxO->value);
     712          }
     713          map* tmpMaxMB=getMap(tmpInputs->content,"maximumMegabytes");
     714          if(tmpMaxMB!=NULL){
     715            if(tmpMaps->content==NULL)
     716              tmpMaps->content=createMap("maximumMegabytes",tmpMaxMB->value);
     717            else
     718              addToMap(tmpMaps->content,"maximumMegabytes",tmpMaxMB->value);
     719          }
     720          /**
     721           * Parsing BoundingBoxData, fill the following map and then add it to
     722           * the content map of the Input maps:
     723           * lowerCorner, upperCorner, srs and dimensions
     724           * cf. parseBoundingBox
     725           */
     726          if(tmpInputs->format!=NULL && strcasecmp(tmpInputs->format,"BoundingBoxData")==0){
     727            maps* tmpI=getMaps(*out,tmpInputs->name);
     728            if(tmpI!=NULL){
     729              map* tmpV=getMap(tmpI->content,"value");
     730              if(tmpV!=NULL){
     731                char *tmpVS=strdup(tmpV->value);
     732                map* tmp=parseBoundingBox(tmpVS);
     733                free(tmpVS);
     734                map* tmpC=tmp;
     735                while(tmpC!=NULL){
     736                  addToMap(tmpMaps->content,tmpC->name,tmpC->value);
     737                  tmpC=tmpC->next;
     738                }
     739                freeMap(&tmp);
     740                free(tmp);
    733741              }
    734               freeMap(&tmp);
    735               free(tmp);
    736742            }
    737743          }
     744        }
     745      }else{
     746        if(tmpInputs!=NULL){
     747          tmpIoType=tmpInputs->defaults;
    738748        }
    739749      }
     
    807817      else
    808818        addToMap(tmpMaps->content,"inRequest","true");
    809 
    810     }
    811     tmpInputs=tmpInputs->next;
     819      elements* tmpElements=getElements(in,tmpMaps->name);
     820      if(tmpMaps->child!=NULL and tmpElements!=NULL and tmpElements->child!=NULL){
     821        char *res=addDefaultValues(&tmpMaps->child,tmpElements->child,m,type,err);
     822        if(strlen(res)>0){
     823          fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
     824          return res;
     825        }
     826      }
     827    }
     828    if(tmpInputs->child!=NULL){
     829      tmpInputss=tmpInputs->next;
     830      tmpInputs=tmpInputs->child;
     831      if(tmpMaps!=NULL){
     832        out1=tmpMaps->child;
     833        out1s=tmpMaps;
     834      }
     835    }else
     836      tmpInputs=tmpInputs->next;
     837  }
     838  if(tmpInputss!=NULL){
     839    out1=out1s;
     840    tmpInputs=tmpInputss;
     841    tmpInputss=NULL;
     842    out1s=NULL;
     843    goto loopOnInputs;
    812844  }
    813845  if(res!=NULL){
     
    879911      maps *res = (maps *) malloc (MAPS_SIZE);
    880912      conf_read (fbkpid, res);
     913      res->child=NULL;
    881914      map* status=getMapFromMaps(res,"status","status");
    882915      addToMap(statusInfo,"Status",status->value);
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