summaryrefslogtreecommitdiff
path: root/TAO/examples/POA
diff options
context:
space:
mode:
authorkirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-12-06 06:04:27 +0000
committerkirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-12-06 06:04:27 +0000
commit54c6ba300abf3a6a4310b0ebdfe35c0d470b2848 (patch)
tree0c3d26f0d321c5a9ca613677377996986284ed0b /TAO/examples/POA
parent87dd8ffc0d3833d9ad4b01098202805cebc26b29 (diff)
downloadATCD-54c6ba300abf3a6a4310b0ebdfe35c0d470b2848.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO/examples/POA')
-rw-r--r--TAO/examples/POA/On_Demand_Loading/Dir_Service.idl35
-rw-r--r--TAO/examples/POA/On_Demand_Loading/Dir_Service_i.cpp105
-rw-r--r--TAO/examples/POA/On_Demand_Loading/Dir_Service_i.h62
-rw-r--r--TAO/examples/POA/On_Demand_Loading/Makefile537
-rw-r--r--TAO/examples/POA/On_Demand_Loading/Makefile.Client75
-rw-r--r--TAO/examples/POA/On_Demand_Loading/Makefile.DirService55
-rw-r--r--TAO/examples/POA/On_Demand_Loading/Servant_Activator.cpp164
-rw-r--r--TAO/examples/POA/On_Demand_Loading/Servant_Activator.h81
-rw-r--r--TAO/examples/POA/On_Demand_Loading/client.cpp195
-rw-r--r--TAO/examples/POA/On_Demand_Loading/generic_servant_export.h35
-rw-r--r--TAO/examples/POA/On_Demand_Loading/server.cpp288
11 files changed, 1632 insertions, 0 deletions
diff --git a/TAO/examples/POA/On_Demand_Loading/Dir_Service.idl b/TAO/examples/POA/On_Demand_Loading/Dir_Service.idl
new file mode 100644
index 00000000000..285661cecbb
--- /dev/null
+++ b/TAO/examples/POA/On_Demand_Loading/Dir_Service.idl
@@ -0,0 +1,35 @@
+// $Id$
+// ================================================================
+//
+// = FILENAME
+// Dir_Service.idl
+//
+// = DESCRIPTION
+// The Dir_Service IDL interface.
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+//
+// ================================================================
+
+interface Dir_Service
+{
+ // = TITLE
+ // The interface for Directory Service.
+ //
+ // = DESCRIPTION
+ // This interface can be used for any directory assistance.
+
+ long tele_number (in string name);
+ // A simple twoway operation, the idea is to verify that the telephone number
+ // can be located.
+
+ oneway void end_note ();
+ // A simple oneway operation, which can be used before ending the session.
+
+ oneway void area_codes_info ();
+ // A oneway operation which describes the area codes.
+
+ void shutdown ();
+ // Shutdown the server.
+};
diff --git a/TAO/examples/POA/On_Demand_Loading/Dir_Service_i.cpp b/TAO/examples/POA/On_Demand_Loading/Dir_Service_i.cpp
new file mode 100644
index 00000000000..10f2a808a79
--- /dev/null
+++ b/TAO/examples/POA/On_Demand_Loading/Dir_Service_i.cpp
@@ -0,0 +1,105 @@
+// $Id$
+//=============================================================================
+//
+// = FILENAME
+// Dir_Service_i.cpp
+//
+// = DESCRIPTION
+// Servant - implementation of the Directory Service object.
+// Provides directory information.
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+//
+//=============================================================================
+
+#define ACE_BUILD_SVC_EXPORT
+
+#include "Dir_Service_i.h"
+#include "ace/OS.h"
+
+ACE_RCSID(On_Demand_Loading, Dir_Service_i, "$Id$")
+
+// Initialization.
+
+Dir_Service_i::Dir_Service_i (CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa)
+ : orb_ (CORBA::ORB::_duplicate (orb)),
+ poa_ (PortableServer::POA::_duplicate (poa))
+ {}
+
+// Wrapping up, cleaning up if any.
+
+Dir_Service_i::~Dir_Service_i (void)
+{}
+
+// Return the Default POA of this Servant
+
+PortableServer::POA_ptr
+Dir_Service_i::_default_POA (CORBA::Environment &env)
+{
+ return PortableServer::POA::_duplicate (this->poa_.in ());
+}
+
+// The telephone number information is provided.
+
+CORBA::Long
+Dir_Service_i::tele_number (const char *name,
+ CORBA::Environment &env)
+{
+ // The telephone number corresponding to the name is returned.
+ return 3617339;
+}
+
+// Ending the session with a word of thanks.
+
+void
+Dir_Service_i::end_note (CORBA::Environment &env)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "Thanks for using DIRECTORY SERVICE!\n"));
+}
+
+// The area code information is displayed.
+
+void
+Dir_Service_i::area_codes_info (CORBA::Environment &env)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "Some area_codes:"
+ " Indianapolis 812"
+ "St.Louis 314"
+ "Sunnyvale 408\n"));
+
+}
+
+// Shuts down the servant.
+
+void
+Dir_Service_i::shutdown (CORBA::Environment &env)
+{
+ this->orb_->shutdown ();
+}
+
+// This is the point of entry into this library.
+
+extern "C" ACE_Svc_Export PortableServer::Servant create_dir_service (CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa);
+
+// The servant pointer is returned which will be of Base class type. The binding to Dir_Service
+//servant will happen at run-time.
+
+PortableServer::Servant
+create_dir_service (CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa)
+{
+ PortableServer::Servant servant;
+
+ ACE_NEW_RETURN (servant,
+ Dir_Service_i (orb,
+ poa),
+ 0);
+ return servant;
+}
+
+
diff --git a/TAO/examples/POA/On_Demand_Loading/Dir_Service_i.h b/TAO/examples/POA/On_Demand_Loading/Dir_Service_i.h
new file mode 100644
index 00000000000..9e793b9553d
--- /dev/null
+++ b/TAO/examples/POA/On_Demand_Loading/Dir_Service_i.h
@@ -0,0 +1,62 @@
+// $Id$
+// ================================================================
+//
+// = FILENAME
+// Dir_Service.h
+//
+// = DESCRIPTION
+// This is a customised servant-- a dynamic linked library which
+// provides directory information.
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+//
+// ================================================================
+
+#ifndef DIR_SERVICE_I_H
+#define DIR_SERVICE_I_H
+
+#include "Dir_ServiceS.h"
+
+class GENERIC_SERVANT_Export Dir_Service_i : public POA_Dir_Service
+{
+ //= TITLE
+ // Directory Service object.
+ //
+ //= DESCRIPTION
+ // Provides directory assistance.
+ public:
+
+ Dir_Service_i (CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa);
+ // Initialization.
+
+ ~Dir_Service_i (void);
+ // Destruction.
+
+ PortableServer::POA_ptr _default_POA (CORBA::Environment &env);
+ // Returns the Default POA of this Servant object
+
+ CORBA::Long tele_number (const char* name,
+ CORBA::Environment &env );
+ // The telephone number is returned.
+
+ void end_note (CORBA::Environment &env);
+ // Just a word of thanks.
+
+ void area_codes_info (CORBA::Environment &env);
+ // Extra area codes information provided.
+
+ void shutdown (CORBA::Environment &env);
+ // Shutdown the ORB.
+
+ private:
+ CORBA::ORB_var orb_;
+ // Keep a pointer to the ORB so we can shut it down.
+
+ PortableServer::POA_var poa_;
+ // Implement a different _default_POA()
+
+};
+
+#endif /*DIR_SERVICE_I_H*/
diff --git a/TAO/examples/POA/On_Demand_Loading/Makefile b/TAO/examples/POA/On_Demand_Loading/Makefile
new file mode 100644
index 00000000000..c791d531d54
--- /dev/null
+++ b/TAO/examples/POA/On_Demand_Loading/Makefile
@@ -0,0 +1,537 @@
+#
+# $Id$
+#
+
+BIN = server
+
+MYFILES = Servant_Activator
+
+SRC = $(addsuffix .cpp,$(MYFILES)) $(addsuffix .cpp, $(BIN))
+
+OBJ = $(addsuffix .o,$(MYFILES))
+
+CPPFLAGS += -I$(TAO_ROOT)
+
+LDLIBS = -lserver -lTAO
+
+LDFLAGS += -L$(TAO_ROOT)/tao
+
+VLDLIBS = $(LDLIBS:%=%$(VAR))
+
+BUILD = $(VBIN)
+
+INSTALL =
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+
+ifndef TAO_ROOT
+TAO_ROOT = $(ACE_ROOT)/TAO
+endif
+
+CLIENT:
+ make -f Makefile.Client
+
+DIR_SERVICE:
+ make -f Makefile.DirService
+
+all: CLIENT DIR_SERVICE $(BIN)
+
+#----------------------------------------------------------------------------
+# Dependencies
+#----------------------------------------------------------------------------
+
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+.obj/Dir_ServiceC.o .obj/Dir_ServiceC.so .shobj/Dir_ServiceC.o .shobj/Dir_ServiceC.so: Dir_ServiceC.cpp Dir_ServiceC.h \
+ $(TAO_ROOT)/tao/corba.h \
+ $(TAO_ROOT)/tao/orbconf.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/inc_user_config.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/config-sunos5.5.h \
+ $(ACE_ROOT)/ace/config-g++-common.h \
+ $(ACE_ROOT)/ace/streams.h \
+ $(ACE_ROOT)/ace/Basic_Types.h \
+ $(ACE_ROOT)/ace/Basic_Types.i \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Get_Opt.h \
+ $(ACE_ROOT)/ace/Get_Opt.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.h \
+ $(ACE_ROOT)/ace/SOCK_IO.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_IO.i \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Synch_T.cpp \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.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/Signal.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Containers_T.h \
+ $(ACE_ROOT)/ace/Containers_T.i \
+ $(ACE_ROOT)/ace/Containers_T.cpp \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc_Base.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Free_List.cpp \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Malloc_T.cpp \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Object_Manager.h \
+ $(ACE_ROOT)/ace/Object_Manager.i \
+ $(ACE_ROOT)/ace/Managed_Object.h \
+ $(ACE_ROOT)/ace/Managed_Object.i \
+ $(ACE_ROOT)/ace/Managed_Object.cpp \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Timer_Queue_T.cpp \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.h \
+ $(ACE_ROOT)/ace/Time_Value.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.i \
+ $(ACE_ROOT)/ace/SOCK_Connector.h \
+ $(ACE_ROOT)/ace/SOCK_Connector.i \
+ $(ACE_ROOT)/ace/Strategies.h \
+ $(ACE_ROOT)/ace/Strategies_T.h \
+ $(ACE_ROOT)/ace/Synch_Options.h \
+ $(ACE_ROOT)/ace/Synch_Options.i \
+ $(ACE_ROOT)/ace/Thread_Manager.h \
+ $(ACE_ROOT)/ace/Thread_Manager.i \
+ $(ACE_ROOT)/ace/Strategies_T.i \
+ $(ACE_ROOT)/ace/Strategies_T.cpp \
+ $(ACE_ROOT)/ace/Service_Repository.h \
+ $(ACE_ROOT)/ace/Service_Types.h \
+ $(ACE_ROOT)/ace/Service_Types.i \
+ $(ACE_ROOT)/ace/Service_Repository.i \
+ $(ACE_ROOT)/ace/WFMO_Reactor.h \
+ $(ACE_ROOT)/ace/Message_Queue.h \
+ $(ACE_ROOT)/ace/Message_Block.h \
+ $(ACE_ROOT)/ace/Message_Block.i \
+ $(ACE_ROOT)/ace/Message_Block_T.h \
+ $(ACE_ROOT)/ace/Message_Block_T.i \
+ $(ACE_ROOT)/ace/Message_Block_T.cpp \
+ $(ACE_ROOT)/ace/IO_Cntl_Msg.h \
+ $(ACE_ROOT)/ace/Message_Queue_T.h \
+ $(ACE_ROOT)/ace/Message_Queue_T.i \
+ $(ACE_ROOT)/ace/Message_Queue_T.cpp \
+ $(ACE_ROOT)/ace/Message_Queue.i \
+ $(ACE_ROOT)/ace/WFMO_Reactor.i \
+ $(ACE_ROOT)/ace/Strategies.i \
+ $(ACE_ROOT)/ace/Connector.h \
+ $(ACE_ROOT)/ace/Map_Manager.h \
+ $(ACE_ROOT)/ace/Map_Manager.i \
+ $(ACE_ROOT)/ace/Map_Manager.cpp \
+ $(ACE_ROOT)/ace/Svc_Handler.h \
+ $(ACE_ROOT)/ace/Task.h \
+ $(ACE_ROOT)/ace/Task.i \
+ $(ACE_ROOT)/ace/Task_T.h \
+ $(ACE_ROOT)/ace/Task_T.i \
+ $(ACE_ROOT)/ace/Task_T.cpp \
+ $(ACE_ROOT)/ace/Module.h \
+ $(ACE_ROOT)/ace/Module.i \
+ $(ACE_ROOT)/ace/Module.cpp \
+ $(ACE_ROOT)/ace/Stream_Modules.h \
+ $(ACE_ROOT)/ace/Stream_Modules.i \
+ $(ACE_ROOT)/ace/Stream_Modules.cpp \
+ $(ACE_ROOT)/ace/Svc_Handler.i \
+ $(ACE_ROOT)/ace/Svc_Handler.cpp \
+ $(ACE_ROOT)/ace/Dynamic.h \
+ $(ACE_ROOT)/ace/Singleton.h \
+ $(ACE_ROOT)/ace/Singleton.i \
+ $(ACE_ROOT)/ace/Singleton.cpp \
+ $(ACE_ROOT)/ace/Dynamic.i \
+ $(ACE_ROOT)/ace/Connector.i \
+ $(ACE_ROOT)/ace/Connector.cpp \
+ $(ACE_ROOT)/ace/Acceptor.h \
+ $(ACE_ROOT)/ace/Acceptor.i \
+ $(ACE_ROOT)/ace/Acceptor.cpp \
+ $(TAO_ROOT)/tao/Align.h \
+ $(TAO_ROOT)/tao/Environment.h \
+ $(TAO_ROOT)/tao/Environment.i \
+ $(TAO_ROOT)/tao/ORB.h \
+ $(TAO_ROOT)/tao/Sequence.h \
+ $(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/Object_KeyC.h \
+ $(TAO_ROOT)/tao/Object_KeyC.i \
+ $(TAO_ROOT)/tao/Union.h \
+ $(TAO_ROOT)/tao/Exception.h \
+ $(TAO_ROOT)/tao/Exception.i \
+ $(TAO_ROOT)/tao/ORB.i \
+ $(TAO_ROOT)/tao/try_macros.h \
+ $(TAO_ROOT)/tao/Any.h \
+ $(TAO_ROOT)/tao/Any.i \
+ $(TAO_ROOT)/tao/NVList.h \
+ $(TAO_ROOT)/tao/NVList.i \
+ $(TAO_ROOT)/tao/Principal.h \
+ $(TAO_ROOT)/tao/Principal.i \
+ $(TAO_ROOT)/tao/Request.h \
+ $(TAO_ROOT)/tao/Request.i \
+ $(TAO_ROOT)/tao/Stub.h \
+ $(TAO_ROOT)/tao/Stub.i \
+ $(TAO_ROOT)/tao/Object.h \
+ $(TAO_ROOT)/tao/Object.i \
+ $(TAO_ROOT)/tao/varout.h \
+ $(TAO_ROOT)/tao/varout.i \
+ $(TAO_ROOT)/tao/varout.cpp \
+ $(TAO_ROOT)/tao/Typecode.h \
+ $(TAO_ROOT)/tao/Typecode.i \
+ $(TAO_ROOT)/tao/Marshal.h \
+ $(TAO_ROOT)/tao/Marshal.i \
+ $(TAO_ROOT)/tao/singletons.h \
+ $(TAO_ROOT)/tao/CDR.h \
+ $(TAO_ROOT)/tao/CDR.i \
+ $(TAO_ROOT)/tao/PolicyC.h \
+ $(TAO_ROOT)/tao/PolicyC.i \
+ $(TAO_ROOT)/tao/CurrentC.h \
+ $(TAO_ROOT)/tao/CurrentC.i \
+ $(TAO_ROOT)/tao/POA.h \
+ $(TAO_ROOT)/tao/POAC.h \
+ $(TAO_ROOT)/tao/POAC.i \
+ $(TAO_ROOT)/tao/Servant_Base.h \
+ $(TAO_ROOT)/tao/POAS.h \
+ $(TAO_ROOT)/tao/POA_CORBA.h \
+ $(TAO_ROOT)/tao/DynAnyC.h \
+ $(TAO_ROOT)/tao/DynAnyC.i \
+ $(TAO_ROOT)/tao/POAS.i \
+ $(TAO_ROOT)/tao/Object_Table.h \
+ $(TAO_ROOT)/tao/Object_Table.i \
+ $(TAO_ROOT)/tao/POA.i \
+ $(TAO_ROOT)/tao/poa_macros.h \
+ $(TAO_ROOT)/tao/params.h \
+ $(TAO_ROOT)/tao/params.i \
+ $(TAO_ROOT)/tao/Connect.h \
+ $(TAO_ROOT)/tao/Connect.i \
+ $(TAO_ROOT)/tao/ORB_Core.h \
+ $(TAO_ROOT)/tao/ORB_Core.i \
+ $(ACE_ROOT)/ace/Dynamic_Service.h \
+ $(ACE_ROOT)/ace/Dynamic_Service.cpp \
+ $(TAO_ROOT)/tao/Operation_Table.h \
+ $(TAO_ROOT)/tao/debug.h \
+ $(TAO_ROOT)/tao/Client_Strategy_Factory.h \
+ $(TAO_ROOT)/tao/Server_Strategy_Factory.h \
+ $(TAO_ROOT)/tao/default_client.h \
+ $(TAO_ROOT)/tao/default_client.i \
+ $(TAO_ROOT)/tao/default_server.h \
+ $(TAO_ROOT)/tao/ORB_Strategies_T.h \
+ $(TAO_ROOT)/tao/ORB_Strategies_T.i \
+ $(TAO_ROOT)/tao/ORB_Strategies_T.cpp \
+ $(TAO_ROOT)/tao/default_server.i \
+ $(TAO_ROOT)/tao/IIOP_Object.h \
+ $(TAO_ROOT)/tao/IIOP_Object.i \
+ $(TAO_ROOT)/tao/IIOP_ORB.h \
+ $(TAO_ROOT)/tao/IIOP_ORB.i \
+ $(TAO_ROOT)/tao/IIOP_Interpreter.h \
+ $(TAO_ROOT)/tao/GIOP.h \
+ $(TAO_ROOT)/tao/GIOP.i \
+ $(TAO_ROOT)/tao/Invocation.h \
+ $(TAO_ROOT)/tao/Invocation.i \
+ $(TAO_ROOT)/tao/Server_Request.h \
+ $(TAO_ROOT)/tao/Server_Request.i \
+ $(TAO_ROOT)/tao/InconsistentTypeCodeC.h \
+ $(TAO_ROOT)/tao/DynAny_i.h \
+ generic_servant_export.h Dir_ServiceC.i Dir_ServiceS.h \
+ Dir_ServiceS_T.h Dir_ServiceS_T.i Dir_ServiceS_T.cpp Dir_ServiceS.i
+.obj/Dir_ServiceS.o .obj/Dir_ServiceS.so .shobj/Dir_ServiceS.o .shobj/Dir_ServiceS.so: Dir_ServiceS.cpp Dir_ServiceS.h Dir_ServiceC.h \
+ $(TAO_ROOT)/tao/corba.h \
+ $(TAO_ROOT)/tao/orbconf.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/inc_user_config.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/config-sunos5.5.h \
+ $(ACE_ROOT)/ace/config-g++-common.h \
+ $(ACE_ROOT)/ace/streams.h \
+ $(ACE_ROOT)/ace/Basic_Types.h \
+ $(ACE_ROOT)/ace/Basic_Types.i \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Get_Opt.h \
+ $(ACE_ROOT)/ace/Get_Opt.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.h \
+ $(ACE_ROOT)/ace/SOCK_IO.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_IO.i \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Synch_T.cpp \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.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/Signal.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Containers_T.h \
+ $(ACE_ROOT)/ace/Containers_T.i \
+ $(ACE_ROOT)/ace/Containers_T.cpp \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc_Base.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Free_List.cpp \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Malloc_T.cpp \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Object_Manager.h \
+ $(ACE_ROOT)/ace/Object_Manager.i \
+ $(ACE_ROOT)/ace/Managed_Object.h \
+ $(ACE_ROOT)/ace/Managed_Object.i \
+ $(ACE_ROOT)/ace/Managed_Object.cpp \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Timer_Queue_T.cpp \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.h \
+ $(ACE_ROOT)/ace/Time_Value.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.i \
+ $(ACE_ROOT)/ace/SOCK_Connector.h \
+ $(ACE_ROOT)/ace/SOCK_Connector.i \
+ $(ACE_ROOT)/ace/Strategies.h \
+ $(ACE_ROOT)/ace/Strategies_T.h \
+ $(ACE_ROOT)/ace/Synch_Options.h \
+ $(ACE_ROOT)/ace/Synch_Options.i \
+ $(ACE_ROOT)/ace/Thread_Manager.h \
+ $(ACE_ROOT)/ace/Thread_Manager.i \
+ $(ACE_ROOT)/ace/Strategies_T.i \
+ $(ACE_ROOT)/ace/Strategies_T.cpp \
+ $(ACE_ROOT)/ace/Service_Repository.h \
+ $(ACE_ROOT)/ace/Service_Types.h \
+ $(ACE_ROOT)/ace/Service_Types.i \
+ $(ACE_ROOT)/ace/Service_Repository.i \
+ $(ACE_ROOT)/ace/WFMO_Reactor.h \
+ $(ACE_ROOT)/ace/Message_Queue.h \
+ $(ACE_ROOT)/ace/Message_Block.h \
+ $(ACE_ROOT)/ace/Message_Block.i \
+ $(ACE_ROOT)/ace/Message_Block_T.h \
+ $(ACE_ROOT)/ace/Message_Block_T.i \
+ $(ACE_ROOT)/ace/Message_Block_T.cpp \
+ $(ACE_ROOT)/ace/IO_Cntl_Msg.h \
+ $(ACE_ROOT)/ace/Message_Queue_T.h \
+ $(ACE_ROOT)/ace/Message_Queue_T.i \
+ $(ACE_ROOT)/ace/Message_Queue_T.cpp \
+ $(ACE_ROOT)/ace/Message_Queue.i \
+ $(ACE_ROOT)/ace/WFMO_Reactor.i \
+ $(ACE_ROOT)/ace/Strategies.i \
+ $(ACE_ROOT)/ace/Connector.h \
+ $(ACE_ROOT)/ace/Map_Manager.h \
+ $(ACE_ROOT)/ace/Map_Manager.i \
+ $(ACE_ROOT)/ace/Map_Manager.cpp \
+ $(ACE_ROOT)/ace/Svc_Handler.h \
+ $(ACE_ROOT)/ace/Task.h \
+ $(ACE_ROOT)/ace/Task.i \
+ $(ACE_ROOT)/ace/Task_T.h \
+ $(ACE_ROOT)/ace/Task_T.i \
+ $(ACE_ROOT)/ace/Task_T.cpp \
+ $(ACE_ROOT)/ace/Module.h \
+ $(ACE_ROOT)/ace/Module.i \
+ $(ACE_ROOT)/ace/Module.cpp \
+ $(ACE_ROOT)/ace/Stream_Modules.h \
+ $(ACE_ROOT)/ace/Stream_Modules.i \
+ $(ACE_ROOT)/ace/Stream_Modules.cpp \
+ $(ACE_ROOT)/ace/Svc_Handler.i \
+ $(ACE_ROOT)/ace/Svc_Handler.cpp \
+ $(ACE_ROOT)/ace/Dynamic.h \
+ $(ACE_ROOT)/ace/Singleton.h \
+ $(ACE_ROOT)/ace/Singleton.i \
+ $(ACE_ROOT)/ace/Singleton.cpp \
+ $(ACE_ROOT)/ace/Dynamic.i \
+ $(ACE_ROOT)/ace/Connector.i \
+ $(ACE_ROOT)/ace/Connector.cpp \
+ $(ACE_ROOT)/ace/Acceptor.h \
+ $(ACE_ROOT)/ace/Acceptor.i \
+ $(ACE_ROOT)/ace/Acceptor.cpp \
+ $(TAO_ROOT)/tao/Align.h \
+ $(TAO_ROOT)/tao/Environment.h \
+ $(TAO_ROOT)/tao/Environment.i \
+ $(TAO_ROOT)/tao/ORB.h \
+ $(TAO_ROOT)/tao/Sequence.h \
+ $(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/Object_KeyC.h \
+ $(TAO_ROOT)/tao/Object_KeyC.i \
+ $(TAO_ROOT)/tao/Union.h \
+ $(TAO_ROOT)/tao/Exception.h \
+ $(TAO_ROOT)/tao/Exception.i \
+ $(TAO_ROOT)/tao/ORB.i \
+ $(TAO_ROOT)/tao/try_macros.h \
+ $(TAO_ROOT)/tao/Any.h \
+ $(TAO_ROOT)/tao/Any.i \
+ $(TAO_ROOT)/tao/NVList.h \
+ $(TAO_ROOT)/tao/NVList.i \
+ $(TAO_ROOT)/tao/Principal.h \
+ $(TAO_ROOT)/tao/Principal.i \
+ $(TAO_ROOT)/tao/Request.h \
+ $(TAO_ROOT)/tao/Request.i \
+ $(TAO_ROOT)/tao/Stub.h \
+ $(TAO_ROOT)/tao/Stub.i \
+ $(TAO_ROOT)/tao/Object.h \
+ $(TAO_ROOT)/tao/Object.i \
+ $(TAO_ROOT)/tao/varout.h \
+ $(TAO_ROOT)/tao/varout.i \
+ $(TAO_ROOT)/tao/varout.cpp \
+ $(TAO_ROOT)/tao/Typecode.h \
+ $(TAO_ROOT)/tao/Typecode.i \
+ $(TAO_ROOT)/tao/Marshal.h \
+ $(TAO_ROOT)/tao/Marshal.i \
+ $(TAO_ROOT)/tao/singletons.h \
+ $(TAO_ROOT)/tao/CDR.h \
+ $(TAO_ROOT)/tao/CDR.i \
+ $(TAO_ROOT)/tao/PolicyC.h \
+ $(TAO_ROOT)/tao/PolicyC.i \
+ $(TAO_ROOT)/tao/CurrentC.h \
+ $(TAO_ROOT)/tao/CurrentC.i \
+ $(TAO_ROOT)/tao/POA.h \
+ $(TAO_ROOT)/tao/POAC.h \
+ $(TAO_ROOT)/tao/POAC.i \
+ $(TAO_ROOT)/tao/Servant_Base.h \
+ $(TAO_ROOT)/tao/POAS.h \
+ $(TAO_ROOT)/tao/POA_CORBA.h \
+ $(TAO_ROOT)/tao/DynAnyC.h \
+ $(TAO_ROOT)/tao/DynAnyC.i \
+ $(TAO_ROOT)/tao/POAS.i \
+ $(TAO_ROOT)/tao/Object_Table.h \
+ $(TAO_ROOT)/tao/Object_Table.i \
+ $(TAO_ROOT)/tao/POA.i \
+ $(TAO_ROOT)/tao/poa_macros.h \
+ $(TAO_ROOT)/tao/params.h \
+ $(TAO_ROOT)/tao/params.i \
+ $(TAO_ROOT)/tao/Connect.h \
+ $(TAO_ROOT)/tao/Connect.i \
+ $(TAO_ROOT)/tao/ORB_Core.h \
+ $(TAO_ROOT)/tao/ORB_Core.i \
+ $(ACE_ROOT)/ace/Dynamic_Service.h \
+ $(ACE_ROOT)/ace/Dynamic_Service.cpp \
+ $(TAO_ROOT)/tao/Operation_Table.h \
+ $(TAO_ROOT)/tao/debug.h \
+ $(TAO_ROOT)/tao/Client_Strategy_Factory.h \
+ $(TAO_ROOT)/tao/Server_Strategy_Factory.h \
+ $(TAO_ROOT)/tao/default_client.h \
+ $(TAO_ROOT)/tao/default_client.i \
+ $(TAO_ROOT)/tao/default_server.h \
+ $(TAO_ROOT)/tao/ORB_Strategies_T.h \
+ $(TAO_ROOT)/tao/ORB_Strategies_T.i \
+ $(TAO_ROOT)/tao/ORB_Strategies_T.cpp \
+ $(TAO_ROOT)/tao/default_server.i \
+ $(TAO_ROOT)/tao/IIOP_Object.h \
+ $(TAO_ROOT)/tao/IIOP_Object.i \
+ $(TAO_ROOT)/tao/IIOP_ORB.h \
+ $(TAO_ROOT)/tao/IIOP_ORB.i \
+ $(TAO_ROOT)/tao/IIOP_Interpreter.h \
+ $(TAO_ROOT)/tao/GIOP.h \
+ $(TAO_ROOT)/tao/GIOP.i \
+ $(TAO_ROOT)/tao/Invocation.h \
+ $(TAO_ROOT)/tao/Invocation.i \
+ $(TAO_ROOT)/tao/Server_Request.h \
+ $(TAO_ROOT)/tao/Server_Request.i \
+ $(TAO_ROOT)/tao/InconsistentTypeCodeC.h \
+ $(TAO_ROOT)/tao/DynAny_i.h \
+ generic_servant_export.h Dir_ServiceC.i Dir_ServiceS_T.h \
+ Dir_ServiceS_T.i Dir_ServiceS_T.cpp Dir_ServiceS.i
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/TAO/examples/POA/On_Demand_Loading/Makefile.Client b/TAO/examples/POA/On_Demand_Loading/Makefile.Client
new file mode 100644
index 00000000000..fe258c8b2bd
--- /dev/null
+++ b/TAO/examples/POA/On_Demand_Loading/Makefile.Client
@@ -0,0 +1,75 @@
+#----------------------------------------------------------------------------
+#
+# $Id$
+#
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Local macros
+#----------------------------------------------------------------------------
+
+ifndef TAO_ROOT
+ TAO_ROOT = $(ACE_ROOT)/TAO
+endif # ! TAO_ROOT
+
+# On non-Windows environment, we should at least define
+# the export_include IDL flag.
+override TAO_IDLFLAGS += -Wb,export_macro=GENERIC_SERVANT_Export \
+ -Wb,export_include=generic_servant_export.h
+
+LDLIBS = -lTAO
+
+LIB = libserver.a
+
+IDL_SRC = Dir_ServiceC Dir_ServiceS
+
+BINFILES = $(IDL_SRC) client
+
+LIB_SRC =
+# $(IDL_SRC) Dir_Service_i
+
+POA_CLT_SRCS = $(addsuffix .cpp,$(BINFILES))
+POA_CLT_OBJS = $(addprefix $(VDIR),$(addsuffix .o,$(BINFILES)))
+
+BIN = client
+
+BUILD = $(VOBJS) $(VLIB) $(BIN)
+
+VLDLIBS = $(LDLIBS:%=%$(VAR))
+
+VBIN = $(BIN:%=%$(VAR))
+
+LSRC = $(addsuffix .cpp,$(LIB_SRC) $(IDL_SRC))
+LOBJ = $(addsuffix .o,$(LIB_SRC))
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(TAO_ROOT)/rules.tao.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU
+#include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+include $(TAO_ROOT)/taoconfig.mk
+
+
+#$(IDL_SRC): cubit.idl
+# $(TAO_ROOT)/TAO_IDL/tao_idl cubit.idl
+
+client: $(POA_CLT_OBJS)
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+
+#clean:
+# -/bin/rm -rf *.o $(BIN) obj.* core Templates.DB .make.state
+
+#realclean: clean
+
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/TAO/examples/POA/On_Demand_Loading/Makefile.DirService b/TAO/examples/POA/On_Demand_Loading/Makefile.DirService
new file mode 100644
index 00000000000..7410057b298
--- /dev/null
+++ b/TAO/examples/POA/On_Demand_Loading/Makefile.DirService
@@ -0,0 +1,55 @@
+#----------------------------------------------------------------------------
+# $Id$
+#
+# Makefile for the Today library in the DLL example
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Local macros
+#----------------------------------------------------------------------------
+
+
+
+SHLIB = libDirService.$(SOEXT)
+
+
+FILES = Dir_ServiceC Dir_ServiceS Dir_Service_i
+OBJ = $(addsuffix .o,$(FILES))
+
+CPPFLAGS += -I$(TAO_ROOT)
+LDLIBS = -lACE -lTAO
+LDFLAGS += -L$(TAO_ROOT)/tao -L$(ACE_ROOT)/ace
+
+LSRC = $(addsuffix .cpp,$(FILES))
+
+VLDLIBS = $(LDLIBS:%=%$(VAR))
+
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+
+ifndef TAO_ROOT
+TAO_ROOT = $(ACE_ROOT)/TAO
+endif
+
+
+#----------------------------------------------------------------------------
+# Local targets
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Dependencies
+#----------------------------------------------------------------------------
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+
+
diff --git a/TAO/examples/POA/On_Demand_Loading/Servant_Activator.cpp b/TAO/examples/POA/On_Demand_Loading/Servant_Activator.cpp
new file mode 100644
index 00000000000..c286696c910
--- /dev/null
+++ b/TAO/examples/POA/On_Demand_Loading/Servant_Activator.cpp
@@ -0,0 +1,164 @@
+// $Id$
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/POA/On_Demand_Loading
+//
+// = FILENAME
+// Servant_Activator.cpp
+//
+// = DESCRIPTION
+// Implementation of Dir_Service_Activator , which is used by a
+// POA with a RETAIN policy.
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "Servant_Activator.h"
+#include "Dir_Service_i.h"
+
+ACE_RCSID(On_Demand_Loading, Servant_Activator, "$Id$")
+
+// Initialization.
+
+Dir_Service_Activator::Dir_Service_Activator (CORBA::ORB_ptr orb)
+ : orb_ (CORBA::ORB::_duplicate (orb))
+{}
+
+// This method associates an seravnt with the ObjectID.
+
+PortableServer::Servant
+Dir_Service_Activator::incarnate (const PortableServer::ObjectId &oid,
+ PortableServer::POA_ptr poa,
+ CORBA::Environment &env)
+{
+ // Convert ObjectId to String.
+
+ CORBA::String_var s = PortableServer::ObjectId_to_string (oid);
+
+ // Activate and return the servant else exception.
+
+ PortableServer::Servant servant = activate_servant (s.in (), poa);
+ if (servant !=0)
+ return servant;
+ else
+ {
+ CORBA::Exception *exception = new CORBA::OBJECT_NOT_EXIST (CORBA::COMPLETED_NO);
+ env.exception (exception);
+ return 0;
+ }
+}
+
+// This is the method is invoked when the object is deactivated or the entire POA is
+// is deactivated or destroyed.
+
+void
+Dir_Service_Activator::etherealize (const PortableServer::ObjectId &oid,
+ PortableServer::POA_ptr poa,
+ PortableServer::Servant servant,
+ CORBA::Boolean cleanup_in_progress,
+ CORBA::Boolean remaining_activations,
+ CORBA::Environment &env)
+{
+ ACE_UNUSED_ARG (oid);
+ ACE_UNUSED_ARG (poa);
+ ACE_UNUSED_ARG (cleanup_in_progress);
+ ACE_UNUSED_ARG (env);
+
+ // If there are no remaining activations i.e ObjectIds associated
+ // with Dir_Service object deactivate it.
+
+ if (remaining_activations == 0)
+ deactivate_servant (servant);
+
+}
+
+
+// This method loads the dynamically linked library which is the servant and returns
+// the servant object which is then used for other operations in the library.
+
+PortableServer::Servant
+Dir_Service_Activator::activate_servant (const char *str,
+ PortableServer::POA_ptr poa)
+{
+ // The string format is function@dll which needs to be parsed.
+ parse_string (str);
+
+ // Now that the library name is available we try to create an dll object
+ // which also opens the library on creation.
+ ACE_NEW_RETURN (dll_,
+ ACE_DLL (dllname_.in ()),
+ 0);
+
+ // The next step is to obtain the symbol for the function whihc will create
+ // the servant object and return it to us.
+ Servant_Creator_Prototype servant_creator;
+ servant_creator = (Servant_Creator_Prototype) dll_->symbol (create_symbol_.in ());
+
+ // Checking whether it is possible to create the servant.
+ if (servant_creator == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%s",
+ dll_->error ()),
+ 0);
+
+ // Now create and return the servant.
+ return servant_creator (this->orb_.in (), poa);
+
+ }
+
+// This method removes the servant and the dll object associated with it with performed the
+// opening and symbol obtaining operations.
+
+void
+Dir_Service_Activator::deactivate_servant (PortableServer::Servant servant)
+{
+ // the servant is destroyed.
+ delete servant;
+
+ // The library loaded is now closed and destroyed.
+ delete dll_;
+
+}
+
+// The objectID is in a format of factory_method@library which has to be parsed and separated
+// into tokens to be used.
+
+void
+Dir_Service_Activator::parse_string (const char *s)
+{
+ // The format of the object name: function@dll
+ // This string is parsed to obatin the library name and the
+ // function name which will create trhe servant and return it to us.
+
+ char str[BUFSIZ],func[BUFSIZ], libname [BUFSIZ];
+ char at[2];
+
+ at[0]= '@';
+ at[1]= '\0';
+ strcpy (func, "");
+ // As strtok () puts a NULL in the position after it gives back a token,
+ // we make two copies of the input string.
+ strcpy (str, s);
+
+ // The strtok() method returns the string until '@' i.e. the function name.
+ ACE_OS::strcpy (func, ACE_OS::strtok(str, at));
+
+ // Get to '@' and make the libname point to the next location in the string.
+ ACE_OS::strcpy (libname, ACE_OS::strchr (s,'@') + 1);
+
+ // Assign the respective strings obtained.
+
+ this->dllname_ = CORBA::string_dup (libname);
+ this->create_symbol_ = CORBA::string_dup (func);
+
+ ACE_DEBUG ((LM_DEBUG,
+ "the servant library:%s\n the factory_method:%s\n ",
+ this->dllname_.in (),
+ this->create_symbol_.in ()));
+
+
+}
+
diff --git a/TAO/examples/POA/On_Demand_Loading/Servant_Activator.h b/TAO/examples/POA/On_Demand_Loading/Servant_Activator.h
new file mode 100644
index 00000000000..3637c551ea3
--- /dev/null
+++ b/TAO/examples/POA/On_Demand_Loading/Servant_Activator.h
@@ -0,0 +1,81 @@
+// $Id$
+//=================================================================================
+//
+// = LIBRARY
+// TAO/tests/POA/On_Demand_Loading
+//
+// = FILENAME
+// Servant_Activator.h
+//
+// = DESCRIPTION
+// Defines a Dir_Service_Activator class which is an Servant_Manager interface which
+// activates a servant by loading it and associates it with an object on demand.
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+//
+//==================================================================================
+
+#include "tao/corba.h"
+#include "ace/DLL.h"
+
+
+class Dir_Service_Activator : public POA_PortableServer::ServantActivator
+{
+ //= TITLE
+ // Servant Activator for the directory service servant.
+ //
+ //= DESCRIPTION
+ // This class associates an unassociated servant with an object in the POA Active Object Map.
+
+public:
+
+ typedef PortableServer::Servant (*Servant_Creator_Prototype) (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
+ // This typedef is used to typecast the void* obtained on finding a symbol in the library.
+
+ Dir_Service_Activator (CORBA::ORB_ptr orb);
+ // Initialization.
+
+ virtual PortableServer::Servant incarnate (const PortableServer::ObjectId &oid,
+ PortableServer::POA_ptr poa,
+ CORBA::Environment &env);
+ // This method is invoked by a POA with USE_SERVANT_MANAGER and
+ // RETAIN policies , whenever it receives a request for a MyFoo
+ // object that is not currently active.
+
+ virtual void etherealize (const PortableServer::ObjectId &oid,
+ PortableServer::POA_ptr adapter,
+ PortableServer::Servant servant,
+ CORBA::Boolean cleanup_in_progress,
+ CORBA::Boolean remaining_activations,
+ CORBA::Environment &env);
+ // This method is invoked whenever a MyFooServant for a MyFoo object
+ // is deactivated.
+
+private:
+
+ PortableServer::Servant activate_servant (const char *str,
+ PortableServer::POA_ptr poa);
+ // Gets the servant on activation by loading the appropriate library and
+ // getting the servant object.
+
+ void deactivate_servant (PortableServer::Servant servant);
+ // The servant is killed and take is taken to close the library loaded.
+
+ void parse_string (const char* s);
+ // Parse the string to obtain the library name and the symbol which will
+ // get us the servant pointer.
+
+ CORBA::ORB_var orb_;
+ // A reference to the ORB.
+
+ CORBA::String_var dllname_;
+ // the name of the library containing the servant.
+
+ CORBA::String_var create_symbol_;
+ // The symbol which on getting invoked will give us the servant pointer.
+
+ ACE_DLL *dll_;
+ // the library object.
+
+};
diff --git a/TAO/examples/POA/On_Demand_Loading/client.cpp b/TAO/examples/POA/On_Demand_Loading/client.cpp
new file mode 100644
index 00000000000..d9c492a2527
--- /dev/null
+++ b/TAO/examples/POA/On_Demand_Loading/client.cpp
@@ -0,0 +1,195 @@
+// $Id$
+// ================================================================
+//
+// = FILENAME
+// client.cpp
+//
+// = DESCRIPTION
+// This is a simple dir_service client implementation which makes calls
+// on the Dir_Service object.
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthiak@cs.wustl.edu>
+//
+// ================================================================
+
+#include "ace/streams.h"
+#include "ace/Get_Opt.h"
+#include "ace/Read_Buffer.h"
+#include "Dir_ServiceS.h"
+#include "Dir_ServiceC.h"
+
+
+ACE_RCSID(On_Demand_Loading, client, "$Id$")
+
+static char *IOR = 0;
+static char *IOR_file = 0;
+static int iterations = 1;
+static int oneway = 0;
+static int shutdown_server = 0;
+
+// Obtain the arguments.
+
+static int
+parse_args (int argc, char **argv)
+{
+ ACE_Get_Opt get_opts (argc, argv, "f:k:i:ox");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'k':
+ IOR = ACE_OS::strdup (get_opts.optarg);
+ break;
+
+ case 'f':
+ IOR_file = get_opts.optarg;
+ break;
+
+ case 'o':
+ oneway = 1;
+ break;
+
+ case 'i':
+ iterations = ::atoi (get_opts.optarg);
+ break;
+
+ case 'x':
+ shutdown_server = 1;
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k IOR "
+ "-f IOR file "
+ "-o oneway "
+ "\n",
+ argv [0]),
+ -1);
+ }
+
+ if (IOR == 0 && IOR_file == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Please specify the IOR or IOR_file for the servant\n"), -1);
+
+ // Indicates successful parsing of command line.
+ return 0;
+}
+
+// This method obtains the IOR from a file.
+
+int
+read_IOR_from_file (void)
+{
+ // Open the file for reading.
+ ACE_HANDLE f_handle = ACE_OS::open (IOR_file, 0);
+
+ if (f_handle == ACE_INVALID_HANDLE)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to open %s for reading\n",
+ IOR_file),
+ -1);
+
+ ACE_Read_Buffer ior_buffer (f_handle);
+ char *data = ior_buffer.read ();
+
+ if (data == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to read ior\n"),
+ -1);
+
+ IOR = ACE_OS::strdup (data);
+ ior_buffer.alloc ()->free (data);
+
+ ACE_OS::close (f_handle);
+
+ return 0;
+}
+
+int
+main (int argc, char **argv)
+{
+ CORBA::Environment env;
+
+ // Initialize the ORB
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0, env);
+ if (env.exception () != 0)
+ {
+ env.print_exception ("CORBA::ORB_init");
+ return -1;
+ }
+
+ // Initialize options based on command-line arguments.
+ int parse_args_result = parse_args (argc, argv);
+ if (parse_args_result != 0)
+ return parse_args_result;
+
+ if (IOR == 0)
+ {
+ int result = read_IOR_from_file ();
+ if (result != 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "Cannot read IOR from %s\n", IOR_file), -1);
+ }
+
+ // Get an object reference from the argument string.
+ CORBA::Object_var object = orb->string_to_object (IOR, env);
+
+ if (env.exception () != 0)
+ {
+ env.print_exception ("CORBA::ORB::string_to_object");
+ return -1;
+ }
+
+ // Try to narrow the object reference to a Dir_Service reference.
+ Dir_Service_var my_dir_service = Dir_Service::_narrow (object.in (), env);
+
+ if (env.exception () != 0)
+ {
+ env.print_exception ("Dir_Service::_narrow");
+ return -1;
+ }
+
+ CORBA::String_var ior =
+ orb->object_to_string (my_dir_service.in (), env);
+
+ if (env.exception () != 0)
+ {
+ env.print_exception ("CORBA::ORB::object_to_string");
+ return -1;
+ }
+
+ ACE_DEBUG ((LM_DEBUG,
+ "\nConnecting to: %s\n\n",
+ ior.in ()));
+
+ long result;
+ for (int i = 0; i < iterations && env.exception () == 0; i++)
+ {
+ if (oneway)
+ // Invoke the area_code_info() method of the foo reference.
+ my_dir_service->area_codes_info (env);
+ else
+ // Invoke the tele_number() method of the foo reference.
+ result = my_dir_service->tele_number ("kirthika",env);
+ }
+
+
+ if (shutdown_server && env.exception () == 0)
+ my_dir_service->shutdown (env);
+
+ if (env.exception () != 0)
+ {
+ env.print_exception ("Dir_Service::tele_number");
+ return 1;
+ }
+
+ // Print the result of doit () method of the foo reference.
+ ACE_DEBUG ((LM_DEBUG, "The telephone number is %d\n", result));
+
+ ACE_OS::free (IOR);
+
+ return 0;
+}
diff --git a/TAO/examples/POA/On_Demand_Loading/generic_servant_export.h b/TAO/examples/POA/On_Demand_Loading/generic_servant_export.h
new file mode 100644
index 00000000000..cabb41f48f7
--- /dev/null
+++ b/TAO/examples/POA/On_Demand_Loading/generic_servant_export.h
@@ -0,0 +1,35 @@
+// $Id$
+
+// Definition for Win32 Export directives.
+// This file is generated automatically by
+// ${TAO_ROOT}/TAO_IDL/GenExportH.BAT
+// ------------------------------
+#ifndef GENERIC_SERVANT_EXPORT_H
+#define GENERIC_SERVANT_EXPORT_H
+
+#include "ace/OS.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (GENERIC_SERVANT_HAS_DLL)
+# if (GENERIC_SERVANT_HAS_DLL == 1)
+# if defined (GENERIC_SERVANT_BUILD_DLL)
+# define GENERIC_SERVANT_Export ACE_Proper_Export_Flag
+# define GENERIC_SERVANT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# else
+# define GENERIC_SERVANT_Export ACE_Proper_Import_Flag
+# define GENERIC_SERVANT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# endif /* GENERIC_SERVANT_BUILD_DLL */
+# else
+# define GENERIC_SERVANT_Export
+# define GENERIC_SERVANT_SINGLETON_DECLARATION(T)
+# endif /* ! GENERIC_SERVANT_HAS_DLL == 1 */
+#else
+# define GENERIC_SERVANT_Export
+# define GENERIC_SERVANT_SINGLETON_DECLARATION(T)
+#endif /* GENERIC_SERVANT_HAS_DLL */
+
+#endif /* GENERIC_SERVANT_EXPORT_H */
+ // End of auto generated file.
diff --git a/TAO/examples/POA/On_Demand_Loading/server.cpp b/TAO/examples/POA/On_Demand_Loading/server.cpp
new file mode 100644
index 00000000000..18d9fd88f3f
--- /dev/null
+++ b/TAO/examples/POA/On_Demand_Loading/server.cpp
@@ -0,0 +1,288 @@
+// $Id$
+//============================================================================
+//
+// =FILENAME
+// server.cpp
+//
+// =DESCRIPTION
+// Server to test the Servant Activator. The servant activator loads a servant
+// on demand and makes its association with the object.
+//
+// =AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+//
+//=============================================================================
+
+#include "ace/streams.h"
+#include "Servant_Activator.h"
+
+ACE_RCSID(On_Demand_Activation, server, "$Id$")
+
+static char *ior_output_file = 0;
+
+// The input arguments are accepted.
+
+static int
+parse_args (int argc, char **argv)
+{
+ ACE_Get_Opt get_opts (argc, argv, "f:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'f':
+ ior_output_file = get_opts.optarg;
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "[-f ior_output_file] "
+ "\n",
+ argv [0]),
+ -1);
+ }
+
+ // Indicates successful parsing of command line.
+ return 0;
+}
+
+// The IOR is written to a file.
+
+static int
+write_iors_to_file (const char *first_ior)
+{
+ if (ior_output_file == 0)
+ // No filename was specified; simply return
+ return 0;
+
+ char ior_output_file_1[BUFSIZ];
+
+
+ ACE_OS::sprintf (ior_output_file_1, "%s_1", ior_output_file);
+
+
+ FILE *output_file_1 = ACE_OS::fopen (ior_output_file_1, "w");
+
+
+ if (output_file_1 == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output files for writing IORs: %s, %s\n",
+ ior_output_file_1),
+ -1);
+
+ int result = ACE_OS::fprintf (output_file_1,
+ "%s",
+ first_ior);
+ if (result <= 0
+ || ACE_static_cast(size_t,result) != ACE_OS::strlen (first_ior))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "ACE_OS::fprintf failed while writing %s to %s\n",
+ first_ior,
+ ior_output_file_1),
+ -1);
+
+
+
+ ACE_OS::fclose (output_file_1);
+
+ return 0;
+}
+
+int
+main (int argc, char **argv)
+{
+ CORBA::Environment env;
+
+ // Initialize the ORB.
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0, env);
+
+ if (env.exception () != 0)
+ {
+ env.print_exception ("CORBA::ORB_init");
+ return -1;
+ }
+
+ int result = parse_args (argc, argv);
+ if (result != 0)
+ return result;
+
+ // Get an Object reference to RootPOA.
+ CORBA::Object_var obj =
+ orb->resolve_initial_references ("RootPOA");
+
+ // Narrow the Object reference to a POA reference
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (obj.in (), env);
+
+ if (env.exception () != 0)
+ {
+ env.print_exception ("PortableServer::POA::_narrow");
+ return -1;
+ }
+
+ // Get the POAManager of RootPOA
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager (env);
+
+ if (env.exception () != 0)
+ {
+ env.print_exception ("PortableServer::POA::the_POAManager");
+ return -1;
+ }
+
+ CORBA::PolicyList policies (4);
+ policies.length (4);
+
+ // ID Assignment Policy
+ policies[0] =
+ root_poa->create_id_assignment_policy (PortableServer::USER_ID, env);
+ if (env.exception () != 0)
+ {
+ env.print_exception ("PortableServer::POA::create_id_assignment_policy");
+ return -1;
+ }
+
+ // Lifespan Policy
+ policies[1] =
+ root_poa->create_lifespan_policy (PortableServer::PERSISTENT, env);
+ if (env.exception () != 0)
+ {
+ env.print_exception ("PortableServer::POA::create_lifespan_policy");
+ return -1;
+ }
+
+ // Request Processing Policy
+ policies[2] =
+ root_poa->create_request_processing_policy (PortableServer::USE_SERVANT_MANAGER, env);
+ if (env.exception () != 0)
+ {
+ env.print_exception ("PortableServer::POA::create_request_processing_policy");
+ return -1;
+ }
+
+ PortableServer::POA_var first_poa;
+ {
+ // Servant Retention Policy
+ policies[3] =
+ root_poa->create_servant_retention_policy (PortableServer::RETAIN, env);
+ if (env.exception () != 0)
+ {
+ env.print_exception ("PortableServer::POA::create_servant_retention_policy");
+ return -1;
+ }
+
+ ACE_CString name = "firstPOA";
+
+ // Create firstPOA as the child of RootPOA with the above policies
+ // firstPOA will use SERVANT_ACTIVATOR because of RETAIN policy.
+ first_poa = root_poa->create_POA (name.c_str (),
+ poa_manager.in (),
+ policies,
+ env);
+ if (env.exception () != 0)
+ {
+ env.print_exception ("PortableServer::POA::create_POA");
+ return -1;
+ }
+ }
+
+
+ // Destroy the policy objects as they have been passed to
+ // create_POA and no longer needed.
+ for (CORBA::ULong i = 0;
+ i < policies.length () && env.exception () == 0;
+ ++i)
+ {
+ CORBA::Policy_ptr policy = policies[i];
+ policy->destroy (env);
+ }
+ if (env.exception () != 0)
+ {
+ env.print_exception ("PortableServer::POA::create_POA");
+ return -1;
+ }
+
+ Dir_Service_Activator servant_activator_impl (orb.in ());
+ PortableServer::ServantActivator_var servant_activator =
+ servant_activator_impl._this (env);
+
+ if (env.exception () != 0)
+ {
+ env.print_exception ("PortableServer::POAManager::_this");
+ return -1;
+ }
+
+ // Set Dir_Service_Activator object as the servant_manager of
+ // firstPOA.
+ first_poa->set_servant_manager (servant_activator.in (), env);
+ if (env.exception () != 0)
+ {
+ env.print_exception ("PortableServer::POAManager::set_servant_manager");
+ return -1;
+ }
+
+ // Create a reference with user created ID in firstPOA which uses
+ // the Dir_Service_Activator. Note the format of the ObjectID specified.
+ // Its factory_method@library_name whihc is then used by the servant activator to
+ // obtain and load the right servant.
+ PortableServer::ObjectId_var first_dir_service_oid =
+ PortableServer::string_to_ObjectId ("create_dir_service@libDirService.so");
+
+ CORBA::Object_var first_dir_service =
+ first_poa->create_reference_with_id (first_dir_service_oid.in (), "IDL:Dir_Service:1.0", env);
+
+ if (env.exception () != 0)
+ {
+ env.print_exception ("PortableServer::POA::create_reference_with_id");
+ return -1;
+ }
+
+ // Invoke object_to_string on the references created in firstPOA
+ CORBA::String_var first_dir_service_ior =
+ orb->object_to_string (first_dir_service.in (), env);
+
+ if (env.exception () != 0)
+ {
+ env.print_exception ("CORBA::ORB::object_to_string");
+ return -1;
+ }
+
+ // Print the ior's of first_dir_service
+ ACE_DEBUG((LM_DEBUG,"%s\n",
+ first_dir_service_ior.in ()));
+
+
+ int write_result = write_iors_to_file (first_dir_service_ior.in ());
+
+ if (write_result != 0)
+ return write_result;
+
+ // Set the poa_manager state to active, ready to process requests.
+ poa_manager->activate (env);
+
+ if (env.exception () != 0)
+ {
+ env.print_exception ("PortableServer::POAManager::activate");
+ return -1;
+ }
+
+ // Run the ORB.
+ if (orb->run () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "CORBA::ORB::run"), -1);
+
+ // Destroy the root_poa and also first_poa and second_poa
+ root_poa->destroy (1,
+ 1,
+ env);
+ if (env.exception () != 0)
+ {
+ env.print_exception ("PortableServer::POA::destroy");
+ return -1;
+ }
+
+ return 0;
+}
+