00001 // -*- C++ -*- 00002 00003 // Trading_Loader.h,v 1.14 2005/11/03 17:38:46 ossama Exp 00004 00005 // =========================================================================== 00006 // FILENAME 00007 // Trading_Loader.h 00008 // 00009 // DESCRIPTION 00010 // This class loads the Trading Service dynamically 00011 // either from svc.conf file or <string_to_object> call. 00012 // 00013 // AUTHORS 00014 // Priyanka Gontla <pgontla@ece.uci.edu> 00015 // 00016 // ========================================================================== 00017 00018 #ifndef TAO_TRADING_LOADER_H 00019 #define TAO_TRADING_LOADER_H 00020 00021 #include "orbsvcs/Trader/Trader.h" 00022 00023 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00024 # pragma once 00025 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00026 00027 #include "orbsvcs/IOR_Multicast.h" 00028 #include "orbsvcs/Trader/Service_Type_Repository.h" 00029 00030 #include "tao/Object_Loader.h" 00031 #include "tao/Utils/ORB_Manager.h" 00032 #include "ace/Auto_Ptr.h" 00033 00034 class TAO_Trading_Serv_Export TAO_Trading_Loader : public TAO_Object_Loader 00035 { 00036 public: 00037 00038 TAO_Trading_Loader (void); 00039 // Constructor 00040 00041 ~TAO_Trading_Loader (void); 00042 // Destructor 00043 00044 virtual int init (int argc, ACE_TCHAR *argv[]); 00045 // Called by the Service Configurator framework to initialize the 00046 // Event Service. Defined in <ace/Service_Config.h> 00047 00048 virtual int fini (void); 00049 // Called by the Service Configurator framework to remove the 00050 // Event Service. Defined in <ace/Service_Config.h> 00051 00052 int run (ACE_ENV_SINGLE_ARG_DECL); 00053 // Run the Trading Service 00054 00055 CORBA::Object_ptr create_object (CORBA::ORB_ptr orb, 00056 int argc, 00057 ACE_TCHAR *argv[] 00058 ACE_ENV_ARG_DECL) 00059 ACE_THROW_SPEC ((CORBA::SystemException)); 00060 // This function call initializes the Trading Service given a reference to the 00061 // ORB and the command line parameters. 00062 00063 protected: 00064 00065 int init_multicast_server (void); 00066 // Enable the Trading Service to answer multicast requests for its 00067 // IOR. 00068 00069 int bootstrap_to_federation (ACE_ENV_SINGLE_ARG_DECL); 00070 // Bootstrap to another trader, and attach to its trader network. 00071 00072 int parse_args (int &argc, ACE_TCHAR *argv []); 00073 // Parses the command line arguments 00074 00075 TAO_ORB_Manager orb_manager_; 00076 // The ORB manager. 00077 00078 auto_ptr<TAO_Trader_Factory::TAO_TRADER> trader_; 00079 // Pointer to the linked trader. 00080 00081 TAO_Service_Type_Repository type_repos_; 00082 // Service Type Repository used by the trading service. 00083 00084 CORBA::String_var ior_; 00085 // IOR of the trader kept around for handiness purposes. 00086 00087 CORBA::Boolean federate_; 00088 // Flag indicating whether this trader should join the federation. 00089 00090 FILE *ior_output_file_; 00091 // File to output the Naming Service IOR. 00092 00093 CORBA::String_var name_; 00094 // Name of this trading service: "hostname:pid". 00095 00096 TAO_IOR_Multicast ior_multicast_; 00097 // Event handler that responds to resolve_initial_references 00098 // requests. 00099 00100 CORBA::Boolean bootstrapper_; 00101 // Flag inidicating whether we're the trader others are bootstrapping to. 00102 00103 CORBA::Boolean dumpior_; 00104 // Flag indication whether to dump the ior to standard output 00105 00106 private: 00107 00108 // Disallow copying and assignment. 00109 TAO_Trading_Loader (const TAO_Trading_Loader &); 00110 TAO_Trading_Loader &operator= (const TAO_Trading_Loader &); 00111 00112 }; 00113 00114 ACE_FACTORY_DECLARE (TAO_Trading_Serv, TAO_Trading_Loader) 00115 00116 #endif /* TAO_TRADING_LOADER_H */