Ignore:
Timestamp:
Jun 29, 2016, 3:40:46 PM (8 years ago)
Author:
djay
Message:

Give the capability to store the main.cfg file in sysconfdir and the services in servicePath if defined in the [main] section.

File:
1 edited

Legend:

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

    r781 r784  
    415415   */
    416416  map *r_inputs = NULL;
     417  map* cwdMap=getMapFromMaps(m,"main","servicePath");
     418  if(cwdMap!=NULL){
     419    sprintf(ntmp,"%s",cwdMap->value);
     420  }else{
    417421#ifndef WIN32
    418   getcwd (ntmp, 1024);
     422    getcwd (ntmp, 1024);
    419423#else
    420   _getcwd (ntmp, 1024);
    421 #endif
     424    _getcwd (ntmp, 1024);
     425#endif
     426  }
    422427  r_inputs = getMap (s1->content, "serviceType");
    423428#ifdef DEBUG
     
    915920    }
    916921  char ntmp[1024];
     922#ifndef ETC_DIR
    917923#ifndef WIN32
    918924  getcwd (ntmp, 1024);
     
    920926  _getcwd (ntmp, 1024);
    921927#endif
     928#else
     929  sprintf(ntmp,"%s",ETC_DIR);
     930#endif
    922931  r_inputs = getMapOrFill (&request_inputs, "metapath", "");
    923932
    924933  char conf_file[10240];
    925934  snprintf (conf_file, 10240, "%s/%s/main.cfg", ntmp, r_inputs->value);
     935#ifdef ETC_DIR
     936#ifndef WIN32
     937    getcwd (ntmp, 1024);
     938#else
     939    _getcwd (ntmp, 1024);
     940#endif
     941#endif
    926942  if (conf_read (conf_file, m) == 2)
    927943    {
     
    945961  else
    946962    {
    947       bindtextdomain ("zoo-kernel", "/usr/share/locale/");
    948       bindtextdomain ("zoo-services", "/usr/share/locale/");
     963      bindtextdomain ("zoo-kernel", LOCALEDIR);
     964      bindtextdomain ("zoo-services", LOCALEDIR);
    949965    }
    950966
     
    11861202  r_inputs = NULL;
    11871203  r_inputs = getMap (request_inputs, "metapath");
    1188  
     1204  map* cwdMap0=getMapFromMaps(m,"main","servicePath");
    11891205  if (r_inputs != NULL)
    1190     snprintf (conf_dir, 1024, "%s/%s", ntmp, r_inputs->value);
     1206    if(cwdMap0!=NULL)
     1207      snprintf (conf_dir, 1024, "%s/%s", cwdMap0->value, r_inputs->value);
     1208    else
     1209      snprintf (conf_dir, 1024, "%s/%s", ntmp, r_inputs->value);
    11911210  else
    1192     snprintf (conf_dir, 1024, "%s", ntmp);
    1193 
     1211    if(cwdMap0!=NULL)
     1212      snprintf (conf_dir, 1024, "%s", cwdMap0->value);
     1213    else
     1214      snprintf (conf_dir, 1024, "%s", ntmp);
    11941215  map* reg = getMapFromMaps (m, "main", "registry");
    11951216  registry* zooRegistry=NULL;
     
    12921313          {
    12931314            errorException (m, _("The specified path does not exist."),
    1294                             "InvalidParameterValue", conf_dir);
     1315                            "InternalError", NULL);
    12951316            freeMaps (&m);
    12961317            free (m);
     
    16171638    }
    16181639
    1619   r_inputs = getMap (request_inputs, "MetaPath");
    1620   if (r_inputs != NULL)
    1621     snprintf (tmps1, 1024, "%s/%s", ntmp, r_inputs->value);
    1622   else
    1623     snprintf (tmps1, 1024, "%s/", ntmp);
    16241640  r_inputs = getMap (request_inputs, "Identifier");
    1625   char *ttmp = zStrdup (tmps1);
    1626   snprintf (tmps1, 1024, "%s/%s.zcfg", ttmp, r_inputs->value);
    1627   free (ttmp);
     1641  snprintf (tmps1, 1024, "%s/%s.zcfg", conf_dir, r_inputs->value);
    16281642#ifdef DEBUG
    16291643  fprintf (stderr, "Trying to load %s\n", tmps1);
     
    18621876   *  - message : is a string where you can store error messages, in case
    18631877   * service is failing, or o provide details on the ongoing operation.
    1864    *  - cwd : is the current working directory
     1878   *  - cwd : the current working directory or servicePath if defined
    18651879   *  - soap : is a boolean value, true if the request was contained in a SOAP
    18661880   * Envelop
     
    18881902  free(tmpUuid);
    18891903  addToMap (_tmpMaps->content, "status", "0");
    1890   addToMap (_tmpMaps->content, "cwd", ntmp);
     1904  if(cwdMap0!=NULL){
     1905    addToMap (_tmpMaps->content, "cwd", cwdMap0->value);
     1906    addToMap (_tmpMaps->content, "rcwd", ntmp);
     1907  }
     1908  else
     1909    addToMap (_tmpMaps->content, "cwd", ntmp);
    18911910  addToMap (_tmpMaps->content, "message", _("No message provided"));
    18921911  map *ltmp = getMap (request_inputs, "soap");
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