summaryrefslogtreecommitdiff
path: root/TAO/examples/POA
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/examples/POA')
-rw-r--r--TAO/examples/POA/Adapter_Activator/Adaptor_Activator.dsw29
-rw-r--r--TAO/examples/POA/Adapter_Activator/Makefile310
-rw-r--r--TAO/examples/POA/Adapter_Activator/README49
-rwxr-xr-xTAO/examples/POA/Adapter_Activator/run_test.pl75
-rw-r--r--TAO/examples/POA/Adapter_Activator/server.cpp420
-rw-r--r--TAO/examples/POA/Adapter_Activator/server.dsp100
-rw-r--r--TAO/examples/POA/Explicit_Activation/README8
-rw-r--r--TAO/examples/POA/Explicit_Activation/server.cpp90
-rw-r--r--TAO/examples/POA/FindPOA/FindPOA.cpp16
-rw-r--r--TAO/examples/POA/Identity/Identity.dsp42
-rw-r--r--TAO/examples/POA/Makefile12
-rw-r--r--TAO/examples/POA/NewPOA/NewPOA.cpp32
-rw-r--r--TAO/examples/POA/README8
-rw-r--r--TAO/examples/POA/RootPOA/RootPOA.cpp30
14 files changed, 1095 insertions, 126 deletions
diff --git a/TAO/examples/POA/Adapter_Activator/Adaptor_Activator.dsw b/TAO/examples/POA/Adapter_Activator/Adaptor_Activator.dsw
new file mode 100644
index 00000000000..f121fae15c3
--- /dev/null
+++ b/TAO/examples/POA/Adapter_Activator/Adaptor_Activator.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "server"=.\server.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/examples/POA/Adapter_Activator/Makefile b/TAO/examples/POA/Adapter_Activator/Makefile
new file mode 100644
index 00000000000..a8290a286a3
--- /dev/null
+++ b/TAO/examples/POA/Adapter_Activator/Makefile
@@ -0,0 +1,310 @@
+#
+# $Id$
+#
+
+BIN = server
+
+LSRC = $(addsuffix .cpp,$(BIN))
+
+CPPFLAGS += -I$(TAO_ROOT) -I../Generic_Servant
+
+LDLIBS = -lGeneric_Servant -lTAO
+LDFLAGS += -L$(TAO_ROOT)/tao -L../Generic_Servant
+
+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.bin.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+
+ifndef TAO_ROOT
+TAO_ROOT = $(ACE_ROOT)/TAO
+endif
+
+#----------------------------------------------------------------------------
+# Dependencies
+#----------------------------------------------------------------------------
+
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+.obj/server.o .obj/server.so .shobj/server.o .shobj/server.so: server.cpp \
+ $(ACE_ROOT)/ace/streams.h \
+ $(ACE_ROOT)/ace/inc_user_config.h \
+ $(ACE_ROOT)/ace/Get_Opt.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/OS.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.i \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(ACE_ROOT)/ace/Malloc_Base.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Get_Opt.i \
+ $(TAO_ROOT)/tao/Timeprobe.h \
+ $(ACE_ROOT)/ace/Timeprobe.h \
+ ../Generic_Servant/MyFooServant.h ../Generic_Servant/FooS.h \
+ ../Generic_Servant/FooC.h \
+ $(TAO_ROOT)/tao/corba.h \
+ $(TAO_ROOT)/tao/corbafwd.h \
+ $(ACE_ROOT)/ace/CDR_Stream.h \
+ $(ACE_ROOT)/ace/Message_Block.h \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Synch_T.cpp \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Free_List.cpp \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Malloc_T.cpp \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Containers_T.h \
+ $(ACE_ROOT)/ace/Containers_T.i \
+ $(ACE_ROOT)/ace/Containers_T.cpp \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/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/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ $(ACE_ROOT)/ace/Message_Block.i \
+ $(ACE_ROOT)/ace/Message_Block_T.h \
+ $(ACE_ROOT)/ace/Message_Block_T.i \
+ $(ACE_ROOT)/ace/Message_Block_T.cpp \
+ $(ACE_ROOT)/ace/CDR_Stream.i \
+ $(TAO_ROOT)/tao/try_macros.h \
+ $(TAO_ROOT)/tao/orbconf.h \
+ $(ACE_ROOT)/ace/CORBA_macros.h \
+ $(TAO_ROOT)/tao/Environment.h \
+ $(TAO_ROOT)/tao/Environment.i \
+ $(TAO_ROOT)/tao/ORB.h \
+ $(TAO_ROOT)/tao/Exception.h \
+ $(TAO_ROOT)/tao/Exception.i \
+ $(TAO_ROOT)/tao/ORB.i \
+ $(TAO_ROOT)/tao/Any.h \
+ $(TAO_ROOT)/tao/CDR.h \
+ $(TAO_ROOT)/tao/Typecode.h \
+ $(TAO_ROOT)/tao/Typecode.i \
+ $(TAO_ROOT)/tao/CDR.i \
+ $(TAO_ROOT)/tao/Any.i \
+ $(TAO_ROOT)/tao/NVList.h \
+ $(TAO_ROOT)/tao/NVList.i \
+ $(TAO_ROOT)/tao/Principal.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/Principal.i \
+ $(TAO_ROOT)/tao/Request.h \
+ $(TAO_ROOT)/tao/Request.i \
+ $(TAO_ROOT)/tao/Server_Request.h \
+ $(TAO_ROOT)/tao/Object_KeyC.h \
+ $(TAO_ROOT)/tao/Object_KeyC.i \
+ $(TAO_ROOT)/tao/GIOP.h \
+ $(TAO_ROOT)/tao/Sequence_T.h \
+ $(TAO_ROOT)/tao/Sequence_T.i \
+ $(TAO_ROOT)/tao/Sequence_T.cpp \
+ $(TAO_ROOT)/tao/GIOP.i \
+ $(TAO_ROOT)/tao/Object.h \
+ $(TAO_ROOT)/tao/Object.i \
+ $(TAO_ROOT)/tao/Server_Request.i \
+ $(TAO_ROOT)/tao/Context.h \
+ $(TAO_ROOT)/tao/Context.i \
+ $(TAO_ROOT)/tao/varout.h \
+ $(TAO_ROOT)/tao/varout.i \
+ $(TAO_ROOT)/tao/varout.cpp \
+ $(TAO_ROOT)/tao/Marshal.h \
+ $(TAO_ROOT)/tao/Marshal.i \
+ $(TAO_ROOT)/tao/singletons.h \
+ $(ACE_ROOT)/ace/Singleton.h \
+ $(ACE_ROOT)/ace/Singleton.i \
+ $(ACE_ROOT)/ace/Singleton.cpp \
+ $(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 \
+ $(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.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Timer_Queue_T.cpp \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(TAO_ROOT)/tao/POAC.h \
+ $(TAO_ROOT)/tao/POAC.i \
+ $(TAO_ROOT)/tao/Servant_Base.h \
+ $(TAO_ROOT)/tao/Servant_Base.i \
+ $(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/Active_Object_Map.h \
+ $(ACE_ROOT)/ace/Map.h \
+ $(ACE_ROOT)/ace/Map.i \
+ $(ACE_ROOT)/ace/Map_T.h \
+ $(ACE_ROOT)/ace/Pair.h \
+ $(ACE_ROOT)/ace/Pair.i \
+ $(ACE_ROOT)/ace/Pair_T.h \
+ $(ACE_ROOT)/ace/Pair_T.i \
+ $(ACE_ROOT)/ace/Pair_T.cpp \
+ $(ACE_ROOT)/ace/Map_Manager.h \
+ $(ACE_ROOT)/ace/Map_Manager.i \
+ $(ACE_ROOT)/ace/Map_Manager.cpp \
+ $(ACE_ROOT)/ace/Active_Map_Manager.h \
+ $(ACE_ROOT)/ace/Active_Map_Manager.i \
+ $(ACE_ROOT)/ace/Active_Map_Manager_T.h \
+ $(ACE_ROOT)/ace/Active_Map_Manager_T.i \
+ $(ACE_ROOT)/ace/Active_Map_Manager_T.cpp \
+ $(ACE_ROOT)/ace/Map_T.i \
+ $(ACE_ROOT)/ace/Map_T.cpp \
+ $(TAO_ROOT)/tao/Server_Strategy_Factory.h \
+ $(ACE_ROOT)/ace/Strategies_T.h \
+ $(ACE_ROOT)/ace/Strategies.h \
+ $(ACE_ROOT)/ace/Strategies.i \
+ $(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/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 \
+ $(TAO_ROOT)/tao/Connect.h \
+ $(ACE_ROOT)/ace/Acceptor.h \
+ $(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/Dynamic.i \
+ $(ACE_ROOT)/ace/Acceptor.i \
+ $(ACE_ROOT)/ace/Acceptor.cpp \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.h \
+ $(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/Time_Value.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.i \
+ $(TAO_ROOT)/tao/Connect.i \
+ $(TAO_ROOT)/tao/params.h \
+ $(TAO_ROOT)/tao/params.i \
+ $(TAO_ROOT)/tao/Active_Object_Map.i \
+ $(TAO_ROOT)/tao/POAManager.h \
+ $(TAO_ROOT)/tao/poa_macros.h \
+ $(TAO_ROOT)/tao/POAManager.i \
+ $(TAO_ROOT)/tao/POA.i \
+ $(TAO_ROOT)/tao/Stub.h \
+ $(TAO_ROOT)/tao/Pluggable.h \
+ $(TAO_ROOT)/tao/MProfile.h \
+ $(TAO_ROOT)/tao/MProfile.i \
+ $(TAO_ROOT)/tao/Stub.i \
+ $(TAO_ROOT)/tao/ORB_Core.h \
+ $(TAO_ROOT)/tao/IIOP_Connector.h \
+ $(ACE_ROOT)/ace/Connector.h \
+ $(ACE_ROOT)/ace/Connector.i \
+ $(ACE_ROOT)/ace/Connector.cpp \
+ $(ACE_ROOT)/ace/SOCK_Connector.h \
+ $(ACE_ROOT)/ace/SOCK_Connector.i \
+ $(TAO_ROOT)/tao/IIOP_Acceptor.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/Client_Strategy_Factory.h \
+ $(TAO_ROOT)/tao/Invocation.h \
+ $(TAO_ROOT)/tao/Invocation.i \
+ $(TAO_ROOT)/tao/InconsistentTypeCodeC.h \
+ $(TAO_ROOT)/tao/DynAny_i.h \
+ $(TAO_ROOT)/tao/Union.h \
+ ../Generic_Servant/generic_servant_export.h ../Generic_Servant/FooC.i \
+ ../Generic_Servant/FooS_T.h ../Generic_Servant/FooS_T.i \
+ ../Generic_Servant/FooS_T.cpp ../Generic_Servant/FooS.i
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/TAO/examples/POA/Adapter_Activator/README b/TAO/examples/POA/Adapter_Activator/README
new file mode 100644
index 00000000000..6f7a41e48b3
--- /dev/null
+++ b/TAO/examples/POA/Adapter_Activator/README
@@ -0,0 +1,49 @@
+// $Id$
+
+This example is very similar to the Explicit_Activation example except
+that the POAs are deleted once the object references have been
+created. After this, an adapter activator is install in the RootPOA to
+reactivate the POAs on demand.
+
+The server program is available here. Use the Generic_Servant/client
+program to test this.
+
+________________________________________
+
+To test this example, type run_test.pl
+________________________________________
+
+Or
+________________________________________
+
+Run the server as follows:
+
+% ./server -f output
+
+This will produce three output files: output_1, output_2, and output_3
+
+Run the client as follows:
+
+% cd $TAO_ROOT/examples/POA/Generic_Servant
+% ./client -f ../Explicit_Activation/output_1
+% ./client -f ../Explicit_Activation/output_2
+% ./client -f ../Explicit_Activation/output_3
+________________________________________
+
+Or
+________________________________________
+
+Run the server as follows:
+
+% ./server -ORBobjrefstyle URL &
+
+Run the client as follows:
+
+% cd $TAO_ROOT/examples/POA/Generic_Servant
+% ./client -k <IOR>
+
+Comments :
+=========
+ - As soon as, the server prints out the IOR, cut it and use it for
+running the client.
+________________________________________
diff --git a/TAO/examples/POA/Adapter_Activator/run_test.pl b/TAO/examples/POA/Adapter_Activator/run_test.pl
new file mode 100755
index 00000000000..70f9c45c46c
--- /dev/null
+++ b/TAO/examples/POA/Adapter_Activator/run_test.pl
@@ -0,0 +1,75 @@
+#$Id$
+# -*- perl -*-
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+unshift @INC, '../../../../bin';
+require ACEutils;
+
+$iorfile = "ior";
+
+$oneway = "";
+$iterations = 100;
+
+$extra_args = "";
+
+# Parse the arguments
+for ($i = 0; $i <= $#ARGV; $i++)
+{
+ SWITCH:
+ {
+ if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?")
+ {
+ print "run_test [-h] [-i iterations] [-o] [-f ior file]\n";
+ print "\n";
+ print "-h -- prints this information\n";
+ print "-f -- ior file\n";
+ print "-i iterations -- specifies iterations\n";
+ print "-o -- call issued are oneways\n";
+ exit;
+ }
+ if ($ARGV[$i] eq "-o")
+ {
+ $oneway = "-o";
+ last SWITCH;
+ }
+ if ($ARGV[$i] eq "-i")
+ {
+ $iterations = $ARGV[$i + 1];
+ $i++;
+ last SWITCH;
+ }
+ if ($ARGV[$i] eq "-f")
+ {
+ $iorfile = $ARGV[$i + 1];
+ $i++;
+ last SWITCH;
+ }
+ $extra_args .= " " . $ARGV[$i];
+ }
+}
+
+$iorfile_1 = $iorfile."_1";
+$iorfile_2 = $iorfile."_2";
+$iorfile_3 = $iorfile."_3";
+
+unlink $iorfile_1;
+unlink $iorfile_2;
+unlink $iorfile_3;
+
+$SV = Process::Create ($EXEPREFIX."server$Process::EXE_EXT", "-f $iorfile $extra_args");
+
+ACE::waitforfile ($iorfile_1);
+ACE::waitforfile ($iorfile_2);
+ACE::waitforfile ($iorfile_3);
+
+$status = system ("../Generic_Servant/client$Process::EXE_EXT $extra_args $oneway -i $iterations -f $iorfile_1");
+$status = system ("../Generic_Servant/client$Process::EXE_EXT $extra_args $oneway -i $iterations -f $iorfile_2");
+$status = system ("../Generic_Servant/client$Process::EXE_EXT $extra_args $oneway -i $iterations -f $iorfile_3 -x");
+
+unlink $iorfile_1;
+unlink $iorfile_2;
+unlink $iorfile_3;
+
+exit $status;
diff --git a/TAO/examples/POA/Adapter_Activator/server.cpp b/TAO/examples/POA/Adapter_Activator/server.cpp
new file mode 100644
index 00000000000..66a31b5b079
--- /dev/null
+++ b/TAO/examples/POA/Adapter_Activator/server.cpp
@@ -0,0 +1,420 @@
+// $Id$
+
+// ================================================================
+//
+// = LIBRARY
+// TAO/tests/POA/Adapter_Activator
+//
+// = FILENAME
+// server.cpp
+//
+// = DESCRIPTION
+// This example is very similar to the Explicit_Activation example
+// except that the POAs are deleted once the object references have
+// been created. After this, an adapter activator is install in the
+// RootPOA to reactivate the POAs on demand.
+//
+// Similar to the Explicit_Activation, the client for this example
+// is Generic_Servant.
+//
+// = AUTHOR
+// Irfan Pyarali
+//
+// ================================================================
+
+#include "ace/Get_Opt.h"
+#include "MyFooServant.h"
+
+ACE_RCSID(Adapter_Activator, server, "$Id$")
+
+class Adapter_Activator : public POA_PortableServer::AdapterActivator
+{
+public:
+
+ Adapter_Activator (PortableServer::POAManager_ptr poa_manager,
+ CORBA::ORB_ptr orb);
+
+ CORBA::Boolean unknown_adapter (PortableServer::POA_ptr parent,
+ const char *name,
+ CORBA_Environment &ACE_TRY_ENV);
+
+ CORBA::PolicyList first_poa_policies_;
+ CORBA::PolicyList second_poa_policies_;
+
+private:
+
+ PortableServer::POAManager_var poa_manager_;
+ CORBA::ORB_var orb_;
+};
+
+Adapter_Activator::Adapter_Activator (PortableServer::POAManager_ptr poa_manager,
+ CORBA::ORB_ptr orb)
+ : poa_manager_ (PortableServer::POAManager::_duplicate (poa_manager)),
+ orb_ (CORBA::ORB::_duplicate (orb))
+{
+}
+
+CORBA::Boolean
+Adapter_Activator::unknown_adapter (PortableServer::POA_ptr parent,
+ const char *name,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ if (ACE_OS::strcmp (name, "firstPOA") == 0)
+ {
+ PortableServer::POA_var child = parent->create_POA (name,
+ this->poa_manager_.in (),
+ this->first_poa_policies_,
+ ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
+ // Creation of firstPOA is over. Destroy the Policy objects.
+ for (CORBA::ULong i = 0;
+ i < this->first_poa_policies_.length ();
+ ++i)
+ {
+ this->first_poa_policies_[i]->destroy (ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+ }
+
+ PortableServer::AdapterActivator_var activator = this->_this (ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
+ child->the_activator (activator.in (),
+ ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
+ MyFooServant *foo_impl = new MyFooServant (this->orb_.in (),
+ child.in (),
+ 28);
+
+ child->set_servant (foo_impl,
+ ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
+ // Finally everything is fine
+ return 1;
+ }
+ else if (ACE_OS::strcmp (name, "secondPOA") == 0)
+ {
+ PortableServer::POA_var child = parent->create_POA (name,
+ this->poa_manager_.in (),
+ this->second_poa_policies_,
+ ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
+ // Creation of secondPOA is over. Destroy the Policy objects.
+ for (CORBA::ULong i = 0;
+ i < this->second_poa_policies_.length ();
+ ++i)
+ {
+ this->second_poa_policies_[i]->destroy (ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+ }
+
+ MyFooServant *foo_impl = new MyFooServant (this->orb_.in (),
+ child.in (),
+ 29);
+
+ PortableServer::ObjectId_var oid =
+ PortableServer::string_to_ObjectId ("third Foo");
+
+ child->activate_object_with_id (oid.in (),
+ foo_impl,
+ ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
+ // Finally everything is fine
+ return 1;
+ }
+ else
+ {
+ // Unknown POA.
+ return 0;
+ }
+}
+
+static char *ior_output_file = 0;
+
+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;
+}
+
+static int
+write_iors_to_file (const char *first_ior,
+ const char *second_ior,
+ const char *third_ior)
+{
+ if (ior_output_file == 0)
+ // No filename was specified; simply return
+ return 0;
+
+ char ior_output_file_1[BUFSIZ];
+ char ior_output_file_2[BUFSIZ];
+ char ior_output_file_3[BUFSIZ];
+
+ ACE_OS::sprintf (ior_output_file_1, "%s_1", ior_output_file);
+ ACE_OS::sprintf (ior_output_file_2, "%s_2", ior_output_file);
+ ACE_OS::sprintf (ior_output_file_3, "%s_3", ior_output_file);
+
+ FILE *output_file_1 = ACE_OS::fopen (ior_output_file_1, "w");
+ FILE *output_file_2 = ACE_OS::fopen (ior_output_file_2, "w");
+ FILE *output_file_3 = ACE_OS::fopen (ior_output_file_3, "w");
+
+ if (output_file_1 == 0 ||
+ output_file_2 == 0 ||
+ output_file_3 == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output files for writing IORs: %s, %s %s\n",
+ ior_output_file_1,
+ ior_output_file_2,
+ ior_output_file_3),
+ -1);
+
+ u_int result = 0;
+
+ result = ACE_OS::fprintf (output_file_1,
+ "%s",
+ first_ior);
+ if (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);
+
+ result = ACE_OS::fprintf (output_file_2,
+ "%s",
+ second_ior);
+ if (result != ACE_OS::strlen (second_ior))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "ACE_OS::fprintf failed while writing %s to %s\n",
+ second_ior,
+ ior_output_file_2),
+ -1);
+
+ result = ACE_OS::fprintf (output_file_3,
+ "%s",
+ third_ior);
+ if (result != ACE_OS::strlen (third_ior))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "ACE_OS::fprintf failed while writing %s to %s\n",
+ third_ior,
+ ior_output_file_3),
+ -1);
+
+ ACE_OS::fclose (output_file_1);
+ ACE_OS::fclose (output_file_2);
+ ACE_OS::fclose (output_file_3);
+
+ return 0;
+}
+
+int
+main (int argc, char **argv)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ // Initialize the ORB first.
+ CORBA::ORB_var orb = CORBA::ORB_init (argc,
+ argv,
+ 0,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ int result = parse_args (argc, argv);
+ if (result != 0)
+ return result;
+
+ // Obtain the RootPOA.
+ CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA");
+
+ // Get the POA_var object from Object_var.
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (obj.in (),
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Get the POAManager of the RootPOA.
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ Adapter_Activator adapter_activator (poa_manager.in (),
+ orb.in ());
+
+ PortableServer::AdapterActivator_var activator = adapter_activator._this (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ root_poa->the_activator (activator.in (),
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ PortableServer::POA_var first_poa;
+ PortableServer::POA_var second_poa;
+
+ {
+ // Policies for the firstPOA to be created.
+ CORBA::PolicyList &policies = adapter_activator.first_poa_policies_;
+ policies.length (4);
+
+ // Id Assignment Policy
+ policies[0] =
+ root_poa->create_id_assignment_policy (PortableServer::SYSTEM_ID,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Lifespan policy
+ policies[1] =
+ root_poa->create_lifespan_policy (PortableServer::PERSISTENT,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Request Processing policy
+ policies[2] =
+ root_poa->create_request_processing_policy (PortableServer::USE_DEFAULT_SERVANT,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Id Uniqueness
+ policies[3] =
+ root_poa->create_id_uniqueness_policy (PortableServer::MULTIPLE_ID,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Create the firstPOA under the RootPOA.
+ first_poa = root_poa->create_POA ("firstPOA",
+ poa_manager.in (),
+ policies,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+
+ {
+ // Policies for the secondPOA to be created.
+ CORBA::PolicyList &policies = adapter_activator.second_poa_policies_;
+ policies.length (2);
+
+ // Id Assignment Policy
+ policies[0] =
+ root_poa->create_id_assignment_policy (PortableServer::USER_ID,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Lifespan policy
+ policies[1] =
+ root_poa->create_lifespan_policy (PortableServer::PERSISTENT,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Create the secondPOA under the firstPOA.
+ second_poa = first_poa->create_POA ("secondPOA",
+ poa_manager.in (),
+ policies,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+
+ // Create a servant.
+ MyFooServant first_foo_impl (orb.in (),
+ root_poa.in (),
+ 27);
+
+ PortableServer::ObjectId_var first_oid =
+ root_poa->activate_object (&first_foo_impl,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Get Object Reference for the first_foo_impl object.
+ Foo_var first_foo = first_foo_impl._this (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ CORBA::Object_var second_foo =
+ first_poa->create_reference ("IDL:Foo:1.0",
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ PortableServer::ObjectId_var third_oid =
+ PortableServer::string_to_ObjectId ("third Foo");
+
+ CORBA::Object_var third_foo =
+ second_poa->create_reference_with_id (third_oid.in (),
+ "IDL:Foo:1.0",
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Stringyfy all the object references and print them out.
+ CORBA::String_var first_ior =
+ orb->object_to_string (first_foo.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ CORBA::String_var second_ior =
+ orb->object_to_string (second_foo.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ CORBA::String_var third_ior =
+ orb->object_to_string (third_foo.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG,
+ "%s\n%s\n%s\n",
+ first_ior.in (),
+ second_ior.in (),
+ third_ior.in ()));
+
+ int write_result = write_iors_to_file (first_ior.in (),
+ second_ior.in (),
+ third_ior.in ());
+ if (write_result != 0)
+ return write_result;
+
+ first_poa->destroy (1,
+ 1,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ poa_manager->activate (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (orb->run () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "CORBA::ORB::run"), -1);
+
+ // Destroy RootPOA (also destroys all child POAs).
+ root_poa->destroy (1,
+ 1,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught");
+ return -1;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (-1);
+
+ return 0;
+}
diff --git a/TAO/examples/POA/Adapter_Activator/server.dsp b/TAO/examples/POA/Adapter_Activator/server.dsp
new file mode 100644
index 00000000000..3fdab5e5a91
--- /dev/null
+++ b/TAO/examples/POA/Adapter_Activator/server.dsp
@@ -0,0 +1,100 @@
+# Microsoft Developer Studio Project File - Name="POA Adapter Activator Server" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=POA Adapter Activator Server - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "server.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "server.mak"\
+ CFG="POA Adapter Activator Server - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "POA Adapter Activator Server - Win32 Release" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE "POA Adapter Activator Server - Win32 Debug" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "POA Adapter Activator Server - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\.." /I "..\..\..\.." /I "..\Generic_Servant\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 tao.lib ace.lib ..\Generic_Servant\Generic_Servant.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "POA Adapter Activator Server - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /I "..\..\..\.." /I "..\Generic_Servant\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ..\Generic_Servant\Generic_Servantd.lib TAOd.lib aced.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "POA Adapter Activator Server - Win32 Release"
+# Name "POA Adapter Activator Server - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\server.cpp
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/examples/POA/Explicit_Activation/README b/TAO/examples/POA/Explicit_Activation/README
index fdf1a3bf367..fd31291356c 100644
--- a/TAO/examples/POA/Explicit_Activation/README
+++ b/TAO/examples/POA/Explicit_Activation/README
@@ -21,7 +21,7 @@ This will produce three output files: output_1, output_2, and output_3
Run the client as follows:
-% cd $TAO_ROOT/tests/POA/Generic_Servant
+% cd $TAO_ROOT/examples/POA/Generic_Servant
% ./client -f ../Explicit_Activation/output_1
% ./client -f ../Explicit_Activation/output_2
% ./client -f ../Explicit_Activation/output_3
@@ -36,13 +36,11 @@ Run the server as follows:
Run the client as follows:
-% cd $TAO_ROOT/tests/POA/Generic_Servant
+% cd $TAO_ROOT/examples/POA/Generic_Servant
% ./client -k <IOR>
-Comments :
+Comments :
=========
- As soon as, the server prints out the IOR, cut it and use it for
running the client.
________________________________________
-
-
diff --git a/TAO/examples/POA/Explicit_Activation/server.cpp b/TAO/examples/POA/Explicit_Activation/server.cpp
index 4b18703c7c9..79d3d96ecb8 100644
--- a/TAO/examples/POA/Explicit_Activation/server.cpp
+++ b/TAO/examples/POA/Explicit_Activation/server.cpp
@@ -10,7 +10,7 @@
//
// = DESCRIPTION
// In this example,
-// - A new POA ( firstPOA) is created, and the different functions
+// - A new POA (firstPOA) is created, and the different functions
// for the explicit activation of objects are demonstrated.
// - The Foo application class objects (defined in
// ./../Generic_Servant/MyFooServant) are used as sample objects.
@@ -128,30 +128,30 @@ write_iors_to_file (const char *first_ior,
int
main (int argc, char **argv)
{
- // CORBA::Environment env;
-
ACE_DECLARE_NEW_CORBA_ENV;
ACE_TRY
{
-
// Initialize the ORB first.
- CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0, ACE_TRY_ENV);
+ CORBA::ORB_var orb = CORBA::ORB_init (argc,
+ argv,
+ 0,
+ ACE_TRY_ENV);
ACE_TRY_CHECK;
-
int result = parse_args (argc, argv);
if (result != 0)
return result;
-
+
// Obtain the RootPOA.
CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA");
// Get the POA_var object from Object_var.
PortableServer::POA_var root_poa =
- PortableServer::POA::_narrow (obj.in (), ACE_TRY_ENV);
+ PortableServer::POA::_narrow (obj.in (),
+ ACE_TRY_ENV);
ACE_TRY_CHECK;
-
+
// Get the POAManager of the RootPOA.
PortableServer::POAManager_var poa_manager =
root_poa->the_POAManager (ACE_TRY_ENV);
@@ -163,12 +163,14 @@ main (int argc, char **argv)
// Id Assignment Policy
policies[0] =
- root_poa->create_id_assignment_policy (PortableServer::USER_ID, ACE_TRY_ENV);
+ root_poa->create_id_assignment_policy (PortableServer::USER_ID,
+ ACE_TRY_ENV);
ACE_TRY_CHECK;
// Lifespan policy
policies[1] =
- root_poa->create_lifespan_policy (PortableServer::PERSISTENT, ACE_TRY_ENV);
+ root_poa->create_lifespan_policy (PortableServer::PERSISTENT,
+ ACE_TRY_ENV);
ACE_TRY_CHECK;
// Create the firstPOA under the RootPOA.
@@ -179,7 +181,7 @@ main (int argc, char **argv)
policies,
ACE_TRY_ENV);
ACE_TRY_CHECK;
-
+
// Create the secondPOA under the firstPOA.
name = "secondPOA";
PortableServer::POA_var second_poa =
@@ -187,45 +189,48 @@ main (int argc, char **argv)
poa_manager.in (),
policies,
ACE_TRY_ENV);
-
+ ACE_TRY_CHECK;
+
// Creation of POAs is over. Destroy the Policy objects.
for (CORBA::ULong i = 0;
- i < policies.length () && ACE_TRY_ENV.exception () == 0;
+ i < policies.length ();
++i)
{
- CORBA::Policy_ptr policy = policies[i];
- policy->destroy (ACE_TRY_ENV);
+ policies[i]->destroy (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
}
-
// Create two Objects of Class MyFooServant (defined in
// ./../GenericServant/MyFooServant.h) Create one object at RootPOA
// and the other at firstPOA.
- MyFooServant first_foo_impl (orb.in (), root_poa.in (), 27);
- MyFooServant second_foo_impl (orb.in (), first_poa.in (), 28);
-
+ MyFooServant first_foo_impl (orb.in (),
+ root_poa.in (),
+ 27);
+ MyFooServant second_foo_impl (orb.in (),
+ first_poa.in (),
+ 28);
+
// Do "activate_object" to activate the first_foo_impl object. It
// returns ObjectId for that object. Operation Used :
- // ObjectId activate_object( in Servant p_servant)
+ // ObjectId activate_object(in Servant p_servant)
// raises (ServantAlreadyActive, WrongPolicy);
PortableServer::ObjectId_var first_oid =
- root_poa->activate_object (&first_foo_impl, ACE_TRY_ENV);
+ root_poa->activate_object (&first_foo_impl,
+ ACE_TRY_ENV);
ACE_TRY_CHECK;
-
-
+
// Get Object Reference for the first_foo_impl object.
Foo_var first_foo = first_foo_impl._this (ACE_TRY_ENV);
ACE_TRY_CHECK;
-
-
+
// Get ObjectId for object secondFoo and use that ObjectId to
// activate the second_foo_impl object.
// Operation Used :
- // void activate_object_with_id( in ObjectId oid, in Servant p_servant)
+ // void activate_object_with_id(in ObjectId oid, in Servant p_servant)
// raises (ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy);
PortableServer::ObjectId_var second_oid =
PortableServer::string_to_ObjectId ("secondFoo");
-
+
first_poa->activate_object_with_id (second_oid.in (),
&second_foo_impl,
ACE_TRY_ENV);
@@ -235,7 +240,6 @@ main (int argc, char **argv)
Foo_var second_foo = second_foo_impl._this (ACE_TRY_ENV);
ACE_TRY_CHECK;
-
// Get ObjectId for the string thirdPOA Create the object reference
// for thirdPOA using that ObjectId. Operation Used :
// Object create_reference_with_id (in ObjectId oid, in CORBA::RepositoryId intf );
@@ -245,62 +249,58 @@ main (int argc, char **argv)
PortableServer::ObjectId_var third_oid =
PortableServer::string_to_ObjectId ("thirdFoo");
*/
-
+
// This will test how the POA handles a user given ID
PortableServer::ObjectId_var third_oid =
PortableServer::string_to_ObjectId ("third Foo");
third_oid[5] = (CORBA::Octet) '\0';
-
+
CORBA::Object_var third_foo =
second_poa->create_reference_with_id (third_oid.in (),
- "IDL:Foo:1.0", ACE_TRY_ENV);
+ "IDL:Foo:1.0",
+ ACE_TRY_ENV);
ACE_TRY_CHECK;
-
// Stringyfy all the object references and print them out.
CORBA::String_var first_ior =
orb->object_to_string (first_foo.in (), ACE_TRY_ENV);
ACE_TRY_CHECK;
-
CORBA::String_var second_ior =
orb->object_to_string (second_foo.in (), ACE_TRY_ENV);
ACE_TRY_CHECK;
-
-
+
CORBA::String_var third_ior =
orb->object_to_string (third_foo.in (), ACE_TRY_ENV);
ACE_TRY_CHECK;
-
ACE_DEBUG ((LM_DEBUG,
"%s\n%s\n%s\n",
first_ior.in (),
second_ior.in (),
third_ior.in ()));
-
+
int write_result = write_iors_to_file (first_ior.in (),
- second_ior.in (),
- third_ior.in ());
+ second_ior.in (),
+ third_ior.in ());
if (write_result != 0)
return write_result;
- // Activate thirdPOA using its ObjectID.
+ // Activate third servant using its ObjectID.
MyFooServant third_foo_impl (orb.in (), second_poa.in (), 29);
second_poa->activate_object_with_id (third_oid.in (),
&third_foo_impl,
ACE_TRY_ENV);
ACE_TRY_CHECK;
-
+
poa_manager->activate (ACE_TRY_ENV);
ACE_TRY_CHECK;
-
if (orb->run () == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "CORBA::ORB::run"), -1);
- // Destroy RootPOA. ( Also destroys firstPOA)
+ // Destroy RootPOA (also destroys all child POAs).
root_poa->destroy (1,
1,
ACE_TRY_ENV);
@@ -316,6 +316,6 @@ main (int argc, char **argv)
}
ACE_ENDTRY;
ACE_CHECK_RETURN (-1);
-
+
return 0;
}
diff --git a/TAO/examples/POA/FindPOA/FindPOA.cpp b/TAO/examples/POA/FindPOA/FindPOA.cpp
index a1215d46459..44edc46c1b2 100644
--- a/TAO/examples/POA/FindPOA/FindPOA.cpp
+++ b/TAO/examples/POA/FindPOA/FindPOA.cpp
@@ -28,13 +28,13 @@ main (int argc, char **argv)
// Initialize the ORB
char str[256]; // Exception message
- ACE_TRY
+ ACE_TRY
{
ACE_OS::strcpy (str, "CORBA::ORB_init");
-
+
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0, ACE_TRY_ENV);
ACE_TRY_CHECK;
-
+
// Get Object reference to RootPOA.
CORBA::Object_var obj =
orb->resolve_initial_references ("RootPOA");
@@ -47,15 +47,15 @@ main (int argc, char **argv)
// Get a TAO_Adapter_Activator reference
TAO_Adapter_Activator activator_impl;
-
+
ACE_OS::strcpy (str, "TAO_Adapter_Activator::_this");
PortableServer::AdapterActivator_var activator =
activator_impl._this (ACE_TRY_ENV);
ACE_TRY_CHECK;
-
+
// Register the TAO_Adapter_Activator reference to be the RootPOA's
// Adapter Activator.
- ACE_OS::strcpy (str,"PortableServer::POA::the_activator");
+ ACE_OS::strcpy (str,"PortableServer::POA::the_activator");
root_poa->the_activator (activator.in (), ACE_TRY_ENV);
ACE_TRY_CHECK;
@@ -67,7 +67,7 @@ main (int argc, char **argv)
1,
ACE_TRY_ENV);
ACE_TRY_CHECK;
-
+
name = "secondPOA";
PortableServer::POA_var second_poa =
first_poa->find_POA (name.c_str (),
@@ -91,7 +91,7 @@ main (int argc, char **argv)
ACE_TRY_CHECK;
ACE_DEBUG ((LM_DEBUG,
- "%s\n%s\n%s\n%s\n",
+ "%s\n%s\n%s\n",
root_poa_name.in (),
first_poa_name.in (),
second_poa_name.in ()));
diff --git a/TAO/examples/POA/Identity/Identity.dsp b/TAO/examples/POA/Identity/Identity.dsp
index 8acd57a0362..dbf16356da3 100644
--- a/TAO/examples/POA/Identity/Identity.dsp
+++ b/TAO/examples/POA/Identity/Identity.dsp
@@ -1,25 +1,25 @@
-# Microsoft Developer Studio Project File - Name="Identity" - Package Owner=<4>
+# Microsoft Developer Studio Project File - Name="POA Identity" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
-CFG=Identity - Win32 Debug
+CFG=POA Identity - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
-!MESSAGE
+!MESSAGE
!MESSAGE NMAKE /f "Identity.mak".
-!MESSAGE
+!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Identity.mak" CFG="Identity - Win32 Debug"
-!MESSAGE
+!MESSAGE
+!MESSAGE NMAKE /f "Identity.mak" CFG="POA Identity - Win32 Debug"
+!MESSAGE
!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Identity - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "Identity - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
+!MESSAGE
+!MESSAGE "POA Identity - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "POA Identity - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
@@ -28,7 +28,7 @@ CFG=Identity - Win32 Debug
CPP=cl.exe
RSC=rc.exe
-!IF "$(CFG)" == "Identity - Win32 Release"
+!IF "$(CFG)" == "POA Identity - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
@@ -51,7 +51,7 @@ LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 ace.lib tao.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..tao" /libpath:"..\..\..\..\ace"
-!ELSEIF "$(CFG)" == "Identity - Win32 Debug"
+!ELSEIF "$(CFG)" == "POA Identity - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
@@ -75,12 +75,12 @@ LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 aced.lib taod.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
-!ENDIF
+!ENDIF
# Begin Target
-# Name "Identity - Win32 Release"
-# Name "Identity - Win32 Debug"
+# Name "POA Identity - Win32 Release"
+# Name "POA Identity - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
@@ -112,9 +112,9 @@ SOURCE=.\testS.cpp
SOURCE=.\test.idl
-!IF "$(CFG)" == "Identity - Win32 Release"
+!IF "$(CFG)" == "POA Identity - Win32 Release"
-USERDEP__TEST_="..\..\..\..\bin\Release\tao_idl.exe"
+USERDEP__TEST_="..\..\..\..\bin\Release\tao_idl.exe"
# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
InputPath=.\test.idl
InputName=test
@@ -150,9 +150,9 @@ BuildCmds= \
$(BuildCmds)
# End Custom Build
-!ELSEIF "$(CFG)" == "Identity - Win32 Debug"
+!ELSEIF "$(CFG)" == "POA Identity - Win32 Debug"
-USERDEP__TEST_="..\..\..\..\bin\tao_idl.exe"
+USERDEP__TEST_="..\..\..\..\bin\tao_idl.exe"
# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
InputPath=.\test.idl
InputName=test
@@ -188,7 +188,7 @@ BuildCmds= \
$(BuildCmds)
# End Custom Build
-!ENDIF
+!ENDIF
# End Source File
# End Group
diff --git a/TAO/examples/POA/Makefile b/TAO/examples/POA/Makefile
index b3f0b00b444..32574c8b614 100644
--- a/TAO/examples/POA/Makefile
+++ b/TAO/examples/POA/Makefile
@@ -10,15 +10,19 @@
# Local macros
#----------------------------------------------------------------------------
-DIRS = Default_Servant \
+DIRS = Generic_Servant \
+ Adapter_Activator \
+ DSI \
+ Default_Servant \
+ Explicit_Activation \
FindPOA \
Forwarding \
- Generic_Servant \
- Explicit_Activation \
+ Identity \
+ Loader \
NewPOA \
On_Demand_Activation \
+ On_Demand_Loading \
RootPOA \
- Identity \
TIE
# The following test hasn't been updated yet
diff --git a/TAO/examples/POA/NewPOA/NewPOA.cpp b/TAO/examples/POA/NewPOA/NewPOA.cpp
index 80058d2f059..d9afbb72c53 100644
--- a/TAO/examples/POA/NewPOA/NewPOA.cpp
+++ b/TAO/examples/POA/NewPOA/NewPOA.cpp
@@ -10,12 +10,12 @@
// = DESCRIPTION
// This program demonstrates creation of new POAs, as children of the root POA or the
// existing POA.
-// There are five new POA created in this example.
+// There are three new POA created in this example.
// The hierarchy of POAs looks like this.
//
// /-->first_poa-->first_poa/second_poa
// RootPOA--
-// \-->third_poa-->third_poa/fourth_poa-->third_poa/fourth_poa/fifth_poa
+// \-->third_poa
//
// = AUTHOR
// Irfan Pyarali
@@ -90,28 +90,22 @@ main (int argc, char **argv)
}
// Creation of the new POA, i.e. firstPOA/secondPOA
- name += TAO_POA::name_separator ();
- name += "secondPOA";
+ name = "secondPOA";
PortableServer::POA_var second_poa =
- root_poa->create_POA (name.c_str (),
- PortableServer::POAManager::_nil (),
- policies,
- env);
+ first_poa->create_POA (name.c_str (),
+ PortableServer::POAManager::_nil (),
+ policies,
+ env);
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POA::create_POA");
return -1;
}
- // Creating thirdPOA/fourthPOA/fifthPOA. The non-existing thirdPOA
- // and thirdPOA/fourthPOA are created automatically.
+ // Creating thirdPOA.
name = "thirdPOA";
- name += TAO_POA::name_separator ();
- name += "forthPOA";
- name += TAO_POA::name_separator ();
- name += "fifthPOA";
- PortableServer::POA_var fifth_poa =
+ PortableServer::POA_var third_poa =
root_poa->create_POA (name.c_str (),
PortableServer::POAManager::_nil (),
policies,
@@ -163,8 +157,8 @@ main (int argc, char **argv)
return -1;
}
- CORBA::String_var fifth_poa_name =
- fifth_poa->the_name (env);
+ CORBA::String_var third_poa_name =
+ third_poa->the_name (env);
if (env.exception () != 0)
{
env.print_exception ("PortableServer::POA::_narrow");
@@ -176,8 +170,8 @@ main (int argc, char **argv)
root_poa_name.in (),
first_poa_name.in (),
second_poa_name.in (),
- fifth_poa_name.in ()));
-
+ third_poa_name.in ()));
+
// This should destroy all its children
root_poa->destroy (1,
1,
diff --git a/TAO/examples/POA/README b/TAO/examples/POA/README
index d3f7c475390..4c90b58d80e 100644
--- a/TAO/examples/POA/README
+++ b/TAO/examples/POA/README
@@ -101,3 +101,11 @@ these applications further.
not hijacked to store the DLL and factory function
name. This information is provided to the Servant
Managers on creation.
+
+ . Explicit_Activation
+
+ This example is very similar to the
+ Explicit_Activation example except that the POAs are
+ deleted once the object references have been
+ created. After this, an adapter activator is install
+ in the RootPOA to reactivate the POAs on demand.
diff --git a/TAO/examples/POA/RootPOA/RootPOA.cpp b/TAO/examples/POA/RootPOA/RootPOA.cpp
index 619dbeaceb3..a7a3538466a 100644
--- a/TAO/examples/POA/RootPOA/RootPOA.cpp
+++ b/TAO/examples/POA/RootPOA/RootPOA.cpp
@@ -25,41 +25,27 @@ ACE_RCSID(RootPOA, RootPOA, "$Id$")
int
main (int argc, char **argv)
{
- // CORBA::Environment env;
-
// Initilize the ORB
ACE_TRY_NEW_ENV
{
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0, ACE_TRY_ENV);
ACE_TRY_CHECK;
- ACE_PRINT_TAO_EXCEPTION (ACE_TRY_ENV,
- "CORBA::ORB_init");
- ACE_CHECK_RETURN (-1);
-
-
// Resolve the initial references for the name RootPOA thus getting
// an object of type CORBA::Object.
CORBA::Object_var obj =
orb->resolve_initial_references ("RootPOA");
-
+
// apply _narrow on the object of type CORBA::Object, to make it a
// POA class Object.
PortableServer::POA_var root_poa =
PortableServer::POA::_narrow (obj.in (), ACE_TRY_ENV);
-
- ACE_PRINT_TAO_EXCEPTION (ACE_TRY_ENV,
- "PortableServer::POA::_narrow");
- ACE_CHECK_RETURN (-1);
+ ACE_TRY_CHECK;
// Get the name of the root POA.
CORBA::String_var poa_name =
root_poa->the_name (ACE_TRY_ENV);
-
- ACE_PRINT_TAO_EXCEPTION (ACE_TRY_ENV,
- "PortableServer::POA::_narrow");
- ACE_CHECK_RETURN (-1);
-
+ ACE_TRY_CHECK;
ACE_DEBUG ((LM_DEBUG,
"The RootPOA is : %s\n",
@@ -69,19 +55,15 @@ main (int argc, char **argv)
root_poa->destroy (1,
1,
ACE_TRY_ENV);
-
- ACE_PRINT_TAO_EXCEPTION (ACE_TRY_ENV,
- "PortableServer::POA::destroy");
- ACE_CHECK_RETURN (-1);
-
+ ACE_TRY_CHECK;
}
ACE_CATCHANY
{
ACE_DEBUG ((LM_DEBUG,
"Exceptions raised \n"));
- ACE_CHECK_RETURN (-1);
+ ACE_CHECK_RETURN (-1);
}
ACE_ENDTRY;
-
+
return 0;
}