00001 // -*- C++ -*- 00002 00003 // $Id: Trading_Loader.h 77001 2007-02-12 07:54:49Z johnnyw $ 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 (void); 00053 // Run the Trading Service 00054 00055 CORBA::Object_ptr create_object (CORBA::ORB_ptr orb, 00056 int argc, 00057 ACE_TCHAR *argv[]); 00058 // This function call initializes the Trading Service given a reference to the 00059 // ORB and the command line parameters. 00060 00061 protected: 00062 00063 int init_multicast_server (void); 00064 // Enable the Trading Service to answer multicast requests for its 00065 // IOR. 00066 00067 int bootstrap_to_federation (void); 00068 // Bootstrap to another trader, and attach to its trader network. 00069 00070 int parse_args (int &argc, ACE_TCHAR *argv []); 00071 // Parses the command line arguments 00072 00073 TAO_ORB_Manager orb_manager_; 00074 // The ORB manager. 00075 00076 auto_ptr<TAO_Trader_Factory::TAO_TRADER> trader_; 00077 // Pointer to the linked trader. 00078 00079 TAO_Service_Type_Repository type_repos_; 00080 // Service Type Repository used by the trading service. 00081 00082 CORBA::String_var ior_; 00083 // IOR of the trader kept around for handiness purposes. 00084 00085 CORBA::Boolean federate_; 00086 // Flag indicating whether this trader should join the federation. 00087 00088 FILE *ior_output_file_; 00089 // File to output the Naming Service IOR. 00090 00091 CORBA::String_var name_; 00092 // Name of this trading service: "hostname:pid". 00093 00094 TAO_IOR_Multicast ior_multicast_; 00095 // Event handler that responds to resolve_initial_references 00096 // requests. 00097 00098 CORBA::Boolean bootstrapper_; 00099 // Flag inidicating whether we're the trader others are bootstrapping to. 00100 00101 CORBA::Boolean dumpior_; 00102 // Flag indication whether to dump the ior to standard output 00103 00104 private: 00105 00106 // Disallow copying and assignment. 00107 TAO_Trading_Loader (const TAO_Trading_Loader &); 00108 TAO_Trading_Loader &operator= (const TAO_Trading_Loader &); 00109 00110 }; 00111 00112 ACE_FACTORY_DECLARE (TAO_Trading_Serv, TAO_Trading_Loader) 00113 00114 #endif /* TAO_TRADING_LOADER_H */