00001 // OSB library ************************************************ -*- C++ -*- 00006 /* 00007 AUTHOR(S): Stephan Broennimann (vb) 00008 00009 RCS information 00010 $Name: OSB_060808 $ 00011 $Revision: 1.8 $ 00012 00013 License 00014 OSB rating and billing library for communication networks 00015 Copyright (C) 2004, 2005, 2006 OSB systems 00016 00017 This file may be distributed and/or modify under the terms of the 00018 GNU General Public License (GPL) as published by the Free Software 00019 Foundation which is provided in the file LICENSE.GPL included in the 00020 packaging of this file. 00021 00022 The file is distributed in the hope that it will be useful, but WITHOUT 00023 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00024 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00025 for more details. 00026 00027 Holders of a OSB Commercial License may use this file under the terms 00028 and conditions of this commercial license. 00029 */ 00030 #ifndef _RQSAPP_H_ 00031 #define _RQSAPP_H_ 00032 00033 // ************************************************************************ 00034 // included header files 00035 // + standard includes 00036 #include <string> 00037 00038 // + libraries 00039 #include <ace/Event_Handler.h> 00040 #include <orbsvcs/CosNamingS.h> 00041 #include <tao/ORB.h> 00042 00043 // + local headers 00044 #include "rqsglobal.h" 00045 #include "rqsthread.h" 00046 00047 // + class declarations 00048 namespace OSB_CORBA { 00049 class CorbaContext; 00050 } 00051 00052 // ************************************************************************ 00053 // forward declarations 00054 00055 // ************************************************************************ 00056 // type definitions 00057 00058 // ************************************************************************ 00059 // class definitions 00061 class RqsAppGlobal : public RqsGlobal { 00062 public: 00064 RqsAppGlobal( 00065 const OSB_CORBA::CorbaContext& context 00066 ); 00068 ~RqsAppGlobal(); 00069 00070 private: 00072 RqsAppGlobal(const RqsAppGlobal&); 00074 RqsAppGlobal& operator=(const RqsAppGlobal&); 00075 00076 public: 00078 OSB_LIB::RequestHandler& srqHandler(); 00080 ServerInfoPtr srvInfo(); 00081 public: 00083 std::string appTag_; 00085 std::string dbName_; 00087 std::string dbUser_; 00088 private: 00090 const OSB_CORBA::CorbaContext& context_; 00092 OSB_LIB::RequestHandler* srqHandler_; 00093 }; // class RqsAppGlobal 00094 00096 class ServerApp : public ACE_Event_Handler { 00097 public: 00099 static const std::string nsName_; 00100 public: 00102 ServerApp( 00103 OSB_CORBA::CorbaContext& context 00104 ); 00105 private: 00107 ServerApp(const ServerApp&); 00109 ServerApp& operator=(const ServerApp&); 00110 public: 00112 bool init( 00113 int argc, 00114 char* const argv[] 00115 ); 00116 00117 void creAppServant(); // this could be virtual 00118 00120 void run(); 00122 void shutdown(bool waitCompletion); 00124 void destroy(); 00125 private: 00127 void initOrb(int argc, char* const argv[]); 00129 void initPoa(); 00131 void getNc(); 00140 int handle_signal(int signum, siginfo_t*, ucontext_t*); 00141 00142 private: 00144 OSB_CORBA::CorbaContext& context_; 00145 00147 RqsThread backEnd_; 00148 00150 00151 00152 bool corbaOk_; 00154 CORBA::ORB_var orb_; 00156 PortableServer::POA_var rootPoa_; 00158 PortableServer::POA_var rqsPoa_; 00160 CosNaming::NamingContext_var nc_; 00162 PortableServer::ServantBase_var rqsServant_; 00164 }; // ServerApp 00165 00166 // ************************************************************************ 00167 // inline definitions 00168 #endif // #ifndef _RQSAPP_H_