bes  Updated for version 3.20.5
ServerApp.cc
1 // ServerApp.cc
2 
3 // This file is part of bes, A C++ back-end server implementation framework
4 // for the OPeNDAP Data Access Protocol.
5 
6 // Copyright (c) 2004-2009 University Corporation for Atmospheric Research
7 // Author: Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.edu>
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
13 //
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
18 //
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 //
23 // You can contact University Corporation for Atmospheric Research at
24 // 3080 Center Green Drive, Boulder, CO 80301
25 
26 // (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
27 // Please read the full copyright statement in the file COPYRIGHT_UCAR.
28 //
29 // Authors:
30 // pwest Patrick West <pwest@ucar.edu>
31 // jgarcia Jose Garcia <jgarcia@ucar.edu>
32 
33 #include <unistd.h>
34 #include <signal.h>
35 #include <sys/wait.h> // for wait
36 #include <sys/types.h>
37 
38 #include <iostream>
39 #include <fstream>
40 #include <sstream>
41 #include <cstring>
42 #include <cstdlib>
43 #include <cerrno>
44 
45 #include <libxml/xmlmemory.h>
46 
47 using std::cout;
48 using std::cerr;
49 using std::endl;
50 using std::ios;
51 using std::ostringstream;
52 using std::ofstream;
53 
54 #include "config.h"
55 
56 #include "ServerApp.h"
57 #include "ServerExitConditions.h"
58 #include "TheBESKeys.h"
59 #include "BESLog.h"
60 #include "SocketListener.h"
61 #include "TcpSocket.h"
62 #include "UnixSocket.h"
63 #include "BESServerHandler.h"
64 #include "BESError.h"
65 #include "PPTServer.h"
66 #include "BESMemoryManager.h"
67 #include "BESDebug.h"
68 #include "BESCatalogUtils.h"
69 #include "BESServerUtils.h"
70 
71 #include "BESDefaultModule.h"
72 #include "BESXMLDefaultCommands.h"
73 #include "BESDaemonConstants.h"
74 
75 static int session_id = 0;
76 
77 // These are set to 1 by their respective handlers and then processed in the
78 // signal processing loop.
79 static volatile sig_atomic_t sigchild = 0;
80 static volatile sig_atomic_t sigpipe = 0;
81 static volatile sig_atomic_t sigterm = 0;
82 static volatile sig_atomic_t sighup = 0;
83 
84 // Set in ServerApp::initialize().
85 // Added jhrg 9/22/15
86 static volatile int master_listener_pid = -1;
87 
88 static string bes_exit_message(int cpid, int stat)
89 {
90  ostringstream oss;
91  oss << "beslistener child pid: " << cpid;
92  if (WIFEXITED(stat)) { // exited via exit()?
93  oss << " exited with status: " << WEXITSTATUS(stat);
94  }
95  else if (WIFSIGNALED(stat)) { // exited via a signal?
96  oss << " exited with signal: " << WTERMSIG(stat);
97 #ifdef WCOREDUMP
98  if (WCOREDUMP(stat)) oss << " and a core dump!";
99 #endif
100  }
101  else {
102  oss << " exited, but I have no clue as to why";
103  }
104 
105  return oss.str();
106 }
107 
108 // These two functions duplicate code in daemon.cc
109 static void block_signals()
110 {
111  sigset_t set;
112  sigemptyset(&set);
113  sigaddset(&set, SIGCHLD);
114  sigaddset(&set, SIGHUP);
115  sigaddset(&set, SIGTERM);
116  sigaddset(&set, SIGPIPE);
117 
118  if (sigprocmask(SIG_BLOCK, &set, 0) < 0) {
119  throw BESInternalError(string("sigprocmask error: ") + strerror(errno) + " while trying to block signals.",
120  __FILE__, __LINE__);
121  }
122 }
123 
124 static void unblock_signals()
125 {
126  sigset_t set;
127  sigemptyset(&set);
128  sigaddset(&set, SIGCHLD);
129  sigaddset(&set, SIGHUP);
130  sigaddset(&set, SIGTERM);
131  sigaddset(&set, SIGPIPE);
132 
133  if (sigprocmask(SIG_UNBLOCK, &set, 0) < 0) {
134  throw BESInternalError(string("sigprocmask error: ") + strerror(errno) + " while trying to unblock signals.",
135  __FILE__, __LINE__);
136  }
137 }
138 
139 // I moved the signal handlers here so that signal processing would be simpler
140 // and no library calls would be made to functions that are not 'asynch safe'.
141 // This was the fix for ticket 2025 and friends (the zombie process problem).
142 // jhrg 3/3/14
143 
144 // This is needed so that the master bes listener will get the exit status of
145 // all of the child bes listeners (preventing them from becoming zombies).
146 static void CatchSigChild(int sig)
147 {
148  if (sig == SIGCHLD) {
149  sigchild = 1;
150  }
151 }
152 
153 // If the HUP signal is sent to the master beslistener, it should exit and
154 // return a value indicating to the besdaemon that it should be restarted.
155 // This also has the side-affect of re-reading the configuration file.
156 static void CatchSigHup(int sig)
157 {
158  if (sig == SIGHUP) {
159  sighup = 1;
160  }
161 }
162 
163 static void CatchSigPipe(int sig)
164 {
165  if (sig == SIGPIPE) {
166  // When a child listener catches SIGPIPE it is because of a
167  // failure on one of its I/O connections - file I/O or, more
168  // likely, network I/O. I have found that C++ ostream objects
169  // seem to 'hide' sigpipe so that a child listener will run
170  // for some time after the client has dropped the
171  // connection. Whether this is from buffering or some other
172  // problem, the situation happens when either the remote
173  // client to exits (e.g., curl) or when Tomcat is stopped
174  // using SIGTERM. So, even though the normal behavior for a
175  // Unix daemon is to look at error codes from write(), etc.,
176  // and exit based on those, this code exits whenever the child
177  // listener catches SIGPIPE. However, if this is the Master
178  // listener, allow the processing loop to handle this signal
179  // and do not exit. jhrg 9/22/15
180  if (getpid() != master_listener_pid) {
181  (*BESLog::TheLog()) << "Child listener (PID: " << getpid() << ") caught SIGPIPE (master listener PID: "
182  << master_listener_pid << "). Child listener Exiting." << endl;
183 
184  // cleanup code here; only the Master listener should run the code
185  // in ServerApp::terminate(); do nothing for cleanup for a child
186  // listener. jhrg 9/22/15
187 
188  // Note that exit() is not safe for use in a signal
189  // handler, so we fallback to the default behavior, which
190  // is to exit.
191  signal(sig, SIG_DFL);
192  raise(sig);
193  }
194  else {
195  LOG("Master listener (PID: " << getpid() << ") caught SIGPIPE." << endl);
196 
197  sigpipe = 1;
198  }
199  }
200 }
201 
202 // This is the default signal sent by 'kill'; when the master beslistener gets
203 // this signal it should stop. besdaemon should not try to start a new
204 // master beslistener.
205 static void CatchSigTerm(int sig)
206 {
207  if (sig == SIGTERM) {
208  sigterm = 1;
209  }
210 }
211 
220 static void register_signal_handlers()
221 {
222  struct sigaction act;
223  sigemptyset(&act.sa_mask);
224  sigaddset(&act.sa_mask, SIGCHLD);
225  sigaddset(&act.sa_mask, SIGPIPE);
226  sigaddset(&act.sa_mask, SIGTERM);
227  sigaddset(&act.sa_mask, SIGHUP);
228  act.sa_flags = 0;
229 #ifdef SA_RESTART
230  BESDEBUG("beslistener", "beslistener: setting restart for sigchld." << endl);
231  act.sa_flags |= SA_RESTART;
232 #endif
233 
234  BESDEBUG("beslistener", "beslistener: Registering signal handlers ... " << endl);
235 
236  act.sa_handler = CatchSigChild;
237  if (sigaction(SIGCHLD, &act, 0))
238  throw BESInternalFatalError("Could not register a handler to catch beslistener child process status.", __FILE__,
239  __LINE__);
240 
241  act.sa_handler = CatchSigPipe;
242  if (sigaction(SIGPIPE, &act, 0) < 0)
243  throw BESInternalFatalError("Could not register a handler to catch beslistener pipe signal.", __FILE__,
244  __LINE__);
245 
246  act.sa_handler = CatchSigTerm;
247  if (sigaction(SIGTERM, &act, 0) < 0)
248  throw BESInternalFatalError("Could not register a handler to catch beslistener terminate signal.", __FILE__,
249  __LINE__);
250 
251  act.sa_handler = CatchSigHup;
252  if (sigaction(SIGHUP, &act, 0) < 0)
253  throw BESInternalFatalError("Could not register a handler to catch beslistener hup signal.", __FILE__,
254  __LINE__);
255 
256  BESDEBUG("beslistener", "beslistener: OK" << endl);
257 }
258 
259 ServerApp::ServerApp() :
260  BESModuleApp(), _portVal(0), _gotPort(false), _IPVal(""), _gotIP(false), _unixSocket(""), _secure(false), _mypid(0), _ts(0), _us(0), _ps(0)
261 {
262  _mypid = getpid();
263 }
264 
265 ServerApp::~ServerApp()
266 {
267  delete TheBESKeys::TheKeys();
268 
269 #if 0
270  BESCatalogUtils::delete_all_catalogs();
271 #endif
272 
273 }
274 
275 int ServerApp::initialize(int argc, char **argv)
276 {
277  int c = 0;
278  bool needhelp = false;
279  string dashi;
280  string dashc;
281  string dashd = "";
282 
283  // If you change the getopt statement below, be sure to make the
284  // corresponding change in daemon.cc and besctl.in
285  while ((c = getopt(argc, argv, "hvsd:c:p:u:i:r:H:")) != -1) {
286  switch (c) {
287  case 'i':
288  dashi = optarg;
289  break;
290  case 'c':
291  dashc = optarg;
292  break;
293  case 'r':
294  break; // we can ignore the /var/run directory option here
295  case 'p':
296  _portVal = atoi(optarg);
297  _gotPort = true;
298  break;
299  case 'H':
300  _IPVal = optarg;
301  _gotIP = true;
302  break;
303  case 'u':
304  _unixSocket = optarg;
305  break;
306  case 'd':
307  dashd = optarg;
308  // BESDebug::SetUp(optarg);
309  break;
310  case 'v':
311  BESServerUtils::show_version(BESApp::TheApplication()->appName());
312  break;
313  case 's':
314  _secure = true;
315  break;
316  case 'h':
317  case '?':
318  default:
319  needhelp = true;
320  break;
321  }
322  }
323 
324  // before we can do any processing, log any messages, initialize any
325  // modules, do anything, we need to determine where the BES
326  // configuration file lives. From here we get the name of the log
327  // file, group and user id, and information that the modules will
328  // need to run properly.
329 
330  // If the -c option was passed, set the config file name in TheBESKeys
331  if (!dashc.empty()) {
332  TheBESKeys::ConfigFile = dashc;
333  }
334 
335  // If the -c option was not passed, but the -i option
336  // was passed, then use the -i option to construct
337  // the path to the config file
338  if (dashc.empty() && !dashi.empty()) {
339  if (dashi[dashi.length() - 1] != '/') {
340  dashi += '/';
341  }
342  string conf_file = dashi + "etc/bes/bes.conf";
343  TheBESKeys::ConfigFile = conf_file;
344  }
345 
346  if (!dashd.empty()) BESDebug::SetUp(dashd);
347 
348  // register the two debug context for the server and ppt. The
349  // Default Module will register the bes context.
350  BESDebug::Register("server");
351  BESDebug::Register("ppt");
352 
353  // Because we are now running as the user specified in the
354  // configuration file, we won't be able to listen on system ports.
355  // If this is a problem, we may need to move this code above setting
356  // the user and group ids.
357  bool found = false;
358  string port_key = "BES.ServerPort";
359  if (!_gotPort) {
360  string sPort;
361  try {
362  TheBESKeys::TheKeys()->get_value(port_key, sPort, found);
363  }
364  catch (BESError &e) {
365  string err = string("FAILED: ") + e.get_message();
366  cerr << err << endl;
367  LOG(err << endl);
368  exit(SERVER_EXIT_FATAL_CANNOT_START);
369  }
370  if (found) {
371  _portVal = atoi(sPort.c_str());
372  if (_portVal != 0) {
373  _gotPort = true;
374  }
375  }
376  }
377 
378  found = false;
379  string ip_key = "BES.ServerIP";
380  if (!_gotIP) {
381  try {
382  TheBESKeys::TheKeys()->get_value(ip_key, _IPVal, found);
383  }
384  catch (BESError &e) {
385  string err = string("FAILED: ") + e.get_message();
386  cerr << err << endl;
387  LOG(err << endl);
388  exit(SERVER_EXIT_FATAL_CANNOT_START);
389  }
390 
391  if (found) {
392  _gotIP = true;
393  }
394  }
395 
396  found = false;
397  string socket_key = "BES.ServerUnixSocket";
398  if (_unixSocket == "") {
399  try {
400  TheBESKeys::TheKeys()->get_value(socket_key, _unixSocket, found);
401  }
402  catch (BESError &e) {
403  string err = string("FAILED: ") + e.get_message();
404  cerr << err << endl;
405  LOG(err << endl);
406  exit(SERVER_EXIT_FATAL_CANNOT_START);
407  }
408  }
409 
410  if (!_gotPort && _unixSocket == "") {
411  string msg = "Must specify a tcp port or a unix socket or both\n";
412  msg += "Please specify on the command line with -p <port>";
413  msg += " and/or -u <unix_socket>\n";
414  msg += "Or specify in the bes configuration file with " + port_key + " and/or " + socket_key + "\n";
415  cout << endl << msg;
416  LOG(msg << endl);
417  BESServerUtils::show_usage(BESApp::TheApplication()->appName());
418  }
419 
420  found = false;
421  if (_secure == false) {
422  string key = "BES.ServerSecure";
423  string isSecure;
424  try {
425  TheBESKeys::TheKeys()->get_value(key, isSecure, found);
426  }
427  catch (BESError &e) {
428  string err = string("FAILED: ") + e.get_message();
429  cerr << err << endl;
430  LOG(err << endl);
431  exit(SERVER_EXIT_FATAL_CANNOT_START);
432  }
433  if (isSecure == "Yes" || isSecure == "YES" || isSecure == "yes") {
434  _secure = true;
435  }
436  }
437 
438  BESDEBUG("beslistener", "beslistener: initializing default module ... " << endl);
439  BESDefaultModule::initialize(argc, argv);
440  BESDEBUG("beslistener", "beslistener: done initializing default module" << endl);
441 
442  BESDEBUG("beslistener", "beslistener: initializing default commands ... " << endl);
444  BESDEBUG("beslistener", "beslistener: done initializing default commands" << endl);
445 
446  // This will load and initialize all of the modules
447  BESDEBUG("beslistener", "beslistener: initializing loaded modules ... " << endl);
448  int ret = BESModuleApp::initialize(argc, argv);
449  BESDEBUG("beslistener", "beslistener: done initializing loaded modules" << endl);
450 
451  BESDEBUG("beslistener", "beslistener: initialized settings:" << *this);
452 
453  if (needhelp) {
454  BESServerUtils::show_usage(BESApp::TheApplication()->appName());
455  }
456 
457  // This sets the process group to be ID of this process. All children
458  // will get this GID. Then use killpg() to send a signal to this process
459  // and all of the children.
460  session_id = setsid();
461  BESDEBUG("beslistener", "beslistener: The master beslistener session id (group id): " << session_id << endl);
462 
463  master_listener_pid = getpid();
464  BESDEBUG("beslistener", "beslistener: The master beslistener Process id: " << master_listener_pid << endl);
465 
466  return ret;
467 }
468 
470 {
471  try {
472  BESDEBUG("beslistener", "beslistener: initializing memory pool ... " << endl);
473  BESMemoryManager::initialize_memory_pool();
474  BESDEBUG("beslistener", "OK" << endl);
475 
476  SocketListener listener;
477  if (_portVal) {
478  if (!_IPVal.empty())
479  _ts = new TcpSocket(_IPVal, _portVal);
480  else
481  _ts = new TcpSocket(_portVal);
482 
483  listener.listen(_ts);
484 
485  BESDEBUG("beslistener", "beslistener: listening on port (" << _portVal << ")" << endl);
486 
487  // Write to stdout works because the besdaemon is listening on the
488  // other end of a pipe where the pipe fd[1] has been dup2'd to
489  // stdout. See daemon.cc:start_master_beslistener.
490  // NB BESLISTENER_PIPE_FD is 1 (stdout)
491  int status = BESLISTENER_RUNNING;
492  int res = write(BESLISTENER_PIPE_FD, &status, sizeof(status));
493 
494  if (res == -1) {
495  LOG("Master listener could not send status to daemon: " << strerror(errno) << endl);
496  ::exit(SERVER_EXIT_FATAL_CANNOT_START);
497  }
498  }
499 
500  if (!_unixSocket.empty()) {
501  _us = new UnixSocket(_unixSocket);
502  listener.listen(_us);
503  BESDEBUG("beslistener", "beslistener: listening on unix socket (" << _unixSocket << ")" << endl);
504  }
505 
506  BESServerHandler handler;
507 
508  _ps = new PPTServer(&handler, &listener, _secure);
509 
510  register_signal_handlers();
511 
512  // Loop forever, processing signals and running the code in PPTServer::initConnection().
513  // NB: The code in initConnection() used to loop forever, but I moved that out to here
514  // so the signal handlers could be in this class. The PPTServer::initConnection() method
515  // is also used by daemon.cc but this class (ServerApp; the beslistener) and the besdaemon
516  // need to do different things for the signals like HUP and TERM, so they cannot share
517  // the signal processing code. One fix for the problem described in ticket 2025 was to
518  // move the signal handlers into PPTServer. Changing how the 'forever' loops are organized
519  // and keeping the signal processing code here (and in daemon.cc) is another solution that
520  // preserves the correct behavior of the besdaemon, too. jhrg 3/5/14
521  while (true) {
522  block_signals();
523 
524  if (sigterm | sighup | sigchild | sigpipe) {
525  int stat;
526  pid_t cpid;
527  while ((cpid = wait4(0 /*any child in the process group*/, &stat, WNOHANG, 0/*no rusage*/)) > 0) {
528  _ps->decr_num_children();
529  if (sigpipe) {
530  LOG("Master listener caught SISPIPE from child: " << cpid << endl);
531  }
532 
533  BESDEBUG("ppt2",
534  bes_exit_message(cpid, stat) << "; num children: " << _ps->get_num_children() << endl);
535  }
536  }
537 
538  if (sighup) {
539  BESDEBUG("ppt2", "Master listener caught SIGHUP, exiting with SERVER_EXIT_RESTART" << endl);
540 
541  LOG("Master listener caught SIGHUP, exiting with SERVER_EXIT_RESTART" << endl);
542  ::exit(SERVER_EXIT_RESTART);
543  }
544 
545  if (sigterm) {
546  BESDEBUG("ppt2", "Master listener caught SIGTERM, exiting with SERVER_NORMAL_SHUTDOWN" << endl);
547 
548  LOG("Master listener caught SIGTERM, exiting with SERVER_NORMAL_SHUTDOWN" << endl);
549  ::exit(SERVER_EXIT_NORMAL_SHUTDOWN);
550  }
551 
552  sigchild = 0; // Only reset this signal, all others cause an exit/restart
553  unblock_signals();
554 
555  // This is where the 'child listener' is started. This method will call
556  // BESServerHandler::handle(...) that will, in turn, fork. The child process
557  // becomes the 'child listener' that actually processes a request.
558  //
559  // This call blocks, using select(), until a client asks for another beslistener.
560  _ps->initConnection();
561  }
562 
563  _ps->closeConnection();
564  }
565  catch (BESError &se) {
566  BESDEBUG("beslistener", "beslistener: caught BESError (" << se.get_message() << ")" << endl);
567 
568  LOG(se.get_message() << endl);
569  int status = SERVER_EXIT_FATAL_CANNOT_START;
570  write(BESLISTENER_PIPE_FD, &status, sizeof(status));
571  close(BESLISTENER_PIPE_FD);
572  return 1;
573  }
574  catch (...) {
575  LOG("caught unknown exception initializing sockets" << endl);
576  int status = SERVER_EXIT_FATAL_CANNOT_START;
577  write(BESLISTENER_PIPE_FD, &status, sizeof(status));
578  close(BESLISTENER_PIPE_FD);
579  return 1;
580  }
581 
582  close(BESLISTENER_PIPE_FD);
583  return 0;
584 }
585 
587 {
588  pid_t apppid = getpid();
589  if (apppid == _mypid) {
590  // These are all safe to call in a signalhandler
591  if (_ps) {
592  _ps->closeConnection();
593  delete _ps;
594  }
595  if (_ts) {
596  _ts->close();
597  delete _ts;
598  }
599  if (_us) {
600  _us->close();
601  delete _us;
602  }
603 
604  // Do this in the reverse order that it was initialized. So
605  // terminate the loaded modules first, then the default
606  // commands, then the default module.
607 
608  // These are not safe to call in a signal handler
609  BESDEBUG("beslistener", "beslistener: terminating loaded modules ... " << endl);
611  BESDEBUG("beslistener", "beslistener: done terminating loaded modules" << endl);
612 
613  BESDEBUG("beslistener", "beslistener: terminating default commands ... " << endl);
615  BESDEBUG("beslistener", "beslistener: done terminating default commands ... " << endl);
616 
617  BESDEBUG("beslistener", "beslistener: terminating default module ... " << endl);
618  BESDefaultModule::terminate();
619  BESDEBUG("beslistener", "beslistener: done terminating default module ... " << endl);
620 
621  xmlCleanupParser();
622  }
623  return sig;
624 }
625 
632 void ServerApp::dump(ostream &strm) const
633 {
634  strm << BESIndent::LMarg << "ServerApp::dump - (" << (void *) this << ")" << endl;
635  BESIndent::Indent();
636  strm << BESIndent::LMarg << "got IP? " << _gotIP << endl;
637  strm << BESIndent::LMarg << "IP: " << _IPVal << endl;
638  strm << BESIndent::LMarg << "got port? " << _gotPort << endl;
639  strm << BESIndent::LMarg << "port: " << _portVal << endl;
640  strm << BESIndent::LMarg << "unix socket: " << _unixSocket << endl;
641  strm << BESIndent::LMarg << "is secure? " << _secure << endl;
642  strm << BESIndent::LMarg << "pid: " << _mypid << endl;
643  if (_ts) {
644  strm << BESIndent::LMarg << "tcp socket:" << endl;
645  BESIndent::Indent();
646  _ts->dump(strm);
647  BESIndent::UnIndent();
648  }
649  else {
650  strm << BESIndent::LMarg << "tcp socket: null" << endl;
651  }
652  if (_us) {
653  strm << BESIndent::LMarg << "unix socket:" << endl;
654  BESIndent::Indent();
655  _us->dump(strm);
656  BESIndent::UnIndent();
657  }
658  else {
659  strm << BESIndent::LMarg << "unix socket: null" << endl;
660  }
661  if (_ps) {
662  strm << BESIndent::LMarg << "ppt server:" << endl;
663  BESIndent::Indent();
664  _ps->dump(strm);
665  BESIndent::UnIndent();
666  }
667  else {
668  strm << BESIndent::LMarg << "ppt server: null" << endl;
669  }
670  BESModuleApp::dump(strm);
671  BESIndent::UnIndent();
672 }
673 
674 int main(int argc, char **argv)
675 {
676  try {
677  ServerApp app;
678  return app.main(argc, argv);
679  }
680  catch (BESError &e) {
681  cerr << "Caught unhandled exception: " << endl;
682  cerr << e.get_message() << endl;
683  return 1;
684  }
685  catch (...) {
686  cerr << "Caught unhandled, unknown exception" << endl;
687  return 1;
688  }
689  return 0;
690 }
691 
exception thrown if an internal error is found and is fatal to the BES
exception thrown if inernal error encountered
static void Register(const std::string &flagName)
register the specified debug flag
Definition: BESDebug.h:138
virtual std::string get_message()
get the error message for this exception
Definition: BESError.h:99
void get_value(const std::string &s, std::string &val, bool &found)
Retrieve the value of a given key, if set.
Definition: TheBESKeys.cc:420
static void SetUp(const std::string &values)
Sets up debugging for the bes.
Definition: BESDebug.cc:64
virtual int terminate(int sig=0)
clean up after the application
static int terminate(void)
Removes the default set of BES XML commands from the list of possible commands.
static int initialize(int argc, char **argv)
Loads the default set of BES XML commands.
Abstract exception class for the BES with basic string message.
Definition: BESError.h:58
static TheBESKeys * TheKeys()
Definition: TheBESKeys.cc:61
virtual int main(int argC, char **argV)
main routine, the main entry point for any BES applications.
Definition: BESApp.cc:53
virtual void dump(ostream &strm) const
dumps information about this object
Definition: ServerApp.cc:632
virtual int terminate(int sig=0)
clean up after the application
Definition: ServerApp.cc:586
virtual void dump(ostream &strm) const
dumps information about this object
virtual int initialize(int argC, char **argV)
Load and initialize any BES modules.
Definition: ServerApp.cc:275
Base application object for all BES applications.
Definition: BESModuleApp.h:59
virtual int initialize(int argC, char **argV)
Load and initialize any BES modules.
Definition: BESModuleApp.cc:69
static BESApp * TheApplication(void)
Returns the BESApp application object for this application.
Definition: BESApp.h:137
virtual int run()
The body of the application, implementing the primary functionality of the BES application.
Definition: ServerApp.cc:469
static std::string ConfigFile
Definition: TheBESKeys.h:147