diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-03-12 16:18:58 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-03-12 16:18:58 +0000 |
commit | 311d9d74b593b8b8856151e3e1358df3f00feb0f (patch) | |
tree | bf1c5cdcd20e3d61ed9d590adfaef8b5fce061df /TAO/orbsvcs/orbsvcs/IFRService/IFR_Service_Utils.h | |
parent | f5bacbe21762d818bb4e4f70961040e26061e840 (diff) | |
download | ATCD-311d9d74b593b8b8856151e3e1358df3f00feb0f.tar.gz |
ChangeLogTag: Wed Mar 12 09:49:00 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/IFRService/IFR_Service_Utils.h')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/IFRService/IFR_Service_Utils.h | 198 |
1 files changed, 162 insertions, 36 deletions
diff --git a/TAO/orbsvcs/orbsvcs/IFRService/IFR_Service_Utils.h b/TAO/orbsvcs/orbsvcs/IFRService/IFR_Service_Utils.h index 993bb85da33..c68820466e0 100644 --- a/TAO/orbsvcs/orbsvcs/IFRService/IFR_Service_Utils.h +++ b/TAO/orbsvcs/orbsvcs/IFRService/IFR_Service_Utils.h @@ -23,83 +23,209 @@ #define TAO_IFR_SERVICE_UTILS_H #include "ace/pre.h" -#include "tao/corba.h" #include "tao/PortableServer/PortableServerC.h" #include "tao/ORB.h" +#include "tao/IFR_Client/IFR_BaseC.h" #include "ifr_service_export.h" +#include "ace/Configuration.h" + // Forward decl; class IFR_ServantLocator; class TAO_IOR_Multicast; class ACE_Configuration; class TAO_Repository_i; +class TAO_IDLType_i; +class TAO_Container_i; +class TAO_Contained_i; class TAO_IFRService_Export TAO_IFR_Server { public: TAO_IFR_Server (void); - // Default constructor. int init_with_orb (int argc, ACE_TCHAR *argv [], CORBA::ORB_ptr orb, - int use_multicast_server = 1); - // Initialize the IFR Service with the command line arguments and - // the ORB. + int use_multicast_server = 0); + /// Initialize the IFR Service with the command line arguments and + /// the ORB. int fini (void); - // Destroy the child POA created in <init_with_orb> + /// Destroy the child POA created in <init_with_orb>. ~TAO_IFR_Server (void); - // Destructor. + /// Destructor. protected: - - int create_poas (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); - // Two persistent POAs, one using a servant locator. - - int create_locator (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); - // Create a servant locator and register it with its POA. + + int create_poa (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + /// Two persistent POAs, one using a servant locator. int open_config (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); - // Open an ACE_Configuration of the appropriate type. + /// Open an ACE_Configuration of the appropriate type. int create_repository (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); - // Create and initialize the repository. + /// Create and initialize the repository. int init_multicast_server (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); - // Enable the Interface Repository to answer multicast requests - // for its IOR. + /// Enable the Interface Repository to answer multicast requests + /// for its IOR. CORBA::ORB_var orb_; - // Reference to our ORB. + /// Reference to our ORB. - PortableServer::POA_var root_poa_; - // Root POA reference. + PortableServer::POA_ptr root_poa_; + /// Root POA reference. - PortableServer::POA_var repo_poa_; - // The Repository's POA reference. - - PortableServer::POA_var ir_object_poa_; - // POA reference for all other IFR objects. - - IFR_ServantLocator *servant_locator_impl_; - // Our servant locator implementation instance. + PortableServer::POA_ptr repo_poa_; + /// The Repository's POA reference. TAO_IOR_Multicast *ior_multicast_; - // Event handler that responds to multicast requests. + /// Event handler that responds to multicast requests. ACE_Configuration *config_; - // Database for the IFR. + /// Database for the IFR. - TAO_Repository_i *repo_impl_; - // The IFR implementation instance. + CORBA::String_var ifr_ior_; + /// Interface Repository's IOR. +}; - CORBA::Repository_ptr repository_; - // The Interface Repository object reference. +class TAO_IFR_Service_Utils +{ +public: + TAO_IFR_Service_Utils (void); + + ~TAO_IFR_Service_Utils (void); + + typedef int (*name_clash_checker)(const char *); + + static char *int_to_string (CORBA::ULong number); + /// Convert the hex form of an 4-byte unsigned int to a string. + + /// The error-checking methods below all return void because + /// they throw a spec-defined exception for every error case + /// (specifically one of the BAD_PARAM minor versions). + + static void valid_container (CORBA::DefinitionKind container_kind, + CORBA::DefinitionKind contained_kind + ACE_ENV_ARG_DECL); + /// Checks for illegal member type in given container type. + + static void pre_exist (const char *id, + name_clash_checker checker, + ACE_Configuration_Section_Key &key, + TAO_Repository_i *repo, + CORBA::DefinitionKind kind + ACE_ENV_ARG_DECL); + /// Wrapper for id_exists() and name_exists(). + + static void id_exists (const char *id, + TAO_Repository_i *repo + ACE_ENV_ARG_DECL); + /// Checks for a global repository id clash. + + static void name_exists (name_clash_checker checker, + ACE_Configuration_Section_Key &key, + TAO_Repository_i *repo, + CORBA::DefinitionKind kind + ACE_ENV_ARG_DECL); + /// Checks for a local name clash. + + static void check_subsection (name_clash_checker checker, + const char *sub_section, + ACE_Configuration *config, + ACE_Configuration_Section_Key &key + ACE_ENV_ARG_DECL); + /// Used by interfaces and components to check for name clashes + /// in the attributes, operations, or component ports subsections. + + static void valid_creation (CORBA::DefinitionKind container_kind, + CORBA::DefinitionKind contained_kind, + const char *id, + name_clash_checker checker, + ACE_Configuration_Section_Key &key, + TAO_Repository_i *repo + ACE_ENV_ARG_DECL); + /// Top-level method which calls all the above error-checking methods. + + static ACE_TString create_common ( + CORBA::DefinitionKind container_kind, + CORBA::DefinitionKind contained_kind, + ACE_Configuration_Section_Key container_key, + ACE_Configuration_Section_Key &new_key, + TAO_Repository_i *repo, + const char *id, + const char *name, + name_clash_checker checker, + const char *version, + const char *sub_section_name + ACE_ENV_ARG_DECL + ); + /// Code common to the creation of an entry for any non-anonymous type. + + static void set_initializers (const CORBA::InitializerSeq &initializers, + ACE_Configuration *config, + ACE_Configuration_Section_Key &key); + /// Common to Container::create_value() and ValueDef::initializers(). + + static void set_supported_interfaces ( + const CORBA::InterfaceDefSeq &supported_interfaces, + ACE_Configuration *config, + ACE_Configuration_Section_Key &key + ); + /// Common to Container::create_value() and ValueDef::supported_interfaces(), + /// Container::create_component() and Component::supported_interfaces(). + + static char *reference_to_path (CORBA::IRObject_ptr obj); + /// Converison from IR Object reference to key location path. + + static CORBA::DefinitionKind path_to_def_kind (ACE_TString &path, + TAO_Repository_i *repo); + /// Conversion from key location path to CORBA::DefinitionKind. + + static CORBA::DefinitionKind reference_to_def_kind ( + CORBA::IRObject_ptr obj, + TAO_Repository_i *repo + ); + /// Conversion from IR Object reference to CORBA::DefinitionKind. + + static TAO_IDLType_i *path_to_idltype (ACE_TString &path, + TAO_Repository_i *repo); + /// Converion from key location path to IDLType. + + static TAO_Contained_i *path_to_contained (ACE_TString &path, + TAO_Repository_i *repo); + /// Converion from key location path to IDLType. + + static TAO_Container_i *path_to_container (ACE_TString &path, + TAO_Repository_i *repo); + /// Converion from key location path to IDLType. + + static CORBA::Object_ptr path_to_ir_object (ACE_TString &path, + TAO_Repository_i *repo + ACE_ENV_ARG_DECL); + /// Conversion from key location path to IR Object reference. + + static CORBA::Object_ptr create_objref (CORBA::DefinitionKind def_kind, + const char *obj_id, + TAO_Repository_i *repo + ACE_ENV_ARG_DECL); + /// Can be called from the above method or directly from a derived class. + + static char *oid_to_string (PortableServer::ObjectId &oid); + /// Copy and octet sequence to a string.. - CORBA::String_var ifr_ior_; - // Interface Repository's IOR. +public: + static ACE_Configuration_Section_Key tmp_key_; + /// To hold a key created by one method for another method to use. + /// Calls to this class will be made after an IFR lock (if any) + /// has been acquired, so thread safety is not an issue with this + /// static variable. + + static TAO_Repository_i *repo_; + /// Needed by TAO_InterfaceDef_i::name_clash, probably can be used + /// all over the place now that it's here. }; #include "ace/post.h" |