Ignore:
Timestamp:
Apr 9, 2015, 5:23:06 AM (10 years ago)
Author:
djay
Message:

Major update. Creation of a basic parsing api. Call validateRequest after fork if any.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/service_conf.y

    r618 r621  
    11/*
    2  * Thx to Jean-Marie CODOL and Naitan GROLLEMUND
    3  * copyright 2009 GeoLabs SARL
    42 * Author : Gérald FENOY
    53 *
     4 * Copyright (c) 209-2015 GeoLabs SARL
     5 *
     6 * Permission is hereby granted, free of charge, to any person obtaining a copy
     7 * of this software and associated documentation files (the "Software"), to deal
     8 * in the Software without restriction, including without limitation the rights
     9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     10 * copies of the Software, and to permit persons to whom the Software is
     11 * furnished to do so, subject to the following conditions:
     12 *
     13 * The above copyright notice and this permission notice shall be included in
     14 * all copies or substantial portions of the Software.
     15 *
     16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     22 * THE SOFTWARE.
    623 */
    724%{
     
    6481%token <s> ID
    6582%token <s> CHAINE
    66 /* STARTXMLDECL et ENDXMLDECL qui sont <?xml et ?>*/
    67 %token STARTXMLDECL ENDXMLDECL
    68 
    69 /* version="xxx" et encoding="xxx" */
    70 %token VERSIONDECL ENCODINGDECL SDDECL
    71 
    72 /* < et > */
     83
    7384%token INFCAR SUPCAR
    7485
     
    130141{
    131142#ifdef DEBUG_SERVICE_CONF
    132   fprintf(stderr,"(%s %d) %s\n",__FILE__,__LINE__,$2);
     143  fprintf(stderr,"STag (%s %d) %s %d %d \n",__FILE__,__LINE__,$2,current_data,previous_data);
    133144  fflush(stderr);
    134145  dumpMap(current_content);
     
    146157  }
    147158  if(strncasecmp($2,"DataInputs",10)==0){
    148     if(wait_mainmetadata==true && current_content!=NULL){
    149       addMapToMap(&my_service->metadata,current_content);
    150       freeMap(&current_content);
    151       free(current_content);
    152       current_content=NULL;
    153       wait_mainmetadata=false;
    154     }
    155159    if(current_element==NULL){
    156160#ifdef DEBUG_SERVICE_CONF
     
    255259           || strncasecmp($2,"BoundingBoxOutput",13)==0 || strncasecmp($2,"BoundingBoxData",12)==0){
    256260          current_data=4;
    257           if(wait_metadata==true){
    258             if(current_content!=NULL){
    259 #ifdef DEBUG_SERVICE_CONF
    260               fprintf(stderr,"add current_content to current_element->content\n");
    261               fprintf(stderr,"LINE %d",__LINE__);
    262 #endif
    263               addMapToMap(&current_element->metadata,current_content);
    264               current_element->next=NULL;
    265               if($2!=NULL)
    266                 current_element->format=zStrdup($2);
    267              
    268               current_element->defaults=NULL;
    269               current_element->supported=NULL;
    270               freeMap(&current_content);
    271               free(current_content);
    272             }
    273           }else{
    274             // No MainMetaData
    275             addMapToMap(&current_element->content,current_content);
    276             freeMap(&current_content);
    277             free(current_content);
    278             current_element->metadata=NULL;
    279             current_element->next=NULL;
    280             if($2!=NULL)
    281               current_element->format=zStrdup($2);
    282             current_element->defaults=NULL;
    283             current_element->supported=NULL;
    284           }
     261          addMapToMap(&current_element->content,current_content);
     262          freeMap(&current_content);
     263          free(current_content);
     264          current_element->next=NULL;
     265          if($2!=NULL)
     266            current_element->format=zStrdup($2);
     267          current_element->defaults=NULL;
     268          current_element->supported=NULL;
    285269          current_content=NULL;
    286           wait_metadata=false;
    287270        }
    288271        else
     
    311294// utiliser la récursivité a gauche
    312295Attributeetoile
    313  : Attributeetoile attribute  {}
     296: Attributeetoile attribute  {}
    314297 |                                {/* Epsilon */}
    315298 ;
     
    367350{
    368351#ifdef DEBUG_SERVICE_CONF
    369   fprintf(stderr,"(%s %d)\n",__FILE__,__LINE__);
     352  fprintf(stderr,"ETag %s (%s %d) %d %d \n",$3,__FILE__,__LINE__,current_data,previous_data);
    370353#endif
    371354  if(strcmp($3,"DataInputs")==0){
     
    399382  }
    400383  if(strcmp($3,"MetaData")==0){
     384    if(current_content!=NULL){
     385#ifdef DEBUG_SERVICE_CONF
     386      fprintf(stderr,"add current_content to current_element->content\n");
     387      fprintf(stderr,"LINE %d",__LINE__);
     388#endif
     389      if(wait_metadata){
     390        current_element->metadata=NULL;
     391        addMapToMap(&current_element->metadata,current_content);
     392        current_element->next=NULL;
     393        current_element->defaults=NULL;
     394        current_element->supported=NULL;
     395      }else{
     396        if(wait_mainmetadata){
     397          addMapToMap(&my_service->metadata,current_content);
     398        }
     399      }
     400
     401      freeMap(&current_content);
     402      free(current_content);
     403      current_content=NULL;
     404    }
    401405    current_data=previous_data;
     406    wait_mainmetadata=false;
     407    wait_metadata=false;
    402408  }
    403409  if(strcmp($3,"ComplexData")==0 || strcmp($3,"LiteralData")==0
    404410     || strcmp($3,"ComplexOutput")==0 || strcmp($3,"LiteralOutput")==0){
     411    if(current_element->format==NULL)
     412      current_element->format=zStrdup($3);
    405413    current_content=NULL;
    406414  }
     
    497505| EPAIR {
    498506#ifdef DEBUG_SERVICE_CONF
    499   fprintf(stderr,"(%s %d)\n",__FILE__,__LINE__);
    500   fprintf(stderr,"EPAIR FOUND !! \n");
     507  fprintf(stderr,"EPAIR (%s %d)\n",__FILE__,__LINE__);
     508  fprintf(stderr,"[%s=>%s]\n",curr_key,$1);
     509  dumpMap(current_content);
     510  fflush(stderr);
     511#endif
     512  if($1!=NULL && curr_key!=NULL){
     513    if(current_content==NULL){
     514#ifdef DEBUG_SERVICE_CONF
     515      fprintf(stderr,"[ZOO: service_conf.y line %d free(%s)]\n",__LINE__,curr_key);
     516#endif
     517      current_content=createMap(curr_key,$1);
     518#ifdef DEBUG_SERVICE_CONF
     519      fprintf(stderr,"[ZOO: service_conf.y line %d free(%s)]\n",__LINE__,curr_key);
     520#endif
     521    }
     522    else{
     523#ifdef DEBUG_SERVICE_CONF
     524      dumpMap(current_content);
     525      fprintf(stderr,"addToMap(current_content,%s,%s) !! \n",curr_key,$1);
     526#endif
     527      addToMap(current_content,curr_key,$1);
     528#ifdef DEBUG_SERVICE_CONF
     529      fprintf(stderr,"addToMap(current_content,%s,%s) end !! \n",curr_key,$1);
     530#endif   
     531    }
     532  }
     533#ifdef DEBUG_SERVICE_CONF
    501534  fprintf(stderr,"[%s=>%s]\n",curr_key,$1);
    502535  fprintf(stderr,"[ZOO: service_conf.y line %d free(%s)]\n",__LINE__,curr_key);
     
    504537  fflush(stderr);
    505538#endif
    506   if($1!=NULL && curr_key!=NULL){
    507     if(current_content==NULL){
    508 #ifdef DEBUG_SERVICE_CONF
    509       fprintf(stderr,"[ZOO: service_conf.y line %d free(%s)]\n",__LINE__,curr_key);
    510 #endif
    511       current_content=createMap(curr_key,$1);
    512 #ifdef DEBUG_SERVICE_CONF
    513       fprintf(stderr,"[ZOO: service_conf.y line %d free(%s)]\n",__LINE__,curr_key);
    514 #endif
    515     }
    516     else{
    517 #ifdef DEBUG_SERVICE_CONF
    518       dumpMap(current_content);
    519       fprintf(stderr,"addToMap(current_content,%s,%s) !! \n",curr_key,$1);
    520 #endif
    521       addToMap(current_content,curr_key,$1);
    522 #ifdef DEBUG_SERVICE_CONF
    523       fprintf(stderr,"addToMap(current_content,%s,%s) end !! \n",curr_key,$1);
    524 #endif   
    525     }
    526   }
    527 #ifdef DEBUG_SERVICE_CONF
    528   fprintf(stderr,"[%s=>%s]\n",curr_key,$1);
    529   fprintf(stderr,"[ZOO: service_conf.y line %d free(%s)]\n",__LINE__,curr_key);
    530   dumpMap(current_content);
    531   fflush(stderr);
    532 #endif
    533539  if(curr_key!=NULL){
    534540    free(curr_key);
     
    543549: ANID  {
    544550#ifdef DEBUG_SERVICE_CONF
    545   fprintf(stderr,"(%s %d)\n",__FILE__,__LINE__);
     551  fprintf(stderr,"processid (%s %d) %s\n",__FILE__,__LINE__,$1);
    546552#endif
    547553  if(data==-1){
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