diff options
Diffstat (limited to 'TAO/orbsvcs')
-rw-r--r-- | TAO/orbsvcs/Naming_Service/Naming_Service.cpp | 247 | ||||
-rw-r--r-- | TAO/orbsvcs/Naming_Service/Naming_Service.h | 40 | ||||
-rw-r--r-- | TAO/orbsvcs/TAO_Service/Makefile | 383 | ||||
-rw-r--r-- | TAO/orbsvcs/TAO_Service/README | 107 | ||||
-rw-r--r-- | TAO/orbsvcs/TAO_Service/TAO_Service.cpp | 71 | ||||
-rw-r--r-- | TAO/orbsvcs/TAO_Service/svc.conf | 17 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Naming_Loader.cpp | 87 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Naming_Loader.h | 58 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp | 235 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.h | 49 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/tests_svc_loader/Makefile | 382 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/tests_svc_loader/README | 12 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/tests_svc_loader/tests_svc_loader.cpp | 89 |
13 files changed, 1551 insertions, 226 deletions
diff --git a/TAO/orbsvcs/Naming_Service/Naming_Service.cpp b/TAO/orbsvcs/Naming_Service/Naming_Service.cpp index aea42b29df1..bce1ac6001e 100644 --- a/TAO/orbsvcs/Naming_Service/Naming_Service.cpp +++ b/TAO/orbsvcs/Naming_Service/Naming_Service.cpp @@ -5,103 +5,21 @@ ACE_RCSID(Naming_Service, Naming_Service, "$Id$") - // Default Constructor. - +// Default Constructor. + TAO_Naming_Service::TAO_Naming_Service (void) - : ior_output_file_ (0), - pid_file_name_ (0), - context_size_ (ACE_DEFAULT_MAP_SIZE), - persistence_file_name_ (0), - base_address_ (TAO_NAMING_BASE_ADDR), - time_ (0), - multicast_ (1) + : time_ (0) { } // Constructor taking command-line arguments. - TAO_Naming_Service::TAO_Naming_Service (int argc, char* argv[]) - : ior_output_file_ (0), - pid_file_name_ (0), - context_size_ (ACE_DEFAULT_MAP_SIZE), - persistence_file_name_ (0), - base_address_ (TAO_NAMING_BASE_ADDR), - time_ (0), - multicast_ (1) + : time_ (0) { this->init (argc, argv); } -int -TAO_Naming_Service::parse_args (int argc, - char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "b:do:p:s:t:f:m:"); - int c; - int size, time, result; - long address; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'd': // debug flag. - TAO_debug_level++; - break; - case 'o': // outputs the naming service ior to a file. - this->ior_output_file_ = - ACE_OS::fopen (get_opts.optarg, "w"); - - if (this->ior_output_file_ == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to open %s for writing: %p\n", - get_opts.optarg), -1); - break; - case 'p': - this->pid_file_name_ = get_opts.optarg; - break; - case 'f': - this->persistence_file_name_ = get_opts.optarg; - break; - case 's': - size = ACE_OS::atoi (get_opts.optarg); - if (size >= 0) - this->context_size_ = size; - break; - case 't': - time = ACE_OS::atoi (get_opts.optarg); - if (time >= 0) - this->time_ = time; - break; - case 'b': - result = ::sscanf (get_opts.optarg, - "%ld", - &address); - if (result == 0 || result == EOF) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to process <-b> option"), - -1); - this->base_address_ = (void *) address; - break; - case 'm': - this->multicast_ = ACE_OS::atoi(get_opts.optarg); - break; - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-NScontextname <contextname> " - "-o <ior_output_file> " - "-p <pid_file_name> " - "-f <persistence_file_name> " - "-b <base_address> " - "-m <1=enable multicast(default), 0=disable multicast " - "\n", - argv [0]), - -1); - } - return 0; -} // Initialize the state of the TAO_Naming_Service object int @@ -109,90 +27,29 @@ TAO_Naming_Service::init (int argc, char *argv[]) { int result; - CORBA::ORB_var orb; - PortableServer::POA_var child_poa; - + ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { - this->orb_ = CORBA::ORB_init (argc, argv, 0, ACE_TRY_ENV); - ACE_TRY_CHECK; - - // Get the POA from the ORB. - CORBA::Object_var poa_object = - this->orb_->resolve_initial_references ("RootPOA", ACE_TRY_ENV); - ACE_TRY_CHECK; - - if (CORBA::is_nil (poa_object.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT (" (%P|%t) Unable to initialize the POA.\n")), - -1); - - // Get the POA object. - this->root_poa_ = PortableServer::POA::_narrow (poa_object.in (), - ACE_TRY_ENV); - ACE_TRY_CHECK; - - // Get the POA_Manager. - PortableServer::POAManager_var poa_manager = - this->root_poa_->the_POAManager (ACE_TRY_ENV); - ACE_TRY_CHECK; - - poa_manager->activate (ACE_TRY_ENV); - ACE_TRY_CHECK; - - CORBA::PolicyList policies (2); - policies.length (2); - - // Id Assignment policy - policies[0] = - this->root_poa_->create_id_assignment_policy (PortableServer::USER_ID, - ACE_TRY_ENV); + this->argc_ = argc; + this->argv_ = argv; + + // Initialize the ORB + this->orb_ = + CORBA::ORB_init (this->argc_, this->argv_, 0, ACE_TRY_ENV); ACE_TRY_CHECK; - // Lifespan policy - policies[1] = - this->root_poa_->create_lifespan_policy (PortableServer::PERSISTENT, - ACE_TRY_ENV); - ACE_TRY_CHECK; + // Parse the args for '-t' option. If '-t' option is passed, do + // the needful and then remove the option from the list of + // arguments. + this->parse_args (this->argc_, this->argv_); - // We use a different POA, otherwise the user would have to change - // the object key each time it invokes the server. + // This function call initializes the naming service and returns + // '-1' in case of an exception. + result = this->my_naming_server_.init_with_orb (this->argc_, + this->argv_, + this->orb_.in ()); - this->ns_poa_ = this->root_poa_->create_POA ("NameService", - poa_manager.in (), - policies, - ACE_TRY_ENV); - // Warning! If create_POA fails, then the policies won't be - // destroyed and there will be hell to pay in memory leaks! - ACE_TRY_CHECK; - - // Creation of the new POAs over, so destroy the Policy_ptr's. - for (CORBA::ULong i = 0; - i < policies.length (); - ++i) - { - CORBA::Policy_ptr policy = policies[i]; - policy->destroy (ACE_TRY_ENV); - ACE_TRY_CHECK; - } - - // Check the non-ORB arguments. this needs to come before we - // initialize my_naming_server so that we can pass on some of - // the command-line arguments. - - result = this->parse_args (argc, argv); - if (result < 0) - return result; - - result = this->my_naming_server_.init (this->orb_.in (), - this->ns_poa_.in (), - this->context_size_, - 0, - 0, - this->persistence_file_name_, - this->base_address_, - this->multicast_); if (result == -1) return result; } @@ -204,32 +61,48 @@ TAO_Naming_Service::init (int argc, ACE_ENDTRY; ACE_CHECK_RETURN (-1); - if (this->ior_output_file_ != 0) - { - CORBA::String_var str = - this->my_naming_server_.naming_service_ior (); - ACE_OS::fprintf (this->ior_output_file_, - "%s", - str.in ()); - ACE_OS::fclose (this->ior_output_file_); - } + return 0; +} + +int +TAO_Naming_Service::parse_args (int argc, + char *argv []) +{ + ACE_Get_Opt get_opts (argc, argv, "b:do:p:s:t:f:m:"); + int c; + int time; + int count_argv = 0; - if (this->pid_file_name_ != 0) + while ((c = get_opts ()) != -1) { - FILE *pidf = fopen (this->pid_file_name_, "w"); - if (pidf != 0) + ++count_argv; + switch (c) { - ACE_OS::fprintf (pidf, - "%ld\n", - ACE_static_cast (long, ACE_OS::getpid ())); - ACE_OS::fclose (pidf); + case 't': + time = ACE_OS::atoi (get_opts.optarg); + if (time >= 0) + this->time_ = time; + + // Remove the option '-t' from argv [] + // to avoid any confusion that might result. + for (int i = count_argv; i != argc; ++i) + argv [i] = argv [i+2]; + + // Decrement the value of this->argc_ to reflect the removal + // of '-t' option. + argc = argc-2; + break; + + case '?': + default: + // Donot do anything. The TAO_Naming_Server::parse_args () + // takes care of indicating an error in case of error. + break; } - } return 0; } // Run the ORB event loop. - int TAO_Naming_Service::run (CORBA_Environment& ACE_TRY_ENV) { @@ -251,17 +124,7 @@ TAO_Naming_Service::run (CORBA_Environment& ACE_TRY_ENV) } // Destructor. - TAO_Naming_Service::~TAO_Naming_Service (void) { - ACE_TRY_NEW_ENV - { - this->root_poa_->destroy (1, 1, ACE_TRY_ENV); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore - } - ACE_ENDTRY; + // Destructor } diff --git a/TAO/orbsvcs/Naming_Service/Naming_Service.h b/TAO/orbsvcs/Naming_Service/Naming_Service.h index 5909a099f34..2803ed442d8 100644 --- a/TAO/orbsvcs/Naming_Service/Naming_Service.h +++ b/TAO/orbsvcs/Naming_Service/Naming_Service.h @@ -49,47 +49,29 @@ public: // Destructor. protected: - int parse_args (int argc, char *argv[]); - // parses the arguments. + + int parse_args (int argc, char *argv []); + // Parse the command line arguments to find + // the timeout period. CORBA::ORB_var orb_; // The ORB. - - PortableServer::POA_var root_poa_; + + // PortableServer::POA_var root_poa_; // The Root POA. - PortableServer::POA_var ns_poa_; - // The Naming Service POA. - TAO_Naming_Server my_naming_server_; // Naming Server instance. - FILE *ior_output_file_; - // File to output the Naming Service IOR. - - const char *pid_file_name_; - // File to output the process id. - - size_t context_size_; - // Size of the hash_table allocated upon the creation of the Naming - // Service context (if one is created). Note: all the contexts - // created under the given context will use the same size for their - // initial hash table allocations. - - const ACE_TCHAR *persistence_file_name_; - // Path to the file to be used to store/read in Naming Service - // persistent state. - - void *base_address_; - // Address to be used for memory mapping Naming Service state file, - // identified by the <persistence_file_name_>. - size_t time_; // After how long the server should stop listening to requests (in // seconds). + + int argc_; + // argc - int multicast_; - // If not zero multicast is enabled. + char *argv_ []; + // argv [] }; #endif /* TAO_NAMING_SERVICE_H */ diff --git a/TAO/orbsvcs/TAO_Service/Makefile b/TAO/orbsvcs/TAO_Service/Makefile new file mode 100644 index 00000000000..b9af8b5d758 --- /dev/null +++ b/TAO/orbsvcs/TAO_Service/Makefile @@ -0,0 +1,383 @@ +#---------------------------------------------------------------------------- +# +# $Id$ +# +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif + +LDLIBS = -lTAO +ACE_SHLIBS = -lTAO -lACE + +PROG_SRCS = TAO_Service.cpp + +# @@ We have to add the NT project files once you commit these files. +SRC = $(PROG_SRCS) + +SIMPLE_SVR_OBJS = TAO_Service.o + +BIN2 = TAO_Service + +#### If the TAO orbsvcs library wasn't built with sufficient components, +#### don't try to build here. +TAO_ORBSVCS := $(shell sh $(ACE_ROOT)/bin/ace_components --orbsvcs) +ifeq (Naming,$(findstring Naming,$(TAO_ORBSVCS))) + BIN = $(BIN2) +endif # Naming + +TAO_IDLFLAGS += -Ge 1 +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(TAO_ROOT)/rules.tao.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- + +LDFLAGS += -L$(TAO_ROOT)/orbsvcs/orbsvcs -L$(TAO_ROOT)/tao -L$(TAO_ROOT)/orbsvcs/Naming_Service +CPPFLAGS += -I$(TAO_ROOT)/orbsvcs + +.PRECIOUS: $(foreach ext, $(IDL_EXT), Time_Date$(ext)) + +TAO_Service: $(addprefix $(VDIR),$(SIMPLE_SVR_OBJS)) $(SHLIB) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) + +$(BIN): + +realclean: clean + -$(RM) $(foreach ext, $(IDL_EXT), Time_Date$(ext)) + +#---------------------------------------------------------------------------- +# Dependencies +#---------------------------------------------------------------------------- + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + + +.obj/TAO_Service.o .obj/TAO_Service.so .shobj/TAO_Service.o .shobj/TAO_Service.so: TAO_Service.cpp \ + $(TAO_ROOT)/tao/corba.h \ + $(ACE_ROOT)/ace/pre.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/post.h \ + $(ACE_ROOT)/ace/ACE_export.h \ + $(ACE_ROOT)/ace/svc_export.h \ + $(ACE_ROOT)/ace/ace_wchar.h \ + $(ACE_ROOT)/ace/OS_Dirent.h \ + $(ACE_ROOT)/ace/OS_Export.h \ + $(ACE_ROOT)/ace/OS_Dirent.inl \ + $(ACE_ROOT)/ace/OS_String.h \ + $(ACE_ROOT)/ace/OS_String.inl \ + $(ACE_ROOT)/ace/OS_Memory.h \ + $(ACE_ROOT)/ace/OS_Memory.inl \ + $(ACE_ROOT)/ace/OS_TLI.h \ + $(ACE_ROOT)/ace/OS_TLI.inl \ + $(ACE_ROOT)/ace/Min_Max.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(TAO_ROOT)/tao/corbafwd.h \ + $(ACE_ROOT)/ace/CDR_Stream.h \ + $(ACE_ROOT)/ace/Message_Block.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Based_Pointer_T.h \ + $(ACE_ROOT)/ace/Based_Pointer_T.i \ + $(ACE_ROOT)/ace/Based_Pointer_T.cpp \ + $(ACE_ROOT)/ace/Based_Pointer_Repository.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers_T.h \ + $(ACE_ROOT)/ace/Containers_T.i \ + $(ACE_ROOT)/ace/Containers_T.cpp \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.i \ + $(ACE_ROOT)/ace/Message_Block.i \ + $(ACE_ROOT)/ace/Message_Block_T.h \ + $(ACE_ROOT)/ace/Message_Block_T.i \ + $(ACE_ROOT)/ace/Message_Block_T.cpp \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/SString.i \ + $(ACE_ROOT)/ace/CDR_Stream.i \ + $(TAO_ROOT)/tao/try_macros.h \ + $(TAO_ROOT)/tao/orbconf.h \ + $(ACE_ROOT)/ace/CORBA_macros.h \ + $(TAO_ROOT)/tao/varbase.h \ + $(TAO_ROOT)/tao/TAO_Export.h \ + $(TAO_ROOT)/tao/corbafwd.i \ + $(TAO_ROOT)/tao/Environment.h \ + $(TAO_ROOT)/tao/Environment.i \ + $(TAO_ROOT)/tao/ORB.h \ + $(TAO_ROOT)/tao/Exception.h \ + $(TAO_ROOT)/tao/Exception.i \ + $(TAO_ROOT)/tao/IOR_LookupTable.h \ + $(ACE_ROOT)/ace/Hash_Map_Manager.h \ + $(ACE_ROOT)/ace/Functor.h \ + $(ACE_ROOT)/ace/Functor.i \ + $(ACE_ROOT)/ace/Functor_T.h \ + $(ACE_ROOT)/ace/Functor_T.i \ + $(ACE_ROOT)/ace/Functor_T.cpp \ + $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \ + $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \ + $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \ + $(ACE_ROOT)/ace/Service_Config.h \ + $(ACE_ROOT)/ace/Service_Object.h \ + $(ACE_ROOT)/ace/Shared_Object.h \ + $(ACE_ROOT)/ace/Shared_Object.i \ + $(ACE_ROOT)/ace/Service_Object.i \ + $(ACE_ROOT)/ace/Service_Config.i \ + $(ACE_ROOT)/ace/Reactor.h \ + $(ACE_ROOT)/ace/Handle_Set.h \ + $(ACE_ROOT)/ace/Handle_Set.i \ + $(ACE_ROOT)/ace/Timer_Queue.h \ + $(ACE_ROOT)/ace/Timer_Queue_T.h \ + $(ACE_ROOT)/ace/Timer_Queue_T.i \ + $(ACE_ROOT)/ace/Timer_Queue_T.cpp \ + $(ACE_ROOT)/ace/Reactor.i \ + $(ACE_ROOT)/ace/Reactor_Impl.h \ + $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \ + $(TAO_ROOT)/tao/Services.h \ + $(TAO_ROOT)/tao/Sequence.h \ + $(TAO_ROOT)/tao/Managed_Types.h \ + $(TAO_ROOT)/tao/Managed_Types.i \ + $(TAO_ROOT)/tao/Sequence.i \ + $(TAO_ROOT)/tao/Sequence_T.h \ + $(TAO_ROOT)/tao/Sequence_T.i \ + $(TAO_ROOT)/tao/Sequence_T.cpp \ + $(TAO_ROOT)/tao/Services.i \ + $(TAO_ROOT)/tao/IORManipulation.h \ + $(TAO_ROOT)/tao/LocalObject.h \ + $(TAO_ROOT)/tao/Object.h \ + $(TAO_ROOT)/tao/Object.i \ + $(TAO_ROOT)/tao/LocalObject.i \ + $(TAO_ROOT)/tao/IORC.h \ + $(TAO_ROOT)/tao/IORC.i \ + $(TAO_ROOT)/tao/Interceptor.h \ + $(TAO_ROOT)/tao/InterceptorC.h \ + $(TAO_ROOT)/tao/IOPC.h \ + $(TAO_ROOT)/tao/CDR.h \ + $(TAO_ROOT)/tao/CDR.i \ + $(TAO_ROOT)/tao/IOPC.i \ + $(TAO_ROOT)/tao/InterceptorC.i \ + $(TAO_ROOT)/tao/Interceptor.i \ + $(TAO_ROOT)/tao/PolicyC.h \ + $(TAO_ROOT)/tao/CurrentC.h \ + $(TAO_ROOT)/tao/CurrentC.i \ + $(TAO_ROOT)/tao/Encodable.h \ + $(TAO_ROOT)/tao/Typecode.h \ + $(TAO_ROOT)/tao/Typecode.i \ + $(TAO_ROOT)/tao/PolicyC.i \ + $(TAO_ROOT)/tao/ORB.i \ + $(TAO_ROOT)/tao/Any.h \ + $(TAO_ROOT)/tao/Any.i \ + $(TAO_ROOT)/tao/NVList.h \ + $(TAO_ROOT)/tao/NVList.i \ + $(TAO_ROOT)/tao/Principal.h \ + $(TAO_ROOT)/tao/Principal.i \ + $(TAO_ROOT)/tao/Request.h \ + $(TAO_ROOT)/tao/Context.h \ + $(TAO_ROOT)/tao/Context.i \ + $(TAO_ROOT)/tao/MessagingC.h \ + $(TAO_ROOT)/tao/ValueBase.h \ + $(TAO_ROOT)/tao/ValueBase.i \ + $(TAO_ROOT)/tao/ValueFactory.h \ + $(TAO_ROOT)/tao/ValueFactory.i \ + $(TAO_ROOT)/tao/TimeBaseC.h \ + $(TAO_ROOT)/tao/TimeBaseC.i \ + $(TAO_ROOT)/tao/PollableC.h \ + $(TAO_ROOT)/tao/PollableC.i \ + $(TAO_ROOT)/tao/MessagingC.i \ + $(TAO_ROOT)/tao/Request.i \ + $(TAO_ROOT)/tao/Server_Request.h \ + $(TAO_ROOT)/tao/Object_KeyC.h \ + $(TAO_ROOT)/tao/Object_KeyC.i \ + $(TAO_ROOT)/tao/Server_Request.i \ + $(TAO_ROOT)/tao/POA.h \ + $(TAO_ROOT)/tao/Object_Adapter.h \ + $(TAO_ROOT)/tao/Key_Adapters.h \ + $(ACE_ROOT)/ace/Map.h \ + $(ACE_ROOT)/ace/Map_T.h \ + $(ACE_ROOT)/ace/Pair.h \ + $(ACE_ROOT)/ace/Pair_T.h \ + $(ACE_ROOT)/ace/Pair_T.i \ + $(ACE_ROOT)/ace/Pair_T.cpp \ + $(ACE_ROOT)/ace/Map_Manager.h \ + $(ACE_ROOT)/ace/Map_Manager.i \ + $(ACE_ROOT)/ace/Map_Manager.cpp \ + $(ACE_ROOT)/ace/Active_Map_Manager.h \ + $(ACE_ROOT)/ace/Active_Map_Manager.i \ + $(ACE_ROOT)/ace/Active_Map_Manager_T.h \ + $(ACE_ROOT)/ace/Active_Map_Manager_T.i \ + $(ACE_ROOT)/ace/Active_Map_Manager_T.cpp \ + $(ACE_ROOT)/ace/Map_T.i \ + $(ACE_ROOT)/ace/Map_T.cpp \ + $(TAO_ROOT)/tao/PortableServerC.h \ + $(TAO_ROOT)/tao/PortableServerC.i \ + $(TAO_ROOT)/tao/Key_Adapters.i \ + $(TAO_ROOT)/tao/Server_Strategy_Factory.h \ + $(TAO_ROOT)/tao/poa_macros.h \ + $(TAO_ROOT)/tao/Servant_Base.h \ + $(TAO_ROOT)/tao/Servant_Base.i \ + $(TAO_ROOT)/tao/Active_Object_Map.h \ + $(TAO_ROOT)/tao/Active_Object_Map.i \ + $(TAO_ROOT)/tao/RTCORBAC.h \ + $(TAO_ROOT)/tao/RTCORBAC.i \ + $(TAO_ROOT)/tao/Object_Adapter.i \ + $(TAO_ROOT)/tao/POAManager.h \ + $(TAO_ROOT)/tao/POAManager.i \ + $(TAO_ROOT)/tao/POA.i \ + $(TAO_ROOT)/tao/Stub.h \ + $(TAO_ROOT)/tao/Pluggable.h \ + $(ACE_ROOT)/ace/Message_Queue.h \ + $(ACE_ROOT)/ace/IO_Cntl_Msg.h \ + $(ACE_ROOT)/ace/Message_Queue_T.h \ + $(ACE_ROOT)/ace/Message_Queue_T.i \ + $(ACE_ROOT)/ace/Message_Queue_T.cpp \ + $(ACE_ROOT)/ace/Strategies.h \ + $(ACE_ROOT)/ace/Strategies_T.h \ + $(ACE_ROOT)/ace/Synch_Options.h \ + $(ACE_ROOT)/ace/Synch_Options.i \ + $(ACE_ROOT)/ace/Thread_Manager.h \ + $(ACE_ROOT)/ace/Thread_Manager.i \ + $(ACE_ROOT)/ace/Strategies_T.i \ + $(ACE_ROOT)/ace/Strategies_T.cpp \ + $(ACE_ROOT)/ace/Service_Repository.h \ + $(ACE_ROOT)/ace/Service_Types.h \ + $(ACE_ROOT)/ace/Service_Types.i \ + $(ACE_ROOT)/ace/Service_Repository.i \ + $(ACE_ROOT)/ace/WFMO_Reactor.h \ + $(ACE_ROOT)/ace/WFMO_Reactor.i \ + $(ACE_ROOT)/ace/Strategies.i \ + $(ACE_ROOT)/ace/Message_Queue.i \ + $(TAO_ROOT)/tao/Pluggable.i \ + $(TAO_ROOT)/tao/MProfile.h \ + $(TAO_ROOT)/tao/Profile.h \ + $(TAO_ROOT)/tao/Tagged_Components.h \ + $(TAO_ROOT)/tao/CONV_FRAMEC.h \ + $(TAO_ROOT)/tao/CONV_FRAMEC.i \ + $(TAO_ROOT)/tao/Tagged_Components.i \ + $(TAO_ROOT)/tao/Profile.i \ + $(TAO_ROOT)/tao/MProfile.i \ + $(TAO_ROOT)/tao/Stub.i \ + $(TAO_ROOT)/tao/params.h \ + $(TAO_ROOT)/tao/params.i \ + $(TAO_ROOT)/tao/ORB_Core.h \ + $(TAO_ROOT)/tao/Policy_Manager.h \ + $(TAO_ROOT)/tao/POA_CORBA.h \ + $(TAO_ROOT)/tao/DynAnyC.h \ + $(TAO_ROOT)/tao/DynAnyC.i \ + $(TAO_ROOT)/tao/DomainC.h \ + $(TAO_ROOT)/tao/DomainC.i \ + $(TAO_ROOT)/tao/Policy_Manager.i \ + $(TAO_ROOT)/tao/Resource_Factory.h \ + $(TAO_ROOT)/tao/Protocol_Factory.h \ + $(TAO_ROOT)/tao/TAO_Singleton_Manager.h \ + $(TAO_ROOT)/tao/TAO_Singleton_Manager.inl \ + $(TAO_ROOT)/tao/TAO_Singleton.h \ + $(TAO_ROOT)/tao/TAO_Singleton.inl \ + $(TAO_ROOT)/tao/TAO_Singleton.cpp \ + $(TAO_ROOT)/tao/ORB_Core.i \ + $(ACE_ROOT)/ace/Dynamic_Service.h \ + $(ACE_ROOT)/ace/Dynamic_Service.cpp \ + $(TAO_ROOT)/tao/Operation_Table.h \ + $(TAO_ROOT)/tao/debug.h \ + $(TAO_ROOT)/tao/Client_Strategy_Factory.h \ + $(TAO_ROOT)/tao/Invocation.h \ + $(TAO_ROOT)/tao/Synch_Reply_Dispatcher.h \ + $(TAO_ROOT)/tao/Reply_Dispatcher.h \ + $(TAO_ROOT)/tao/Reply_Dispatcher.i \ + $(TAO_ROOT)/tao/GIOP_Message_State.h \ + $(TAO_ROOT)/tao/Pluggable_Messaging.h \ + $(TAO_ROOT)/tao/Pluggable_Messaging_Utils.h \ + $(TAO_ROOT)/tao/Pluggable_Messaging_Utils.i \ + $(TAO_ROOT)/tao/Pluggable_Messaging.i \ + $(TAO_ROOT)/tao/GIOP_Message_State.i \ + $(TAO_ROOT)/tao/Synch_Reply_Dispatcher.i \ + $(TAO_ROOT)/tao/TAOC.h \ + $(TAO_ROOT)/tao/Priority_Mapping_Manager.h \ + $(TAO_ROOT)/tao/Priority_Mapping.h \ + $(TAO_ROOT)/tao/Priority_Mapping.i \ + $(TAO_ROOT)/tao/Priority_Mapping_Manager.i \ + $(TAO_ROOT)/tao/TAOC.i \ + $(TAO_ROOT)/tao/operation_details.h \ + $(TAO_ROOT)/tao/target_specification.h \ + $(TAO_ROOT)/tao/target_specification.i \ + $(TAO_ROOT)/tao/operation_details.i \ + $(TAO_ROOT)/tao/Invocation.i \ + $(TAO_ROOT)/tao/InconsistentTypeCodeC.h \ + $(TAO_ROOT)/tao/DynAny_i.h \ + $(TAO_ROOT)/tao/ObjectIDList.h \ + $(TAO_ROOT)/tao/ObjectIDList.i \ + $(TAO_ROOT)/tao/WrongTransactionC.h \ + $(TAO_ROOT)/tao/InterfaceC.h \ + $(TAO_ROOT)/tao/ifrfwd.h \ + $(TAO_ROOT)/tao/BoundsC.h \ + $(TAO_ROOT)/tao/BoundsC.i \ + $(TAO_ROOT)/tao/MessagingS.h \ + $(TAO_ROOT)/tao/TimeBaseS.h \ + $(TAO_ROOT)/tao/TimeBaseS_T.h \ + $(TAO_ROOT)/tao/TimeBaseS_T.i \ + $(TAO_ROOT)/tao/TimeBaseS_T.cpp \ + $(TAO_ROOT)/tao/TimeBaseS.i \ + $(TAO_ROOT)/tao/MessagingS_T.h \ + $(TAO_ROOT)/tao/MessagingS_T.i \ + $(TAO_ROOT)/tao/MessagingS_T.cpp \ + $(TAO_ROOT)/tao/MessagingS.i + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/orbsvcs/TAO_Service/README b/TAO/orbsvcs/TAO_Service/README new file mode 100644 index 00000000000..73a66488e37 --- /dev/null +++ b/TAO/orbsvcs/TAO_Service/README @@ -0,0 +1,107 @@ +// $Id$ + +This directory has a generic server which opens and reads the svc.conf file in +the directory and dynamically loads and unloads the various ORB services as per +the entries made in the svc.conf file. + +To Load a Service Dynamically: +***************************** + +1. Add an entry to the svc.conf which specifies the service name that you wish to + load dynamically. + + The syntax for loading a service dynamically is: + + dynamic < Service name i.e. name that you want the Service Repository to + use to identify the dynamically linked Service_Object + so that you can look it up later via, + e.g., ACE_Dynamic_Service::instance () > \ + < The type of the service > \ + < The shared DLL that has the function + _make_Service_Name () , called the factory function> : \ + <factory_function> \ + "< arguments to be passed to the service similar to command line arguments>" + + +To load Naming Service dynamically : +---------------------------------- + + dynamic TAO_Naming_Loader Service_Object * \ + TAO_CosNaming:_make_TAO_Naming_Loader () "dummy -o ns.ior" + + So, here we want our service name to be TAO_Naming_Loader and its a + <Service_Object *> and the factory function is in TAO_CosNaming + DLL. We specify argv [0] to be "dummy" and the actual arguments + start from argv [1] as in the usual case. + +To load Event Service dynamically: +--------------------------------- + + In the case of Event Service, we also want to load the default +Event Service Factory in addition to the Event Service. So, we need to +add these two entries when we want to load the event service. + +# Dynamically configure the default Event Service Factory +dynamic CEC_Factory Service_Object * \ + TAO_CosEvent:_make_TAO_CEC_Default_Factory () "" + +# Dynamically configure the naming service into the application process. +dynamic TAO_CEC_Event_Loader Service_Object * \ + TAO_CosEvent:_make_TAO_CEC_Event_Loader () "dummy -o foo.ref" + + +To Remove a Service +******************* + + The directive for removing a service is <remove>. Removing a +service is simpler. Add the following entry to the same svc.conf file +after commenting the entry for loading the same service, so that +the service is not loaded again. + + +The generic entry is : + +remove Service_Name + +To Unload Naming Service : +------------------------ + +# Dynamically remove the Naming Service from the application process. +remove TAO_Naming_Loader + +To Unload Event Service : +------------------------ + +# Dynamically remove the Event Service from the application process. +remove TAO_Event_Loader + + +To Run TAO_Service : +================== + +1. Start with a empty svc.conf file. Run the TAO_Service. Make sure +that you start with an empty svc.conf file because the ORB_init () and +the service configurator get pretty confused. + +In detail, the svc.conf file is read and services loaded when +ORB_init () is called in the main (). But, to load any service, we +need to initialize the ORB. Here, it gets confused. To avoid this, +run the TAO_Service with no entries in the svc.conf file. + +2. After running the server, now start adding entries to the svc.conf +file depending on the services you wish to load. After adding an +entry, send a SIGHUP signal: + +% kill -1 PID_of_TAO_Service + + to the TAO_Service. The service configurator reads the +svc.conf file again and reconfigures the services. + +3. If you want to test if the service is loaded successfully, run the +generic client program < tests_svc_loader.cpp > located in +orbsvcs/tests/tests_svc_loader. For more details about the +tests_svc_loader.cpp, read the README in the same directory. + +4. If you want to remove the service at any instant, add an entry to +the svc.conf file to reflect your intent and send a signal to the +TAO_Service again. diff --git a/TAO/orbsvcs/TAO_Service/TAO_Service.cpp b/TAO/orbsvcs/TAO_Service/TAO_Service.cpp new file mode 100644 index 00000000000..51c972c2448 --- /dev/null +++ b/TAO/orbsvcs/TAO_Service/TAO_Service.cpp @@ -0,0 +1,71 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// orbsvcs/TAO_Service/ +// +// = FILENAME +// TAO_Service.cpp +// +// = DESCRIPTION +// This directory contains an example that illustrates how the ACE +// Service Configurator can dynamically configure an ORB and its +// servants from a svc.conf file. +// +// = AUTHOR +// Priyanka Gontla <pgontla@ece.uci.edu> +// +// ============================================================================ + +#include "tao/corba.h" +#include "ace/Service_Config.h" +#include "ace/Log_Msg.h" + +ACE_RCSID(TAO_Service, TAO_Service, "$Id$"); + +extern "C" void handler (int) +{ + ACE_Service_Config::reconfig_occurred (1); +} + +int +main (int argc, ACE_TCHAR *argv[]) +{ + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + // ORB initialization boiler plate... + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "", ACE_TRY_ENV); + ACE_TRY_CHECK; + + ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGHUP); + + ACE_Reactor *reactor = + orb->orb_core ()->reactor (); + + for (;;) + { + ACE_Time_Value tv (5, 0); + + orb->perform_work (tv); + + ACE_DEBUG ((LM_DEBUG, + "Reconfig flag = %d\n", + ACE_Service_Config::reconfig_occurred ())); + + if (ACE_Service_Config::reconfig_occurred ()) + ACE_Service_Config::reconfigure (); + } + + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, argv[0]); + return -1; + } + ACE_ENDTRY; + return 0; + +} diff --git a/TAO/orbsvcs/TAO_Service/svc.conf b/TAO/orbsvcs/TAO_Service/svc.conf new file mode 100644 index 00000000000..326e17e1c53 --- /dev/null +++ b/TAO/orbsvcs/TAO_Service/svc.conf @@ -0,0 +1,17 @@ +# Dynamically configure the naming service into the application process. +#dynamic TAO_Naming_Loader Service_Object * TAO_CosNaming:_make_TAO_Naming_Loader () "dummy -o ns.ior" + +# Dynamically configure the default Event Service Factory +#dynamic CEC_Factory Service_Object * TAO_CosEvent:_make_TAO_CEC_Default_Factory () "" + +# Dynamically configure the naming service into the application process. +#dynamic TAO_CEC_Event_Loader Service_Object * TAO_CosEvent:_make_TAO_CEC_Event_Loader () "dummy -o foo.ref -x" + +#Dynamically remove the event service from the application process +#remove TAO_Event_Loader + +#Dynamically remove the event service factory from the application process +#remove CEC_Factory + +#Dynamically remove the naming service from the application process +#remove TAO_Naming_Loader diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Loader.cpp b/TAO/orbsvcs/orbsvcs/Naming/Naming_Loader.cpp new file mode 100644 index 00000000000..1f6e236bf72 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Loader.cpp @@ -0,0 +1,87 @@ +// $Id$ + +//============================================================================================== +// LIBRARY +// libTAO_CosNaming.so +// +// DESCRIPTION +// This class allows for dynamically loading +// the Naming Service. +// +// AUTHORS +// Priyanka Gontla <pgontla@ece.uci.edu> +// Carlos O'Ryan <coryan@uci.edu> +//============================================================================================== + +#include "Naming_Loader.h" + +ACE_RCSID (Naming, Naming_Loader, "$Id$"); + +TAO_Naming_Loader::TAO_Naming_Loader (void) +{ + // Constructor +} + +TAO_Naming_Loader::~TAO_Naming_Loader (void) +{ + // Destructor +} + +int +TAO_Naming_Loader::init (int argc, char *argv[]) +{ + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + // Initialize the ORB + CORBA::ORB_ptr orb = + CORBA::ORB_init (argc, argv, 0, ACE_TRY_ENV); + + // This function call initializes the Naming Service + CORBA::Object_var object = + this->create_object (orb, argc, argv, ACE_TRY_ENV); + ACE_TRY_CHECK; + + } + ACE_CATCHANY + { + // @@ Should we log this??? + return -1; + } + ACE_ENDTRY; + return 0; +} + +int +TAO_Naming_Loader::fini (void) +{ + // Remove the Naming Service. + return this->naming_server_.fini (); +} + +CORBA::Object_ptr +TAO_Naming_Loader::create_object (CORBA::ORB_ptr orb, + int argc, char *argv[], + CORBA::Environment &) +{ + int result; + + // Initializes the Naming Service. Returns -1 + // on an error. + result = this->naming_server_.init_with_orb (argc, + argv, + orb); + if (result == -1) + return CORBA::Object::_nil (); + + return 0; +} + +ACE_SVC_FACTORY_DEFINE (TAO_Naming_Loader); + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class ACE_Dynamic_Service<TAO_Naming_Loader>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Dynamic_Service<TAO_Naming_Loader> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Loader.h b/TAO/orbsvcs/orbsvcs/Naming/Naming_Loader.h new file mode 100644 index 00000000000..25022840b0d --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Loader.h @@ -0,0 +1,58 @@ +// $Id $ + +// =========================================================================================== +// FILENAME +// Naming_Loader.h +// +// DESCRIPTION +// This class loads the Naming Service dynamically +// either from svc.conf file or <string_to_object> call. +// +// AUTHORS +// Priyanka Gontla <pgontla@ece.uci.edu> +// +// ========================================================================================== + +#ifndef TAO_NAMING_LOADER_H +#define TAO_NAMING_LOADER_H + +#include "tao/Object_Loader.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/Naming/Naming_Utils.h" + +class ACE_Svc_Export TAO_Naming_Loader : public TAO_Object_Loader +{ +public: + + // Constructor + TAO_Naming_Loader (void); + + // Destructor + ~TAO_Naming_Loader (void); + + // Called by the Service Configurator framework to initialize the + // Event Service. Defined in <ace/Service_Config.h> + virtual int init (int argc, char *argv[]); + + // Called by the Service Configurator framework to remove the + // Event Service. Defined in <ace/Service_Config.h> + virtual int fini (void); + + // This function call initializes the Naming Service given a reference to the + // ORB and the command line parameters. + CORBA::Object_ptr create_object (CORBA::ORB_ptr orb, + int argc, char *argv[], + CORBA::Environment &ACE_TRY_ENV); + + protected: + TAO_Naming_Server naming_server_; + // Instance of the TAO_Naming_Server +}; + +ACE_SVC_FACTORY_DECLARE (TAO_Naming_Loader); + +#endif /* TAO_NAMING_LOADER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp index f839348fffb..62e446319c5 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp +++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp @@ -7,6 +7,7 @@ #include "Transient_Naming_Context.h" #include "Persistent_Context_Index.h" #include "ace/Auto_Ptr.h" +#include "ace/Get_Opt.h" ACE_RCSID(Naming, Naming_Utils, "$Id$") @@ -14,7 +15,13 @@ TAO_Naming_Server::TAO_Naming_Server (void) : naming_context_ (), ior_multicast_ (0), naming_service_ior_ (), - context_index_ (0) + context_index_ (0), + ior_output_file_ (0), + pid_file_name_ (0), + context_size_ (ACE_DEFAULT_MAP_SIZE), + persistence_file_name_ (0), + base_address_ (TAO_NAMING_BASE_ADDR), + multicast_ (1) { } @@ -29,7 +36,13 @@ TAO_Naming_Server::TAO_Naming_Server (CORBA::ORB_ptr orb, : naming_context_ (), ior_multicast_ (0), naming_service_ior_ (), - context_index_ (0) + context_index_ (0), + ior_output_file_ (0), + pid_file_name_ (0), + context_size_ (ACE_DEFAULT_MAP_SIZE), + persistence_file_name_ (0), + base_address_ (TAO_NAMING_BASE_ADDR), + multicast_ (1) { if (this->init (orb, poa, @@ -113,6 +126,195 @@ TAO_Naming_Server::init (CORBA::ORB_ptr orb, } int +TAO_Naming_Server::parse_args (int argc, + char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "b:do:p:s:f:m:"); + int c; + int size, result; + long address; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'd': // debug flag. + TAO_debug_level++; + break; + case 'o': // outputs the naming service ior to a file. + this->ior_output_file_ = + ACE_OS::fopen (get_opts.optarg, "w"); + + if (this->ior_output_file_ == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to open %s for writing: %p\n", + get_opts.optarg), -1); + break; + case 'p': + this->pid_file_name_ = get_opts.optarg; + break; + case 'f': + this->persistence_file_name_ = get_opts.optarg; + break; + case 's': + size = ACE_OS::atoi (get_opts.optarg); + if (size >= 0) + this->context_size_ = size; + break; + case 'b': + result = ::sscanf (get_opts.optarg, + "%ld", + &address); + if (result == 0 || result == EOF) + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to process <-b> option"), + -1); + this->base_address_ = (void *) address; + break; + case 'm': + this->multicast_ = ACE_OS::atoi(get_opts.optarg); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-NScontextname <contextname> " + "-o <ior_output_file> " + "-p <pid_file_name> " + "-f <persistence_file_name> " + "-b <base_address> " + "-m <1=enable multicast(default), 0=disable multicast " + "\n", + argv [0]), + -1); + } + return 0; +} + +int +TAO_Naming_Server::init_with_orb (int argc, + char *argv [], + CORBA::ORB_ptr orb) +{ + int result; + + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + // Duplicate the ORB + this->orb_ = CORBA::ORB::_duplicate (orb); + + // Get the POA from the ORB. + CORBA::Object_var poa_object = + orb->resolve_initial_references ("RootPOA", ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (CORBA::is_nil (poa_object.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT (" (%P|%t) Unable to initialize the POA.\n")), + -1); + } + + // Get the POA object. + this->root_poa_ = PortableServer::POA::_narrow (poa_object.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + // Get the POA_Manager. + PortableServer::POAManager_var poa_manager = + this->root_poa_->the_POAManager (ACE_TRY_ENV); + ACE_TRY_CHECK; + + poa_manager->activate (ACE_TRY_ENV); + ACE_TRY_CHECK; + + CORBA::PolicyList policies (2); + policies.length (2); + + // Id Assignment policy + policies[0] = + this->root_poa_->create_id_assignment_policy (PortableServer::USER_ID, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + // Lifespan policy + policies[1] = + this->root_poa_->create_lifespan_policy (PortableServer::PERSISTENT, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + // We use a different POA, otherwise the user would have to change + // the object key each time it invokes the server. + this->ns_poa_ = this->root_poa_->create_POA ("NameService", + poa_manager.in (), + policies, + ACE_TRY_ENV); + // Warning! If create_POA fails, then the policies won't be + // destroyed and there will be hell to pay in memory leaks! + ACE_TRY_CHECK; + + // Creation of the new POAs over, so destroy the Policy_ptr's. + for (CORBA::ULong i = 0; + i < policies.length (); + ++i) + { + CORBA::Policy_ptr policy = policies[i]; + policy->destroy (ACE_TRY_ENV); + ACE_TRY_CHECK; + } + + // Check the non-ORB arguments. this needs to come before we + // initialize my_naming_server so that we can pass on some of + // the command-line arguments. + result = this->parse_args (argc, argv); + + if (result < 0) + return result; + + result = this->init (orb, + this->ns_poa_.in (), + this->context_size_, + 0, + 0, + this->persistence_file_name_, + this->base_address_, + this->multicast_); + if (result == -1) + return result; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "TAO_Naming_Service::init"); + return -1; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (-1); + + if (this->ior_output_file_ != 0) + { + CORBA::String_var str = + this->naming_service_ior (); + ACE_OS::fprintf (this->ior_output_file_, + "%s", + str.in ()); + ACE_OS::fclose (this->ior_output_file_); + } + + if (this->pid_file_name_ != 0) + { + FILE *pidf = fopen (this->pid_file_name_, "w"); + if (pidf != 0) + { + ACE_OS::fprintf (pidf, + "%ld\n", + ACE_static_cast (long, ACE_OS::getpid ())); + ACE_OS::fclose (pidf); + } + } + return 0; +} + +int TAO_Naming_Server::init_new_naming (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, const ACE_TCHAR @@ -167,7 +369,7 @@ TAO_Naming_Server::init_new_naming (CORBA::ORB_ptr orb, orb->object_to_string (this->naming_context_.in (), ACE_TRY_ENV); ACE_TRY_CHECK; - + // Make the Naming Service locatable through iioploc. if (orb->_tao_add_to_IOR_table ("NameService", this->naming_context_.in ()) @@ -265,6 +467,29 @@ TAO_Naming_Server::init_new_naming (CORBA::ORB_ptr orb, return 0; } +int +TAO_Naming_Server::fini (void) +{ + // Destroy the child POA ns_poa that is created when initializing + // the Naming Service + ACE_TRY_NEW_ENV + { + this->ns_poa_->destroy (1, 1, ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (this->orb_->_tao_del_from_IOR_table ("NameService") != 0 + && TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + "TAO_Naming_Server: cannot remove entry from IOR table\n")); + } + ACE_CATCHANY + { + // Ignore + } + ACE_ENDTRY; + return 0; +} + char* TAO_Naming_Server::naming_service_ior (void) { @@ -286,10 +511,10 @@ TAO_Naming_Server::~TAO_Naming_Server (void) ACE_Event_Handler::READ_MASK | ACE_Event_Handler::DONT_CALL); delete this->ior_multicast_; } - - delete context_index_; + delete context_index_; } + CosNaming::NamingContext_ptr TAO_Naming_Client::operator -> (void) const { diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.h b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.h index f4008fe3f24..66c3de59f73 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.h +++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.h @@ -104,6 +104,15 @@ public: // If <enable_multicast> is not zero then the service will respond // to multicast location queries. + int init_with_orb (int argc, + char *argv [], + CORBA::ORB_ptr orb); + // Initialize the Naming Service with the command line arguments and + // the ORB. + + int fini (void); + // Destroy the child POA created in <init_with_orb> + ~TAO_Naming_Server (void); // Destructor. @@ -129,6 +138,9 @@ protected: // If <enable_multicast> is not zero then the service will respond // to multicast location queries. + int parse_args (int argc, char *argv[]); + // parses the arguments. + CosNaming::NamingContext_var naming_context_; // Root NamingContext_ptr. @@ -142,6 +154,43 @@ protected: // Pointer to the object used to create/initialize // the Naming Service when local persistent Naming Service is // desired. + + CORBA::ORB_var orb_; + // The ORB + + PortableServer::POA_var root_poa_; + // The Root POA. + + PortableServer::POA_var ns_poa_; + // The Naming Service POA. + + FILE *ior_output_file_; + // File to output the Naming Service IOR. + + const char *pid_file_name_; + // File to output the process id. + + size_t context_size_; + // Size of the hash_table allocated upon the creation of the Naming + // Service context (if one is created). Note: all the contexts + // created under the given context will use the same size for their + // initial hash table allocations. + + const ACE_TCHAR *persistence_file_name_; + // Path to the file to be used to store/read in Naming Service + // persistent state. + + void *base_address_; + // Address to be used for memory mapping Naming Service state file, + // identified by the <persistence_file_name_>. + + size_t time_; + // After how long the server should stop listening to requests (in + // seconds). + + int multicast_; + // If not zero multicast is enabled. + }; class TAO_Naming_Export TAO_Naming_Client diff --git a/TAO/orbsvcs/tests/tests_svc_loader/Makefile b/TAO/orbsvcs/tests/tests_svc_loader/Makefile new file mode 100644 index 00000000000..c02cb2240dc --- /dev/null +++ b/TAO/orbsvcs/tests/tests_svc_loader/Makefile @@ -0,0 +1,382 @@ +#---------------------------------------------------------------------------- +# +# $Id$ +# +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif + +LDLIBS = -lTAO +ACE_SHLIBS = -lTAO -lACE + +PROG_SRCS = tests_svc_loader.cpp \ + +SRC = $(PROG_SRCS) + +SIMPLE_CLI_OBJS = tests_svc_loader.o \ + +BIN2 = tests_svc_loader + +#### If the TAO orbsvcs library wasn't built with sufficient components, +#### don't try to build here. +TAO_ORBSVCS := $(shell sh $(ACE_ROOT)/bin/ace_components --orbsvcs) +ifeq (Naming,$(findstring Naming,$(TAO_ORBSVCS))) + BIN = $(BIN2) +endif # Naming + +TAO_IDLFLAGS += -Ge 1 +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(TAO_ROOT)/rules.tao.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- + +LDFLAGS += -L$(TAO_ROOT)/orbsvcs/orbsvcs -L$(TAO_ROOT)/tao -L$(TAO_ROOT)/orbsvcs/Naming_Service +CPPFLAGS += -I$(TAO_ROOT)/orbsvcs + +.PRECIOUS: $(foreach ext, $(IDL_EXT), Time_Date$(ext)) + +tests_svc_loader: $(addprefix $(VDIR),$(SIMPLE_CLI_OBJS)) $(SHLIB) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) + +$(BIN): + +realclean: clean + -$(RM) $(foreach ext, $(IDL_EXT), Time_Date$(ext)) + +#---------------------------------------------------------------------------- +# Dependencies +#---------------------------------------------------------------------------- + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + + +.obj/tests_svc_loader.o .obj/tests_svc_loader.so .shobj/tests_svc_loader.o .shobj/tests_svc_loader.so: tests_svc_loader.cpp \ + $(ACE_ROOT)/ace/Service_Config.h \ + $(ACE_ROOT)/ace/pre.h \ + $(ACE_ROOT)/ace/Service_Object.h \ + $(ACE_ROOT)/ace/Shared_Object.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/post.h \ + $(ACE_ROOT)/ace/ACE_export.h \ + $(ACE_ROOT)/ace/svc_export.h \ + $(ACE_ROOT)/ace/ace_wchar.h \ + $(ACE_ROOT)/ace/OS_Dirent.h \ + $(ACE_ROOT)/ace/OS_Export.h \ + $(ACE_ROOT)/ace/OS_Dirent.inl \ + $(ACE_ROOT)/ace/OS_String.h \ + $(ACE_ROOT)/ace/OS_String.inl \ + $(ACE_ROOT)/ace/OS_Memory.h \ + $(ACE_ROOT)/ace/OS_Memory.inl \ + $(ACE_ROOT)/ace/OS_TLI.h \ + $(ACE_ROOT)/ace/OS_TLI.inl \ + $(ACE_ROOT)/ace/Min_Max.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/Shared_Object.i \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Service_Object.i \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers_T.h \ + $(ACE_ROOT)/ace/Containers_T.i \ + $(ACE_ROOT)/ace/Containers_T.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Based_Pointer_T.h \ + $(ACE_ROOT)/ace/Based_Pointer_T.i \ + $(ACE_ROOT)/ace/Based_Pointer_T.cpp \ + $(ACE_ROOT)/ace/Based_Pointer_Repository.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.i \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/SString.i \ + $(ACE_ROOT)/ace/Service_Config.i \ + $(ACE_ROOT)/ace/Reactor.h \ + $(ACE_ROOT)/ace/Handle_Set.h \ + $(ACE_ROOT)/ace/Handle_Set.i \ + $(ACE_ROOT)/ace/Timer_Queue.h \ + $(ACE_ROOT)/ace/Timer_Queue_T.h \ + $(ACE_ROOT)/ace/Timer_Queue_T.i \ + $(ACE_ROOT)/ace/Timer_Queue_T.cpp \ + $(ACE_ROOT)/ace/Reactor.i \ + $(ACE_ROOT)/ace/Reactor_Impl.h \ + $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \ + $(TAO_ROOT)/tao/corba.h \ + $(TAO_ROOT)/tao/corbafwd.h \ + $(ACE_ROOT)/ace/CDR_Stream.h \ + $(ACE_ROOT)/ace/Message_Block.h \ + $(ACE_ROOT)/ace/Message_Block.i \ + $(ACE_ROOT)/ace/Message_Block_T.h \ + $(ACE_ROOT)/ace/Message_Block_T.i \ + $(ACE_ROOT)/ace/Message_Block_T.cpp \ + $(ACE_ROOT)/ace/CDR_Stream.i \ + $(TAO_ROOT)/tao/try_macros.h \ + $(TAO_ROOT)/tao/orbconf.h \ + $(ACE_ROOT)/ace/CORBA_macros.h \ + $(TAO_ROOT)/tao/varbase.h \ + $(TAO_ROOT)/tao/TAO_Export.h \ + $(TAO_ROOT)/tao/corbafwd.i \ + $(TAO_ROOT)/tao/Environment.h \ + $(TAO_ROOT)/tao/Environment.i \ + $(TAO_ROOT)/tao/ORB.h \ + $(TAO_ROOT)/tao/Exception.h \ + $(TAO_ROOT)/tao/Exception.i \ + $(TAO_ROOT)/tao/IOR_LookupTable.h \ + $(ACE_ROOT)/ace/Hash_Map_Manager.h \ + $(ACE_ROOT)/ace/Functor.h \ + $(ACE_ROOT)/ace/Functor.i \ + $(ACE_ROOT)/ace/Functor_T.h \ + $(ACE_ROOT)/ace/Functor_T.i \ + $(ACE_ROOT)/ace/Functor_T.cpp \ + $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \ + $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \ + $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \ + $(TAO_ROOT)/tao/Services.h \ + $(TAO_ROOT)/tao/Sequence.h \ + $(TAO_ROOT)/tao/Managed_Types.h \ + $(TAO_ROOT)/tao/Managed_Types.i \ + $(TAO_ROOT)/tao/Sequence.i \ + $(TAO_ROOT)/tao/Sequence_T.h \ + $(TAO_ROOT)/tao/Sequence_T.i \ + $(TAO_ROOT)/tao/Sequence_T.cpp \ + $(TAO_ROOT)/tao/Services.i \ + $(TAO_ROOT)/tao/IORManipulation.h \ + $(TAO_ROOT)/tao/LocalObject.h \ + $(TAO_ROOT)/tao/Object.h \ + $(TAO_ROOT)/tao/Object.i \ + $(TAO_ROOT)/tao/LocalObject.i \ + $(TAO_ROOT)/tao/IORC.h \ + $(TAO_ROOT)/tao/IORC.i \ + $(TAO_ROOT)/tao/Interceptor.h \ + $(TAO_ROOT)/tao/InterceptorC.h \ + $(TAO_ROOT)/tao/IOPC.h \ + $(TAO_ROOT)/tao/CDR.h \ + $(TAO_ROOT)/tao/CDR.i \ + $(TAO_ROOT)/tao/IOPC.i \ + $(TAO_ROOT)/tao/InterceptorC.i \ + $(TAO_ROOT)/tao/Interceptor.i \ + $(TAO_ROOT)/tao/PolicyC.h \ + $(TAO_ROOT)/tao/CurrentC.h \ + $(TAO_ROOT)/tao/CurrentC.i \ + $(TAO_ROOT)/tao/Encodable.h \ + $(TAO_ROOT)/tao/Typecode.h \ + $(TAO_ROOT)/tao/Typecode.i \ + $(TAO_ROOT)/tao/PolicyC.i \ + $(TAO_ROOT)/tao/ORB.i \ + $(TAO_ROOT)/tao/Any.h \ + $(TAO_ROOT)/tao/Any.i \ + $(TAO_ROOT)/tao/NVList.h \ + $(TAO_ROOT)/tao/NVList.i \ + $(TAO_ROOT)/tao/Principal.h \ + $(TAO_ROOT)/tao/Principal.i \ + $(TAO_ROOT)/tao/Request.h \ + $(TAO_ROOT)/tao/Context.h \ + $(TAO_ROOT)/tao/Context.i \ + $(TAO_ROOT)/tao/MessagingC.h \ + $(TAO_ROOT)/tao/ValueBase.h \ + $(TAO_ROOT)/tao/ValueBase.i \ + $(TAO_ROOT)/tao/ValueFactory.h \ + $(TAO_ROOT)/tao/ValueFactory.i \ + $(TAO_ROOT)/tao/TimeBaseC.h \ + $(TAO_ROOT)/tao/TimeBaseC.i \ + $(TAO_ROOT)/tao/PollableC.h \ + $(TAO_ROOT)/tao/PollableC.i \ + $(TAO_ROOT)/tao/MessagingC.i \ + $(TAO_ROOT)/tao/Request.i \ + $(TAO_ROOT)/tao/Server_Request.h \ + $(TAO_ROOT)/tao/Object_KeyC.h \ + $(TAO_ROOT)/tao/Object_KeyC.i \ + $(TAO_ROOT)/tao/Server_Request.i \ + $(TAO_ROOT)/tao/POA.h \ + $(TAO_ROOT)/tao/Object_Adapter.h \ + $(TAO_ROOT)/tao/Key_Adapters.h \ + $(ACE_ROOT)/ace/Map.h \ + $(ACE_ROOT)/ace/Map_T.h \ + $(ACE_ROOT)/ace/Pair.h \ + $(ACE_ROOT)/ace/Pair_T.h \ + $(ACE_ROOT)/ace/Pair_T.i \ + $(ACE_ROOT)/ace/Pair_T.cpp \ + $(ACE_ROOT)/ace/Map_Manager.h \ + $(ACE_ROOT)/ace/Map_Manager.i \ + $(ACE_ROOT)/ace/Map_Manager.cpp \ + $(ACE_ROOT)/ace/Active_Map_Manager.h \ + $(ACE_ROOT)/ace/Active_Map_Manager.i \ + $(ACE_ROOT)/ace/Active_Map_Manager_T.h \ + $(ACE_ROOT)/ace/Active_Map_Manager_T.i \ + $(ACE_ROOT)/ace/Active_Map_Manager_T.cpp \ + $(ACE_ROOT)/ace/Map_T.i \ + $(ACE_ROOT)/ace/Map_T.cpp \ + $(TAO_ROOT)/tao/PortableServerC.h \ + $(TAO_ROOT)/tao/PortableServerC.i \ + $(TAO_ROOT)/tao/Key_Adapters.i \ + $(TAO_ROOT)/tao/Server_Strategy_Factory.h \ + $(TAO_ROOT)/tao/poa_macros.h \ + $(TAO_ROOT)/tao/Servant_Base.h \ + $(TAO_ROOT)/tao/Servant_Base.i \ + $(TAO_ROOT)/tao/Active_Object_Map.h \ + $(TAO_ROOT)/tao/Active_Object_Map.i \ + $(TAO_ROOT)/tao/RTCORBAC.h \ + $(TAO_ROOT)/tao/RTCORBAC.i \ + $(TAO_ROOT)/tao/Object_Adapter.i \ + $(TAO_ROOT)/tao/POAManager.h \ + $(TAO_ROOT)/tao/POAManager.i \ + $(TAO_ROOT)/tao/POA.i \ + $(TAO_ROOT)/tao/Stub.h \ + $(TAO_ROOT)/tao/Pluggable.h \ + $(ACE_ROOT)/ace/Message_Queue.h \ + $(ACE_ROOT)/ace/IO_Cntl_Msg.h \ + $(ACE_ROOT)/ace/Message_Queue_T.h \ + $(ACE_ROOT)/ace/Message_Queue_T.i \ + $(ACE_ROOT)/ace/Message_Queue_T.cpp \ + $(ACE_ROOT)/ace/Strategies.h \ + $(ACE_ROOT)/ace/Strategies_T.h \ + $(ACE_ROOT)/ace/Synch_Options.h \ + $(ACE_ROOT)/ace/Synch_Options.i \ + $(ACE_ROOT)/ace/Thread_Manager.h \ + $(ACE_ROOT)/ace/Thread_Manager.i \ + $(ACE_ROOT)/ace/Strategies_T.i \ + $(ACE_ROOT)/ace/Strategies_T.cpp \ + $(ACE_ROOT)/ace/Service_Repository.h \ + $(ACE_ROOT)/ace/Service_Types.h \ + $(ACE_ROOT)/ace/Service_Types.i \ + $(ACE_ROOT)/ace/Service_Repository.i \ + $(ACE_ROOT)/ace/WFMO_Reactor.h \ + $(ACE_ROOT)/ace/WFMO_Reactor.i \ + $(ACE_ROOT)/ace/Strategies.i \ + $(ACE_ROOT)/ace/Message_Queue.i \ + $(TAO_ROOT)/tao/Pluggable.i \ + $(TAO_ROOT)/tao/MProfile.h \ + $(TAO_ROOT)/tao/Profile.h \ + $(TAO_ROOT)/tao/Tagged_Components.h \ + $(TAO_ROOT)/tao/CONV_FRAMEC.h \ + $(TAO_ROOT)/tao/CONV_FRAMEC.i \ + $(TAO_ROOT)/tao/Tagged_Components.i \ + $(TAO_ROOT)/tao/Profile.i \ + $(TAO_ROOT)/tao/MProfile.i \ + $(TAO_ROOT)/tao/Stub.i \ + $(TAO_ROOT)/tao/params.h \ + $(TAO_ROOT)/tao/params.i \ + $(TAO_ROOT)/tao/ORB_Core.h \ + $(TAO_ROOT)/tao/Policy_Manager.h \ + $(TAO_ROOT)/tao/POA_CORBA.h \ + $(TAO_ROOT)/tao/DynAnyC.h \ + $(TAO_ROOT)/tao/DynAnyC.i \ + $(TAO_ROOT)/tao/DomainC.h \ + $(TAO_ROOT)/tao/DomainC.i \ + $(TAO_ROOT)/tao/Policy_Manager.i \ + $(TAO_ROOT)/tao/Resource_Factory.h \ + $(TAO_ROOT)/tao/Protocol_Factory.h \ + $(TAO_ROOT)/tao/TAO_Singleton_Manager.h \ + $(TAO_ROOT)/tao/TAO_Singleton_Manager.inl \ + $(TAO_ROOT)/tao/TAO_Singleton.h \ + $(TAO_ROOT)/tao/TAO_Singleton.inl \ + $(TAO_ROOT)/tao/TAO_Singleton.cpp \ + $(TAO_ROOT)/tao/ORB_Core.i \ + $(ACE_ROOT)/ace/Dynamic_Service.h \ + $(ACE_ROOT)/ace/Dynamic_Service.cpp \ + $(TAO_ROOT)/tao/Operation_Table.h \ + $(TAO_ROOT)/tao/debug.h \ + $(TAO_ROOT)/tao/Client_Strategy_Factory.h \ + $(TAO_ROOT)/tao/Invocation.h \ + $(TAO_ROOT)/tao/Synch_Reply_Dispatcher.h \ + $(TAO_ROOT)/tao/Reply_Dispatcher.h \ + $(TAO_ROOT)/tao/Reply_Dispatcher.i \ + $(TAO_ROOT)/tao/GIOP_Message_State.h \ + $(TAO_ROOT)/tao/Pluggable_Messaging.h \ + $(TAO_ROOT)/tao/Pluggable_Messaging_Utils.h \ + $(TAO_ROOT)/tao/Pluggable_Messaging_Utils.i \ + $(TAO_ROOT)/tao/Pluggable_Messaging.i \ + $(TAO_ROOT)/tao/GIOP_Message_State.i \ + $(TAO_ROOT)/tao/Synch_Reply_Dispatcher.i \ + $(TAO_ROOT)/tao/TAOC.h \ + $(TAO_ROOT)/tao/Priority_Mapping_Manager.h \ + $(TAO_ROOT)/tao/Priority_Mapping.h \ + $(TAO_ROOT)/tao/Priority_Mapping.i \ + $(TAO_ROOT)/tao/Priority_Mapping_Manager.i \ + $(TAO_ROOT)/tao/TAOC.i \ + $(TAO_ROOT)/tao/operation_details.h \ + $(TAO_ROOT)/tao/target_specification.h \ + $(TAO_ROOT)/tao/target_specification.i \ + $(TAO_ROOT)/tao/operation_details.i \ + $(TAO_ROOT)/tao/Invocation.i \ + $(TAO_ROOT)/tao/InconsistentTypeCodeC.h \ + $(TAO_ROOT)/tao/DynAny_i.h \ + $(TAO_ROOT)/tao/ObjectIDList.h \ + $(TAO_ROOT)/tao/ObjectIDList.i \ + $(TAO_ROOT)/tao/WrongTransactionC.h \ + $(TAO_ROOT)/tao/InterfaceC.h \ + $(TAO_ROOT)/tao/ifrfwd.h \ + $(TAO_ROOT)/tao/BoundsC.h \ + $(TAO_ROOT)/tao/BoundsC.i \ + $(TAO_ROOT)/tao/MessagingS.h \ + $(TAO_ROOT)/tao/TimeBaseS.h \ + $(TAO_ROOT)/tao/TimeBaseS_T.h \ + $(TAO_ROOT)/tao/TimeBaseS_T.i \ + $(TAO_ROOT)/tao/TimeBaseS_T.cpp \ + $(TAO_ROOT)/tao/TimeBaseS.i \ + $(TAO_ROOT)/tao/MessagingS_T.h \ + $(TAO_ROOT)/tao/MessagingS_T.i \ + $(TAO_ROOT)/tao/MessagingS_T.cpp \ + $(TAO_ROOT)/tao/MessagingS.i + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/orbsvcs/tests/tests_svc_loader/README b/TAO/orbsvcs/tests/tests_svc_loader/README new file mode 100644 index 00000000000..1e581782879 --- /dev/null +++ b/TAO/orbsvcs/tests/tests_svc_loader/README @@ -0,0 +1,12 @@ +// $Id$ + + This directory contains a generic client program. The program +takes an object reference as a commandline parameter and checks if it +refers to an existing object and a debug statement is printed out to +reflect the same. + +To Run tests_svc_loader +======================= + +./tests_svc_loader file://ns.ior + diff --git a/TAO/orbsvcs/tests/tests_svc_loader/tests_svc_loader.cpp b/TAO/orbsvcs/tests/tests_svc_loader/tests_svc_loader.cpp new file mode 100644 index 00000000000..186f224b3d8 --- /dev/null +++ b/TAO/orbsvcs/tests/tests_svc_loader/tests_svc_loader.cpp @@ -0,0 +1,89 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// orbsvcs/tests/tests_svc_loader +// +// = FILENAME +// client.cpp +// +// = DESCRIPTION +// This directory contains a client that checks if a given object +// reference points to an existing object or not and prints a debug +// statement to reflect the same. This client is to be used in +// conjunction with testing the dynamically loadable services. If +// the service is loaded successfully, the object reference from the +// server would be a valid one and the corresponding debug statement +// is printed out. Or viceversa. +// +// = AUTHOR +// Priyanka Gontla <pgontla@ece.uci.edu> +// +// ============================================================================ + +#include <iostream> +#include "ace/Service_Config.h" +#include "ace/Log_Msg.h" +#include "ace/pre.h" + +#include "tao/corba.h" + +ACE_RCSID(tests_svc_loader, tests_svc_loader, "$Id$"); + +int main (int argc, char *argv []) +{ + + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + // First initialize the ORB, that will remove some arguments... + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, 0, ACE_TRY_ENV); + ACE_TRY_CHECK; + + // There must be at least one argument, the file that has to be + // retrieved + if (argc < 2) + { + ACE_DEBUG ((LM_DEBUG, + "Usage: File name to be retrieved%s", + argv[0])); + + return -1; + } + + // Use the first argument to create the object reference. + CORBA::Object_var object = + orb->string_to_object (argv[1], ACE_TRY_ENV); + ACE_TRY_CHECK; + + // Check if this object reference is a valid one.. + CORBA::Boolean not_exists = + object->_non_existent (ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (not_exists) + { + // Object reference was not of an existing object + ACE_DEBUG ((LM_ERROR, + "The Object is non existent\n")); + } + else + { + // The Object exists + ACE_DEBUG ((LM_DEBUG, + "The object exists!!!\n")); + } + + } + ACE_CATCH (CORBA::SystemException ,e) + { + ACE_DEBUG ((LM_ERROR, + "CORBA System Exception Raised!\n")); + } + ACE_ENDTRY; + ACE_CHECK_RETURN (-1); + + return 0; +} |