Ignore:
Timestamp:
Jun 17, 2015, 5:52:29 PM (9 years ago)
Author:
djay
Message:

Fixes in configure.ac. Fix in registry creation. Fixes for Data node for WPS version 2.0.0.

File:
1 edited

Legend:

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

    r667 r673  
    206206createRegistry (maps* m,registry ** r, char *reg_dir, int saved_stdout)
    207207{
    208   struct dirent *dp;
    209   int scount = 0;
    210 
     208  char registryKeys[3][15]={
     209    "concept",
     210    "generic",
     211    "implementation"
     212  };
     213  int scount = 0,i=0;
    211214  if (reg_dir == NULL)
    212215    return 0;
    213   DIR *dirp = opendir (reg_dir);
    214   if (dirp == NULL)
    215     {
    216       return -1;
    217     }
    218   while ((dp = readdir (dirp)) != NULL){
    219     if ((dp->d_type == DT_DIR || dp->d_type == DT_LNK) && dp->d_name[0] != '.')
    220       {
    221 
    222         char * tmpName =
    223           (char *) malloc ((strlen (reg_dir) + strlen (dp->d_name) + 2) *
    224                            sizeof (char));
    225         sprintf (tmpName, "%s/%s", reg_dir, dp->d_name);
    226        
    227         DIR *dirp1 = opendir (tmpName);
    228         struct dirent *dp1;
    229         while ((dp1 = readdir (dirp1)) != NULL){
    230           char* extn = strstr(dp1->d_name, ".zcfg");
    231           if(dp1->d_name[0] != '.' && extn != NULL && strlen(extn) == 5)
     216  for(i=0;i<3;i++){
     217    char * tmpName =
     218      (char *) malloc ((strlen (reg_dir) + strlen (registryKeys[i]) + 2) *
     219                       sizeof (char));
     220    sprintf (tmpName, "%s/%s", reg_dir, registryKeys[i]);
     221   
     222    DIR *dirp1 = opendir (tmpName);
     223    struct dirent *dp1;
     224    while ((dp1 = readdir (dirp1)) != NULL){
     225      char* extn = strstr(dp1->d_name, ".zcfg");
     226      if(dp1->d_name[0] != '.' && extn != NULL && strlen(extn) == 5)
     227        {
     228          int t;
     229          char *tmps1=
     230            (char *) malloc ((strlen (tmpName) + strlen (dp1->d_name) + 2) *
     231                             sizeof (char));
     232          sprintf (tmps1, "%s/%s", tmpName, dp1->d_name);
     233          char *tmpsn = zStrdup (dp1->d_name);
     234          tmpsn[strlen (tmpsn) - 5] = 0;
     235          service* s1 = (service *) malloc (SERVICE_SIZE);
     236          if (s1 == NULL)
    232237            {
    233               int t;
    234               char *tmps1=
    235                 (char *) malloc ((strlen (tmpName) + strlen (dp1->d_name) + 2) *
    236                                  sizeof (char));
    237               sprintf (tmps1, "%s/%s", tmpName, dp1->d_name);
    238               char *tmpsn = zStrdup (dp1->d_name);
    239               tmpsn[strlen (tmpsn) - 5] = 0;
    240               service* s1 = (service *) malloc (SERVICE_SIZE);
    241               if (s1 == NULL)
    242                 {
    243                   dup2 (saved_stdout, fileno (stdout));
    244                   errorException (m, _("Unable to allocate memory."),
    245                                   "InternalError", NULL);
    246                   return -1;
    247                 }
    248               t = readServiceFile (m, tmps1, &s1, tmpsn);
    249               free (tmpsn);
    250               if (t < 0)
    251                 {
    252                   map *tmp00 = getMapFromMaps (m, "lenv", "message");
    253                   char tmp01[1024];
    254                   if (tmp00 != NULL)
    255                     sprintf (tmp01, _("Unable to parse the ZCFG file: %s (%s)"),
    256                              dp1->d_name, tmp00->value);
    257                   else
    258                     sprintf (tmp01, _("Unable to parse the ZCFG file: %s."),
    259                              dp1->d_name);
    260                   dup2 (saved_stdout, fileno (stdout));
    261                   errorException (m, tmp01, "InternalError", NULL);
    262                   return -1;
    263                 }
    264 #ifdef DEBUG
    265               dumpService (s1);
    266               fflush (stdout);
    267               fflush (stderr);
    268 #endif
    269               if(strncasecmp(dp->d_name,"implementation",14)==0){
    270                 inheritance(*r,&s1);
    271               }
    272               addServiceToRegistry(r,dp->d_name,s1);
    273               freeService (&s1);
    274               free (s1);
    275               scount++;
     238              dup2 (saved_stdout, fileno (stdout));
     239              errorException (m, _("Unable to allocate memory."),
     240                              "InternalError", NULL);
     241              return -1;
    276242            }
     243          t = readServiceFile (m, tmps1, &s1, tmpsn);
     244          free (tmpsn);
     245          if (t < 0)
     246            {
     247              map *tmp00 = getMapFromMaps (m, "lenv", "message");
     248              char tmp01[1024];
     249              if (tmp00 != NULL)
     250                sprintf (tmp01, _("Unable to parse the ZCFG file: %s (%s)"),
     251                         dp1->d_name, tmp00->value);
     252              else
     253                sprintf (tmp01, _("Unable to parse the ZCFG file: %s."),
     254                         dp1->d_name);
     255              dup2 (saved_stdout, fileno (stdout));
     256              errorException (m, tmp01, "InternalError", NULL);
     257              return -1;
     258            }
     259#ifdef DEBUG
     260          dumpService (s1);
     261          fflush (stdout);
     262          fflush (stderr);
     263#endif
     264          if(strncasecmp(registryKeys[i],"implementation",14)==0){
     265            inheritance(*r,&s1);
     266          }
     267          addServiceToRegistry(r,registryKeys[i],s1);
     268          freeService (&s1);
     269          free (s1);
     270          scount++;
    277271        }
    278         (void) closedir (dirp1);
    279       }
     272    }
     273    (void) closedir (dirp1);
    280274  }
    281   (void) closedir (dirp);
    282275  return 0;
    283276}
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