diff options
Diffstat (limited to 'tests/POA/Loader')
-rw-r--r-- | tests/POA/Loader/Makefile.am | 52 | ||||
-rw-r--r-- | tests/POA/Loader/Servant_Activator.cpp | 35 | ||||
-rw-r--r-- | tests/POA/Loader/Servant_Activator.h | 103 | ||||
-rw-r--r-- | tests/POA/Loader/Servant_Locator.cpp | 37 | ||||
-rw-r--r-- | tests/POA/Loader/Servant_Locator.h | 101 | ||||
-rw-r--r-- | tests/POA/Loader/Server_Manager.cpp | 2 | ||||
-rw-r--r-- | tests/POA/Loader/Server_Manager.h | 93 | ||||
-rwxr-xr-x | tests/POA/Loader/run_test.pl | 4 | ||||
-rw-r--r-- | tests/POA/Loader/server.cpp | 26 |
9 files changed, 196 insertions, 257 deletions
diff --git a/tests/POA/Loader/Makefile.am b/tests/POA/Loader/Makefile.am deleted file mode 100644 index fb675280511..00000000000 --- a/tests/POA/Loader/Makefile.am +++ /dev/null @@ -1,52 +0,0 @@ -## Process this file with automake to create Makefile.in -## -## $Id$ -## -## This file was generated by MPC. Any changes made directly to -## this file will be lost the next time it is generated. -## -## MPC Command: -## ../bin/mwc.pl -type automake -noreldefs TAO.mwc - -ACE_BUILDDIR = $(top_builddir)/.. -ACE_ROOT = $(top_srcdir)/.. -TAO_BUILDDIR = $(top_builddir) -TAO_ROOT = $(top_srcdir) - - -## Makefile.POA_Loader_Server.am - -if BUILD_EXCEPTIONS - -noinst_PROGRAMS = server - -server_CPPFLAGS = \ - -I$(ACE_ROOT) \ - -I$(ACE_BUILDDIR) \ - -I$(TAO_ROOT) \ - -I$(TAO_BUILDDIR) - -server_SOURCES = \ - Servant_Activator.cpp \ - Servant_Locator.cpp \ - Server_Manager.cpp \ - server.cpp \ - Servant_Activator.h \ - Servant_Locator.h \ - Server_Manager.h - -server_LDADD = \ - $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \ - $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \ - $(TAO_BUILDDIR)/tao/libTAO.la \ - $(ACE_BUILDDIR)/ace/libACE.la - -endif BUILD_EXCEPTIONS - -## Clean up template repositories, etc. -clean-local: - -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.* - -rm -f gcctemp.c gcctemp so_locations *.ics - -rm -rf cxx_repository ptrepository ti_files - -rm -rf templateregistry ir.out - -rm -rf ptrepository SunWS_cache Templates.DB diff --git a/tests/POA/Loader/Servant_Activator.cpp b/tests/POA/Loader/Servant_Activator.cpp index 76650d877d2..9f274cb60a4 100644 --- a/tests/POA/Loader/Servant_Activator.cpp +++ b/tests/POA/Loader/Servant_Activator.cpp @@ -1,29 +1,22 @@ -// $Id$ -// ============================================================================ -// -// = LIBRARY -// TAO/examples/POA/Loader -// -// = FILENAME -// Servant_Activator.cpp -// -// = DESCRIPTION -// Implementation of <ServantActivator>, which is used by a POA -// with a RETAIN policy. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ +//============================================================================= +/** + * @file Servant_Activator.cpp + * + * $Id$ + * + * Implementation of <ServantActivator>, which is used by a POA + * with a RETAIN policy. + * + * + * @author Kirthika Parameswaran <kirthika@cs.wustl.edu> + */ +//============================================================================= + #include "Servant_Activator.h" #include "ace/OS_NS_string.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 diff --git a/tests/POA/Loader/Servant_Activator.h b/tests/POA/Loader/Servant_Activator.h index 2b00f10541a..7f1815ac5ed 100644 --- a/tests/POA/Loader/Servant_Activator.h +++ b/tests/POA/Loader/Servant_Activator.h @@ -1,22 +1,17 @@ // 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> class, which activates a servant by -// obtaining it and associates it with an object on-demand. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ================================================================ +//============================================================================= +/** + * @file Servant_Activator.h + * + * $Id$ + * + * Defines a <ServantActivator> class, which activates a servant by + * obtaining it and associates it with an object on-demand. + * + * @author Kirthika Parameswaran <kirthika@cs.wustl.edu> + */ +//============================================================================= #ifndef SERVANT_ACTIVATOR_H #define SERVANT_ACTIVATOR_H @@ -30,76 +25,84 @@ #include "ace/DLL.h" #include "ace/Log_Msg.h" +/** + * Servant Activator for the test servant. + * + * This class associates an unassociated servant with an object in + * the POA Active Object Map. + */ class ServantActivator : public virtual PortableServer::ServantActivator, public virtual ::CORBA::LocalObject { - //= TITLE - // Servant Activator for the test servant. - // - //= DESCRIPTION - // This class associates an unassociated servant with an object in - // the POA Active Object Map. public: + /** + * 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 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. + /** + * This typedef is used to obtain the garbage_collection_function symbol + * in the dll. Invoking the function pointer obtained would then destroy + * the 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. + /// Initialization. ServantActivator (CORBA::ORB_ptr orb, const ACE_TCHAR *dllname, const ACE_TCHAR *factory_function, const ACE_TCHAR *garbage_collection_function); - // Initialization. + /** + * This method is invoked by a POA with USE_SERVANT_MANAGER and + * RETAIN policies, whenever it receives a request for a + * test 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 PortableServer::Servant incarnate (const PortableServer::ObjectId &oid, PortableServer::POA_ptr poa); - // This method is invoked by a POA with USE_SERVANT_MANAGER and - // RETAIN policies, whenever it receives a request for a - // test 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. + /** + * This method is invoked whenever a test 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. + */ virtual void etherealize (const PortableServer::ObjectId &oid, PortableServer::POA_ptr adapter, PortableServer::Servant servant, CORBA::Boolean cleanup_in_progress, CORBA::Boolean remaining_activations); - // This method is invoked whenever a test 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: + /// The ACE_DLL object which performs the task of loading the dll + /// and accessing it. ACE_DLL dll_; - // The ACE_DLL object which performs the task of loading the dll - // and accessing it. + /// The function pointer of factory_function type. SERVANT_FACTORY servant_supplier_; - // The function pointer of factory_function type. + /// The function pointer of garbage_collection_function type. SERVANT_GARBAGE_COLLECTOR servant_garbage_collector_; - // The function pointer of garbage_collection_function type. + /// A reference to the ORB. CORBA::ORB_var orb_; - // A reference to the ORB. }; #endif /* SERVANT_ACTIVATOR_H */ diff --git a/tests/POA/Loader/Servant_Locator.cpp b/tests/POA/Loader/Servant_Locator.cpp index c7c91e02667..7faaa0a429d 100644 --- a/tests/POA/Loader/Servant_Locator.cpp +++ b/tests/POA/Loader/Servant_Locator.cpp @@ -1,29 +1,22 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO/examples/POA/Loader -// -// = FILENAME -// Servant_Locator.cpp -// -// = DESCRIPTION -// Implementation of ServantLocator class, used with a POA -// having a NON_RETAIN policy. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ + +//============================================================================= +/** + * @file Servant_Locator.cpp + * + * $Id$ + * + * Implementation of ServantLocator class, used with a POA + * having a NON_RETAIN policy. + * + * + * @author Kirthika Parameswaran <kirthika@cs.wustl.edu> + */ +//============================================================================= + #include "Servant_Locator.h" #include "ace/OS_NS_string.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 diff --git a/tests/POA/Loader/Servant_Locator.h b/tests/POA/Loader/Servant_Locator.h index 2c4c64a92a4..050856983b3 100644 --- a/tests/POA/Loader/Servant_Locator.h +++ b/tests/POA/Loader/Servant_Locator.h @@ -1,22 +1,19 @@ // This may look like C, but it's really -*- C++ -*- -// $Id$ - -// ================================================================ -// -// = LIBRARY -// TAO/examples/POA/Loader -// -// = FILENAME -// Servant_Locator.h -// -// = DESCRIPTION -// Defines a ServantLocator class , used with a POA having -// a NON_RETAIN policy. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ================================================================ + +//============================================================================= +/** + * @file Servant_Locator.h + * + * $Id$ + * + * Defines a ServantLocator class , used with a POA having + * a NON_RETAIN policy. + * + * + * @author Kirthika Parameswaran <kirthika@cs.wustl.edu> + */ +//============================================================================= + #ifndef SERVANT_LOCATOR_H #define SERVANT_LOCATOR_H @@ -44,74 +41,82 @@ class ServantLocator : // Manager. It is invoked when the POA has an USE_SERVANT_MANAGER // policy and a servant_retention policy of NON_RETAIN type. public: + /** + * 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 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. + /** + * This typedef is used to obtain the garbage_collection_function symbol + * in the dll. Invoking the function pointer obtained would then destroy + * the 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. + /// Constructor. ServantLocator (CORBA::ORB_ptr orb, const ACE_TCHAR *dllname, const ACE_TCHAR *factory_function, const ACE_TCHAR *garbage_collection_function); - // Constructor. + /** + * This method is invoked by a POA whenever it receives a request + * for test 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 PortableServer::Servant preinvoke (const PortableServer::ObjectId &oid, PortableServer::POA_ptr adapter, const char *operation, PortableServer::ServantLocator::Cookie &the_cookie); - // This method is invoked by a POA whenever it receives a request - // for test 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. + /** + * This method is invoked whenever a test servant 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. + */ virtual void postinvoke (const PortableServer::ObjectId &oid, PortableServer::POA_ptr adapter, const char *operation, PortableServer::ServantLocator::Cookie the_cookie, PortableServer::Servant the_servant); - // This method is invoked whenever a test servant 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: + /// The name of the dll containing the servant. ACE_CString dllname_; - // The name of the dll containing the servant. + /// The symbol which on getting invoked will give us the servant + /// pointer. ACE_CString create_symbol_; - // The symbol which on getting invoked will give us the servant - // pointer. + /// The ACE_DLL object which performs the task of loading the dll + /// and accessing it. ACE_DLL dll_; - // The ACE_DLL object which performs the task of loading the dll - // and accessing it. + /// The function pointer of factory_function type. SERVANT_FACTORY servant_supplier_; - // The function pointer of factory_function type. + /// The function pointer of garbage_collection_function type. SERVANT_GARBAGE_COLLECTOR servant_garbage_collector_; - // The function pointer of garbage_collection_function type. + /// A reference to the ORB. CORBA::ORB_var orb_; - // A reference to the ORB. }; #endif /* SERVANT_LOCATOR_H */ diff --git a/tests/POA/Loader/Server_Manager.cpp b/tests/POA/Loader/Server_Manager.cpp index eae582da9c6..3511aeffe3b 100644 --- a/tests/POA/Loader/Server_Manager.cpp +++ b/tests/POA/Loader/Server_Manager.cpp @@ -4,8 +4,6 @@ #include "ace/Get_Opt.h" #include "ace/OS_NS_stdio.h" -ACE_RCSID(Loader, Server_Manager, "$Id$") - Server_i::Server_i (void) : ior_output_file_ (0), policies_ (4) diff --git a/tests/POA/Loader/Server_Manager.h b/tests/POA/Loader/Server_Manager.h index 84d347dc2b4..15db7a8549a 100644 --- a/tests/POA/Loader/Server_Manager.h +++ b/tests/POA/Loader/Server_Manager.h @@ -1,102 +1,103 @@ // 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> -// +/** + * @file Server_Manager.h + * + * $Id$ + * + * Helper class for the server application. + * + * + * @author Kirthika Parameswaran <kirthika@cs.wustl.edu> + */ //============================================================================= + #ifndef SERVER_MANAGER_H #define SERVER_MANAGER_H #include "Servant_Activator.h" #include "Servant_Locator.h" +/** + * @class Server_i + * + * @brief This class provides the server application with helper methods + * + * 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. + */ 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. + /// Initialisation. Server_i (void); - // Initialisation. + /// Destruction. ~Server_i (void); - // Destruction. + /// Initialisation of the ORB and poa. int init (int argc, ACE_TCHAR **argv); - // Initialisation of the ORB and poa. + /** + * 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. + */ 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. + /// A ServantActivator object is created and initialised. int create_activator (PortableServer::POA_var first_poa); - // A ServantActivator object is created and initialised. + /// A ServantActivator object is created and initialised. int create_locator (PortableServer::POA_var second_poa); - // A ServantActivator object is created and initialised. + /// The server is executed. int run (void); - // The server is executed. private: + /// Parses the input arguments. int parse_args (int argc, ACE_TCHAR **argv); - // Parses the input arguments. + /// The IORs are written to a file for future use. int write_iors_to_file (const char *first_ior, const char *second_ior); - // The IORs are written to a file for future use. + /// Default ior file. ACE_TCHAR *ior_output_file_; - // Default ior file. + /// The orb pointer. CORBA::ORB_var orb_; - // The orb pointer. + /// The poa policicies. CORBA::PolicyList policies_; - // The poa policicies. + /// The root_poa which is used for cretaing different child poas. PortableServer::POA_var root_poa_; - // The root_poa which is used for cretaing different child poas. + /// The poa_manager object. PortableServer::POAManager_var poa_manager_; - // The poa_manager object. + /// The object pointer used by the ServantActivator. CORBA::Object_var first_test_; - // The object pointer used by the ServantActivator. + /// The object pointer used by the Servant Locator. CORBA::Object_var second_test_; - // The object pointer used by the Servant Locator. + /// The servant activator object. ServantActivator *servant_activator_; - // The servant activator object. + /// The servant locator object. ServantLocator *servant_locator_; - // The servant locator object. }; #endif /* SERVER_MANAGER_H */ diff --git a/tests/POA/Loader/run_test.pl b/tests/POA/Loader/run_test.pl index 0bc52287cac..83dda3bc405 100755 --- a/tests/POA/Loader/run_test.pl +++ b/tests/POA/Loader/run_test.pl @@ -18,8 +18,8 @@ $extra_args = ""; $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; - -$server->AddLibPath ('../Generic_Servant/.'); + +$server->AddLibPath ('../Generic_Servant/.'); $client->AddLibPath ('../Generic_Servant/.'); # Parse the arguments diff --git a/tests/POA/Loader/server.cpp b/tests/POA/Loader/server.cpp index 55e2f7f8b3f..809eccba1fa 100644 --- a/tests/POA/Loader/server.cpp +++ b/tests/POA/Loader/server.cpp @@ -1,21 +1,19 @@ -// $Id$ -//============================================================================ -// -// = FILENAME -// server.cpp -// -// = DESCRIPTION -// Server application to test the Servant Activator and Servant Locator. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// +//============================================================================= +/** + * @file server.cpp + * + * $Id$ + * + * 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$") +#include "Server_Manager.h" int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) |