source: trunk/gsdl/src/colservr/colservrconfig.cpp@ 1860

Last change on this file since 1860 was 1860, checked in by cs025, 23 years ago

Included CORBA branch for first time

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1/**********************************************************************
2 *
3 * colservrconfig.cpp --
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * A component of the Greenstone digital library software
7 * from the New Zealand Digital Library Project at the
8 * University of Waikato, New Zealand.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 * $Id: colservrconfig.cpp 1860 2001-01-25 18:26:45Z cs025 $
25 *
26 *********************************************************************/
27
28/*
29 $Log$
30 Revision 1.4 2001/01/25 18:26:44 cs025
31 Included CORBA branch for first time
32
33 Revision 1.2.2.1 2000/04/04 15:02:31 cs025
34 Corba first commit
35
36 Revision 1.2 1999/09/07 04:57:20 sjboddie
37 added gpl notice
38
39 Revision 1.1 1999/02/21 22:32:55 rjmcnab
40
41 Initial revision.
42
43 */
44
45
46#include "colservrconfig.h"
47#include "fileutil.h"
48#include "cfgread.h"
49
50
51#if defined(GSDL_USE_OBJECTSPACE)
52# include <ospace/std/iostream>
53# include <ospace/std/fstream>
54#elif defined(GSDL_USE_IOS_H)
55# include <iostream.h>
56# include <fstream.h>
57#else
58# include <iostream>
59# include <fstream>
60#endif
61
62// collect_cfg_read reads collect.cfg returning true on success.
63bool collect_cfg_read (collectserver &cserver, const text_t &gsdlhome,
64 const text_t &collection) {
65 text_t filename = filename_cat (gsdlhome, "collect");
66 filename = filename_cat (filename, collection);
67 filename = filename_cat (filename, "etc");
68 filename = filename_cat (filename, "collect.cfg");
69 if (!file_exists (filename)) {
70 filename = filename_cat (gsdlhome, "etc");
71 filename = filename_cat (filename, "collect.cfg");
72 if (!file_exists (filename)) return false;
73 }
74
75 return cserver.read_configfile(filename);
76 /*
77 // read in the collection configuration file
78 text_t key;
79 text_tarray cfgline;
80 char *cstr = filename.getcstr();
81 ifstream confin (cstr);
82 delete cstr;
83
84 if (confin) {
85 while (read_cfg_line(confin, cfgline) >= 0) {
86 if (cfgline.size () >= 2) {
87 key = cfgline[0];
88 cfgline.erase(cfgline.begin());
89
90 // configure the collection server
91 cserver.configure (key, cfgline);
92 }
93 }
94 confin.close ();
95 return true;
96 }
97 return false;
98 */
99}
100
101
102// build_cfg_read reads build.cfg and returns true on success.
103bool build_cfg_read (collectserver &cserver, const text_t &gsdlhome,
104 const text_t &collection) {
105 text_t filename = filename_cat (gsdlhome, "collect");
106 filename = filename_cat (filename, collection);
107 filename = filename_cat (filename, "index");
108
109 filename = filename_cat (filename, "build.cfg");
110 if (!file_exists (filename)) {
111 filename = filename_cat (gsdlhome, "index");
112 filename = filename_cat (filename, "build.cfg");
113 if (!file_exists (filename)) return false;
114 }
115
116 return cserver.read_configfile(filename);
117
118 /*
119 // read in the build configuration file
120 text_t key;
121 text_tarray cfgline;
122 char *cstr = filename.getcstr();
123 ifstream confin (cstr);
124 delete cstr;
125
126 if (confin) {
127 while (read_cfg_line(confin, cfgline) >= 0) {
128 if (cfgline.size () >= 2) {
129 key = cfgline[0];
130 cfgline.erase(cfgline.begin());
131
132 // configure the collection server
133 cserver.configure (key, cfgline);
134 }
135 }
136 confin.close ();
137 return true;
138 }
139 return false;
140 */
141}
Note: See TracBrowser for help on using the repository browser.