Ignore:
Timestamp:
Nov 4, 2016, 4:58:41 PM (6 years ago)
Author:
knut
Message:

Added support for include mechanism in the main.cfg file. An [include] block can be added in main.cfg, like this:

[include]
servicename1 = /my/service/repository/service1.zcfg
servicename2 = /my/service/repository/service2.zcfg
...

The word "include" thus has a special (reserved) meaning, just as "main" does. If necessary, a user may change "include" to something else by redefining the IMPORTSERVICE macro.

The service name (left hand side) should match the [service name] in the config (zcfg) file, but the path/file name (right hand side) may be arbitrary.

When handling requests, Zoo will first check if there is an [include] block, then recursively search the working directory (CWD) and subdirectories as before. If an [include]d service happens to be located in a CWD (sub)directory, it will be published by its [include]d name.

As currently implemented, Zoo will search CWD for the library files of [include]d services if the libPath parameter is not set (note that presently only C and PHP services support the libPath parameter).

Added new function (zoo_path_compare) to check if two path strings refer to the same physical file. It should handle symbolic links (typically, Linux/Unix?) and different path separators (typically, Windows).

File:
1 edited

Legend:

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

    r785 r789  
    3535#endif
    3636#include <signal.h>
     37
     38// #include <stdlib.h>
     39/*
     40 * Compare two file path strings to see if they refer to the same file.
     41 *
     42 * @param path1 the first file path
     43 * @param path2 the second file path
     44 *
     45 * @return 0 if the files are identical
     46 */
     47#define PATHBUFSIZE 4096
     48int zoo_path_compare(char* path1, char* path2) {
     49
     50  if (path1 == NULL || path2 == NULL) {
     51    return -1;
     52  }
     53
     54  char realpath1[PATHBUFSIZE];
     55  char realpath2[PATHBUFSIZE];
     56
     57#ifdef WIN32
     58  int res1 = GetFullPathName(path1, PATHBUFSIZE, realpath1, NULL);
     59  int res2 = GetFullPathName(path2, PATHBUFSIZE, realpath2, NULL);
     60
     61  if (res1 == 0 || res2 == 0) {
     62    return -1;
     63  }
     64  else {
     65    return strncasecmp(realpath1, realpath2, PATHBUFSIZE);
     66  }
     67#else
     68  char* ptr1 = realpath(path1, realpath1);
     69  char* ptr2 = realpath(path2, realpath2);
     70
     71  if (ptr1 == NULL || ptr2 == NULL) {
     72    return -1;
     73  }
     74  else {
     75    return strncmp(realpath1, realpath2, PATHBUFSIZE);
     76  }
     77#endif
     78}
    3779
    3880/**
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