Ignore:
Timestamp:
Feb 12, 2014, 3:25:15 PM (10 years ago)
Author:
djay
Message:

Add the optional Ruby Language Support to the ZOO-Kernel with an API similar to the Python ZOO-API. Small rewrite of Python support. Fix issue #86 and #87. Add usid in [lenv] section, this value is used to generate an unique identifier based on time and the process identifier. This usid is now used to name the stored result or the mapfile generated. Remove *some* warning messages displayed at compilation time.

File:
1 edited

Legend:

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

    r452 r453  
    12121212      map* tmpm2=getMap(tmp_maps->content,"tmpUrl");
    12131213      if(tmpm1!=NULL && tmpm2!=NULL){
    1214         if(strncasecmp(tmpm2->value,"http://",7)==0){
     1214        if( strncasecmp( tmpm2->value, "http://", 7) == 0 ||
     1215            strncasecmp( tmpm2->value, "https://", 8 ) == 0 ){
    12151216          sprintf(url,"%s/%s_%i.xml",tmpm2->value,service,pid);
    12161217        }else
     
    18921893      map * errormap = createMap("text",tmpMsg);
    18931894      addToMap(errormap,"code", "InternalError");
     1895     
    18941896      printExceptionReportResponse(m,errormap);
    18951897      freeMap(&errormap);
     
    19031905  }
    19041906 
     1907  if(res==SERVICE_FAILED){
     1908    map * errormap;
     1909    map *lenv;
     1910    lenv=getMapFromMaps(m,"lenv","message");
     1911    char *tmp0;
     1912    if(lenv!=NULL){
     1913      tmp0=(char*)malloc((strlen(lenv->value)+strlen(_("Unable to run the Service. The message returned back by the Service was the following: "+1)))*sizeof(char));
     1914      sprintf(tmp0,_("Unable to run the Service. The message returned back by the Service was the following: %s"),lenv->value);
     1915    }
     1916    else{
     1917      tmp0=(char*)malloc((strlen(_("Unable to run the Service. No more information was returned back by the Service."))+1)*sizeof(char));
     1918      sprintf(tmp0,_("Unable to run the Service. No more information was returned back by the Service."));
     1919    }
     1920    errormap = createMap("text",tmp0);
     1921    free(tmp0);
     1922    addToMap(errormap,"code", "InternalError");
     1923    printExceptionReportResponse(m,errormap);
     1924    freeMap(&errormap);
     1925    free(errormap);
     1926    return;
     1927  }
     1928
    19051929  if(asRaw==0){
    19061930#ifdef DEBUG
     
    19151939      toto=getMap(tmpI->content,"asReference");
    19161940#ifdef USE_MS
    1917       if(toto!=NULL && strcasecmp(toto->value,"true")==0 && testMap==NULL){
     1941      if(toto!=NULL && strcasecmp(toto->value,"true")==0 && testMap==NULL)
    19181942#else
    1919       if(toto!=NULL && strcasecmp(toto->value,"true")==0){
    1920 #endif
     1943      if(toto!=NULL && strcasecmp(toto->value,"true")==0)
     1944#endif
     1945        {
    19211946        elements* in=getElements(s->outputs,tmpI->name);
    19221947        char *format=NULL;
     
    19331958        map *ext=getMap(tmpI->content,"extension");
    19341959        map *tmp1=getMapFromMaps(m,"main","tmpPath");
    1935         char *file_name;
     1960        char *file_name,*file_path;
    19361961        bool hasExt=true;
    19371962        if(ext==NULL){
     
    19571982          hasExt=false;
    19581983        }
    1959         file_name=(char*)malloc((strlen(tmp1->value)+strlen(s->name)+strlen(ext->value)+strlen(tmpI->name)+13)*sizeof(char));
    1960         sprintf(file_name,"%s/%s_%s_%i.%s",tmp1->value,s->name,tmpI->name,cpid+100000,ext->value);
    1961         FILE *ofile=fopen(file_name,"wb");
     1984        file_name=(char*)malloc((strlen(s->name)+strlen(ext->value)+strlen(tmpI->name)+1024)*sizeof(char));
     1985        int cpid0=cpid+time(NULL);
     1986        sprintf(file_name,"%s_%s_%i.%s",s->name,tmpI->name,cpid0,ext->value);
     1987        file_path=(char*)malloc((strlen(tmp1->value)+strlen(file_name)+2)*sizeof(char));
     1988        sprintf(file_path,"%s/%s",tmp1->value,file_name);
     1989        FILE *ofile=fopen(file_path,"wb");
    19621990        if(ofile==NULL){
    19631991          char tmpMsg[1024];
     
    19681996          freeMap(&errormap);
    19691997          free(errormap);
     1998          free(file_name);
     1999          free(file_path);
    19702000          return;
    19712001        }
     2002        free(file_path);
    19722003        map *tmp2=getMapFromMaps(m,"main","tmpUrl");
    19732004        map *tmp3=getMapFromMaps(m,"main","serverAddress");
    19742005        char *file_url;
    19752006        if(strncasecmp(tmp2->value,"http://",7)==0){
    1976           file_url=(char*)malloc((strlen(tmp2->value)+strlen(s->name)+strlen(ext->value)+strlen(tmpI->name)+13)*sizeof(char));
    1977           sprintf(file_url,"%s/%s_%s_%i.%s",tmp2->value,s->name,tmpI->name,cpid+100000,ext->value);
     2007          file_url=(char*)malloc((strlen(tmp2->value)+strlen(file_name))*sizeof(char));
     2008          sprintf(file_url,"%s/%s",tmp2->value,file_name);
    19782009        }else{
    1979           file_url=(char*)malloc((strlen(tmp3->value)+strlen(tmp2->value)+strlen(s->name)+strlen(ext->value)+strlen(tmpI->name)+13)*sizeof(char));
    1980           sprintf(file_url,"%s/%s/%s_%s_%i.%s",tmp3->value,tmp2->value,s->name,tmpI->name,cpid+100000,ext->value);
     2010          file_url=(char*)malloc((strlen(tmp3->value)+strlen(tmp2->value)+strlen(file_name))*sizeof(char));
     2011          sprintf(file_url,"%s/%s/%s",tmp3->value,tmp2->value,file_name);
    19812012        }
    19822013        addToMap(tmpI->content,"Reference",file_url);
     
    20192050                         request_inputs,
    20202051                         request_outputs);
    2021   }
    2022   else
    2023     if(res!=SERVICE_FAILED){
     2052    }
     2053    else{
    20242054      /**
    20252055       * We get the requested output or fallback to the first one if the
     
    20832113#endif
    20842114      }
    2085     }else{
    2086       char tmp[1024];
    2087       map * errormap;
    2088       map *lenv;
    2089       lenv=getMapFromMaps(m,"lenv","message");
    2090       if(lenv!=NULL)
    2091         sprintf(tmp,_("Unable to run the Service. The message returned back by the Service was the following : %s"),lenv->value);
    2092       else
    2093         sprintf(tmp,_("Unable to run the Service. No more information was returned back by the Service."));
    2094       errormap = createMap("text",tmp);     
    2095       addToMap(errormap,"code", "InternalError");
    2096       printExceptionReportResponse(m,errormap);
    2097       freeMap(&errormap);
    2098       free(errormap);
    20992115    }
    21002116}
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