Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes

ServerApp Class Reference

#include <ServerApp.h>

Inheritance diagram for ServerApp:
Inheritance graph
[legend]
Collaboration diagram for ServerApp:
Collaboration graph
[legend]

List of all members.

Public Member Functions

string appName (void) const
 Returns the name of the application.
virtual void dump (ostream &strm) const
 dumps information about this object
virtual int initialize (int argC, char **argV)
 Load and initialize any BES modules.
virtual int main (int argC, char **argV)
 main method of the BES application
virtual int run ()
 the applications functionality is implemented in the run method
 ServerApp ()
virtual int terminate (int sig=0)
 clean up after the application
virtual ~ServerApp ()

Static Public Member Functions

static void signalInterrupt (int sig)
static void signalRestart (int sig)
static void signalTerminate (int sig)
static BESApp * TheApplication (void)
 Returns the BESApp application object for this application.

Protected Attributes

string _appName
bool _debug
bool _isInitialized

Static Protected Attributes

static BESApp * _theApplication = 0

Detailed Description

Definition at line 43 of file ServerApp.h.


Constructor & Destructor Documentation

ServerApp::ServerApp (  ) 

Definition at line 69 of file ServerApp.cc.

ServerApp::~ServerApp (  )  [virtual]

Definition at line 83 of file ServerApp.cc.


Member Function Documentation

string BESApp::appName ( void   )  const [inline, inherited]

Returns the name of the application.

The name of the application is typically argv[0] passed into the main function. But could be passed into the application or derived in a different way.

Returns:
name of the application

Definition at line 132 of file BESApp.h.

References BESApp::_appName.

Referenced by BESBaseApp::dump(), initialize(), CmdApp::signalBrokenPipe(), CmdApp::signalCannotConnect(), CmdApp::signalInterrupt(), and CmdApp::signalTerminate().

void ServerApp::dump ( ostream &  strm  )  const [virtual]

dumps information about this object

Displays the pointer value of this instance

Parameters:
strm C++ i/o stream to dump the information to

Reimplemented from BESModuleApp.

Definition at line 629 of file ServerApp.cc.

References PPTServer::dump(), UnixSocket::dump(), TcpSocket::dump(), BESIndent::Indent(), BESIndent::LMarg(), and BESIndent::UnIndent().

Here is the call graph for this function:

int ServerApp::initialize ( int  argC,
char **  argV 
) [virtual]

Load and initialize any BES modules.

Returns:
0 if successful and not 0 otherwise
Parameters:
argC argc value passed to the main function
argV argv value passed to the main function

Reimplemented from BESModuleApp.

Definition at line 285 of file ServerApp.cc.

References BESApp::appName(), BESDEBUG, TheBESKeys::ConfigFile, BESError::get_message(), BESKeys::get_value(), BESDebug::Register(), SERVER_EXIT_FATAL_CAN_NOT_START, BESDebug::SetUp(), BESServerUtils::show_usage(), BESServerUtils::show_version(), signalInterrupt(), signalRestart(), signalTerminate(), BESApp::TheApplication(), TheBESKeys::TheKeys(), and BESLog::TheLog().

Here is the call graph for this function:

int BESBaseApp::main ( int  argC,
char **  argV 
) [virtual, inherited]

main method of the BES application

sets the appName to argv[0], then calls initialize, run, and terminate in that order. Exceptions should be caught in the individual methods initialize, run and terminate and handled there.

Returns:
0 if successful and not 0 otherwise
Parameters:
argC argc value passed to the main function
argV argv value passed to the main function

Implements BESApp.

Definition at line 75 of file BESBaseApp.cc.

References BESApp::_appName, BESBaseApp::initialize(), BESBaseApp::run(), and BESBaseApp::terminate().

Referenced by main().

Here is the call graph for this function:

int ServerApp::run ( void   )  [virtual]

the applications functionality is implemented in the run method

It is up to the derived class to implement this method.

Returns:
0 if successful and not 0 otherwise
Exceptions:
BESError if the derived class does not implement this method

Reimplemented from BESBaseApp.

Definition at line 536 of file ServerApp.cc.

References BESDEBUG, BESError::get_message(), PPTServer::initConnection(), BESMemoryManager::initialize_memory_pool(), SocketListener::listen(), and BESLog::TheLog().

Here is the call graph for this function:

void ServerApp::signalInterrupt ( int  sig  )  [static]

Definition at line 98 of file ServerApp.cc.

References SERVER_EXIT_NORMAL_SHUTDOWN, BESApp::terminate(), and BESApp::TheApplication().

Referenced by initialize().

Here is the call graph for this function:

void ServerApp::signalRestart ( int  sig  )  [static]

Definition at line 108 of file ServerApp.cc.

References SERVER_EXIT_RESTART, BESApp::terminate(), and BESApp::TheApplication().

Referenced by initialize().

Here is the call graph for this function:

void ServerApp::signalTerminate ( int  sig  )  [static]

Definition at line 88 of file ServerApp.cc.

References SERVER_EXIT_NORMAL_SHUTDOWN, BESApp::terminate(), and BESApp::TheApplication().

Referenced by initialize().

Here is the call graph for this function:

int ServerApp::terminate ( int  sig = 0  )  [virtual]

clean up after the application

Calls terminate on each of the loaded modules

Returns:
0 if successful and not 0 otherwise
Parameters:
sig if the application is terminating due to a signal, otherwise 0 is passed.

Reimplemented from BESModuleApp.

Definition at line 586 of file ServerApp.cc.

References BESDEBUG, UnixSocket::close(), Socket::close(), and PPTServer::closeConnection().

Here is the call graph for this function:

static BESApp* BESApp::TheApplication ( void   )  [inline, static, inherited]

Returns the BESApp application object for this application.

Returns:
The application object

Definition at line 138 of file BESApp.h.

References BESApp::_theApplication.

Referenced by initialize(), CmdApp::signalBrokenPipe(), CmdApp::signalCannotConnect(), signalInterrupt(), CmdApp::signalInterrupt(), signalRestart(), signalTerminate(), and CmdApp::signalTerminate().


Member Data Documentation

string BESApp::_appName [protected, inherited]

Definition at line 60 of file BESApp.h.

Referenced by BESApp::appName(), and BESBaseApp::main().

bool BESApp::_debug [protected, inherited]

Definition at line 61 of file BESApp.h.

bool BESApp::_isInitialized [protected, inherited]

Definition at line 62 of file BESApp.h.

Referenced by BESBaseApp::dump(), BESBaseApp::initialize(), and BESBaseApp::terminate().

BESApp * BESApp::_theApplication = 0 [static, protected, inherited]

Definition at line 63 of file BESApp.h.

Referenced by BESApp::TheApplication().


The documentation for this class was generated from the following files: