summaryrefslogtreecommitdiff
path: root/TAO/examples/POA/Loader
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/examples/POA/Loader')
-rw-r--r--TAO/examples/POA/Loader/Loader.dsw29
-rw-r--r--TAO/examples/POA/Loader/Makefile47
-rw-r--r--TAO/examples/POA/Loader/README60
-rw-r--r--TAO/examples/POA/Loader/Servant_Activator.cpp95
-rw-r--r--TAO/examples/POA/Loader/Servant_Activator.h101
-rw-r--r--TAO/examples/POA/Loader/Servant_Locator.cpp107
-rw-r--r--TAO/examples/POA/Loader/Servant_Locator.h112
-rw-r--r--TAO/examples/POA/Loader/Server_Manager.cpp389
-rw-r--r--TAO/examples/POA/Loader/Server_Manager.h106
-rwxr-xr-xTAO/examples/POA/Loader/run_test.pl68
-rw-r--r--TAO/examples/POA/Loader/server.cpp68
-rw-r--r--TAO/examples/POA/Loader/server.dsp124
12 files changed, 0 insertions, 1306 deletions
diff --git a/TAO/examples/POA/Loader/Loader.dsw b/TAO/examples/POA/Loader/Loader.dsw
deleted file mode 100644
index a6cb35f3e3c..00000000000
--- a/TAO/examples/POA/Loader/Loader.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "POA Loader Server"=".\server.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/TAO/examples/POA/Loader/Makefile b/TAO/examples/POA/Loader/Makefile
deleted file mode 100644
index ea2d5c9daa8..00000000000
--- a/TAO/examples/POA/Loader/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# $Id$
-#
-
-BIN = server
-
-MYFILES = Server_Manager Servant_Activator Servant_Locator
-
-SRC = $(addsuffix .cpp,$(MYFILES)) $(addsuffix .cpp, $(BIN))
-OBJ = $(addsuffix .o,$(MYFILES))
-
-CPPFLAGS += -I$(TAO_ROOT)
-
-LDLIBS = -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
-
-#----------------------------------------------------------------------------
-# Dependencies
-#----------------------------------------------------------------------------
-
-# 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/Loader/README b/TAO/examples/POA/Loader/README
deleted file mode 100644
index db78c9c5df6..00000000000
--- a/TAO/examples/POA/Loader/README
+++ /dev/null
@@ -1,60 +0,0 @@
-$Id$
-
-Loader Example
---------------
-
-This example illustrates how to dynamically link and load servants
-into a POA in a platform-independent manner using the ACE_DLL feature
-and standard CORBA Servant Manager features. In the example, the POA
-is configured with the USE_SERVANT_MANAGER policy value, which relies
-on an application supplied Servant Manager object to supply
-object/server associations.
-
-If the POA has the RETAIN value for the servant retention, the POA
-expects the Servant Manager to implement the Servant Activator
-interface. Conversely, when the POA is created with the NON_RETAIN
-value for servant retention, the Servant Manager must implement the
-Servant_Locator interface.
-
-This example illustrates both Servant Activator and Servant_Locator
-interfaces. The servant object is created by a factory function that
-resides in a DLL that is linked and loaded into the server's address
-space on-demand when client requests arrive. The ObjectID in each
-client request indicates which DLL name and which factory function to
-use to create the servant.
-
-For the Servant_Activator example, once the servant is loaded, the
-Object-to-Servant association is added to the Active Object Map
-maintained by the POA. This association becomes invalid when the POA
-is destroyed or/and the Object is deactivated. In contrast, for the
-Servant_Locator example operation request from the client causes the
-servant to be linked, processed, destroyed, and unlinked.
-
-For all examples, the dynamic configuration granularity is at the POA
-level,i.e., a Servant Activator or Servant Locator is associated with
-a DLL that is linked and loaded into memory and servant objects
-obtained on-demand. The factory function within the DLL decides the
-servant to be supplied based on the ObjectId and supplies the
-appropriate servant to the Servant Manager interface. Theres also an
-providence made for an garbage_collection function which can be used
-to destroy the servant. Both the factory function as well as the
-garbage collection function can be implemented by the application
-developer in the preferred manner.
-
-Note that the server need not be statically linked with the DLL. The
-DLL name and the factory function used to obtain the servant can be
-provided to the server at run-time. This gives us the flexibility of
-modifying and linking the servant without having to statically link
-the server along with the DLL.
-
-Execution:
----------
-
- Run the run_test_pl perl script.
-
-example:
- run_test_pl -f ior_file
-
-The output will demonstrate the different actions performed by the
-Servant_Manager via the Servant_Activator and the Servant_Locator
-interfaces.
diff --git a/TAO/examples/POA/Loader/Servant_Activator.cpp b/TAO/examples/POA/Loader/Servant_Activator.cpp
deleted file mode 100644
index f98404fe0b1..00000000000
--- a/TAO/examples/POA/Loader/Servant_Activator.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO/examples/POA/Loader
-//
-// = FILENAME
-// Servant_Activator.cpp
-//
-// = DESCRIPTION
-// Implementation of <ServantActivator_i>, which is used by a POA
-// with a RETAIN policy.
-//
-// = AUTHOR
-// Kirthika Parameswaran <kirthika@cs.wustl.edu>
-//
-// ============================================================================
-
-#include "Servant_Activator.h"
-
-ACE_RCSID(Loader, Servant_Activator, "$Id$")
-
-// Initialization.The dllname is used by the Loactor to load it into
-// memory. The factory function is the point of entry into the dll and
-// is used for obtaining the servant. The garbage_collection_function
-// is used to kill the servant.
-
-ServantActivator_i::ServantActivator_i (CORBA::ORB_ptr orb,
- const char *dllname,
- const char *factory_function,
- const char *garbage_collection_function)
- : orb_ (CORBA::ORB::_duplicate (orb))
-{
- // The dll is opened using the dllname passed.
- if (this->dll_.open (dllname) == -1)
- ACE_ERROR ((LM_ERROR,
- "%p\n",
- this->dll_.error ()));
-
-
- // Obtain the symbol for the function that will
- // get the servant object.
- servant_supplier_ = ACE_reinterpret_cast
- (SERVANT_FACTORY, this->dll_.symbol (factory_function));
-
- // Obtain tne symbol for the function which
- // will destroy the servant.
- servant_garbage_collector_ = ACE_reinterpret_cast
- (SERVANT_GARBAGE_COLLECTOR, this->dll_.symbol (garbage_collection_function));
-
-}
-
-// This method associates an servant with the ObjectID.
-
-PortableServer::Servant
-ServantActivator_i::incarnate (const PortableServer::ObjectId &oid,
- PortableServer::POA_ptr poa,
- CORBA::Environment &env)
-{
- // Obtain the servant else exception.
- PortableServer::Servant servant =
- (*servant_supplier_) (oid,
- poa,
- this->orb_.in ());
- if (servant != 0)
- return servant;
- else
- TAO_THROW_ENV_RETURN (CORBA::OBJECT_NOT_EXIST (CORBA::COMPLETED_NO),
- env,
- 0);
-}
-
-// This is the method invoked when the object is deactivated or the
-// entire POA is is deactivated or destroyed.
-
-void
-ServantActivator_i::etherealize (const PortableServer::ObjectId &oid,
- PortableServer::POA_ptr poa,
- PortableServer::Servant servant,
- CORBA::Boolean,
- CORBA::Boolean remaining_activations,
- CORBA::Environment &)
-{
- // If there are no remaining activations i.e ObjectIds associated
- // with MyFooServant object, deactivate it by calling the garbage_collection_function.
- // Etheralization happens on POA::destroy() and/or Object::deactivate().
-
- if (remaining_activations == 0)
- (*servant_garbage_collector_) (oid,
- poa,
- servant);
-
-}
-
diff --git a/TAO/examples/POA/Loader/Servant_Activator.h b/TAO/examples/POA/Loader/Servant_Activator.h
deleted file mode 100644
index 14afe4c4e8b..00000000000
--- a/TAO/examples/POA/Loader/Servant_Activator.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// This may look like C, but it's really -*- C++ -*-
-// $Id$
-
-//=================================================================================
-//
-// = LIBRARY
-// TAO/examples/POA/On_Demand_Loading
-//
-// = FILENAME
-// Servant_Activator.h
-//
-// = DESCRIPTION
-// Defines a <ServantActivator_i> class, which activates a servant by
-// obtaining it and associates it with an object on-demand.
-//
-// = AUTHOR
-// Kirthika Parameswaran <kirthika@cs.wustl.edu>
-//
-//==================================================================================
-
-#include "ace/OS.h"
-
-#ifndef SERVANT_ACTIVATOR_H
-#define SERVANT_ACTIVATOR_H
-
-#include "tao/corba.h"
-#include "ace/DLL.h"
-
-class ServantActivator_i : public POA_PortableServer::ServantActivator
-{
- //= TITLE
- // Servant Activator for the MyFoo servant.
- //
- //= DESCRIPTION
- // This class associates an unassociated servant with an object in
- // the POA Active Object Map.
-public:
- typedef PortableServer::Servant
- (*SERVANT_FACTORY) (const PortableServer::ObjectId &oid,
- PortableServer::POA_ptr poa,
- CORBA::ORB_ptr orb);
- // This typedef is used to typecast the void* obtained when finding
- // a symbol in the dll. Invoking the function pointer obtained would
- // get a servant.
-
- typedef void
- (*SERVANT_GARBAGE_COLLECTOR) (const PortableServer::ObjectId &oid,
- PortableServer::POA_ptr,
- PortableServer::Servant servant);
- // This typedef is used to obtain the garbage_collection_function symbol
- // in the dll. Invoking the function pointer obtained would then destroy
- // the servant.
-
- ServantActivator_i (CORBA::ORB_ptr orb,
- const char *dllname,
- const char *factory_function,
- const char *garbage_collection_function);
- // 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
- // MyFooServant object that is not currently active. When an servant
- // pointer corresponding to objectId is not found in the Active
- // Object Map, the POA hands over the job of obtaining the servant
- // to the Servant Manager. Depending upon whether the POA is created
- // with RETAIN or NON_RETAIN as the servant_retention policy, the
- // Servant Activator or the Servant Locator interface is invoked
- // respectively.
-
- 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. This occurs when the POA is destroyed or the
- // Object is deactivated. When the POA is getting destroyed, it
- // needs to deactivate every object in the Active Object Map and on
- // that call the ServantActivator invokes this method which will
- // destroy the servant associated with the object.
-
-private:
- ACE_DLL dll_;
- // The ACE_DLL object which performs the task of loading the dll
- // and accessing it.
-
- SERVANT_FACTORY servant_supplier_;
- // The function pointer of factory_function type.
-
- SERVANT_GARBAGE_COLLECTOR servant_garbage_collector_;
- // The function pointer of garbage_collection_function type.
-
- CORBA::ORB_var orb_;
- // A reference to the ORB.
-};
-
-#endif /* SERVANT_ACTIVATOR_H */
diff --git a/TAO/examples/POA/Loader/Servant_Locator.cpp b/TAO/examples/POA/Loader/Servant_Locator.cpp
deleted file mode 100644
index 439c78d9d61..00000000000
--- a/TAO/examples/POA/Loader/Servant_Locator.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO/examples/POA/Loader
-//
-// = FILENAME
-// Servant_Locator.cpp
-//
-// = DESCRIPTION
-// Implementation of ServantLocator_i class, used with a POA
-// having a NON_RETAIN policy.
-//
-// = AUTHOR
-// Kirthika Parameswaran <kirthika@cs.wustl.edu>
-//
-// ============================================================================
-
-#include "Servant_Locator.h"
-
-ACE_RCSID(Loader, Servant_Locator, "$Id$")
-
-// Initialization.The dllname is used by the Loactor to load it into
-// memory. The factory function is the point of entry into the dll and
-// is used for obtaining the servant. The garbage_collection_function
-// is used to kill the servant.
-
-ServantLocator_i::ServantLocator_i (CORBA::ORB_ptr orb,
- const char *dllname,
- const char *factory_function,
- const char *garbage_collection_function)
- : orb_ (CORBA::ORB::_duplicate (orb))
-{
- // The dll is opened using the dllname passed.
- if (this->dll_.open (dllname) == -1)
- ACE_ERROR ((LM_ERROR,
- "%p",
- this->dll_.error ()));
-
- // Obtain the symbol for the function that will
- // get the servant object.
- servant_supplier_ = ACE_reinterpret_cast
- (SERVANT_FACTORY, this->dll_.symbol (factory_function));
-
- // Obtain tne symbol for the function which
- // will destroy the servant.
- servant_garbage_collector_ = ACE_reinterpret_cast
- (SERVANT_GARBAGE_COLLECTOR, this->dll_.symbol (garbage_collection_function));
-
-}
-
-// This method associates an servant with the ObjectID.
-
-PortableServer::Servant
-ServantLocator_i::preinvoke (const PortableServer::ObjectId &oid,
- PortableServer::POA_ptr poa,
- const char * /* operation */,
- PortableServer::ServantLocator::Cookie &cookie,
- CORBA::Environment &env)
-{
- PortableServer::Servant servant =
- (*servant_supplier_) (oid,
- poa,
- this->orb_.in ());
- if (servant != 0)
- {
- // Return the servant as the cookie , used as a check when
- // postinvoke is called on this ServantLocator_i.
-
- cookie = servant;
- return servant;
- }
- else
- TAO_THROW_ENV_RETURN (CORBA::OBJECT_NOT_EXIST (CORBA::COMPLETED_NO),
- env,
- 0);
-}
-
-// Since the servant gets invoked per operation, the servant has to be
-// destroyed per operation too. This is accomplished in the
-// postinvoke method.
-
-void
-ServantLocator_i::postinvoke (const PortableServer::ObjectId &oid,
- PortableServer::POA_ptr poa ,
- const char * /* operation */,
- PortableServer::ServantLocator::Cookie cookie,
- PortableServer::Servant servant,
- CORBA::Environment &/* env */)
-{
- // Check the passed servant with the cookie.
- PortableServer::Servant my_servant =
- ACE_reinterpret_cast (PortableServer::Servant,
- cookie);
-
- ACE_ASSERT (servant == my_servant);
-
- // Invoke the garbage_collection_function.
- (*servant_garbage_collector_) (oid,
- poa,
- servant);
-
- // To avoid warning about unused variable with ACE_NDEBUG.
- ACE_UNUSED_ARG (my_servant);
-}
-
diff --git a/TAO/examples/POA/Loader/Servant_Locator.h b/TAO/examples/POA/Loader/Servant_Locator.h
deleted file mode 100644
index 280e11c08e7..00000000000
--- a/TAO/examples/POA/Loader/Servant_Locator.h
+++ /dev/null
@@ -1,112 +0,0 @@
-// This may look like C, but it's really -*- C++ -*-
-// $Id$
-
-//================================================================================
-//
-// = LIBRARY
-// TAO/examples/POA/Loader
-//
-// = FILENAME
-// Servant_Locator.h
-//
-// = DESCRIPTION
-// Defines a ServantLocator_i class , used with a POA having
-// a NON_RETAIN policy.
-//
-// = AUTHOR
-// Kirthika Parameswaran <kirthika@cs.wustl.edu>
-//
-//==================================================================================
-
-#include "ace/OS.h"
-
-#ifndef SERVANT_LOCATOR_H
-#define SERVANT_LOCATOR_H
-
-#include "tao/corba.h"
-#include "ace/DLL.h"
-
-class ServantLocator_i : public POA_PortableServer::ServantLocator
-{
- // = TITLE
- // This class is used by a POA with USE_SERVANT_MANAGER and
- // NON_RETAIN policy.
- //
- // = DESCRIPTION
- // This class defines the Servant Locator interface of the Servant
- // Manager. It is invoked when the POA has an USE_SERVANT_MANAGER
- // policy and a servant_retention policy of NON_RETAIN type.
-public:
- typedef PortableServer::Servant
- (*SERVANT_FACTORY) (const PortableServer::ObjectId &oid,
- PortableServer::POA_ptr poa,
- CORBA::ORB_ptr orb);
- // This typedef is used to typecast the void* obtained when finding
- // a symbol in the dll. Invoking the function pointer obtained would
- // get a servant.
-
- typedef void
- (*SERVANT_GARBAGE_COLLECTOR) (const PortableServer::ObjectId &oid,
- PortableServer::POA_ptr,
- PortableServer::Servant servant);
- // This typedef is used to obtain the garbage_collection_function symbol
- // in the dll. Invoking the function pointer obtained would then destroy
- // the servant.
-
- ServantLocator_i (CORBA::ORB_ptr orb,
- const char *dllname,
- const char *factory_function,
- const char *garbage_collection_function);
- // Constructor.
-
- virtual PortableServer::Servant preinvoke (const PortableServer::ObjectId &oid,
- PortableServer::POA_ptr adapter,
- const char *operation,
- PortableServer::ServantLocator::Cookie &the_cookie,
- CORBA::Environment &env);
- // This method is invoked by a POA whenever it receives a request
- // for MyFoo object that is not currently active. When the POA is
- // created using the NON_RETAIN policy the Active Object Map is not
- // maintained, in other words, an association between the ObjectId
- // and the servant is not maintained. Hence every client request the
- // servant has to be loaded. Note the operation argument. This
- // argument specifies the operation to be invoked on the
- // servant. The cookie helps in marking the servant. This marking is
- // useful while destroying the servant.
-
- virtual void postinvoke (const PortableServer::ObjectId &oid,
- PortableServer::POA_ptr adapter,
- const char *operation,
- PortableServer::ServantLocator::Cookie the_cookie,
- PortableServer::Servant the_servant,
- CORBA::Environment &env);
- // This method is invoked whenever a MyFooServant completes a
- // request. As the Servant Loactor interface is used when the POA
- // doesnt maintain the Active Object Map, its necessary to get rid
- // of the servant after the client request has been processed. The
- // appropriate servant is destroyed by verifying the cookie.Again
- // this method is invoked per client request.
-
-private:
- ACE_CString dllname_;
- // The name of the dll containing the servant.
-
- ACE_CString create_symbol_;
- // The symbol which on getting invoked will give us the servant
- // pointer.
-
- ACE_DLL dll_;
- // The ACE_DLL object which performs the task of loading the dll
- // and accessing it.
-
- SERVANT_FACTORY servant_supplier_;
- // The function pointer of factory_function type.
-
- SERVANT_GARBAGE_COLLECTOR servant_garbage_collector_;
- // The function pointer of garbage_collection_function type.
-
- CORBA::ORB_var orb_;
- // A reference to the ORB.
-};
-
-#endif /* SERVANT_LOCATOR_H */
diff --git a/TAO/examples/POA/Loader/Server_Manager.cpp b/TAO/examples/POA/Loader/Server_Manager.cpp
deleted file mode 100644
index 16bf3ee6fee..00000000000
--- a/TAO/examples/POA/Loader/Server_Manager.cpp
+++ /dev/null
@@ -1,389 +0,0 @@
-// $Id$
-
-#include "Server_Manager.h"
-
-ACE_RCSID(Loader, Server_Manager, "$Id$")
-
-Server_i::Server_i(void)
- : ior_output_file_ (0),
- policies_ (4)
-{
-}
-
-Server_i::~Server_i(void)
-{
-}
-
-// This method parses the input.
-
-int
-Server_i::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 IORs obtained are written into files for further use.
-
-int
-Server_i::write_iors_to_file (const char *first_ior,
- const char *second_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];
-
- ACE_OS::sprintf (ior_output_file_1,
- "%s_1",
- ior_output_file_);
- ACE_OS::sprintf (ior_output_file_2,
- "%s_2",
- 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");
- if (output_file_1 == 0
- || output_file_2 == 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "Cannot open output files for writing IORs: %s, %s\n",
- ior_output_file_1,
- ior_output_file_2),
- -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);
-
- result = ACE_OS::fprintf (output_file_2,
- "%s",
- second_ior);
- if (result <= 0
- || ACE_static_cast (size_t,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);
- ACE_OS::fclose (output_file_1);
- ACE_OS::fclose (output_file_2);
- return 0;
-}
-
-// Initialisation of the ORB and POA.
-
-int
-Server_i::init (int argc, char **argv)
-{
- CORBA::Environment TAO_TRY_ENV;
-
- TAO_TRY
- {
- // Initialize the ORB.
- orb_ = CORBA::ORB_init (argc,
- argv,
- 0,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- 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
- root_poa_ = PortableServer::POA::_narrow (obj.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // Get the POAManager of RootPOA
- poa_manager_ = root_poa_->the_POAManager (TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("Server_i:init_poa ()");
- return 1;
- }
- TAO_ENDTRY;
-
- return 0;
-}
-
-// This method creates an poa with 4 policies of which the servent
-// retention policy decides whether the Servant Activator or the
-// Servant Locator would be used by the Servant Manager.
-
-PortableServer::POA_ptr
-Server_i::create_poa (const char *name,
- int servant_retention_policy)
-{
- CORBA::Environment TAO_TRY_ENV;
- PortableServer::POA_ptr my_poa = 0;
-
- TAO_TRY
- {
- policies_.length (4);
-
- // ID Assignment Policy.
- policies_[0] =
- root_poa_->create_id_assignment_policy
- (PortableServer::USER_ID,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // Lifespan Policy.
- policies_[1] =
- root_poa_->create_lifespan_policy
- (PortableServer::PERSISTENT,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // Request Processing Policy.
- policies_[2] =
- root_poa_->create_request_processing_policy
- (PortableServer::USE_SERVANT_MANAGER,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // Servant Retention Policy.
- if (servant_retention_policy == 1)
- policies_[3] =
- root_poa_->create_servant_retention_policy
- (PortableServer::RETAIN,
- TAO_TRY_ENV);
-
- if (servant_retention_policy == 0)
- policies_[3] =
- root_poa_->create_servant_retention_policy
- (PortableServer::NON_RETAIN,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // Create myPOA as the child of RootPOA with the above
- // policies_. myPOA will use SERVANT_ACTIVATOR or
- // SERVANT_LOCATOR depending upon the servant retention policy
- // being RETAIN or NONRETAIN respectively.
- my_poa = root_poa_->create_POA (name,
- poa_manager_.in (),
- policies_,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // Destroy the policy objects as they have been passed to
- // create_POA and no longer needed.
- for (CORBA::ULong i = 0;
- i < policies_.length () && TAO_TRY_ENV.exception () == 0;
- ++i)
- {
- CORBA::Policy_ptr policy = policies_[i];
- policy->destroy (TAO_TRY_ENV);
- }
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("Server_i:create_poa ()");
- return 0;
- }
- TAO_ENDTRY;
-
- return my_poa;
-}
-
-// The Servant Activator object is created and initialised.
-
-int
-Server_i::create_activator (PortableServer::POA_var first_poa)
-{
- CORBA::Environment TAO_TRY_ENV;
-
- TAO_TRY
- {
- // An Servant Activator object is created which will activate
- // the servant on demand.
- ACE_NEW_RETURN (servant_activator_impl_,
- ServantActivator_i (orb_.in (),
- "Generic_Servant",
- "supply_servant",
- "destroy_servant"),
- 0);
-
- PortableServer::ServantActivator_var servant_activator =
- servant_activator_impl_->_this (TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // Set ServantActivator_i object as the servant_manager of
- // firstPOA.
- first_poa->set_servant_manager (servant_activator.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // Create a reference with user created ID in firstPOA which
- // uses the MyFooServantActivator.
- PortableServer::ObjectId_var first_foo_oid =
- PortableServer::string_to_ObjectId ("firstFoo");
-
- first_foo_ = first_poa->create_reference_with_id (first_foo_oid.in (),
- "IDL:Foo:1.0",
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("Server_i:create_activator ()");
- return 1;
- }
- TAO_ENDTRY;
-
- return 0;
-}
-
-// The Servant Locator object is created and initialised.
-
-int
-Server_i::create_locator (PortableServer::POA_var second_poa)
-{
- CORBA::Environment TAO_TRY_ENV;
-
- TAO_TRY
- {
- // An Servant Locator object is created which will activate
- // the servant on demand.
- ACE_NEW_RETURN (servant_locator_impl_,
- ServantLocator_i (orb_.in (),
- "Generic_Servant",
- "supply_servant",
- "destroy_servant"),
- 0);
-
- PortableServer::ServantLocator_var servant_locator =
- servant_locator_impl_->_this (TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // Set ServantLocator_i object as the servant Manager of
- // secondPOA.
-
- second_poa->set_servant_manager (servant_locator.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // Try to create a reference with user created ID in second_poa
- // which uses MyFooServantLocator.
- PortableServer::ObjectId_var second_foo_oid =
- PortableServer::string_to_ObjectId ("secondFoo");
-
- second_foo_ =
- second_poa->create_reference_with_id (second_foo_oid.in (),
- "IDL:Foo:1.0",
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("Server_i:create_locator ()");
- return 1;
- }
- TAO_ENDTRY;
-
- return 0;
-}
-
-// The execution process of the server.
-
-int
-Server_i::run (void)
-{
- CORBA::Environment TAO_TRY_ENV;
-
- TAO_TRY
- {
- // Invoke object_to_string on the references created in firstPOA
- // and secondPOA.
-
- CORBA::String_var first_foo_ior =
- orb_->object_to_string (first_foo_.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- CORBA::String_var second_foo_ior =
- orb_->object_to_string (second_foo_.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // Print the ior's of first_foo and second_foo.
-
- ACE_DEBUG ((LM_DEBUG,"%s\n%s\n",
- first_foo_ior.in (),
- second_foo_ior.in ()));
-
- int write_result =
- this->write_iors_to_file (first_foo_ior.in (),
- second_foo_ior.in ());
- if (write_result != 0)
- return write_result;
-
- // Set the poa_manager state to active, ready to process
- // requests.
- poa_manager_->activate (TAO_TRY_ENV);
-
- TAO_CHECK_ENV;
-
- // 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,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("Server_i:run ()");
- return 1;
- }
- TAO_ENDTRY;
-
- return 0;
-}
-
diff --git a/TAO/examples/POA/Loader/Server_Manager.h b/TAO/examples/POA/Loader/Server_Manager.h
deleted file mode 100644
index 575b60be0ac..00000000000
--- a/TAO/examples/POA/Loader/Server_Manager.h
+++ /dev/null
@@ -1,106 +0,0 @@
-// This may look like C, but it's really -*- C++ -*-
-// $Id$
-
-//=================================================================================
-//
-// = LIBRARY
-// TAO/examples/POA/Loader
-//
-// = FILENAME
-// Server_Manager.h
-//
-// = DESCRIPTION
-// Helper class for the server application.
-//
-// = AUTHOR
-// Kirthika Parameswaran <kirthika@cs.wustl.edu>
-//
-//==================================================================================
-
-#ifndef SERVER_MANAGER_H
-#define SERVER_MANAGER_H
-
-#include "ace/streams.h"
-#include "Servant_Activator.h"
-#include "Servant_Locator.h"
-
-class Server_i
-{
- // = TITLE
- // This class provides the server application with helper methods
- //
- // = DESCRIPTION
- // The various methods required by the server application for
- // utilizing the ServantActivator and ServantLocator interfaces of
- // the Servant Manager are implemented by this class. These
- // include initialisation procedures of the ServantActivator and
- // ServantLocator, and creation of POAs with emphasis on the
- // servant retention policy.
-public:
- // = Initialization and termination methods.
- Server_i (void);
- // Initialisation.
-
- ~Server_i (void);
- // Destruction.
-
- int init (int argc, char **argv);
- // Initialisation of the ORB and poa.
-
- PortableServer::POA_ptr create_poa (const char* name,
- int servant_retention_policy);
- // This method creates a POA from the root_poa with emphasis being
- // on the servant_retention_policy which decides the use of the
- // ServantActivator or ServantLocator interfaces. The
- // servent_retention_policy value is 1 for the RETAIN policy and 0
- // for the NONRETAIN policy.
-
- int create_activator (PortableServer::POA_var first_poa);
- // A ServantActivator object is created and initialised.
-
- int create_locator (PortableServer::POA_var second_poa);
- // A ServantActivator object is created and initialised.
-
- int run (void);
- // The server is executed.
-
-private:
- int parse_args (int argc, char **argv);
- // Parses the input arguments.
-
- int write_iors_to_file (const char *first_ior,
- const char *second_ior);
- // The IORs are written to a file for future use.
-
- char *ior_output_file_;
- // Default ior file.
-
- CORBA::ORB_var orb_;
- // The orb pointer.
-
- CORBA::PolicyList policies_;
- // The poa policicies.
-
- PortableServer::POA_var root_poa_;
- // The root_poa which is used for cretaing different child poas.
-
- PortableServer::POAManager_var poa_manager_;
- // The poa_manager object.
-
- CORBA::Object_var first_foo_;
- // The object pointer used by the ServantActivator.
-
- CORBA::Object_var second_foo_;
- // The object pointer used by the Servant Locator.
-
- ServantActivator_i *servant_activator_impl_;
- // The servant activator object.
-
- ServantLocator_i *servant_locator_impl_;
- // The servant locator object.
-};
-
-#endif /* SERVER_MANAGER_H */
-
-
-
diff --git a/TAO/examples/POA/Loader/run_test.pl b/TAO/examples/POA/Loader/run_test.pl
deleted file mode 100755
index 025f876b3fe..00000000000
--- a/TAO/examples/POA/Loader/run_test.pl
+++ /dev/null
@@ -1,68 +0,0 @@
-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
- & eval 'exec perl -S $0 $argv:q'
- if 0;
-
-#$Id$
-# -*- perl -*-
-unshift @INC, '../../../../bin';
-require ACEutils;
-
-$iorfile = "ior";
-
-$oneway = "";
-$iterations = 100;
-
-# 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;
- }
- print "run_test: Unknown Option: ".$ARGV[$i]."\n";
- }
-}
-
-$iorfile_1 = $iorfile."_1";
-$iorfile_2 = $iorfile."_2";
-
-unlink $iorfile_1;
-unlink $iorfile_2;
-
-$SV = Process::Create ($EXEPREFIX."server$Process::EXE_EXT", "-f $iorfile");
-
-ACE::waitforfile ($iorfile_1);
-ACE::waitforfile ($iorfile_2);
-
-$status = system ("../Generic_Servant/client$Process::EXE_EXT $oneway -i $iterations -f $iorfile_1");
-$status = system ("../Generic_Servant/client$Process::EXE_EXT $oneway -i $iterations -f $iorfile_2 -x");
-
-unlink $iorfile_1;
-unlink $iorfile_2;
-
-exit $status;
diff --git a/TAO/examples/POA/Loader/server.cpp b/TAO/examples/POA/Loader/server.cpp
deleted file mode 100644
index a48a28c96d1..00000000000
--- a/TAO/examples/POA/Loader/server.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-// $Id$
-
-//============================================================================
-//
-// = FILENAME
-// server.cpp
-//
-// = DESCRIPTION
-// Server application to test the Servant Activator and Servant Locator.
-//
-// = AUTHOR
-// Kirthika Parameswaran <kirthika@cs.wustl.edu>
-//
-//=============================================================================
-
-#include "Server_Manager.h"
-
-ACE_RCSID(Loader, server, "$Id$")
-
-int
-main (int argc, char **argv)
-{
- Server_i server;
-
- if (server.init (argc, argv) != 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "Failure during Initialisation: init ()\n"),
- -1);
-
- // This POA is used to test the Servant Activator interface and
- // hence has an RETAIN policy.
- PortableServer::POA_var first_poa =
- server.create_poa ("firstPOA", 1);
-
- if (first_poa.in () == 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "Failure during first POA creation: create_poa ()\n"),
- -1);
-
- // This poa is used to test the Servant Activator interface and
- // hence has an NONRETAIN policy.
- PortableServer::POA_var second_poa =
- server.create_poa ("secondPOA", 0);
-
- if (second_poa.in () == 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "Failure during second POA creation: create_poa ()\n"),
- -1);
-
- // The Servant Activator interface is created and initialised.
- if (server.create_activator (first_poa) != 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "Failure during first Servant Activator creation: create_activator()\n"),
- -1);
-
- // The Servant Locator interface is created and initialised.
- if (server.create_locator (second_poa) !=0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "Failure during first Servant Locator creation: create_activator()\n"),
- -1);
-
- // The server begins processing requests.
- if (server.run () != 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "Failure during request processing: run ()\n"),
- -1);
- return 0;
-}
diff --git a/TAO/examples/POA/Loader/server.dsp b/TAO/examples/POA/Loader/server.dsp
deleted file mode 100644
index ab444c08630..00000000000
--- a/TAO/examples/POA/Loader/server.dsp
+++ /dev/null
@@ -1,124 +0,0 @@
-# Microsoft Developer Studio Project File - Name="POA Loader 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 Loader 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 "POA Loader 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 "POA Loader Server.mak" CFG="POA Loader Server - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "POA Loader Server - Win32 Release" (based on\
- "Win32 (x86) Console Application")
-!MESSAGE "POA Loader 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 Loader 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 "Release"
-# 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 "..\..\..\.." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# 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 /nologo /subsystem:console /machine:I386 /out:"Release/server.exe" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
-
-!ELSEIF "$(CFG)" == "POA Loader 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 "..\..\..\.." /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 TAOd.lib aced.lib /nologo /subsystem:console /debug /machine:I386 /out:"server.exe" /pdbtype:sept /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
-
-!ENDIF
-
-# Begin Target
-
-# Name "POA Loader Server - Win32 Release"
-# Name "POA Loader Server - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\Servant_Activator.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Servant_Locator.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\server.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Server_Manager.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\Servant_Activator.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\Servant_Locator.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\Server_Manager.h
-# End Source File
-# End Group
-# End Target
-# End Project