Ignore:
Timestamp:
Sep 27, 2010, 10:09:32 PM (14 years ago)
Author:
djay
Message:

Add missing updated code from 26 ...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-kernel/zoo_service_loader.c

    r30 r32  
    4444#include "service.h"
    4545#include "service_internal.h"
    46 
    47 
    48 #ifdef USE_PYTHON
    4946#include "service_internal_python.h"
    50 #endif
    5147
    5248#ifdef USE_JAVA
     
    182178    freeMaps(&m);
    183179    free(m);
    184     freeMap(&request_inputs);
    185     free(request_inputs);
    186180    return 1;
    187181  }
     
    194188      freeMaps(&m);
    195189      free(m);
    196       freeMap(&request_inputs);
    197       free(request_inputs);
    198190      free(REQUEST);
    199191      return 1;
     
    418410  s1=(service*)calloc(1,SERVICE_SIZE);
    419411  if(s1 == NULL){
     412    freeMaps(&m);
     413    free(m);
     414    free(REQUEST);
     415    free(SERVICE_URL);
    420416    return errorException(m, "Unable to allocate memory.","InternalError");
    421417  }
     
    437433  fflush(stdout);
    438434  dup2(saved_stdout,fileno(stdout));
    439   if(t==22){
    440     errorException(m, "The value for <indetifier> seems to be wrong. Please, ensure that the process exsits using the GetCapabilities request.", "InvalidParameterValue");
    441     exit(0);
     435  if(t<0){
     436    char tmpMsg[2048+strlen(r_inputs->value)];
     437    sprintf(tmpMsg,"The value for <indetifier> seems to be wrong (%s). Please, ensure that the process exist using the GetCapabilities request.",r_inputs->value);
     438    errorException(m, tmpMsg, "InvalidParameterValue");
     439    freeService(&s1);
     440    free(s1);
     441    freeMaps(&m);
     442    free(m);
     443    free(REQUEST);
     444    free(SERVICE_URL);
     445    return 0;
    442446  }
    443   //s[0]=s1;
     447  close(saved_stdout);
    444448
    445449#ifdef DEBUG
     
    483487    if(r_inputs==NULL) r_inputs=getMap(request_inputs,"RawDataOutput");
    484488   
    485     //#ifdef DEBUG
     489#ifdef DEBUG
    486490    fprintf(stderr,"OUTPUT Parsing ... \n");
    487     //#endif
     491#endif
    488492    if(r_inputs!=NULL){
    489       //#ifdef DEBUG
     493#ifdef DEBUG
    490494      fprintf(stderr,"OUTPUT Parsing start now ... \n");
    491       //#endif
     495#endif
    492496      char current_output_as_string[10240];
    493497      char cursor_output[10240];
     
    765769#endif
    766770        xmlNodePtr cur2=cur->children;
    767         while(cur2){
    768           while(cur2->type!=XML_ELEMENT_NODE)
     771        while(cur2!=NULL){
     772          while(cur2!=NULL && cur2->type!=XML_ELEMENT_NODE)
    769773            cur2=cur2->next;
     774          if(cur2==NULL)
     775            break;
    770776          /**
    771777           * Indentifier
     
    10241030#endif
    10251031            xmlNodePtr cur4=cur2->children;
    1026             while(cur4){
    1027               while(cur4->type!=XML_ELEMENT_NODE)
     1032            while(cur4!=NULL){
     1033              while(cur4!=NULL &&cur4->type!=XML_ELEMENT_NODE)
    10281034                cur4=cur4->next;
    1029 
     1035              if(cur4==NULL)
     1036                break;
    10301037              if(xmlStrcasecmp(cur4->name, BAD_CAST "LiteralData")==0){
    10311038                /**
     
    11031110        dumpMaps(request_input_real_format);
    11041111#endif
    1105         tmpmaps=tmpmaps->next;
    1106              
     1112        freeMaps(&tmpmaps);
     1113        free(tmpmaps);
     1114        tmpmaps=NULL;         
    11071115      }
    11081116#ifdef DEBUG
     
    14271435  int eres=SERVICE_STARTED;
    14281436  int cpid=getpid();
     1437 
     1438  maps *_tmpMaps=(maps*)malloc(MAPS_SIZE);
     1439  _tmpMaps->name=strdup("lenv");
     1440  char tmpBuff[100];
     1441  sprintf(tmpBuff,"%i",cpid);
     1442  _tmpMaps->content=createMap("sid",tmpBuff);
     1443  _tmpMaps->next=NULL;
     1444  addToMap(_tmpMaps->content,"status","0");
     1445  addMapsToMaps(&m,_tmpMaps);
     1446  freeMaps(&_tmpMaps);
     1447  free(_tmpMaps);
     1448
    14291449#ifdef DEBUG
    14301450  dumpMap(request_inputs);
     
    15881608    }
    15891609    else{
    1590 #ifdef USE_PYTHON
    15911610      if(strncasecmp(r_inputs->value,"PYTHON",6)==0){
    15921611        eres=zoo_python_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format);
    15931612      }
    15941613      else
    1595 #endif
    15961614       
    15971615#ifdef USE_JAVA
     
    16601678      r_inputs=getMapFromMaps(m,"main","tmpPath");
    16611679      map* r_inputs1=getMap(s1->content,"ServiceProvider");
    1662       char* fbkp=(char*)malloc((strlen(r_inputs->value)+strlen(r_inputs1->value)+16)*sizeof(char));
     1680      char* fbkp=(char*)malloc((strlen(r_inputs->value)+strlen(r_inputs1->value)+100)*sizeof(char));
    16631681      sprintf(fbkp,"%s/%s_%d.xml",r_inputs->value,r_inputs1->value,cpid);
    1664       char* flog=(char*)malloc((strlen(r_inputs->value)+strlen(r_inputs1->value)+22)*sizeof(char));
     1682      char* flog=(char*)malloc((strlen(r_inputs->value)+strlen(r_inputs1->value)+100)*sizeof(char));
    16651683      sprintf(flog,"%s/%s_%d_error.log",r_inputs->value,r_inputs1->value,cpid);
    1666       fprintf(stderr,"File to use as backup %s\n",fbkp);
    16671684#ifdef DEBUG
    16681685      fprintf(stderr,"RUN IN BACKGROUND MODE \n");
     
    16751692      free(fbkp);
    16761693      free(flog);
     1694      if(setsid()<0)
     1695        return errorException(m, "Unable to run the child process properly", "InternalError");
    16771696      /**
    16781697       * set status to SERVICE_STARTED and flush stdout to ensure full
     
    16811700       * this way the data will be updated at the end of the process run.
    16821701       */
     1702      updateStatus(m);
    16831703      printProcessResponse(m,request_inputs,cpid,
    1684                             s1,r_inputs->value,SERVICE_STARTED,
     1704                            s1,r_inputs1->value,SERVICE_STARTED,
    16851705                            request_input_real_format,
    16861706                            request_output_real_format);
     
    18101830        }
    18111831      } else{
    1812 
    1813 #ifdef USE_PYTHON
    18141832        if(strncasecmp(r_inputs->value,"PYTHON",6)==0){
    18151833          eres=zoo_python_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format);
    18161834        }
    18171835        else
    1818 #endif
    18191836
    18201837#ifdef USE_JAVA
     
    18531870      }
    18541871 
    1855       //res=execute(&m,&request_input_real_format,&request_output_real_format);
    18561872    } else {
    18571873      /**
     
    18731889                   cpid,m,eres);
    18741890
    1875   //if(getpid()==cpid){
     1891  if(((int)getpid())!=cpid){
     1892    fclose(stdout);
     1893    fclose(stderr);
     1894    unhandleStatus(m);
     1895  }
     1896
    18761897  freeService(&s1);
    18771898  free(s1);
    18781899  freeMaps(&m);
    18791900  free(m);
    1880   freeMaps(&tmpmaps);
    1881   free(tmpmaps);
    18821901 
    18831902  freeMaps(&request_input_real_format);
    18841903  free(request_input_real_format);
    18851904 
    1886   //freeMap(&request_inputs);
    1887   //free(request_inputs);
    1888    
    18891905  /* The following is requested but get issue using with Python support :/ */
    18901906  /* freeMaps(&request_output_real_format);
    1891      free(request_output_real_format);
    1892   */
     1907     free(request_output_real_format);*/
    18931908 
    18941909  free(REQUEST);
     
    18991914  fflush(stderr);
    19001915#endif
    1901     //}
    19021916
    19031917  return 0;
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