Changeset 784 for trunk/zoo-project


Ignore:
Timestamp:
Jun 29, 2016, 3:40:46 PM (3 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.

Location:
trunk/zoo-project
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/HISTORY.txt

    r781 r784  
    11Version 1.6.0-dev
     2  * Add servicePath special key to specify the service location
     3  * Add --with-etc-dir option to specify the location of the main.cfg file
    24  * Support GDAL version 2.1.0.
    35  * Add the MapServer 7.0.1 internal support.
  • trunk/zoo-project/zoo-kernel/Makefile.in

    r780 r784  
    33all: version.h zoo_loader.cgi ${YAML_FILE1}
    44
    5 version.h:
     5version.h: Makefile
    66        echo "#define ZOO_VERSION \"`svnversion`\"" > version.h
     7        echo "@ETC_DEF@" >> version.h
     8        echo "#define LOCALEDIR \"@localedir@\"" >>  version.h
    79
    810service.o: service.c service.h
     
    9092        g++ -c ${XML2CFLAGS} ${PYTHONCFLAGS} ${CFLAGS} service_loader.c
    9193
    92 zoo_service_loader.o: zoo_service_loader.c service.h
     94zoo_service_loader.o: zoo_service_loader.c service.h version.h ${MS_FILE} ${PYTHON_FILE} ${PHP_FILE} ${JAVA_FILE} ${JS_FILE} ${PERL_FILE} ${RUBY_FILE} ${YAML_FILE} ${OTB_FILE} ${SAGA_FILE}
    9395        g++ -g -O2 ${XML2CFLAGS} ${CFLAGS} ${SAGA_CFLAGS} ${OTBCFLAGS} ${PYTHONCFLAGS} ${JAVACFLAGS} ${JSCFLAGS} ${PERLCFLAGS} ${PHPCFLAGS} ${SAGA_ENABLED} ${OTB_ENABLED} ${PYTHON_ENABLED} ${JS_ENABLED} ${PHP_ENABLED} ${PERL_ENABLED} ${JAVA_ENABLED} -c zoo_service_loader.c  -fno-common -DPIC -o zoo_service_loader.o
    9496
  • trunk/zoo-project/zoo-kernel/ZOOMakefile.opts.in

    r753 r784  
    9999LDFLAGS=-lzoo_service @DEFAULT_LIBS@ -L../../thirds/cgic206 -lcgic ${GDAL_LIBS} ${XML2LDFLAGS} ${PYTHONLDFLAGS} ${PERLLDFLAGS}  ${PHPLDFLAGS} ${JAVALDFLAGS} ${JSLDFLAGS}  ${FCGI_LDFLAGS} @OPENSSL_LDFLAGS@ -luuid ${MS_LDFLAGS} ${MACOS_LD_FLAGS} ${MACOS_LD_NET_FLAGS} ${YAML_LDFLAGS} ${OTBLDFLAGS} ${SAGA_LDFLAGS}
    100100
     101DATAROOTDIR=@datarootdir@/zoo-project
  • trunk/zoo-project/zoo-kernel/configure.ac

    r775 r784  
    6767fi
    6868AC_SUBST([DEB_DEF])
     69
     70AC_ARG_WITH([etc-dir],
     71    [AS_HELP_STRING([--with-etc-dir=PATH], [Specifies an alternative path to store the main.cfg file ( default: ZOO-Kernel location) ])],
     72    [ETC_DEF="#define ETC_DIR \\\"${sysconfdir}\\\""], [ETC_DEF=""])
     73AC_SUBST([ETC_DEF])
    6974
    7075AC_ARG_WITH([cgi-dir],
  • trunk/zoo-project/zoo-kernel/locale/po/messages.po

    r781 r784  
    305305msgstr "Unable to load the main.cfg file."
    306306
     307#: zoo_service_loader.c:895
     308msgid "%s The following file: %s cannot be found."
     309msgstr "%s The following file: %s cannot be found."
     310
    307311#: zoo_service_loader.c:940
    308312#, c-format
  • trunk/zoo-project/zoo-kernel/main_conf_read.l

    r771 r784  
    3636attname [a-zA-Z0-9_\-:.]+
    3737
    38 attvalue1       [%\*,;@a-zA-Z0-9_\-.:" "\"\'/\\\(\)\+\x41-\xff?&=]+
     38attvalue1       [%\*,;@a-zA-Z0-9_\-.:" "\"\'/\\\(\)\+\x41-\xff?&=\!$]+
    3939
    4040whitesp                      [ ]
  • trunk/zoo-project/zoo-kernel/response_print.c

    r781 r784  
    15461546       * Else fallback to the initial method using the xml file to write in ...
    15471547       */
    1548       char ntmp[1024];
    1549 #ifndef WIN32
    1550       getcwd(ntmp,1024);
    1551 #else
    1552       _getcwd(ntmp,1024);
    1553 #endif
     1548      map* cwdMap=getMapFromMaps(m,"main","servicePath");
    15541549      struct stat myFileInfo;
    15551550      int statRes;
    15561551      char file_path[1024];
    1557       sprintf(file_path,"%s/GetStatus.zcfg",ntmp);
     1552      if(cwdMap!=NULL){
     1553        sprintf(file_path,"%s/GetStatus.zcfg",cwdMap->value);
     1554      }else{
     1555        char ntmp[1024];
     1556#ifndef WIN32
     1557        getcwd(ntmp,1024);
     1558#else
     1559        _getcwd(ntmp,1024);
     1560#endif
     1561        sprintf(file_path,"%s/GetStatus.zcfg",ntmp);
     1562      }
     1563      fprintf(stderr,"%s \n",file_path);
    15581564      statRes=stat(file_path,&myFileInfo);
    15591565      if(statRes==0){
  • trunk/zoo-project/zoo-kernel/service_internal_js.c

    r781 r784  
    7070  JS_MaybeGC(cx);
    7171
    72   char ntmp[1024];
    73   getcwd(ntmp,1024);
    74 
    7572  jsval *argv = JS_ARGV(cx,argv1);
    7673  int i=0;
     
    7875  for(i=0;i<argc;i++){
    7976    char *filename = JSValToChar(cx,&argv[i]);
    80     char *api0=(char*)malloc((strlen(ntmp)+strlen(filename)+2)*sizeof(char));
    81     sprintf(api0,"%s/%s",ntmp,filename);
    8277#ifdef JS_DEBUG
    8378    fprintf(stderr,"Trying to load %s\n",api0);
    8479    fflush(stderr);
    8580#endif
    86     JSObject *api_script1=loadZooApiFile(cx,JS_GetGlobalObject(cx),api0);
    87     free(api0);
     81    JSObject *api_script1=loadZooApiFile(cx,JS_GetGlobalObject(cx),filename);
    8882  }
    8983  JS_MaybeGC(cx);
     
    175169  map* tmpm1=getMap(request,"metapath");
    176170  char ntmp[1024];
    177   getcwd(ntmp,1024);
     171  map* cwdMap=getMapFromMaps(*main_conf,"main","servicePath");
     172  if(cwdMap!=NULL)
     173    sprintf(ntmp,"%s",cwdMap->value);
     174  else
     175    getcwd(ntmp,1024);
    178176
    179177  /**
  • trunk/zoo-project/zoo-kernel/service_internal_php.c

    r738 r784  
    185185  maps* inputs=*real_inputs;
    186186  maps* outputs=*real_outputs;
    187   char ntmp[1024];
    188   getcwd(ntmp,1024);
    189187   
    190188  map* libp = getMapFromMaps(m, "main", "libPath"); 
  • trunk/zoo-project/zoo-kernel/service_internal_python.c

    r781 r784  
    168168  }
    169169  else{
    170     python_path=(char*)".";
     170    map* cwdMap=getMapFromMaps(*main_conf,"main","servicePath");
     171    if(cwdMap!=NULL)
     172      python_path=cwdMap->value;
     173    else
     174      python_path=(char*)".";
    171175  }
    172176  tmp=NULL;
  • trunk/zoo-project/zoo-kernel/sqlapi.c

    r734 r784  
    2727#include "ogrsf_frmts.h"
    2828#include "ogr_p.h"
     29#if GDAL_VERSION_MAJOR >= 2
     30#include <gdal_priv.h>
     31#endif
    2932
    3033#include "sqlapi.h"
     
    3538 * Global GDALDataset pointer
    3639 */
    37 OGRDataSource *zoo_DS = NULL;
     40#if GDAL_VERSION_MAJOR >=2
     41GDALDataset
     42#else
     43OGRDataSource
     44#endif
     45 *zoo_DS = NULL;
    3846
    3947/**
     
    98106  OGRSFDriver *poDriver = NULL;
    99107  OGRRegisterAll();
     108
     109#if GDAL_VERSION_MAJOR >= 2
     110  zoo_DS = (GDALDataset*) GDALOpenEx( sqlInitString,
     111                                      GDAL_OF_UPDATE | GDAL_OF_VECTOR,
     112                                      NULL, NULL, NULL );
     113#else
    100114  zoo_DS = OGRSFDriverRegistrar::Open(sqlInitString,false,&poDriver);
     115#endif
    101116  if( zoo_DS == NULL ){
    102117#ifdef DEBUG
     
    124139    zoo_DS->ReleaseResultSet( zoo_ResultSet );
    125140  if(zoo_DS!=NULL){
     141#if GDAL_VERSION_MAJOR >= 2
     142    GDALClose(zoo_DS);
     143#else
    126144    OGRDataSource::DestroyDataSource( zoo_DS );
     145#endif
    127146    zoo_DS=NULL;
    128147  }
  • trunk/zoo-project/zoo-kernel/sqlapi.h

    r680 r784  
    2525#ifndef ZOO_SQLAPI_H
    2626#define ZOO_SQLAPI_H 1
     27#ifdef RELY_ON_DB
     28#include "service.h"
     29#include "service_internal.h"
    2730
    2831#ifdef __cplusplus
    2932extern "C" {
    3033#endif
    31 
    32 #ifdef RELY_ON_DB
    33 #include "service.h"
    34 #include "service_internal.h"
    3534  ZOO_DLL_EXPORT void init_sql(maps*);
    3635  ZOO_DLL_EXPORT void close_sql(maps*);
     
    4342  ZOO_DLL_EXPORT char* getStatusId(maps*,char*);
    4443  ZOO_DLL_EXPORT void removeService(maps*,char*);
    45 #endif
    4644
    4745#ifdef __cplusplus
     
    5048
    5149#endif
     50#endif
  • 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