diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2002-03-14 15:42:39 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2002-03-14 15:42:39 +0000 |
commit | 17f5c876337ecc724f41514f9524a50171f9bfbe (patch) | |
tree | bafd6dac30430073eda7cf2311fe7776dbfaa99e | |
parent | 2cb3b07af39510c3fd8efaa408eec36782ff767d (diff) | |
download | ATCD-17f5c876337ecc724f41514f9524a50171f9bfbe.tar.gz |
ChangeLogTag: Thu Mar 14 09:26:54 2002 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 26 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Makefile.CosNaming | 720 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp | 249 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.h | 70 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Naming_Service_Container.cpp | 390 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Naming_Service_Container.h | 225 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp | 66 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.h | 11 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Storable.cpp | 25 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Storable.h | 145 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Storable.inl | 148 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp | 1280 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.h | 297 | ||||
-rwxr-xr-x | TAO/orbsvcs/tests/Simple_Naming/run_test.pl | 24 |
14 files changed, 3651 insertions, 25 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 3944e1306ef..78977a866ab 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,29 @@ +Thu Mar 14 09:26:54 2002 Chad Elliott <elliott_c@ociweb.com> + + * orbsvcs/orbsvcs/Makefile.CosNaming: + * orbsvcs/orbsvcs/Naming/Flat_File_Persistence.h: + * orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp: + * orbsvcs/orbsvcs/Naming/Naming_Service_Container.h: + * orbsvcs/orbsvcs/Naming/Naming_Service_Container.cpp: + * orbsvcs/orbsvcs/Naming/Naming_Utils.h: + * orbsvcs/orbsvcs/Naming/Naming_Utils.cpp: + * orbsvcs/orbsvcs/Naming/Storable.h: + * orbsvcs/orbsvcs/Naming/Storable.inl: + * orbsvcs/orbsvcs/Naming/Storable.cpp: + * orbsvcs/orbsvcs/Naming/Storable_Naming_Context.h: + * orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp: + + Adding a flat file Naming Service persistence originally written + by Chanaka Liyanaarachchi <chanaka@ociweb.com> and Bruce Trask + <trask_b@ociweb.com>. A new option, -u, was added to use the flat + file persistence instead of the mmap() persistence. The -u option + takes a parameter which specifies which directory is used to + store the persistence files. + + * orbsvcs/tests/Simple_Naming/run_test.pl: + + Update the test to include a test for -u. + Thu Mar 14 09:51:06 2002 Carlos O'Ryan <coryan@uci.edu> * orbsvcs/performance-tests/Makefile: diff --git a/TAO/orbsvcs/orbsvcs/Makefile.CosNaming b/TAO/orbsvcs/orbsvcs/Makefile.CosNaming index 072aec4000a..1d75fca5f25 100644 --- a/TAO/orbsvcs/orbsvcs/Makefile.CosNaming +++ b/TAO/orbsvcs/orbsvcs/Makefile.CosNaming @@ -44,7 +44,11 @@ CPP_SRCS += \ Naming/Entries \ Naming/Persistent_Context_Index \ Naming/Naming_Utils \ - Naming/Naming_Loader + Naming/Naming_Loader \ + Naming/Storable \ + Naming/Storable_Naming_Context \ + Naming/Naming_Service_Container \ + Naming/Flat_File_Persistence IDL_SRC = \ $(addsuffix S.cpp, $(IDL_FILES)) \ @@ -1887,6 +1891,8 @@ realclean: clean $(ACE_ROOT)/ace/Hash_Map_With_Allocator_T.h \ $(ACE_ROOT)/ace/Hash_Map_With_Allocator_T.i \ $(ACE_ROOT)/ace/Hash_Map_With_Allocator_T.cpp \ + Naming/Storable_Naming_Context.h Naming/Storable.h \ + Naming/Storable.inl Naming/Flat_File_Persistence.h \ $(TAO_ROOT)/tao/debug.h \ $(TAO_ROOT)/tao/ORB_Core.h \ $(TAO_ROOT)/tao/Policy_Manager.h \ @@ -2192,6 +2198,718 @@ realclean: clean $(ACE_ROOT)/ace/Dynamic_Service.i \ $(ACE_ROOT)/ace/Dynamic_Service.cpp +.obj/Storable.o .obj/Storable.so .shobj/Storable.o .shobj/Storable.so: Naming/Storable.cpp Naming/Storable.h \ + $(TAO_ROOT)/tao/corba.h \ + $(ACE_ROOT)/ace/pre.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/ace_wchar.inl \ + $(ACE_ROOT)/ace/OS_Errno.h \ + $(ACE_ROOT)/ace/OS_Export.h \ + $(ACE_ROOT)/ace/OS_Errno.inl \ + $(TAO_ROOT)/tao/corbafwd.h \ + $(ACE_ROOT)/ace/CDR_Base.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/Message_Block.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/OS_Dirent.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/Default_Constants.h \ + $(ACE_ROOT)/ace/Global_Macros.h \ + $(ACE_ROOT)/ace/Min_Max.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Flag_Manip.h \ + $(ACE_ROOT)/ace/Flag_Manip.i \ + $(ACE_ROOT)/ace/Handle_Ops.h \ + $(ACE_ROOT)/ace/Handle_Ops.i \ + $(ACE_ROOT)/ace/Lib_Find.h \ + $(ACE_ROOT)/ace/Lib_Find.i \ + $(ACE_ROOT)/ace/Init_ACE.h \ + $(ACE_ROOT)/ace/Init_ACE.i \ + $(ACE_ROOT)/ace/Sock_Connect.h \ + $(ACE_ROOT)/ace/Sock_Connect.i \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/Malloc.h \ + $(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/OS_Log_Msg_Attributes.h \ + $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.inl \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(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_Adapter.h \ + $(ACE_ROOT)/ace/Base_Thread_Adapter.h \ + $(ACE_ROOT)/ace/Base_Thread_Adapter.inl \ + $(ACE_ROOT)/ace/Thread_Adapter.inl \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ + $(ACE_ROOT)/ace/Malloc_Allocator.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc_Allocator.i \ + $(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/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(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/Unbounded_Set.h \ + $(ACE_ROOT)/ace/Node.h \ + $(ACE_ROOT)/ace/Node.cpp \ + $(ACE_ROOT)/ace/Unbounded_Set.inl \ + $(ACE_ROOT)/ace/Unbounded_Set.cpp \ + $(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/CDR_Base.inl \ + $(ACE_ROOT)/ace/CORBA_macros.h \ + $(TAO_ROOT)/tao/orbconf.h \ + $(TAO_ROOT)/tao/varbase.h \ + $(TAO_ROOT)/tao/TAO_Export.h \ + $(TAO_ROOT)/tao/corbafwd.i \ + $(TAO_ROOT)/tao/Typecode.h \ + $(TAO_ROOT)/tao/Exception.h \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/String_Base.h \ + $(ACE_ROOT)/ace/String_Base_Const.h \ + $(ACE_ROOT)/ace/String_Base.i \ + $(ACE_ROOT)/ace/String_Base.cpp \ + $(ACE_ROOT)/ace/Auto_Ptr.h \ + $(ACE_ROOT)/ace/Auto_Ptr.i \ + $(ACE_ROOT)/ace/Auto_Ptr.cpp \ + $(ACE_ROOT)/ace/SString.i \ + $(TAO_ROOT)/tao/Exception.i \ + $(TAO_ROOT)/tao/Typecode.i \ + $(TAO_ROOT)/tao/Any.h \ + $(TAO_ROOT)/tao/CDR.h \ + $(ACE_ROOT)/ace/CDR_Stream.h \ + $(ACE_ROOT)/ace/CDR_Stream.i \ + $(TAO_ROOT)/tao/CDR.i \ + $(TAO_ROOT)/tao/Environment.h \ + $(TAO_ROOT)/tao/Environment.i \ + $(TAO_ROOT)/tao/Object.h \ + $(TAO_ROOT)/tao/Policy_ForwardC.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/Policy_ForwardC.i \ + $(TAO_ROOT)/tao/Object.i \ + $(TAO_ROOT)/tao/Any.i \ + $(TAO_ROOT)/tao/NVList.h \ + $(ACE_ROOT)/ace/Unbounded_Queue.h \ + $(ACE_ROOT)/ace/Unbounded_Queue.inl \ + $(ACE_ROOT)/ace/Unbounded_Queue.cpp \ + $(TAO_ROOT)/tao/NVList.i \ + $(TAO_ROOT)/tao/LocalObject.h \ + $(TAO_ROOT)/tao/LocalObject.i \ + $(TAO_ROOT)/tao/Principal.h \ + $(TAO_ROOT)/tao/OctetSeqC.h \ + $(TAO_ROOT)/tao/OctetSeqC.i \ + $(TAO_ROOT)/tao/Principal.i \ + $(TAO_ROOT)/tao/ORB.h \ + $(TAO_ROOT)/tao/Services.h \ + $(TAO_ROOT)/tao/Services.i \ + $(TAO_ROOT)/tao/CORBA_String.h \ + $(TAO_ROOT)/tao/CORBA_String.inl \ + $(TAO_ROOT)/tao/PolicyC.h \ + $(TAO_ROOT)/tao/CurrentC.h \ + $(TAO_ROOT)/tao/CurrentC.i \ + $(TAO_ROOT)/tao/Remote_Object_Proxy_Impl.h \ + $(TAO_ROOT)/tao/Object_Proxy_Impl.h \ + $(TAO_ROOT)/tao/Encodable.h \ + $(TAO_ROOT)/tao/PolicyC.i \ + $(TAO_ROOT)/tao/ORB.i \ + $(TAO_ROOT)/tao/BoundsC.h \ + $(TAO_ROOT)/tao/BoundsC.i \ + $(TAO_ROOT)/tao/ValueBase.h \ + $(TAO_ROOT)/tao/ValueBase.i \ + $(TAO_ROOT)/tao/ValueFactory.h \ + $(TAO_ROOT)/tao/ValueFactory.i \ + $(TAO_ROOT)/tao/DomainC.h \ + $(TAO_ROOT)/tao/DomainC.i \ + $(TAO_ROOT)/tao/WrongTransactionC.h \ + $(TAO_ROOT)/tao/WrongTransactionC.i \ + $(TAO_ROOT)/tao/Object_KeyC.h \ + $(TAO_ROOT)/tao/Object_KeyC.i \ + $(TAO_ROOT)/tao/ObjectIDList.h \ + $(TAO_ROOT)/tao/ObjectIDList.i \ + $(TAO_ROOT)/tao/StringSeqC.h \ + $(TAO_ROOT)/tao/StringSeqC.i \ + $(TAO_ROOT)/tao/PortableInterceptorC.h \ + $(TAO_ROOT)/tao/DynamicC.h \ + $(TAO_ROOT)/tao/DynamicC.i \ + $(TAO_ROOT)/tao/ObjectReferenceTemplateC.h \ + $(TAO_ROOT)/tao/ObjectReferenceTemplateC.i \ + $(TAO_ROOT)/tao/Messaging_SyncScopeC.h \ + $(TAO_ROOT)/tao/IOPC.h \ + $(TAO_ROOT)/tao/IOPC.i \ + $(TAO_ROOT)/tao/Messaging_SyncScopeC.i \ + $(TAO_ROOT)/tao/PortableInterceptorC.i \ + Naming/Storable.inl + +.obj/Storable_Naming_Context.o .obj/Storable_Naming_Context.so .shobj/Storable_Naming_Context.o .shobj/Storable_Naming_Context.so: Naming/Storable_Naming_Context.cpp \ + $(ACE_ROOT)/ace/Auto_Ptr.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/ace_wchar.inl \ + $(ACE_ROOT)/ace/OS_Errno.h \ + $(ACE_ROOT)/ace/OS_Export.h \ + $(ACE_ROOT)/ace/OS_Errno.inl \ + $(ACE_ROOT)/ace/OS_Dirent.h \ + $(ACE_ROOT)/ace/OS_Dirent.inl \ + $(ACE_ROOT)/ace/OS_String.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(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/Default_Constants.h \ + $(ACE_ROOT)/ace/Global_Macros.h \ + $(ACE_ROOT)/ace/Min_Max.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Auto_Ptr.i \ + $(ACE_ROOT)/ace/Auto_Ptr.cpp \ + Naming/Storable_Naming_Context.h Naming/Hash_Naming_Context.h \ + Naming/Naming_Context_Interface.h \ + CosNamingS.h \ + CosNamingC.h \ + $(TAO_ROOT)/tao/corba.h \ + $(TAO_ROOT)/tao/corbafwd.h \ + $(ACE_ROOT)/ace/CDR_Base.h \ + $(ACE_ROOT)/ace/Message_Block.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/Flag_Manip.h \ + $(ACE_ROOT)/ace/Flag_Manip.i \ + $(ACE_ROOT)/ace/Handle_Ops.h \ + $(ACE_ROOT)/ace/Handle_Ops.i \ + $(ACE_ROOT)/ace/Lib_Find.h \ + $(ACE_ROOT)/ace/Lib_Find.i \ + $(ACE_ROOT)/ace/Init_ACE.h \ + $(ACE_ROOT)/ace/Init_ACE.i \ + $(ACE_ROOT)/ace/Sock_Connect.h \ + $(ACE_ROOT)/ace/Sock_Connect.i \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/Malloc.h \ + $(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/OS_Log_Msg_Attributes.h \ + $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.inl \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(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_Adapter.h \ + $(ACE_ROOT)/ace/Base_Thread_Adapter.h \ + $(ACE_ROOT)/ace/Base_Thread_Adapter.inl \ + $(ACE_ROOT)/ace/Thread_Adapter.inl \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ + $(ACE_ROOT)/ace/Malloc_Allocator.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc_Allocator.i \ + $(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/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(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/Unbounded_Set.h \ + $(ACE_ROOT)/ace/Node.h \ + $(ACE_ROOT)/ace/Node.cpp \ + $(ACE_ROOT)/ace/Unbounded_Set.inl \ + $(ACE_ROOT)/ace/Unbounded_Set.cpp \ + $(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/CDR_Base.inl \ + $(ACE_ROOT)/ace/CORBA_macros.h \ + $(TAO_ROOT)/tao/orbconf.h \ + $(TAO_ROOT)/tao/varbase.h \ + $(TAO_ROOT)/tao/TAO_Export.h \ + $(TAO_ROOT)/tao/corbafwd.i \ + $(TAO_ROOT)/tao/Typecode.h \ + $(TAO_ROOT)/tao/Exception.h \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/String_Base.h \ + $(ACE_ROOT)/ace/String_Base_Const.h \ + $(ACE_ROOT)/ace/String_Base.i \ + $(ACE_ROOT)/ace/String_Base.cpp \ + $(ACE_ROOT)/ace/SString.i \ + $(TAO_ROOT)/tao/Exception.i \ + $(TAO_ROOT)/tao/Typecode.i \ + $(TAO_ROOT)/tao/Any.h \ + $(TAO_ROOT)/tao/CDR.h \ + $(ACE_ROOT)/ace/CDR_Stream.h \ + $(ACE_ROOT)/ace/CDR_Stream.i \ + $(TAO_ROOT)/tao/CDR.i \ + $(TAO_ROOT)/tao/Environment.h \ + $(TAO_ROOT)/tao/Environment.i \ + $(TAO_ROOT)/tao/Object.h \ + $(TAO_ROOT)/tao/Policy_ForwardC.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/Policy_ForwardC.i \ + $(TAO_ROOT)/tao/Object.i \ + $(TAO_ROOT)/tao/Any.i \ + $(TAO_ROOT)/tao/NVList.h \ + $(ACE_ROOT)/ace/Unbounded_Queue.h \ + $(ACE_ROOT)/ace/Unbounded_Queue.inl \ + $(ACE_ROOT)/ace/Unbounded_Queue.cpp \ + $(TAO_ROOT)/tao/NVList.i \ + $(TAO_ROOT)/tao/LocalObject.h \ + $(TAO_ROOT)/tao/LocalObject.i \ + $(TAO_ROOT)/tao/Principal.h \ + $(TAO_ROOT)/tao/OctetSeqC.h \ + $(TAO_ROOT)/tao/OctetSeqC.i \ + $(TAO_ROOT)/tao/Principal.i \ + $(TAO_ROOT)/tao/ORB.h \ + $(TAO_ROOT)/tao/Services.h \ + $(TAO_ROOT)/tao/Services.i \ + $(TAO_ROOT)/tao/CORBA_String.h \ + $(TAO_ROOT)/tao/CORBA_String.inl \ + $(TAO_ROOT)/tao/PolicyC.h \ + $(TAO_ROOT)/tao/CurrentC.h \ + $(TAO_ROOT)/tao/CurrentC.i \ + $(TAO_ROOT)/tao/Remote_Object_Proxy_Impl.h \ + $(TAO_ROOT)/tao/Object_Proxy_Impl.h \ + $(TAO_ROOT)/tao/Encodable.h \ + $(TAO_ROOT)/tao/PolicyC.i \ + $(TAO_ROOT)/tao/ORB.i \ + $(TAO_ROOT)/tao/BoundsC.h \ + $(TAO_ROOT)/tao/BoundsC.i \ + $(TAO_ROOT)/tao/ValueBase.h \ + $(TAO_ROOT)/tao/ValueBase.i \ + $(TAO_ROOT)/tao/ValueFactory.h \ + $(TAO_ROOT)/tao/ValueFactory.i \ + $(TAO_ROOT)/tao/DomainC.h \ + $(TAO_ROOT)/tao/DomainC.i \ + $(TAO_ROOT)/tao/WrongTransactionC.h \ + $(TAO_ROOT)/tao/WrongTransactionC.i \ + $(TAO_ROOT)/tao/Object_KeyC.h \ + $(TAO_ROOT)/tao/Object_KeyC.i \ + $(TAO_ROOT)/tao/ObjectIDList.h \ + $(TAO_ROOT)/tao/ObjectIDList.i \ + $(TAO_ROOT)/tao/StringSeqC.h \ + $(TAO_ROOT)/tao/StringSeqC.i \ + $(TAO_ROOT)/tao/PortableInterceptorC.h \ + $(TAO_ROOT)/tao/DynamicC.h \ + $(TAO_ROOT)/tao/DynamicC.i \ + $(TAO_ROOT)/tao/ObjectReferenceTemplateC.h \ + $(TAO_ROOT)/tao/ObjectReferenceTemplateC.i \ + $(TAO_ROOT)/tao/Messaging_SyncScopeC.h \ + $(TAO_ROOT)/tao/IOPC.h \ + $(TAO_ROOT)/tao/IOPC.i \ + $(TAO_ROOT)/tao/Messaging_SyncScopeC.i \ + $(TAO_ROOT)/tao/PortableInterceptorC.i \ + Naming/naming_export.h \ + CosNamingC.i \ + $(TAO_ROOT)/tao/PortableServer/PortableServer.h \ + $(TAO_ROOT)/tao/PortableServer/portableserver_export.h \ + $(TAO_ROOT)/tao/PortableServer/PortableServerC.h \ + $(TAO_ROOT)/tao/PortableServer/PortableServerC.i \ + $(TAO_ROOT)/tao/PortableServer/Servant_Base.h \ + $(TAO_ROOT)/tao/Abstract_Servant_Base.h \ + $(ACE_ROOT)/ace/Atomic_Op.h \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Atomic_Op.cpp \ + $(TAO_ROOT)/tao/PortableServer/Servant_Base.i \ + $(TAO_ROOT)/tao/PortableServer/Collocated_Object.h \ + $(TAO_ROOT)/tao/PortableServer/Collocated_Object.i \ + $(TAO_ROOT)/tao/PortableServer/ThruPOA_Object_Proxy_Impl.h \ + $(TAO_ROOT)/tao/PortableServer/Direct_Object_Proxy_Impl.h \ + CosNamingS_T.h \ + CosNamingS_T.i \ + CosNamingS_T.cpp \ + CosNamingS.i \ + Naming/naming_export.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/Test_and_Set.h \ + $(ACE_ROOT)/ace/Test_and_Set.i \ + $(ACE_ROOT)/ace/Test_and_Set.cpp \ + $(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 \ + Naming/Persistent_Entries.h \ + $(ACE_ROOT)/ace/Hash_Map_With_Allocator_T.h \ + $(ACE_ROOT)/ace/Hash_Map_With_Allocator_T.i \ + $(ACE_ROOT)/ace/Hash_Map_With_Allocator_T.cpp \ + Naming/Storable.h Naming/Storable.inl Naming/Bindings_Iterator_T.h \ + Naming/Bindings_Iterator_T.cpp Naming/Naming_Service_Container.h \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers_T.h \ + $(ACE_ROOT)/ace/Array_Base.h \ + $(ACE_ROOT)/ace/Array_Base.inl \ + $(ACE_ROOT)/ace/Array_Base.cpp \ + $(ACE_ROOT)/ace/Containers_T.i \ + $(ACE_ROOT)/ace/Containers_T.cpp \ + Naming/Naming_Service_Container.cpp + +.obj/Naming_Service_Container.o .obj/Naming_Service_Container.so .shobj/Naming_Service_Container.o .shobj/Naming_Service_Container.so: Naming/Naming_Service_Container.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/pre.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/ace_wchar.inl \ + $(ACE_ROOT)/ace/OS_Errno.h \ + $(ACE_ROOT)/ace/OS_Export.h \ + $(ACE_ROOT)/ace/OS_Errno.inl \ + $(ACE_ROOT)/ace/OS_Dirent.h \ + $(ACE_ROOT)/ace/OS_Dirent.inl \ + $(ACE_ROOT)/ace/OS_String.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(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/Default_Constants.h \ + $(ACE_ROOT)/ace/Global_Macros.h \ + $(ACE_ROOT)/ace/Min_Max.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Flag_Manip.h \ + $(ACE_ROOT)/ace/Flag_Manip.i \ + $(ACE_ROOT)/ace/Handle_Ops.h \ + $(ACE_ROOT)/ace/Handle_Ops.i \ + $(ACE_ROOT)/ace/Lib_Find.h \ + $(ACE_ROOT)/ace/Lib_Find.i \ + $(ACE_ROOT)/ace/Init_ACE.h \ + $(ACE_ROOT)/ace/Init_ACE.i \ + $(ACE_ROOT)/ace/Sock_Connect.h \ + $(ACE_ROOT)/ace/Sock_Connect.i \ + $(ACE_ROOT)/ace/ACE.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/OS_Log_Msg_Attributes.h \ + $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.inl \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(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_Adapter.h \ + $(ACE_ROOT)/ace/Base_Thread_Adapter.h \ + $(ACE_ROOT)/ace/Base_Thread_Adapter.inl \ + $(ACE_ROOT)/ace/Thread_Adapter.inl \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ + $(ACE_ROOT)/ace/Malloc_Allocator.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc_Allocator.i \ + $(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/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(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/Unbounded_Set.h \ + $(ACE_ROOT)/ace/Node.h \ + $(ACE_ROOT)/ace/Node.cpp \ + $(ACE_ROOT)/ace/Unbounded_Set.inl \ + $(ACE_ROOT)/ace/Unbounded_Set.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.i \ + Naming/Naming_Service_Container.h \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers_T.h \ + $(ACE_ROOT)/ace/Array_Base.h \ + $(ACE_ROOT)/ace/Array_Base.inl \ + $(ACE_ROOT)/ace/Array_Base.cpp \ + $(ACE_ROOT)/ace/Unbounded_Queue.h \ + $(ACE_ROOT)/ace/Unbounded_Queue.inl \ + $(ACE_ROOT)/ace/Unbounded_Queue.cpp \ + $(ACE_ROOT)/ace/Containers_T.i \ + $(ACE_ROOT)/ace/Containers_T.cpp \ + Naming/Naming_Service_Container.cpp + +.obj/Flat_File_Persistence.o .obj/Flat_File_Persistence.so .shobj/Flat_File_Persistence.o .shobj/Flat_File_Persistence.so: Naming/Flat_File_Persistence.cpp \ + Naming/Flat_File_Persistence.h Naming/Storable.h \ + $(TAO_ROOT)/tao/corba.h \ + $(ACE_ROOT)/ace/pre.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/ace_wchar.inl \ + $(ACE_ROOT)/ace/OS_Errno.h \ + $(ACE_ROOT)/ace/OS_Export.h \ + $(ACE_ROOT)/ace/OS_Errno.inl \ + $(TAO_ROOT)/tao/corbafwd.h \ + $(ACE_ROOT)/ace/CDR_Base.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/Message_Block.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/OS_Dirent.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/Default_Constants.h \ + $(ACE_ROOT)/ace/Global_Macros.h \ + $(ACE_ROOT)/ace/Min_Max.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Flag_Manip.h \ + $(ACE_ROOT)/ace/Flag_Manip.i \ + $(ACE_ROOT)/ace/Handle_Ops.h \ + $(ACE_ROOT)/ace/Handle_Ops.i \ + $(ACE_ROOT)/ace/Lib_Find.h \ + $(ACE_ROOT)/ace/Lib_Find.i \ + $(ACE_ROOT)/ace/Init_ACE.h \ + $(ACE_ROOT)/ace/Init_ACE.i \ + $(ACE_ROOT)/ace/Sock_Connect.h \ + $(ACE_ROOT)/ace/Sock_Connect.i \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/Malloc.h \ + $(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/OS_Log_Msg_Attributes.h \ + $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.inl \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(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_Adapter.h \ + $(ACE_ROOT)/ace/Base_Thread_Adapter.h \ + $(ACE_ROOT)/ace/Base_Thread_Adapter.inl \ + $(ACE_ROOT)/ace/Thread_Adapter.inl \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ + $(ACE_ROOT)/ace/Malloc_Allocator.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc_Allocator.i \ + $(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/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(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/Unbounded_Set.h \ + $(ACE_ROOT)/ace/Node.h \ + $(ACE_ROOT)/ace/Node.cpp \ + $(ACE_ROOT)/ace/Unbounded_Set.inl \ + $(ACE_ROOT)/ace/Unbounded_Set.cpp \ + $(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/CDR_Base.inl \ + $(ACE_ROOT)/ace/CORBA_macros.h \ + $(TAO_ROOT)/tao/orbconf.h \ + $(TAO_ROOT)/tao/varbase.h \ + $(TAO_ROOT)/tao/TAO_Export.h \ + $(TAO_ROOT)/tao/corbafwd.i \ + $(TAO_ROOT)/tao/Typecode.h \ + $(TAO_ROOT)/tao/Exception.h \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/String_Base.h \ + $(ACE_ROOT)/ace/String_Base_Const.h \ + $(ACE_ROOT)/ace/String_Base.i \ + $(ACE_ROOT)/ace/String_Base.cpp \ + $(ACE_ROOT)/ace/Auto_Ptr.h \ + $(ACE_ROOT)/ace/Auto_Ptr.i \ + $(ACE_ROOT)/ace/Auto_Ptr.cpp \ + $(ACE_ROOT)/ace/SString.i \ + $(TAO_ROOT)/tao/Exception.i \ + $(TAO_ROOT)/tao/Typecode.i \ + $(TAO_ROOT)/tao/Any.h \ + $(TAO_ROOT)/tao/CDR.h \ + $(ACE_ROOT)/ace/CDR_Stream.h \ + $(ACE_ROOT)/ace/CDR_Stream.i \ + $(TAO_ROOT)/tao/CDR.i \ + $(TAO_ROOT)/tao/Environment.h \ + $(TAO_ROOT)/tao/Environment.i \ + $(TAO_ROOT)/tao/Object.h \ + $(TAO_ROOT)/tao/Policy_ForwardC.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/Policy_ForwardC.i \ + $(TAO_ROOT)/tao/Object.i \ + $(TAO_ROOT)/tao/Any.i \ + $(TAO_ROOT)/tao/NVList.h \ + $(ACE_ROOT)/ace/Unbounded_Queue.h \ + $(ACE_ROOT)/ace/Unbounded_Queue.inl \ + $(ACE_ROOT)/ace/Unbounded_Queue.cpp \ + $(TAO_ROOT)/tao/NVList.i \ + $(TAO_ROOT)/tao/LocalObject.h \ + $(TAO_ROOT)/tao/LocalObject.i \ + $(TAO_ROOT)/tao/Principal.h \ + $(TAO_ROOT)/tao/OctetSeqC.h \ + $(TAO_ROOT)/tao/OctetSeqC.i \ + $(TAO_ROOT)/tao/Principal.i \ + $(TAO_ROOT)/tao/ORB.h \ + $(TAO_ROOT)/tao/Services.h \ + $(TAO_ROOT)/tao/Services.i \ + $(TAO_ROOT)/tao/CORBA_String.h \ + $(TAO_ROOT)/tao/CORBA_String.inl \ + $(TAO_ROOT)/tao/PolicyC.h \ + $(TAO_ROOT)/tao/CurrentC.h \ + $(TAO_ROOT)/tao/CurrentC.i \ + $(TAO_ROOT)/tao/Remote_Object_Proxy_Impl.h \ + $(TAO_ROOT)/tao/Object_Proxy_Impl.h \ + $(TAO_ROOT)/tao/Encodable.h \ + $(TAO_ROOT)/tao/PolicyC.i \ + $(TAO_ROOT)/tao/ORB.i \ + $(TAO_ROOT)/tao/BoundsC.h \ + $(TAO_ROOT)/tao/BoundsC.i \ + $(TAO_ROOT)/tao/ValueBase.h \ + $(TAO_ROOT)/tao/ValueBase.i \ + $(TAO_ROOT)/tao/ValueFactory.h \ + $(TAO_ROOT)/tao/ValueFactory.i \ + $(TAO_ROOT)/tao/DomainC.h \ + $(TAO_ROOT)/tao/DomainC.i \ + $(TAO_ROOT)/tao/WrongTransactionC.h \ + $(TAO_ROOT)/tao/WrongTransactionC.i \ + $(TAO_ROOT)/tao/Object_KeyC.h \ + $(TAO_ROOT)/tao/Object_KeyC.i \ + $(TAO_ROOT)/tao/ObjectIDList.h \ + $(TAO_ROOT)/tao/ObjectIDList.i \ + $(TAO_ROOT)/tao/StringSeqC.h \ + $(TAO_ROOT)/tao/StringSeqC.i \ + $(TAO_ROOT)/tao/PortableInterceptorC.h \ + $(TAO_ROOT)/tao/DynamicC.h \ + $(TAO_ROOT)/tao/DynamicC.i \ + $(TAO_ROOT)/tao/ObjectReferenceTemplateC.h \ + $(TAO_ROOT)/tao/ObjectReferenceTemplateC.i \ + $(TAO_ROOT)/tao/Messaging_SyncScopeC.h \ + $(TAO_ROOT)/tao/IOPC.h \ + $(TAO_ROOT)/tao/IOPC.i \ + $(TAO_ROOT)/tao/Messaging_SyncScopeC.i \ + $(TAO_ROOT)/tao/PortableInterceptorC.i \ + Naming/Storable.inl + .obj/CosNamingS.o .obj/CosNamingS.so .shobj/CosNamingS.o .shobj/CosNamingS.so: CosNamingS.cpp CosNamingS.h \ $(ACE_ROOT)/ace/pre.h CosNamingC.h \ $(TAO_ROOT)/tao/corba.h \ diff --git a/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp b/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp new file mode 100644 index 00000000000..b6351e19941 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.cpp @@ -0,0 +1,249 @@ +// $Id$ + +//----------------------------------------------------------------------------- +// Flat File class implementations +//----------------------------------------------------------------------------- +#include "Flat_File_Persistence.h" + +TAO_NS_FlatFileWriter::TAO_NS_FlatFileWriter () + : fout_ (0) +{ +} + +int +TAO_NS_FlatFileWriter::open(const char * filename) +{ + + this->fout_ = ACE_OS::fopen(filename, "w"); + if (this->fout_ == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing %s", + filename), + 1); + + delete_bindings_ = 0; + filename_ = filename; + + return 0; +} + +TAO_NS_FlatFileWriter::~TAO_NS_FlatFileWriter () +{ +} + +int +TAO_NS_FlatFileWriter::close() +{ + ACE_OS::fclose(this->fout_); + + if (delete_bindings_) + remove (filename_.c_str()); + return 0; +} + +TAO_Writer_Base & +TAO_NS_FlatFileWriter::operator <<( + const TAO_NS_Persistence_Header &header) +{ + unsigned int size = header.size(); + ACE_CString context_name = header.context_name(); + + if (this->fout_ != 0) + { + ACE_OS::fprintf(this->fout_, "%d\n%s\n%d\n", + context_name.length(), + context_name.c_str(), + size); + ACE_OS::fflush(this->fout_); + } + + return *this; +} + +TAO_Writer_Base & +TAO_NS_FlatFileWriter::operator <<( + const TAO_NS_Persistence_Record &record) +{ + if (this->fout_ != 0) + { + TAO_NS_Persistence_Record::Record_Type type = record.type(); + + ACE_OS::fprintf(this->fout_, "%d\n", type); + + ACE_CString id = record.id(); + + ACE_OS::fprintf(this->fout_, "%d\n%s\n", id.length(), id.c_str()); + + ACE_CString kind = record.kind(); + ACE_OS::fprintf(this->fout_, "%d\n%s\n", + kind.length(), + kind.c_str()); + + ACE_CString ior = record.ior(); + + ACE_OS::fprintf(this->fout_, "%d\n%s\n", + ior.length(), + ior.c_str()); + + ACE_CString context_binding = record.context_binding(); + + ACE_OS::fprintf(this->fout_, "%d\n%s\n", + context_binding.length(), + context_binding.c_str()); + + ACE_OS::fflush(this->fout_); + } + + return *this; +} + + + +//******************** Flat File Reader **************************** + + +TAO_NS_FlatFileReader::TAO_NS_FlatFileReader () + : fin_ (0) +{ +} + +int +TAO_NS_FlatFileReader::open(const char * filename) +{ + fin_ = ACE_OS::fopen(filename, "r"); + + ACE_DECLARE_NEW_CORBA_ENV; + if (fin_ == 0) + ACE_ERROR_RETURN ((LM_ERROR, + ""), + 1); + + return 0; +} + +TAO_NS_FlatFileReader::~TAO_NS_FlatFileReader () +{ + +} + +int +TAO_NS_FlatFileReader::close() +{ + ACE_OS::fclose(fin_); + return 0; +} + + +TAO_Reader_Base & +TAO_NS_FlatFileReader::operator >>( + TAO_NS_Persistence_Header &header) +{ + unsigned int size; + int bufSize = 0; + + fscanf(fin_, "%d\n", &bufSize); + char* context_name = new char[bufSize+1]; + //char* context_name = 0; + //ACE_NEW_RETURN(context_name, char[bufSize+1], 0); + ACE_OS::fgets(context_name, bufSize+1, fin_); + fscanf(fin_, "%d\n", &size); + + ACE_CString new_cn = ACE_CString(context_name); + header.context_name(new_cn); + delete context_name; + + header.size(size); + + return *this; + +} + +TAO_Reader_Base & +TAO_NS_FlatFileReader::operator >>( + TAO_NS_Persistence_Record &record) +{ + int type_integer = 0; + fscanf(fin_, "%d\n", &type_integer); + TAO_NS_Persistence_Record::Record_Type type = + ACE_static_cast (TAO_NS_Persistence_Record::Record_Type, type_integer); + + record.type(type); + + int bufSize = 0; + + //id + fscanf(fin_, "%d\n", &bufSize); + char *id = new char[bufSize+1]; + //char *id; + //ACE_NEW_RETURN (id, char[bufSize+1], 1); + + ACE_OS::fgets(id, bufSize+1, fin_); + ACE_CString newId(id); + record.id(newId); + + delete id; + + //kind + fscanf(fin_, "%d\n", &bufSize); + char *kind = new char[bufSize+1]; + //char *kind; + //ACE_NEW (kind, char[bufSize+1]); + + ACE_OS::fgets(kind, bufSize+1, fin_); + kind[bufSize] = '\0'; + + ACE_CString newKind(kind); + record.kind(newKind); + + delete kind; + + //ior + fscanf(fin_, "%d\n", &bufSize); + char *ior = new char[bufSize+1]; + //char *ior; + //ACE_NEW(ior, char[bufSize+1]); + + ACE_OS::fgets(ior, bufSize+1, fin_); + ACE_CString newIor(ior); + record.ior(newIor); + + delete ior; + + //context_binding + fscanf(fin_, "%d\n", &bufSize); + char *context_binding = new char[bufSize+1]; + //char *context_binding; + //ACE_NEW (context_binding, char[bufSize+1]); + + ACE_OS::fgets(context_binding, bufSize+1, fin_); + + ACE_CString new_cb(context_binding); + + record.context_binding(new_cb); + + delete context_binding; + + return *this; + +} + +TAO_Reader_Base *TAO_NS_FlatFileFactory::create_reader() +{ + TAO_Reader_Base *reader = 0; + + ACE_NEW_RETURN (reader, + TAO_NS_FlatFileReader(), + 0); + + return reader; +} + +TAO_Writer_Base *TAO_NS_FlatFileFactory::create_writer() +{ + TAO_Writer_Base *writer = 0; + + ACE_NEW_RETURN (writer, + TAO_NS_FlatFileWriter(), + 0); + return writer; +} diff --git a/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.h b/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.h new file mode 100644 index 00000000000..36b2adb5f9c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Naming/Flat_File_Persistence.h @@ -0,0 +1,70 @@ +// $Id$ +// ============================================================================ +// +// = LIBRARY +// cos +// +// = FILENAME +// +// +// = AUTHOR +// +// +// ============================================================================ + +#ifndef TAO_FLAT_FILE_PERSISTENCE_H +#define TAO_FLAT_FILE_PERSISTENCE_H + +#include "Storable.h" +#include "tao/corba.h" + +//------------------------------------------------------------------------ +// The Flat File concrete classes +//------------------------------------------------------------------------ +class TAO_NS_FlatFileWriter : public TAO_Writer_Base +{ +public: + + TAO_NS_FlatFileWriter(); + virtual ~TAO_NS_FlatFileWriter(); + + virtual int open(const char * filename); + virtual int close(); + + virtual TAO_Writer_Base& operator << (const TAO_NS_Persistence_Header &header); + virtual TAO_Writer_Base& operator << (const TAO_NS_Persistence_Record &record); + +private: + FILE* fout_; + ACE_CString filename_; +}; + +class TAO_NS_FlatFileReader : public TAO_Reader_Base +{ +public: + + TAO_NS_FlatFileReader (); + virtual ~TAO_NS_FlatFileReader(); + + virtual int open(const char * filename); + virtual int close(); + + virtual TAO_Reader_Base& operator >> (TAO_NS_Persistence_Header &header); + virtual TAO_Reader_Base& operator >> (TAO_NS_Persistence_Record &record); + +private: + FILE* fin_; +}; + + +class TAO_NS_FlatFileFactory : public TAO_Naming_Service_Persistence_Factory +{ +public: + // Factory Methods + + virtual TAO_Reader_Base *create_reader(); + virtual TAO_Writer_Base *create_writer(); +}; + + +#endif diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Service_Container.cpp b/TAO/orbsvcs/orbsvcs/Naming/Naming_Service_Container.cpp new file mode 100644 index 00000000000..abc14d55a5c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Service_Container.cpp @@ -0,0 +1,390 @@ +// $Id$ +// ============================================================================ +// +// = LIBRARY +// cos +// +// = FILENAME +// Naming_Service_Container.cpp +// +// = AUTHOR +// Bruce Trask <trask_b@ociweb.com> +// +// ============================================================================ + + +#ifndef NS_CONTAINER_C +#define NS_CONTAINER_C + +#include "ace/Malloc.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Naming_Service_Container.h" + +ACE_ALLOC_HOOK_DEFINE(ACE_NS_Node) + +# if ! defined (ACE_HAS_BROKEN_NOOP_DTORS) +template <class T> +ACE_NS_Node<T>::~ACE_NS_Node (void) +{ +} +# endif /* ! defined (ACE_HAS_BROKEN_NOOP_DTORS) */ + +template <class T> +ACE_NS_Node<T>::ACE_NS_Node (const T &i, ACE_NS_Node<T> *n) + : next_ (n), + item_ (i) +{ + // ACE_TRACE ("ACE_NS_Node<T>::ACE_NS_Node"); +} + +template <class T> +ACE_NS_Node<T>::ACE_NS_Node (ACE_NS_Node<T> *n, int) + : next_ (n) +{ + // ACE_TRACE ("ACE_NS_Node<T>::ACE_NS_Node"); +} + +template <class T> +ACE_NS_Node<T>::ACE_NS_Node (const ACE_NS_Node<T> &s) + : next_ (s.next_), + item_ (s.item_) +{ + // ACE_TRACE ("ACE_NS_Node<T>::ACE_NS_Node"); +} + + +ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_List) + + template <class T> size_t +ACE_Unbounded_List<T>::size (void) const +{ + // ACE_TRACE ("ACE_Unbounded_List<T>::size"); + return this->cur_size_; +} + +template <class T> int +ACE_Unbounded_List<T>::insert_tail (const T &item) +{ + ACE_NS_Node<T> *temp; + + // Insert <item> into the old dummy node location. + this->head_->item_ = item; + + // Create a new dummy node. + ACE_NEW_MALLOC_RETURN (temp, + (ACE_NS_Node<T>*) this->allocator_->malloc (sizeof (ACE_NS_Node<T>)), + ACE_NS_Node<T> (this->head_->next_), + -1); + // Link this pointer into the list. + this->head_->next_ = temp; + + // Point the head to the new dummy node. + this->head_ = temp; + + this->cur_size_++; + return 0; +} + +template <class T> void +ACE_Unbounded_List<T>::reset (void) +{ + ACE_TRACE ("reset"); + + this->delete_nodes (); +} + +template <class T> void +ACE_Unbounded_List<T>::dump (void) const +{ + ACE_TRACE ("ACE_Unbounded_List<T>::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nhead_ = %u"), this->head_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nhead_->next_ = %u"), this->head_->next_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncur_size_ = %d\n"), this->cur_size_)); + + T *item = 0; +#if !defined (ACE_NLOGGING) + size_t count = 1; +#endif /* ! ACE_NLOGGING */ + + for (ACE_Unbounded_List_Iterator<T> iter (*(ACE_Unbounded_List<T> *) this); + iter.next (item) != 0; + iter.advance ()) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("count = %d\n"), count++)); + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +} + +template <class T> void +ACE_Unbounded_List<T>::copy_nodes (const ACE_Unbounded_List<T> &us) +{ + for (ACE_NS_Node<T> *curr = us.head_->next_; + curr != us.head_; + curr = curr->next_) + this->insert_tail (curr->item_); +} + +template <class T> void +ACE_Unbounded_List<T>::delete_nodes (void) +{ + ACE_NS_Node<T> *curr = this->head_->next_; + + // Keep looking until we've hit the dummy node. + + while (curr != this->head_) + { + ACE_NS_Node<T> *temp = curr; + curr = curr->next_; + ACE_DES_FREE_TEMPLATE (temp, + this->allocator_->free, + ACE_NS_Node, + <T>); + this->cur_size_--; + } + + // Reset the list to be a circular list with just a dummy node. + this->head_->next_ = this->head_; +} + +template <class T> +ACE_Unbounded_List<T>::~ACE_Unbounded_List (void) +{ + // ACE_TRACE ("ACE_Unbounded_List<T>::~ACE_Unbounded_List"); + + this->delete_nodes (); + + // Delete the dummy node. + ACE_DES_FREE_TEMPLATE (head_, + this->allocator_->free, + ACE_NS_Node, + <T>); + this->head_ = 0; +} + +template <class T> +ACE_Unbounded_List<T>::ACE_Unbounded_List (ACE_Allocator *alloc) + : head_ (0), + cur_size_ (0), + allocator_ (alloc) +{ + // ACE_TRACE ("ACE_Unbounded_List<T>::ACE_Unbounded_List"); + + if (this->allocator_ == 0) + this->allocator_ = ACE_Allocator::instance (); + + ACE_NEW_MALLOC (this->head_, + (ACE_NS_Node<T>*) this->allocator_->malloc (sizeof (ACE_NS_Node<T>)), + ACE_NS_Node<T>); + // Make the list circular by pointing it back to itself. + this->head_->next_ = this->head_; +} + +template <class T> +ACE_Unbounded_List<T>::ACE_Unbounded_List (const ACE_Unbounded_List<T> &us) + : head_ (0), + cur_size_ (0), + allocator_ (us.allocator_) +{ + ACE_TRACE ("ACE_Unbounded_List<T>::ACE_Unbounded_List"); + + if (this->allocator_ == 0) + this->allocator_ = ACE_Allocator::instance (); + + ACE_NEW_MALLOC (this->head_, + (ACE_NS_Node<T>*) this->allocator_->malloc (sizeof (ACE_NS_Node<T>)), + ACE_NS_Node<T>); + this->head_->next_ = this->head_; + this->copy_nodes (us); +} + +template <class T> void +ACE_Unbounded_List<T>::operator= (const ACE_Unbounded_List<T> &us) +{ + ACE_TRACE ("ACE_Unbounded_List<T>::operator="); + + if (this != &us) + { + this->delete_nodes (); + this->copy_nodes (us); + } +} + +template <class T> int +ACE_Unbounded_List<T>::insert (const T &item) +{ + ACE_TRACE ("ACE_Unbounded_List<T>::insert"); + return this->insert_tail (item); +} + +template <class T> int +ACE_Unbounded_List<T>::remove (const T &item) +{ + // ACE_TRACE ("ACE_Unbounded_List<T>::remove"); + + // Insert the item to be founded into the dummy node. + this->head_->item_ = item; + + ACE_NS_Node<T> *curr = this->head_; + + while (!(curr->next_->item_ == item)) + curr = curr->next_; + + if (curr->next_ == this->head_) + return -1; // Item was not found. + else + { + ACE_NS_Node<T> *temp = curr->next_; + // Skip over the node that we're deleting. + curr->next_ = temp->next_; + this->cur_size_--; + ACE_DES_FREE_TEMPLATE (temp, + this->allocator_->free, + ACE_NS_Node, + <T>); + return 0; + } +} + +template <class T> ACE_Unbounded_List_Iterator<T> +ACE_Unbounded_List<T>::begin (void) +{ + // ACE_TRACE ("ACE_Unbounded_List<T>::begin"); + return ACE_Unbounded_List_Iterator<T> (*this); +} + +template <class T> ACE_Unbounded_List_Iterator<T> +ACE_Unbounded_List<T>::end (void) +{ + // ACE_TRACE ("ACE_Unbounded_List<T>::end"); + return ACE_Unbounded_List_Iterator<T> (*this, 1); +} + + +ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_List_Iterator) + + template <class T> void +ACE_Unbounded_List_Iterator<T>::dump (void) const +{ + // ACE_TRACE ("ACE_Unbounded_List_Iterator<T>::dump"); +} + +template <class T> +ACE_Unbounded_List_Iterator<T>::ACE_Unbounded_List_Iterator (ACE_Unbounded_List<T> &s, int end) + : current_ (end == 0 ? s.head_->next_ : s.head_ ), + set_ (&s) +{ + // ACE_TRACE ("ACE_Unbounded_List_Iterator<T>::ACE_Unbounded_List_Iterator"); +} + +template <class T> int +ACE_Unbounded_List_Iterator<T>::advance (void) +{ + // ACE_TRACE ("ACE_Unbounded_List_Iterator<T>::advance"); + this->current_ = this->current_->next_; + return this->current_ != this->set_->head_; +} + +template <class T> int +ACE_Unbounded_List_Iterator<T>::first (void) +{ + // ACE_TRACE ("ACE_Unbounded_List_Iterator<T>::first"); + this->current_ = this->set_->head_->next_; + return this->current_ != this->set_->head_; +} + +template <class T> int +ACE_Unbounded_List_Iterator<T>::done (void) const +{ + ACE_TRACE ("ACE_Unbounded_List_Iterator<T>::done"); + + return this->current_ == this->set_->head_; +} + +template <class T> int +ACE_Unbounded_List_Iterator<T>::next (T *&item) +{ + // ACE_TRACE ("ACE_Unbounded_List_Iterator<T>::next"); + if (this->current_ == this->set_->head_) + return 0; + else + { + item = &this->current_->item_; + return 1; + } +} + +template <class T> ACE_Unbounded_List_Iterator<T> +ACE_Unbounded_List_Iterator<T>::operator++ (int) +{ + //ACE_TRACE ("ACE_Unbounded_List_Iterator<T>::operator++ (int)"); + ACE_Unbounded_List_Iterator<T> retv (*this); + + // postfix operator + + this->advance (); + return retv; +} + +template <class T> ACE_Unbounded_List_Iterator<T>& +ACE_Unbounded_List_Iterator<T>::operator++ (void) +{ + // ACE_TRACE ("ACE_Unbounded_List_Iterator<T>::operator++ (void)"); + + // prefix operator + + this->advance (); + return *this; +} + +template <class T> T& +ACE_Unbounded_List_Iterator<T>::operator* (void) +{ + //ACE_TRACE ("ACE_Unbounded_List_Iterator<T>::operator*"); + T *retv = 0; + + int result = this->next (retv); + ACE_ASSERT (result != 0); + ACE_UNUSED_ARG (result); + + return *retv; +} + +template <class T> int +ACE_Unbounded_List_Iterator<T>::operator== (const ACE_Unbounded_List_Iterator<T> &rhs) const +{ + //ACE_TRACE ("ACE_Unbounded_List_Iterator<T>::operator=="); + return (this->set_ == rhs.set_ && this->current_ == rhs.current_); +} + +template <class T> int +ACE_Unbounded_List_Iterator<T>::operator!= (const ACE_Unbounded_List_Iterator<T> &rhs) const +{ + //ACE_TRACE ("ACE_Unbounded_List_Iterator<T>::operator!="); + return (this->set_ != rhs.set_ || this->current_ != rhs.current_); +} +/* -*- C++ -*- */ + +// --- + +template <class T> int +ACE_Unbounded_List<T>::is_empty (void) const +{ + ACE_TRACE ("ACE_Unbounded_List<T>::is_empty"); + return this->head_ == this->head_->next_; +} + +template <class T> int +ACE_Unbounded_List<T>::is_full (void) const +{ + ACE_TRACE ("ACE_Unbounded_List<T>::is_full"); + return 0; // We should implement a "node of last resort for this..." +} + + +#endif /* NS_CONTAINERS_T_C */ + diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Service_Container.h b/TAO/orbsvcs/orbsvcs/Naming/Naming_Service_Container.h new file mode 100644 index 00000000000..c73decb05fd --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Service_Container.h @@ -0,0 +1,225 @@ +/* -*- C++ -*- */ +// $Id$ +// ============================================================================ +// +// = LIBRARY +// cos +// +// = FILENAME +// Naming_Service_Container.h +// +// = AUTHOR +// Bruce Trask <trask_b@ociweb.com> +// +// ============================================================================ + + +#ifndef NS_CONTAINER_H +#define NS_CONTAINER_H +#include "ace/pre.h" + +#include "ace/ACE.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// Need by ACE_DLList_Node. +#include "ace/Containers.h" + +class ACE_Allocator; + + +// Forward declarations. +template <class T> class ACE_Unbounded_List; +template <class T> class ACE_Unbounded_List_Iterator; + + +template<class T> +class ACE_NS_Node +{ + // = TITLE + // Implementation element in a Queue, List, and Stack. +public: + friend class ACE_Unbounded_List<T>; + friend class ACE_Unbounded_List_Iterator<T>; + + + +# if ! defined (ACE_HAS_BROKEN_NOOP_DTORS) + ~ACE_NS_Node (void); + // This isn't necessary, but it keeps some compilers happy. +# endif /* ! defined (ACE_HAS_BROKEN_NOOP_DTORS) */ + +private: + // = Initialization methods + ACE_NS_Node (const T &i, ACE_NS_Node<T> *n); + ACE_NS_Node (ACE_NS_Node<T> *n = 0, int = 0); + ACE_NS_Node (const ACE_NS_Node<T> &n); + + ACE_NS_Node<T> *next_; + // Pointer to next element in the list of <ACE_NS_Node>s. + + T item_; + // Current value of the item in this node. +}; + + + + + +template <class T> +class ACE_Unbounded_List_Iterator +{ + // = TITLE + // Implement an iterator over an unbounded List. +public: + // = Initialization method. + ACE_Unbounded_List_Iterator (ACE_Unbounded_List<T> &s, int end = 0); + + // = Iteration methods. + + int next (T *&next_item); + // Pass back the <next_item> that hasn't been seen in the List. + // Returns 0 when all items have been seen, else 1. + + int advance (void); + // Move forward by one element in the List. Returns 0 when all the + // items in the List have been seen, else 1. + + int first (void); + // Move to the first element in the List. Returns 0 if the + // List is empty, else 1. + + int done (void) const; + // Returns 1 when all items have been seen, else 0. + + void dump (void) const; + // Dump the state of an object. + + // = STL styled iteration, compare, and reference functions. + + ACE_Unbounded_List_Iterator<T> operator++ (int); + // Postfix advance. + + ACE_Unbounded_List_Iterator<T>& operator++ (void); + // Prefix advance. + + T& operator* (void); + // Returns a reference to the interal element <this> is pointing to. + + int operator== (const ACE_Unbounded_List_Iterator<T> &) const; + int operator!= (const ACE_Unbounded_List_Iterator<T> &) const; + // Check if two iterators point to the same position + + ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + +private: + + ACE_NS_Node<T> *current_; + // Pointer to the current node in the iteration. + + ACE_Unbounded_List<T> *set_; + // Pointer to the set we're iterating over. +}; + +template <class T> +class ACE_Unbounded_List +{ + // = TITLE + // Implement a simple unordered set of <T> of unbounded size. + // + // = DESCRIPTION + // This implementation of an unordered set uses a circular + // linked list with a dummy node. This implementation does not + // allow duplicates, but it maintains FIFO ordering of insertions. +public: + friend class ACE_Unbounded_List_Iterator<T>; + + // Trait definition. + typedef ACE_Unbounded_List_Iterator<T> ITERATOR; + typedef ACE_Unbounded_List_Iterator<T> iterator; + + // = Initialization and termination methods. + ACE_Unbounded_List (ACE_Allocator *alloc = 0); + // Constructor. Use user specified allocation strategy + // if specified. + + ACE_Unbounded_List (const ACE_Unbounded_List<T> &); + // Copy constructor. + + void operator= (const ACE_Unbounded_List<T> &); + // Assignment operator. + + ~ACE_Unbounded_List (void); + // Destructor. + + // = Check boundary conditions. + + int is_empty (void) const; + // Returns 1 if the container is empty, otherwise returns 0. + + int is_full (void) const; + // Returns 1 if the container is full, otherwise returns 0. + + // = Classic unordered set operations. + + int insert (const T &new_item); + // Insert <new_item> into the set (doesn't allow duplicates). + // Returns -1 if failures occur, 1 if item is already present, else + // 0. + + int remove (const T &item); + // Remove first occurrence of <item> from the set. Returns 0 if + // it removes the item, -1 if it can't find the item, and -1 if a + // failure occurs. + + size_t size (void) const; + // Size of the set. + + void dump (void) const; + // Dump the state of an object. + + void reset (void); + // Reset the <ACE_Unbounded_List> to be empty. + + // = STL-styled unidirectional iterator factory. + ACE_Unbounded_List_Iterator<T> begin (void); + ACE_Unbounded_List_Iterator<T> end (void); + + ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + +private: + int insert_tail (const T &item); + // Insert <item> at the tail of the set (doesn't check for + // duplicates). + + void delete_nodes (void); + // Delete all the nodes in the List. + + void copy_nodes (const ACE_Unbounded_List<T> &); + // Copy nodes into this set. + + ACE_NS_Node<T> *head_; + // Head of the linked list of NS_Nodes. + + size_t cur_size_; + // Current size of the set. + + ACE_Allocator *allocator_; + // Allocation strategy of the set. +}; + + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Naming_Service_Container.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Naming_Service_Container.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include "ace/post.h" +#endif /* NS_CONTAINERS_T_H */ diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp index f3c19c757ee..3a5039972d1 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp +++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp @@ -3,6 +3,8 @@ #include "Naming_Utils.h" #include "Transient_Naming_Context.h" #include "Persistent_Context_Index.h" +#include "Storable_Naming_Context.h" +#include "Flat_File_Persistence.h" #include "orbsvcs/CosNamingC.h" #include "tao/debug.h" @@ -28,7 +30,8 @@ TAO_Naming_Server::TAO_Naming_Server (void) context_size_ (ACE_DEFAULT_MAP_SIZE), persistence_file_name_ (0), base_address_ (TAO_NAMING_BASE_ADDR), - multicast_ (0) + multicast_ (0), + use_storable_context_ (0) { } @@ -39,7 +42,8 @@ TAO_Naming_Server::TAO_Naming_Server (CORBA::ORB_ptr orb, int resolve_for_existing_naming_service, const ACE_TCHAR *persistence_location, void *base_addr, - int enable_multicast) + int enable_multicast, + int use_storable_context) : naming_context_ (), ior_multicast_ (0), naming_service_ior_ (), @@ -49,7 +53,8 @@ TAO_Naming_Server::TAO_Naming_Server (CORBA::ORB_ptr orb, context_size_ (ACE_DEFAULT_MAP_SIZE), persistence_file_name_ (0), base_address_ (TAO_NAMING_BASE_ADDR), - multicast_ (0) + multicast_ (0), + use_storable_context_ (0) { if (this->init (orb, poa, @@ -58,7 +63,8 @@ TAO_Naming_Server::TAO_Naming_Server (CORBA::ORB_ptr orb, resolve_for_existing_naming_service, persistence_location, base_addr, - enable_multicast) == -1) + enable_multicast, + use_storable_context) == -1) ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "TAO_Naming_Server::init")); @@ -73,7 +79,8 @@ TAO_Naming_Server::init (CORBA::ORB_ptr orb, int resolve_for_existing_naming_service, const ACE_TCHAR *persistence_location, void *base_addr, - int enable_multicast) + int enable_multicast, + int use_storable_context) { if (resolve_for_existing_naming_service) { @@ -127,14 +134,15 @@ TAO_Naming_Server::init (CORBA::ORB_ptr orb, persistence_location, base_addr, context_size, - enable_multicast); + enable_multicast, + use_storable_context); } int TAO_Naming_Server::parse_args (int argc, char *argv[]) { - ACE_Get_Opt get_opts (argc, argv, "b:do:p:s:f:m:"); + ACE_Get_Opt get_opts (argc, argv, "b:do:p:s:f:m:u:"); int c; int size, result; long address; @@ -178,6 +186,10 @@ TAO_Naming_Server::parse_args (int argc, case 'm': this->multicast_ = ACE_OS::atoi(get_opts.opt_arg ()); break; + case 'u': + this->use_storable_context_ = 1; + this->persistence_file_name_ = get_opts.opt_arg (); + break; case '?': default: ACE_ERROR_RETURN ((LM_ERROR, @@ -187,7 +199,8 @@ TAO_Naming_Server::parse_args (int argc, "-p <pid_file_name> " "-f <persistence_file_name> " "-b <base_address> " - "-m <1=enable multicast, 0=disable multicast(default)>" + "-m <1=enable multicast, 0=disable multicast(default) " + "-u <storable_persistence_directory (not used with -f)> " "\n", argv [0]), -1); @@ -283,7 +296,8 @@ TAO_Naming_Server::init_with_orb (int argc, 0, this->persistence_file_name_, this->base_address_, - this->multicast_); + this->multicast_, + this->use_storable_context_); if (result == -1) return result; } @@ -322,16 +336,42 @@ TAO_Naming_Server::init_with_orb (int argc, int TAO_Naming_Server::init_new_naming (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, - const ACE_TCHAR - *persistence_location, + const ACE_TCHAR *persistence_location, void *base_addr, size_t context_size, - int enable_multicast) + int enable_multicast, + int use_storable_context) { ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { - if (persistence_location != 0) + if (use_storable_context) + { + // In lieu of a fully implemented service configurator version + // of this Reader and Writer, let's just take something off the + // command line for now. + TAO_Naming_Service_Persistence_Factory *persFactory = 0; + ACE_NEW_RETURN(persFactory, TAO_NS_FlatFileFactory, -1); + + // Was a location specified? + if (persistence_location == 0) + { + // No, assign the default location "." + persistence_location = "."; + } + + this->naming_context_ = + TAO_Storable_Naming_Context::recreate_all(orb, + poa, + TAO_ROOT_NAMING_CONTEXT, + context_size, + 0, + persFactory, + persistence_location + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + else if (persistence_location != 0) // // Initialize Persistent Naming Service. // diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.h b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.h index 0b30fab4ffe..bc8df570fcd 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.h +++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.h @@ -69,7 +69,8 @@ public: int resolve_for_existing_naming_service = 1, const ACE_TCHAR *persistence_location = 0, void *base_addr = TAO_NAMING_BASE_ADDR, - int enable_multicast = 1); + int enable_multicast = 1, + int use_storable_context = 0); // Constructor. Attempts to find an existing Naming Service if // <resolve_for_existing_naming_service> is set to true. If it is // false, or no Naming Service was found during a <timeout> period, @@ -90,7 +91,8 @@ public: int resolve_for_existing_naming_service = 1, const ACE_TCHAR *persistence_location = 0, void *base_addr = TAO_NAMING_BASE_ADDR, - int enable_multicast = 1); + int enable_multicast = 1, + int use_storable_context = 0); // Initializer. Attempts to find an existing Naming Service if // <resolve_for_existing_naming_service> is set to true. If it is // false, or no Naming Service was found during a <timeout> period, @@ -128,7 +130,8 @@ protected: const ACE_TCHAR *persistence_location, void *base_addr, size_t context_size, - int enable_multicast); + int enable_multicast, + int use_storable_context); // Helper method: create Naming Service locally. // Make the root context of size // <context_size>, register it under the <root_poa>, and make the Naming @@ -191,6 +194,8 @@ protected: int multicast_; // If not zero multicast is enabled. + int use_storable_context_; + // If not zero use flat file persistence }; class TAO_Naming_Export TAO_Naming_Client diff --git a/TAO/orbsvcs/orbsvcs/Naming/Storable.cpp b/TAO/orbsvcs/orbsvcs/Naming/Storable.cpp new file mode 100644 index 00000000000..8fdb58357be --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Naming/Storable.cpp @@ -0,0 +1,25 @@ +// $Id$ +// ============================================================================ +// +// = LIBRARY +// cos +// +// = FILENAME +// Storable.cpp +// +// = AUTHOR +// Bruce Trask <trask_b@ociweb.com> +// Chanaka Liyanaarachchi <chanaka@ociweb.com> +// +// ============================================================================ + +#include "Storable.h" + +#if !defined (__ACE_INLINE__) +#include "Storable.inl" +#endif /* __ACE_INLINE__ */ + + + + + diff --git a/TAO/orbsvcs/orbsvcs/Naming/Storable.h b/TAO/orbsvcs/orbsvcs/Naming/Storable.h new file mode 100644 index 00000000000..e2aaa24b8f4 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Naming/Storable.h @@ -0,0 +1,145 @@ +// $Id$ +// ============================================================================ +// +// = LIBRARY +// cos +// +// = FILENAME +// Storable.h +// +// = AUTHOR +// Bruce Trask <trask_b@ociweb.com> +// Chanaka Liyanaarachchi <chanaka@ociweb.com> +// +// ============================================================================ + +#ifndef STORABLE_H +#define STORABLE_H + +#include "tao/corba.h" + +const int szInt = sizeof(int); +const int szChar = sizeof(char); +const int szBool = sizeof(int); + +class TAO_Writer_Base; +class TAO_Reader_Base; + +class TAO_Storable_Base +{ +public: + TAO_Storable_Base(); + + TAO_Storable_Base (TAO_Reader_Base&); + + virtual ~TAO_Storable_Base(); + + virtual void Write(TAO_Writer_Base&) = 0; + +}; + +class TAO_NS_Persistence_Header +{ + public: + void size (unsigned int size); + unsigned int size () const ; + + void context_name (const ACE_CString& context_name); + ACE_CString context_name () const; + + private: + unsigned int size_; + ACE_CString context_name_; +}; + +class TAO_NS_Persistence_Record +{ + public: + enum Record_Type {NCONTEXT, OBJREF}; + + Record_Type type () const; + void type (Record_Type type); + + ACE_CString id () const; + void id (const ACE_CString& id); + + ACE_CString kind () const; + void kind (const ACE_CString& kind); + + ACE_CString ior () const; + void ior (const ACE_CString& ior); + + ACE_CString context_binding () const; + void context_binding (const ACE_CString& context_binding); + + private: + Record_Type type_; + ACE_CString id_; + ACE_CString kind_; + ACE_CString ior_; + ACE_CString context_binding_; +}; + +class TAO_Writer_Base +{ + public: + virtual ~TAO_Writer_Base(); + TAO_Writer_Base(); + + virtual int open (const char* name) = 0; + virtual int close () = 0; + + virtual TAO_Writer_Base& operator << ( + const TAO_NS_Persistence_Header& header) = 0; + + virtual TAO_Writer_Base& operator << ( + const TAO_NS_Persistence_Record& record) = 0; + + + + public: + int delete_bindings_; + // this is used to indicate to the Writer that the bindings map is now + // empty and therefore now persistence resources are needed for it. + +}; + +class TAO_Reader_Base +{ + public: + TAO_Reader_Base (); + virtual ~TAO_Reader_Base (); + + virtual int open (const char* name) = 0; + virtual int close () = 0; + + virtual TAO_Reader_Base& operator >> ( + TAO_NS_Persistence_Header& header) = 0; + + virtual TAO_Reader_Base& operator >> ( + TAO_NS_Persistence_Record& record) = 0; + + + +}; + +class TAO_Naming_Service_Persistence_Factory +{ +public: + TAO_Naming_Service_Persistence_Factory(); + + virtual ~TAO_Naming_Service_Persistence_Factory(); + + // Factory Methods + + virtual TAO_Reader_Base *create_reader() = 0; + virtual TAO_Writer_Base *create_writer() = 0; +}; + +#if defined (__ACE_INLINE__) +#include "Storable.inl" +#endif /* __ACE_INLINE_ */ + +#endif + + diff --git a/TAO/orbsvcs/orbsvcs/Naming/Storable.inl b/TAO/orbsvcs/orbsvcs/Naming/Storable.inl new file mode 100644 index 00000000000..7de75a8f4e4 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Naming/Storable.inl @@ -0,0 +1,148 @@ +// $Id$ +// ============================================================================ +// +// = LIBRARY +// cos +// +// = FILENAME +// Storable.i +// +// = AUTHOR +// Bruce Trask <trask_b@ociweb.com> +// Chanaka Liyanaarachchi <chanaka@ociweb.com> +// +// ============================================================================ + +ACE_INLINE +TAO_Storable_Base::TAO_Storable_Base() +{ +} + +ACE_INLINE +TAO_Storable_Base::TAO_Storable_Base (TAO_Reader_Base &) +{ +} + +ACE_INLINE +TAO_Storable_Base::~TAO_Storable_Base() +{ +} + +ACE_INLINE +TAO_Writer_Base::TAO_Writer_Base() + : delete_bindings_(0) +{ +} + +ACE_INLINE +TAO_Writer_Base::~TAO_Writer_Base() +{ +} + +ACE_INLINE +TAO_Reader_Base::TAO_Reader_Base() +{ +} + +ACE_INLINE +TAO_Reader_Base::~TAO_Reader_Base() +{ +} + + + +ACE_INLINE void +TAO_NS_Persistence_Header::size (unsigned int size) +{ + this->size_ = size; +} + +ACE_INLINE unsigned int +TAO_NS_Persistence_Header::size () const +{ + return this->size_; +} + +ACE_INLINE void +TAO_NS_Persistence_Header::context_name (const ACE_CString& context_name) +{ + this->context_name_ = context_name; +} + +ACE_INLINE ACE_CString +TAO_NS_Persistence_Header::context_name () const +{ + return this->context_name_; +} + + +ACE_INLINE TAO_NS_Persistence_Record::Record_Type +TAO_NS_Persistence_Record::type () const +{ + return this->type_; +} + +ACE_INLINE void +TAO_NS_Persistence_Record::type (Record_Type type) +{ + this->type_ = type; +} + +ACE_INLINE ACE_CString +TAO_NS_Persistence_Record::id () const +{ + return this->id_; +} + +ACE_INLINE void +TAO_NS_Persistence_Record::id (const ACE_CString& id) +{ + this->id_ = id; +} + +ACE_INLINE ACE_CString +TAO_NS_Persistence_Record::kind () const +{ + return this->kind_; +} + +ACE_INLINE void +TAO_NS_Persistence_Record::kind (const ACE_CString& kind) +{ + this->kind_ = kind; +} + +ACE_INLINE ACE_CString +TAO_NS_Persistence_Record::ior () const +{ + return this->ior_; +} + +ACE_INLINE void +TAO_NS_Persistence_Record::ior (const ACE_CString& ior) +{ + this->ior_ = ior; +} + + +ACE_INLINE ACE_CString +TAO_NS_Persistence_Record::context_binding () const +{ + return this->context_binding_; +} + +ACE_INLINE void +TAO_NS_Persistence_Record::context_binding (const ACE_CString& context_binding) +{ + this->context_binding_ = context_binding; +} + +ACE_INLINE +TAO_Naming_Service_Persistence_Factory::TAO_Naming_Service_Persistence_Factory() +{ +} + +ACE_INLINE +TAO_Naming_Service_Persistence_Factory::~TAO_Naming_Service_Persistence_Factory() +{ +} diff --git a/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp b/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp new file mode 100644 index 00000000000..e41964396d1 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp @@ -0,0 +1,1280 @@ +// $Id$ +// ============================================================================ +// +// = LIBRARY +// cos +// +// = FILENAME +// Storable_Naming_Context.cpp +// +// = AUTHOR +// Bruce Trask <trask_b@ociweb.com> +// Chanaka Liyanaarachchi <chanaka@ociweb.com> +// +// ============================================================================ + +#include "ace/Auto_Ptr.h" +#include "Storable_Naming_Context.h" +#include "Bindings_Iterator_T.h" + +CosNaming::NamingContext_ptr TAO_Storable_Naming_Context::root_context_; + +ACE_RCSID(Naming, Storable_Naming_Context, "Storable_Naming_Context.cpp,v 1.16 1999/12/16 23:40:07 othman Exp") + +int +TAO_Storable_Bindings_Map::unbind (const char *id, + const char *kind) +{ + TAO_Persistent_ExtId name (id, kind); + return this->map_.unbind (name); +} + +int +TAO_Storable_Bindings_Map::bind (const char *id, + const char *kind, + CORBA::Object_ptr obj, + CosNaming::BindingType type) +{ + return this->shared_bind (id, kind, obj, type, 0); +} + +int +TAO_Storable_Bindings_Map::rebind (const char *id, + const char *kind, + CORBA::Object_ptr obj, + CosNaming::BindingType type) +{ + return this->shared_bind (id, kind, obj, type, 1); +} + +int +TAO_Storable_Bindings_Map::find (const char *id, + const char *kind, + CORBA::Object_ptr & obj, + CosNaming::BindingType &type) +{ + TAO_Persistent_ExtId name (id, kind); + TAO_Persistent_IntId entry; + + if (this->map_.find (name, + entry) != 0) + { + return -1; + } + else + { + ACE_DECLARE_NEW_CORBA_ENV; + obj = orb_->string_to_object (entry.ref_ ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + type = entry.type_; + + return 0; + } +} + +TAO_Storable_Bindings_Map::TAO_Storable_Bindings_Map (size_t hash_table_size) + : map_ (hash_table_size) +{ +} + +TAO_Storable_Bindings_Map::TAO_Storable_Bindings_Map (size_t hash_table_size, CORBA::ORB_ptr orb, const char* poa_id,PortableServer::POA_ptr poa) + : map_ (hash_table_size), + orb_ (CORBA::ORB::_duplicate (orb)), + name_ (poa_id), + poa_ (PortableServer::POA::_duplicate (poa)) +{ +} + +TAO_Storable_Bindings_Map::~TAO_Storable_Bindings_Map (void) +{ +} + +TAO_Storable_Bindings_Map::HASH_MAP & +TAO_Storable_Bindings_Map::map (void) +{ + return map_; +} + +size_t +TAO_Storable_Bindings_Map::current_size (void) +{ + return map_.current_size (); +} + +size_t +TAO_Storable_Bindings_Map::total_size (void) +{ + return map_.total_size (); +} + +int +TAO_Storable_Bindings_Map::shared_bind (const char * id, + const char * kind, + CORBA::Object_ptr obj, + CosNaming::BindingType type, + int rebind) +{ + TAO_Persistent_ExtId new_name (CORBA::string_dup(id), CORBA::string_dup(kind)); + TAO_Persistent_IntId new_entry (orb_->object_to_string(obj), type); + TAO_Persistent_IntId old_entry; + + if (rebind == 0) + { + // Do a normal bind. + return this->map_.bind (new_name, new_entry); + } + else + // Rebind. + { + // Check that types of old and new entries match. + if (this->map_.find (new_name, + old_entry) == 0 + && type != old_entry.type_) + return -2; + + else + return this->map_.rebind (new_name, new_entry); + } +} + +const char * TAO_Storable_Bindings_Map::name() +{ + return name_.rep(); +} + +void TAO_Storable_Bindings_Map::Write(TAO_Writer_Base& wrtr) +{ + ACE_Hash_Map_Iterator<TAO_Persistent_ExtId,TAO_Persistent_IntId, ACE_Null_Mutex> it = map_.begin(); + ACE_Hash_Map_Iterator<TAO_Persistent_ExtId,TAO_Persistent_IntId, ACE_Null_Mutex> itend = map_.end(); + + if (it == itend) + { + wrtr.delete_bindings_ = 1; + return; + } + + ACE_Hash_Map_Entry<TAO_Persistent_ExtId,TAO_Persistent_IntId> ent = *it; + + const char *my_name = name_.rep(); + + TAO_NS_Persistence_Header header; + + ACE_CString name(my_name); + header.context_name (name); + header.size ((const unsigned short)map_.current_size()); + + wrtr << header; + + while (!(it == itend)) + { + TAO_NS_Persistence_Record record; + + CosNaming::BindingType bt = (*it).int_id_.type_; + if (bt == CosNaming::ncontext) + record.type(TAO_NS_Persistence_Record::NCONTEXT); + else if (bt == CosNaming::nobject) + record.type(TAO_NS_Persistence_Record::OBJREF); + //else + //there shouldn't be any other, can there be ?? + //ignore for now + + // todo - are we using this i ?? + //int i = map_.current_size(); + + const char *myid = (*it).ext_id_.id(); + ACE_CString id(myid); + record.id(id); + + const char *mykind = (*it).ext_id_.kind(); + ACE_CString kind(mykind); + record.kind(kind); + + ACE_CString ior((*it).int_id_.ref_); + record.ior(ior); + + if (bt == 1) + { + CORBA::Object_var obj = orb_->string_to_object((*it).int_id_.ref_); + PortableServer::ObjectId_var oid = poa_->reference_to_id(obj.in()); + CORBA::String_var nm = PortableServer::ObjectId_to_string(oid.in()); + const char *newname = nm.in(); + ACE_CString name(newname); + record.context_binding(name); + } + wrtr << record; + it.advance(); + } +} + +TAO_Storable_Naming_Context::TAO_Storable_Naming_Context ( + CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + const char *poa_id, + TAO_Naming_Service_Persistence_Factory *factory, + const ACE_TCHAR *persistence_directory, + size_t hash_table_size) + : TAO_Hash_Naming_Context (poa, + poa_id), + counter_ (0), + storable_context_ (0), + orb_(CORBA::ORB::_duplicate (orb)), + factory_(factory), + persistence_directory_ (persistence_directory) +{ + ACE_NEW (this->storable_context_, + TAO_Storable_Bindings_Map (hash_table_size,orb,poa_id,poa)); + context_ = storable_context_; +} + +TAO_Storable_Naming_Context::TAO_Storable_Naming_Context ( + CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + const char *poa_id, + TAO_Storable_Bindings_Map *bindings_map, + TAO_Naming_Service_Persistence_Factory *factory, + const ACE_TCHAR *persistence_directory, + size_t) + : TAO_Hash_Naming_Context (poa, poa_id), + counter_ (0), + storable_context_ (0), + orb_(CORBA::ORB::_duplicate (orb)), + factory_(factory), + persistence_directory_ (persistence_directory) +{ + this->storable_context_ = bindings_map; + context_ = storable_context_; +} + +TAO_Storable_Naming_Context::~TAO_Storable_Naming_Context (void) +{ +} + +CosNaming::NamingContext_ptr +TAO_Storable_Naming_Context::make_new_context ( + CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + const char *poa_id, + size_t context_size, + TAO_Naming_Service_Persistence_Factory *factory, + const ACE_TCHAR *persistence_directory + ACE_ENV_ARG_DECL) +{ + // Store the stub we will return here. + CosNaming::NamingContext_var result; + + // Put together a servant for the new Naming Context. + + TAO_Storable_Naming_Context *context_impl = 0; + ACE_NEW_THROW_EX (context_impl, + TAO_Storable_Naming_Context (orb, + poa, + poa_id, + factory, + persistence_directory, + context_size), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (result._retn ()); + + // Put <context_impl> into the auto pointer temporarily, in case next + // allocation fails. + ACE_Auto_Basic_Ptr<TAO_Storable_Naming_Context> temp (context_impl); + + TAO_Naming_Context *context = 0; + ACE_NEW_THROW_EX (context, + TAO_Naming_Context (context_impl), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (result._retn ()); + + // Let <implementation> know about it's <interface>. + context_impl->interface (context); + + // Release auto pointer, and start using reference counting to + // control our servant. + temp.release (); + PortableServer::ServantBase_var s = context; + + // Register the new context with the POA. + PortableServer::ObjectId_var id = + PortableServer::string_to_ObjectId (poa_id); + + // If we try to register a naming context that is already registered, + // the following activation causes a POA::ObjectAlreadyActive exception be + // thrown which is transmitted as a CORBA::UNKNOWN on the wire. To rectify + // this problem, we explicitly throw the correct INS exception in + // this situation. + ACE_TRY + { + poa->activate_object_with_id (id.in (), + context + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCH (PortableServer::POA::ObjectAlreadyActive, ex) + { + ACE_THROW_RETURN (CosNaming::NamingContext::AlreadyBound(), + CosNaming::NamingContext::_nil ()); + } + ACE_ENDTRY; + + ACE_CHECK_RETURN (result._retn ()); + + result = context->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ()); + + return result._retn (); +} + +CosNaming::NamingContext_ptr +TAO_Storable_Naming_Context::new_context (ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX, + ace_mon, + this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ()); + + // Check to make sure this object didn't have <destroy> method + // invoked on it. + if (this->destroyed_) + ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (), + CosNaming::NamingContext::_nil ()); + + // Generate a POA id for the new context. + char poa_id[BUFSIZ]; + ACE_OS::sprintf (poa_id, + "%s_%d", + this->poa_id_.c_str (), + this->counter_++); + + // Create a new context. + CosNaming::NamingContext_var result = + make_new_context (this->orb_, + this->poa_.in (), + poa_id, + this->storable_context_->total_size (), + this->factory_, + this->persistence_directory_.c_str () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ()); + + return result._retn (); +} + +void +TAO_Storable_Naming_Context::rebind (const CosNaming::Name& n, + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL) +{ + ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX, ace_mon, + this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + // Check to make sure this object didn't have <destroy> method + // invoked on it. + if (this->destroyed_) + ACE_THROW (CORBA::OBJECT_NOT_EXIST ()); + + // Get the length of the name. + CORBA::ULong name_len = n.length (); + + // Check for invalid name. + if (name_len == 0) + ACE_THROW (CosNaming::NamingContext::InvalidName()); + + // If we received compound name, resolve it to get the context in + // which the rebinding should take place, then perform the rebinding + // on target context. + if (name_len > 1) + { + CosNaming::NamingContext_var context = + get_context (n ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CosNaming::Name simple_name; + simple_name.length (1); + simple_name[0] = n[name_len - 1]; + context->rebind (simple_name, obj ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + else + // If we received a simple name, we need to rebind it in this + // context. + { + int result = this->context_->rebind (n[0].id, + n[0].kind, + obj, + CosNaming::nobject); + + + ACE_CString writer_name(this->persistence_directory_); + writer_name += "/"; + writer_name += ACE_static_cast(TAO_Storable_Bindings_Map*, + this->context_)->name(); + //TAO_Writer_Base *wrtr = factory_->create_writer(writer_name.c_str()); + TAO_Writer_Base *wrtr = factory_->create_writer(); + if (wrtr->open (writer_name.c_str()) != 0) + { + delete wrtr; + ACE_THROW (CORBA::PERSIST_STORE ()); + } + + ACE_static_cast (TAO_Storable_Bindings_Map*, + this->context_)->Write(*wrtr); + wrtr->close(); + delete wrtr; + + // Check for error conditions. + if (result == -1) + ACE_THROW (CORBA::INTERNAL ()); + + else if (result == -2) + ACE_THROW (CosNaming::NamingContext::NotFound + (CosNaming::NamingContext::not_object, n)); + } +} + +void +TAO_Storable_Naming_Context::bind_context (const CosNaming::Name &n, + CosNaming::NamingContext_ptr nc + ACE_ENV_ARG_DECL) +{ + ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX, ace_mon, + this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + // Check to make sure this object didn't have <destroy> method + // invoked on it. + if (this->destroyed_) + ACE_THROW (CORBA::OBJECT_NOT_EXIST ()); + + // Do not allow binding of nil context reference. + if (CORBA::is_nil (nc)) + ACE_THROW (CORBA::BAD_PARAM ()); + + // Get the length of the name. + CORBA::ULong name_len = n.length (); + + // Check for invalid name. + if (name_len == 0) + ACE_THROW (CosNaming::NamingContext::InvalidName()); + + // If we received compound name, resolve it to get the context in + // which the binding should take place, then perform the binding on + // target context. + if (name_len > 1) + { + CosNaming::NamingContext_var context = + get_context (n ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CosNaming::Name simple_name; + simple_name.length (1); + simple_name[0] = n[name_len - 1]; + context->bind_context (simple_name, nc ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + // If we received a simple name, we need to bind it in this context. + else + { + // Try binding the name. + int result = this->context_->bind (n[0].id, + n[0].kind, + nc, + CosNaming::ncontext); + if (result == 1) + ACE_THROW (CosNaming::NamingContext::AlreadyBound()); + + // Something went wrong with the internal structure + else if (result == -1) + ACE_THROW (CORBA::INTERNAL ()); + + ACE_CString writer_name(this->persistence_directory_); + writer_name += "/"; + writer_name += ACE_static_cast(TAO_Storable_Bindings_Map*, + this->context_)->name(); + + //TAO_Writer_Base *wrtr = factory_->create_writer(writer_name.c_str()); + TAO_Writer_Base *wrtr = factory_->create_writer(); + if (wrtr->open (writer_name.c_str()) != 0) + { + delete wrtr; + ACE_THROW (CORBA::PERSIST_STORE ()); + } + + ACE_static_cast(TAO_Storable_Bindings_Map*, + this->context_)->Write(*wrtr); + wrtr->close(); + delete wrtr; + } +} + +void +TAO_Storable_Naming_Context::rebind_context (const CosNaming::Name &n, + CosNaming::NamingContext_ptr nc + ACE_ENV_ARG_DECL) +{ + ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX, ace_mon, + this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + // Check to make sure this object didn't have <destroy> method + // invoked on it. + if (this->destroyed_) + ACE_THROW (CORBA::OBJECT_NOT_EXIST ()); + + // Get the length of the name. + CORBA::ULong name_len = n.length (); + + // Check for invalid name. + if (name_len == 0) + ACE_THROW (CosNaming::NamingContext::InvalidName()); + + // If we received compound name, resolve it to get the context in + // which the rebinding should take place, then perform the rebinding + // on target context. + if (name_len > 1) + { + CosNaming::NamingContext_var context = + get_context (n ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CosNaming::Name simple_name; + simple_name.length (1); + simple_name[0] = n[name_len - 1]; + context->rebind_context (simple_name, nc ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + else + // If we received a simple name, we need to rebind it in this + // context. + { + int result = this->context_->rebind (n[0].id, + n[0].kind, + nc, + CosNaming::ncontext); + // Check for error conditions. + if (result == -1) + ACE_THROW (CORBA::INTERNAL ()); + + else if (result == -2) + ACE_THROW (CosNaming::NamingContext::NotFound + (CosNaming::NamingContext::not_context, n)); + + ACE_CString writer_name(this->persistence_directory_); + writer_name += "/"; + writer_name += ACE_static_cast(TAO_Storable_Bindings_Map*, + this->context_)->name(); + //TAO_Writer_Base *wrtr = factory_->create_writer(writer_name.c_str()); + TAO_Writer_Base *wrtr = factory_->create_writer(); + if (wrtr->open (writer_name.c_str()) != 0) + { + delete wrtr; + ACE_THROW (CORBA::PERSIST_STORE ()); + } + + ACE_static_cast(TAO_Storable_Bindings_Map*, + this->context_)->Write(*wrtr); + wrtr->close(); + delete wrtr; + } +} + +CORBA::Object_ptr +TAO_Storable_Naming_Context::resolve (const CosNaming::Name& n + ACE_ENV_ARG_DECL) +{ + ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + // Check to make sure this object didn't have <destroy> method + // invoked on it. + if (this->destroyed_) + ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (), + CORBA::Object::_nil ()); + + // Get the length of the name. + CORBA::ULong name_len = n.length (); + + // Check for invalid name. + if (name_len == 0) + ACE_THROW_RETURN (CosNaming::NamingContext::InvalidName(), + CORBA::Object::_nil ()); + + // Resolve the first component of the name. + + // Stores the binding type for the first name component. + CosNaming::BindingType type; + // Stores the object reference bound to the first name component. + CORBA::Object_ptr obj = CORBA::Object::_nil (); + + if (this->context_->find (n[0].id, + n[0].kind, + obj, + type) == -1) + ACE_THROW_RETURN (CosNaming::NamingContext::NotFound + (CosNaming::NamingContext::missing_node, n), + CORBA::Object::_nil ()); + + // Store the value in var to avoid memory leaks. + CORBA::Object_var result = obj; + + // If the name we have to resolve is a compound name, we need to + // resolve it recursively. + if (name_len > 1) + { + CosNaming::NamingContext_var context = + CosNaming::NamingContext::_nil (); + + if (type == CosNaming::ncontext) + { + // Narrow to NamingContext. + context = CosNaming::NamingContext::_narrow (result.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (result._retn ()); + } + else + // The first name component wasn't bound to a NamingContext. + ACE_THROW_RETURN (CosNaming::NamingContext::NotFound + (CosNaming::NamingContext::not_context, + n), + CORBA::Object::_nil ()); + + // If narrow failed... + if (CORBA::is_nil (context.in ())) + ACE_THROW_RETURN (CosNaming::NamingContext::NotFound + (CosNaming::NamingContext::not_context, n), + CORBA::Object::_nil ()); + else + { + // Successfully resolved the first name component, need to + // recursively call resolve on <n> without the first component. + + // We need a name just like <n> but without the first + // component. Instead of copying data we can reuse <n>'s + // buffer since we will only be using it for 'in' parameters + // (no modifications). + CosNaming::Name rest_of_name + (n.maximum () - 1, + n.length () - 1, + ACE_const_cast (CosNaming::NameComponent*, + n.get_buffer ()) + 1); + + // If there are any exceptions, they will propagate up. + return context->resolve (rest_of_name + ACE_ENV_ARG_PARAMETER); + } + } + // If the name we had to resolve was simple, we just need to return + // the result. + return result._retn (); +} + +void +TAO_Storable_Naming_Context::unbind (const CosNaming::Name& n + ACE_ENV_ARG_DECL) +{ + ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX, ace_mon, + this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + // Check to make sure this object didn't have <destroy> method + // invoked on it. + if (this->destroyed_) + ACE_THROW (CORBA::OBJECT_NOT_EXIST ()); + + // Get the length of the name. + CORBA::ULong name_len = n.length (); + + // Check for invalid name. + if (name_len == 0) + ACE_THROW (CosNaming::NamingContext::InvalidName()); + + // If we received compound name, resolve it to get the context in + // which the unbinding should take place, then perform the unbinding + // on target context. + if (name_len > 1) + { + CosNaming::NamingContext_var context = + get_context (n ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CosNaming::Name simple_name; + simple_name.length (1); + simple_name[0] = n[name_len - 1]; + context->unbind (simple_name ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + // If we received a simple name, we need to unbind it in this + // context. + else + if (this->context_->unbind (n[0].id, + n[0].kind) == -1) + ACE_THROW (CosNaming::NamingContext::NotFound + (CosNaming::NamingContext::missing_node, n)); + + ACE_CString writer_name(this->persistence_directory_); + writer_name += "/"; + writer_name += ACE_static_cast(TAO_Storable_Bindings_Map*, + this->context_)->name(); + //TAO_Writer_Base *wrtr = factory_->create_writer(writer_name.c_str()); + TAO_Writer_Base *wrtr = factory_->create_writer(); + if (wrtr->open (writer_name.c_str()) != 0) + { + delete wrtr; + ACE_THROW (CORBA::PERSIST_STORE ()); + } + + ACE_static_cast(TAO_Storable_Bindings_Map*, + this->context_)->Write(*wrtr); + wrtr->close(); + delete wrtr; +} + +CosNaming::NamingContext_ptr +TAO_Storable_Naming_Context::bind_new_context (const CosNaming::Name& n + ACE_ENV_ARG_DECL) +{ + ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX, + ace_mon, + this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ()); + + // Check to make sure this object didn't have <destroy> method + // invoked on it. + if (this->destroyed_) + ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (), + CosNaming::NamingContext::_nil ()); + + // Stores our new Naming Context. + CosNaming::NamingContext_var result = + CosNaming::NamingContext::_nil (); + + // Create new context. + result = new_context (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ()); + + // Bind the new context to the name. + ACE_TRY + { + bind_context (n, + result.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + { + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY_EX(DESTROY) + { + result->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK_EX(DESTROY); + } + ACE_CATCHANY + { + // Do nothing? + } + ACE_ENDTRY; + } + // Re-raise the exception in bind_context() + ACE_RE_THROW; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ()); + + return result._retn (); +} + +void +TAO_Storable_Naming_Context::destroy (ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX, + ace_mon, + this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + // Check to make sure this object didn't have <destroy> method + // invoked on it. + if (this->destroyed_) + ACE_THROW (CORBA::OBJECT_NOT_EXIST ()); + + if (this->context_->current_size () != 0) + ACE_THROW (CosNaming::NamingContext::NotEmpty()); + + // Destroy is a no-op on a root context. + if (root ()) + return; + + else + { + this->destroyed_ = 2; + + // Remove self from POA. Because of reference counting, the POA + // will automatically delete the servant when all pending requests + // on this servant are complete. + + PortableServer::POA_var poa = + this->_default_POA (); + + PortableServer::ObjectId_var id = + PortableServer::string_to_ObjectId (poa_id_.fast_rep ()); + + ACE_CHECK; + + poa->deactivate_object (id.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } +} + + +void +TAO_Storable_Naming_Context::bind (const CosNaming::Name& n, + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL) +{ + ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX, + ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + // Check to make sure this object didn't have <destroy> method + // invoked on it. + if (this->destroyed_) + ACE_THROW (CORBA::OBJECT_NOT_EXIST ()); + + // Get the length of the name. + CORBA::ULong name_len = n.length (); + + // Check for invalid name. + if (name_len == 0) + ACE_THROW (CosNaming::NamingContext::InvalidName()); + + // If we received compound name, resolve it to get the context in + // which the binding should take place, then perform the binding on + // target context. + if (name_len > 1) + { + CosNaming::NamingContext_var context = + this->get_context (n ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CosNaming::Name simple_name; + simple_name.length (1); + simple_name[0] = n[name_len - 1]; + context->bind (simple_name, obj ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + // If we received a simple name, we need to bind it in this context. + else + { + // Try binding the name. + int result = this->context_->bind (n[0].id, + n[0].kind, + obj, + CosNaming::nobject); + if (result == 1) + ACE_THROW (CosNaming::NamingContext::AlreadyBound()); + + // Something went wrong with the internal structure + else if (result == -1) + ACE_THROW (CORBA::INTERNAL ()); + + ACE_CString writer_name(this->persistence_directory_); + writer_name += "/"; + writer_name += ACE_static_cast(TAO_Storable_Bindings_Map*, + this->context_)->name(); + //TAO_Writer_Base *wrtr = factory_->create_writer((char*)(writer_name.c_str())); + TAO_Writer_Base *wrtr = factory_->create_writer(); + if (wrtr->open (writer_name.c_str()) != 0) + { + delete wrtr; + ACE_THROW (CORBA::PERSIST_STORE ()); + } + + ACE_static_cast(TAO_Storable_Bindings_Map*, + this->context_)->Write(*wrtr); + + wrtr->close(); + delete wrtr; + } +} + + +void +TAO_Storable_Naming_Context::list (CORBA::ULong how_many, + CosNaming::BindingList_out &bl, + CosNaming::BindingIterator_out &bi + ACE_ENV_ARG_DECL) +{ + // Allocate nil out parameters in case we won't be able to complete + // the operation. + bi = CosNaming::BindingIterator::_nil (); + ACE_NEW_THROW_EX (bl, + CosNaming::BindingList (0), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + // Obtain a lock before we proceed with the operation. + ACE_GUARD_THROW_EX (ACE_SYNCH_RECURSIVE_MUTEX, + ace_mon, + this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + // Check to make sure this object didn't have <destroy> method + // invoked on it. + if (this->destroyed_) + ACE_THROW (CORBA::OBJECT_NOT_EXIST ()); + + // Dynamically allocate iterator for traversing the underlying hash map. + HASH_MAP::ITERATOR *hash_iter = 0; + ACE_NEW_THROW_EX (hash_iter, + HASH_MAP::ITERATOR (storable_context_->map ()), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + // Store <hash_iter temporarily in auto pointer, in case we'll have + // some failures and throw an exception. + ACE_Auto_Basic_Ptr<HASH_MAP::ITERATOR> temp (hash_iter); + + // Silliness below is required because of broken old g++!!! E.g., + // without it, we could have just said HASH_MAP::ITERATOR everywhere we use ITER_DEF. + typedef ACE_Hash_Map_Manager<TAO_Persistent_ExtId, + TAO_Persistent_IntId, + ACE_Null_Mutex>::ITERATOR ITER_DEF; + typedef ACE_Hash_Map_Manager<TAO_Persistent_ExtId, + TAO_Persistent_IntId, + ACE_Null_Mutex>::ENTRY ENTRY_DEF; + + // Typedef to the type of BindingIterator servant for ease of use. + typedef TAO_Bindings_Iterator<ITER_DEF, ENTRY_DEF> ITER_SERVANT; + + // A pointer to BindingIterator servant. + ITER_SERVANT *bind_iter = 0; + + // Number of bindings that will go into the BindingList <bl>. + CORBA::ULong n; + + // Calculate number of bindings that will go into <bl>. + if (this->context_->current_size () > how_many) + n = how_many; + else + n = this->context_->current_size (); + + // Use the hash map iterator to populate <bl> with bindings. + bl->length (n); + + ENTRY_DEF *hash_entry; + + for (CORBA::ULong i = 0; i < n; i++) + { + hash_iter->next (hash_entry); + hash_iter->advance (); + + if (ITER_SERVANT::populate_binding (hash_entry, bl[i]) == 0) + ACE_THROW (CORBA::NO_MEMORY()); + } + + // Now we are done with the BindingsList, and we can follow up on + // the BindingIterator business. + + // If we do not need to pass back BindingIterator. + if (this->context_->current_size () <= how_many) + return; + else + { + // Create a BindingIterator for return. + ACE_NEW_THROW_EX (bind_iter, + ITER_SERVANT (this, hash_iter, + this->poa_.in (), this->lock_), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + // Release <hash_iter> from auto pointer, and start using + // reference counting to control our servant. + temp.release (); + PortableServer::ServantBase_var iter = bind_iter; + + // Increment reference count on this Naming Context, so it doesn't get + // deleted before the BindingIterator servant gets deleted. + interface_->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + // Register with the POA. + char poa_id[BUFSIZ]; + ACE_OS::sprintf (poa_id, + "%s_%d", + this->poa_id_.c_str (), + this->counter_++); + PortableServer::ObjectId_var id = + PortableServer::string_to_ObjectId (poa_id); + + this->poa_->activate_object_with_id (id.in (), + bind_iter + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + bi = bind_iter->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } +} + +#include "Naming_Service_Container.h" +CosNaming::NamingContext_ptr TAO_Storable_Naming_Context::recreate_all( + CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + const char *poa_id, + size_t context_size, + int reentering, + TAO_Naming_Service_Persistence_Factory *factory, + const ACE_TCHAR *persistence_directory + ACE_ENV_ARG_DECL) +{ + + ACE_UNUSED_ARG (reentering); + + ACE_Unbounded_List<ACE_CString> context_id_coll; + ACE_Unbounded_List<ACE_CString> context_kind_coll; + ACE_Unbounded_List<ACE_CString> context_binding_coll; + ACE_Unbounded_List<ACE_CString> context_IOR_coll; + ACE_Unbounded_List<ACE_CString> ref_id_coll; + ACE_Unbounded_List<ACE_CString> ref_kind_coll; + ACE_Unbounded_List<ACE_CString> ref_IOR_coll; + ACE_Unbounded_List<ACE_CString> ref_type_coll; + + ACE_CString reader_name(persistence_directory); + reader_name += "/"; + reader_name += poa_id; + + TAO_Reader_Base *rdr; + + // This is the call the to the abstract factory + //rdr = factory->create_reader(ACE_const_cast (char *, reader_name.c_str())); + rdr = factory->create_reader(); + int retVal = rdr->open(ACE_const_cast (char *, reader_name.c_str())); + + if (retVal != 0) + { + // This means that there was no stored state and so need to make the context. + // This can happen if a naming context with no entries existed at the time the + // INS crashed. + return TAO_Storable_Naming_Context::make_new_context ( + orb, + poa, + poa_id, + context_size, + factory, + persistence_directory + ACE_ENV_ARG_PARAMETER); + + } + + TAO_Storable_Bindings_Map *bindings_map; + + // create the new bindings map + ACE_NEW_THROW_EX (bindings_map, + TAO_Storable_Bindings_Map (context_size,orb,poa_id,poa), + CORBA::NO_MEMORY ()); + + // get the data for this bindings map from the file + + TAO_NS_Persistence_Header header; + TAO_NS_Persistence_Record record; + + *rdr >> header; + unsigned int max_count = 0; + + // read in the data + for (unsigned int i = 0; i < header.size() ; i++) + { + *rdr >> record; + TAO_NS_Persistence_Record::Record_Type type = record.type(); + + if (type == TAO_NS_Persistence_Record::NCONTEXT) + { + ACE_CString context_id = record.id(); + context_id_coll.insert(context_id); + + ACE_CString context_kind = record.kind(); + context_kind_coll.insert(context_kind); + //size_t sz = context_kind_coll.size(); + + ACE_CString context_IOR = record.ior(); + context_IOR_coll.insert(context_IOR); + + ACE_CString context_binding = record.context_binding(); + context_binding_coll.insert(context_binding); + + // Lets rip the context_binding apart to reverse engineer + // the counter used to generate it. We'll save the max + // count we see for later use to initialize this context + int underscore_pos = context_binding.rfind('_'); + if (underscore_pos != ACE_CString::npos) + { + ACE_CString count_str = context_binding.substring ( + underscore_pos + 1); + unsigned int count = ACE_OS::atoi (count_str.c_str()); + if (count >= max_count) + { + max_count = count + 1; + } + } + } + + else if (type == TAO_NS_Persistence_Record::OBJREF) + { + ref_type_coll.insert(ACE_CString("nobject")); + + ACE_CString ref_id = record.id(); + ref_id_coll.insert(ref_id); + + ACE_CString ref_kind = record.kind(); + ref_kind_coll.insert(ref_kind); + //size_t sz = ref_kind_coll.size(); + + ACE_CString ref_IOR = record.ior(); + ref_IOR_coll.insert(ref_IOR); + } + } + + // now put this data into the bindings map. Let's bind the nobject + //references first + ACE_Unbounded_List<ACE_CString>::iterator id_set_iter(ref_id_coll); + ACE_Unbounded_List<ACE_CString>::iterator IOR_set_iter(ref_IOR_coll); + IOR_set_iter = ref_IOR_coll.begin(); + ACE_Unbounded_List<ACE_CString>::iterator kind_set_iter(ref_kind_coll); + kind_set_iter = ref_kind_coll.begin(); + //vector<ACE_CString>::iterator kind_set_iter = ref_kind_coll.begin(); + for (id_set_iter = ref_id_coll.begin(); + id_set_iter != ref_id_coll.end(); + ++id_set_iter,++IOR_set_iter,++kind_set_iter) + { + CORBA::Object_var obj_ref = orb->string_to_object((*IOR_set_iter).c_str()); + bindings_map->bind((*id_set_iter).c_str(), + (*kind_set_iter).c_str(),obj_ref.in(), + (CosNaming::BindingType)0); + } + + // Now bind the ncontexts + ACE_Unbounded_List<ACE_CString>::iterator + context_id_set_iter(context_id_coll); + ACE_Unbounded_List<ACE_CString>::iterator + context_IOR_set_iter(context_IOR_coll); + context_IOR_set_iter = context_IOR_coll.begin(); + ACE_Unbounded_List<ACE_CString>::iterator + context_kind_set_iter(context_kind_coll); + context_kind_set_iter = context_kind_coll.begin(); + for (context_id_set_iter = context_id_coll.begin(); + context_id_set_iter != context_id_coll.end(); + ++context_id_set_iter,++context_IOR_set_iter,++context_kind_set_iter) + { + CORBA::Object_var obj_ref = orb->string_to_object( + (*context_IOR_set_iter).c_str()); + bindings_map->bind((*context_id_set_iter).c_str(), + (*context_kind_set_iter).c_str(), + obj_ref.in(), + (CosNaming::BindingType)1); + } + + // now create the context + // This is basically a call to make_new_context except we are creating + // the context impl with the bindings map already created and we are passing + // it into the overloaded constructor. + + // Store the stub we will return here. + CosNaming::NamingContext_var result; + + // Put together a servant for the new Naming Context. + TAO_Storable_Naming_Context *context_impl = 0; + // create an impl that takes a bindings map in its constructor + ACE_NEW_THROW_EX (context_impl, + TAO_Storable_Naming_Context (orb, + poa, + poa_id, + bindings_map, + factory, + persistence_directory, + context_size), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (result._retn ()); + + // We need to ensure that we set the counter for this context + // higher than the highest count we see in the contexts contained + // within it. Otherwise we will end up with object id collisions + // if we add a new context after a reload. + if (context_impl->counter_ < max_count) + { + context_impl->counter_ = max_count; + } + + // Put <context_impl> into the auto pointer temporarily, in case next + // allocation fails. + ACE_Auto_Basic_Ptr<TAO_Storable_Naming_Context> temp (context_impl); + + TAO_Naming_Context *context = 0; + ACE_NEW_THROW_EX (context, + TAO_Naming_Context (context_impl), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (result._retn ()); + + // Let <implementation> know about it's <interface>. + context_impl->interface (context); + + // Release auto pointer, and start using reference counting to + // control our servant. + temp.release (); + PortableServer::ServantBase_var s = context; + + // Register the new context with the POA. + PortableServer::ObjectId_var id = + PortableServer::string_to_ObjectId (poa_id); + + poa->activate_object_with_id (id.in (), + context + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (result._retn ()); + + result = context->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (CosNaming::NamingContext::_nil ()); + + // Now we need to recursively read in the other context's contents + ACE_Unbounded_List<ACE_CString>::iterator context_binding_set_iter(context_binding_coll); + context_binding_set_iter = context_binding_coll.begin(); + for (; context_binding_set_iter != context_binding_coll.end(); + ++context_binding_set_iter) + { + CosNaming::NamingContext_var temp = + TAO_Storable_Naming_Context::recreate_all( + orb, + poa, + (*context_binding_set_iter).c_str(), + context_size, + 1, + factory, + persistence_directory + ACE_ENV_ARG_PARAMETER); + } + rdr->close(); + delete rdr; // Should be scoped instead + return result._retn (); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class ACE_Unbounded_List_Iterator<ACE_CString>; +template class ACE_Unbounded_List<ACE_CString>; +template class ACE_NS_Node<ACE_CString>; +template class ACE_Auto_Basic_Ptr<TAO_Storable_Naming_Context>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Unbounded_List_Iterator<ACE_CString> +#pragma instantiate ACE_Unbounded_List<ACE_CString> +#pragma instantiate ACE_NS_Node<ACE_CString> +#pragma instantiate ACE_Auto_Basic_Ptr<TAO_Storable_Naming_Context> +#endif diff --git a/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.h b/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.h new file mode 100644 index 00000000000..1c7961ab54f --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.h @@ -0,0 +1,297 @@ +/* -*- C++ -*- */ +// $Id$ +// ============================================================================ +// +// = LIBRARY +// cos +// +// = FILENAME +// Storable_Naming_Context.h +// +// = AUTHOR +// Bruce Trask <trask_b@ociweb.com> +// +// ============================================================================ + +#ifndef TAO_STORABLE_NAMING_CONTEXT_H +#define TAO_STORABLE_NAMING_CONTEXT_H +#include "ace/pre.h" + +#include "Hash_Naming_Context.h" +#include "ace/Hash_Map_Manager.h" +#include "Persistent_Entries.h" + +#include "Storable.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class TAO_Naming_Export TAO_Storable_Bindings_Map : public TAO_Bindings_Map, + public TAO_Storable_Base +{ + // = TITLE + // Provides hash-table-based transient storage for name to object bindings in a + // Naming Context. + // + // = DESCRIPTION + // A thin wrapper on top of ACE_Hash_Map_Manager. Supports + // TAO_Bindings_Map interface. Used by TAO_Transient_Naming_Context. +public: + + typedef ACE_Hash_Map_Manager<TAO_Persistent_ExtId, + TAO_Persistent_IntId, + ACE_Null_Mutex> HASH_MAP; + // Underlying data structure - typedef for ease of use. + + // = Initialization and termination methods. + + TAO_Storable_Bindings_Map (size_t hash_table_size); + // Constructor. + + TAO_Storable_Bindings_Map (size_t hash_table_size, + CORBA::ORB_ptr orb, + const char* poa_id,PortableServer::POA_ptr poa); + + virtual ~TAO_Storable_Bindings_Map (void); + // Destructor. + + // = Accessors. + + HASH_MAP &map (void); + // Get a reference to the underlying hash map. + + size_t total_size (void); + // Return the size of the underlying hash table. + + virtual size_t current_size (void); + // Return current number of entries (name bindings) in the + // underlying hash map. + + // = Name bindings manipulation methods. + + virtual int bind (const char *id, + const char *kind, + CORBA::Object_ptr obj, + CosNaming::BindingType type); + // Add a binding with the specified parameters to the table. + // Return 0 on success and -1 on failure, 1 if there already is a + // binding with <id> and <kind>. + + virtual int rebind (const char *id, + const char *kind, + CORBA::Object_ptr obj, + CosNaming::BindingType type); + // Overwrite a binding containing <id> and <kind> (or create a new + // one if one doesn't exist) with the specified parameters. Return + // 0 or 1 on success. Return -1 or -2 on failure. (-2 is returned + // if the new and old bindings differ in type). + + virtual int unbind (const char * id, + const char * kind); + // Remove a binding containing <id> and <kind> from the table. + // Return 0 on success and -1 on failure. + + virtual int find (const char * id, + const char * kind, + CORBA::Object_ptr & obj, + CosNaming::BindingType &type); + // Find the binding containing <id> and <kind> in the table, and + // pass binding's type and object back to the caller by reference. + // Return 0 on success and -1 on failure. Note: a 'duplicated' object + // reference is assigned to <obj>, so the caller is responsible for + // its deallocation. + + virtual void Write(TAO_Writer_Base& wrtr); + + virtual const char * name(); + +private: + + int shared_bind (const char *id, + const char *kind, + CORBA::Object_ptr obj, + CosNaming::BindingType type, + int rebind); + // Helper: factors common code from <bind> and <rebind>. + + HASH_MAP map_; + // Hash map used for storage. + + CORBA::ORB_ptr orb_; + + ACE_CString name_; + + PortableServer::POA_var poa_; +}; + +class TAO_Naming_Export TAO_Storable_Naming_Context : public TAO_Hash_Naming_Context +{ + // = TITLE + // This class plays a role of a 'ConcreteImplementor' in the + // Bridge pattern architecture of the CosNaming::NamingContext + // implementation. + // + // = DESCRIPTION + // This class provides a implementation of the + // NamingContext functionality, i.e., the state can be preserved + // across process boundaries. Derives from + // TAO_Hash_Naming_Context and uses TAO_Storable_Bindings_Map to + // store name to object bindings. + +public: + + typedef TAO_Storable_Bindings_Map::HASH_MAP HASH_MAP; + // Underlying data structure - typedef for ease of use. + + // = Initialization and termination methods. + + TAO_Storable_Naming_Context (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + const char *poa_id, + TAO_Naming_Service_Persistence_Factory *factory, + const ACE_TCHAR *persistence_directory, + size_t hash_table_size = ACE_DEFAULT_MAP_SIZE); + + TAO_Storable_Naming_Context (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + const char *poa_id, + TAO_Storable_Bindings_Map* bm, + TAO_Naming_Service_Persistence_Factory *factory, + const ACE_TCHAR *persistence_directory, + size_t hash_table_size = ACE_DEFAULT_MAP_SIZE); + + // Constructor. + + virtual ~TAO_Storable_Naming_Context (void); + // Destructor. + + // = Utility methods. + static CosNaming::NamingContext_ptr make_new_context ( + CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + const char *poa_id, + size_t context_size, + TAO_Naming_Service_Persistence_Factory *factory, + const ACE_TCHAR *persistence_directory + ACE_ENV_ARG_DECL); + + // This utility method factors out the code needed to create a new + // Storable Naming Context servant and activate it under the + // specified POA with the specified id. This function is static so + // that the code can be used, both from inside the class (e.g., + // <new_context>), and from outside (e.g., Naming_Utils.cpp). + + // = Methods not implemented in TAO_Hash_Naming_Context. + + static CosNaming::NamingContext_ptr recreate_all( + CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + const char *poa_id, + size_t context_size, + int reentering, + TAO_Naming_Service_Persistence_Factory *factory, + const ACE_TCHAR *persistence_directory + ACE_ENV_ARG_DECL); + + + virtual CosNaming::NamingContext_ptr new_context (ACE_ENV_SINGLE_ARG_DECL); + // This operation returns a new naming context implemented by the + // same naming server in which the operation was invoked. The + // context is not bound. + + virtual void list (CORBA::ULong how_many, + CosNaming::BindingList_out &bl, + CosNaming::BindingIterator_out &bi + ACE_ENV_ARG_DECL); + // Returns at most the requested number of bindings <how_many> in + // <bl>. If the naming context contains additional bindings, they + // are returned with a BindingIterator. In the naming context does + // not contain any additional bindings <bi> returned as null. + + + virtual void rebind (const CosNaming::Name& n, + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL); + + virtual void bind (const CosNaming::Name &n, + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL); + // Create a binding for name <n> and object <obj> in the naming + // context. Compound names are treated as follows: ctx->bind (<c1; + // c2; c3; cn>, obj) = (ctx->resolve (<c1; c2; cn-1>))->bind (<cn>, + // obj) if the there already exists a binding for the specified + // name, <AlreadyBound> exception is thrown. Naming contexts should + // be bound using <bind_context> and <rebind_context> in order to + // participate in name resolution later. + + + virtual void bind_context (const CosNaming::Name &n, + CosNaming::NamingContext_ptr nc + ACE_ENV_ARG_DECL); + // This is the version of <bind> specifically for binding naming + // contexts, so that they will participate in name resolution when + // compound names are passed to be resolved. + + virtual void rebind_context (const CosNaming::Name &n, + CosNaming::NamingContext_ptr nc + ACE_ENV_ARG_DECL); + // This is a version of <rebind> specifically for naming contexts, + // so that they can participate in name resolution when compound + // names are passed. + + virtual CORBA::Object_ptr resolve (const CosNaming::Name &n + ACE_ENV_ARG_DECL); + // Return object reference that is bound to the name. Compound name + // resolve is defined as follows: ctx->resolve (<c1; c2; cn>) = + // ctx->resolve (<c1; c2 cn-1>)->resolve (<cn>) The naming service + // does not return the type of the object. Clients are responsible + // for "narrowing" the object to the appropriate type. + + virtual void unbind (const CosNaming::Name &n + ACE_ENV_ARG_DECL); + // Remove the name binding from the context. When compound names + // are used, unbind is defined as follows: ctx->unbind (<c1; c2; + // cn>) = (ctx->resolve (<c1; c2; cn-1>))->unbind (<cn>) + + virtual CosNaming::NamingContext_ptr bind_new_context ( + const CosNaming::Name &n + ACE_ENV_ARG_DECL); + // This operation creates a new context and binds it to the name + // supplied as an argument. The newly-created context is + // implemented by the same server as the context in which it was + // bound (the name argument excluding the last component). + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL); + // Delete the naming context. The user should take care to <unbind> any + // bindings in which the given context is bound to some names, to + // avoid dangling references when invoking <destroy> operation. + // NOTE: <destory> is a no-op on the root context. + // NOTE: after <destroy> is invoked on a Naming Context, all + // BindingIterators associated with that Naming Context are also destroyed. + +protected: + + ACE_UINT32 counter_; + // Counter used for generation of POA ids for children Naming + // Contexts. + + TAO_Storable_Bindings_Map *storable_context_; + // A pointer to the underlying data structure used to store name + // bindings. While our superclass (TAO_Hash_Naming_Context) also + // maintains a pointer to the data structure, keeping this pointer + // around saves us from the need to downcast when invoking + // non-virtual methods. + + CORBA::ORB_ptr orb_; + + TAO_Naming_Service_Persistence_Factory *factory_; + + /// The directory in which to store the files + ACE_CString persistence_directory_; + + static CosNaming::NamingContext_ptr root_context_; +}; + +#include "ace/post.h" +#endif /* TAO_STORABLE_NAMING_CONTEXT_H */ diff --git a/TAO/orbsvcs/tests/Simple_Naming/run_test.pl b/TAO/orbsvcs/tests/Simple_Naming/run_test.pl index ed543a8b7c0..9eb626eea2b 100755 --- a/TAO/orbsvcs/tests/Simple_Naming/run_test.pl +++ b/TAO/orbsvcs/tests/Simple_Naming/run_test.pl @@ -28,6 +28,7 @@ $ns_multicast_port = 10001 + PerlACE::uniqueid (); # Can not be 10000 on Chorus $ns_orb_port = 12000 + PerlACE::uniqueid (); $iorfile = PerlACE::LocalFile ("ns.ior"); $persistent_ior_file = PerlACE::LocalFile ("pns.ior"); +$file_persistent_ior_file = PerlACE::LocalFile ("fpns.ior"); $persistent_log_file = PerlACE::LocalFile ("test_log"); $data_file = PerlACE::LocalFile ("test_run.data"); @@ -35,9 +36,8 @@ $status = 0; sub name_server { - my $args = "@_ "."-ORBNameServicePort $ns_multicast_port -o $iorfile -m 1"; + my $args = "-ORBNameServicePort $ns_multicast_port -o $iorfile -m 1 @_"; my $prog = "../../Naming_Service/Naming_Service"; - $NS = new PerlACE::Process ($prog, $args); unlink $iorfile; @@ -74,11 +74,15 @@ sub client "-e -ORBInitRef NameService=file://$iorfile", "-y -ORBInitRef NameService=file://$iorfile", "-p $persistent_ior_file -ORBInitRef NameService=file://$iorfile", - "-c file://$persistent_ior_file -ORBInitRef NameService=file://$iorfile"); + "-c file://$persistent_ior_file -ORBInitRef NameService=file://$iorfile", + "-p $file_persistent_ior_file -ORBInitRef NameService=file://$iorfile", + "-c file://$file_persistent_ior_file -ORBInitRef NameService=file://$iorfile"); @server_opts = ("", "", "", "", "", "", "-ORBEndpoint iiop://$TARGETHOSTNAME:$ns_orb_port -f $persistent_log_file", - "-ORBEndpoint iiop://$TARGETHOSTNAME:$ns_orb_port -f $persistent_log_file"); + "-ORBEndpoint iiop://$TARGETHOSTNAME:$ns_orb_port -f $persistent_log_file", + "-ORBEndpoint iiop://$TARGETHOSTNAME:$ns_orb_port -u .", + "-ORBEndpoint iiop://$TARGETHOSTNAME:$ns_orb_port -u ."); @comments = ("Simple Test: \n", "Simple Test (using multicast to locate the server): \n", @@ -86,12 +90,15 @@ sub client "Iterator Test: \n", "Exceptions Test: \n", "Destroy Test: \n", - "Persistent Test (Part 1): \n", - "Persistent Test (Part 2): \n"); + "mmap() Persistent Test (Part 1): \n", + "mmap() Persistent Test (Part 2): \n", + "Flat File Persistent Test (Part 1): \n", + "Flat File Persistent Test (Part 2): \n"); $test_number = 0; -unlink $persistent_ior_file, $persistent_log_file; +unlink ($persistent_ior_file, $file_persistent_ior_file, + $persistent_log_file, "NameService", "NameService_0"); # Run server and client for each of the tests. Client uses ior in a # file to bootstrap to the server. @@ -106,7 +113,8 @@ foreach $o (@opts) { $test_number++; } -unlink $persistent_ior_file, $persistent_log_file; +unlink ($persistent_ior_file, $file_persistent_ior_file, \ + $persistent_log_file, "NameService", "NameService_0"); # Now run the multithreaded test, sending output to the file. print STDERR "\n Multithreaded Test:\n"; |