diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
commit | 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (patch) | |
tree | da50d054f9c761c3f6a5923f6979e93306c56d68 /TAO/examples/POA/DSI | |
parent | 0e555b9150d38e3b3473ba325b56db2642e6352b (diff) | |
download | ATCD-6b846cf03c0bcbd8c276cb0af61a181e5f98eaae.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/examples/POA/DSI')
-rw-r--r-- | TAO/examples/POA/DSI/Database.idl | 75 | ||||
-rw-r--r-- | TAO/examples/POA/DSI/Database_i.cpp | 415 | ||||
-rw-r--r-- | TAO/examples/POA/DSI/Database_i.h | 149 | ||||
-rw-r--r-- | TAO/examples/POA/DSI/Makefile.am | 121 | ||||
-rw-r--r-- | TAO/examples/POA/DSI/POA_DSI.mpc | 29 | ||||
-rw-r--r-- | TAO/examples/POA/DSI/README | 4 | ||||
-rw-r--r-- | TAO/examples/POA/DSI/client.cpp | 233 | ||||
-rwxr-xr-x | TAO/examples/POA/DSI/run_test.pl | 42 | ||||
-rw-r--r-- | TAO/examples/POA/DSI/server.cpp | 204 |
9 files changed, 0 insertions, 1272 deletions
diff --git a/TAO/examples/POA/DSI/Database.idl b/TAO/examples/POA/DSI/Database.idl deleted file mode 100644 index b2b0b21cb2b..00000000000 --- a/TAO/examples/POA/DSI/Database.idl +++ /dev/null @@ -1,75 +0,0 @@ -// $Id$ - -module Database -{ - typedef unsigned long Flags; - - typedef string Identifier; - - exception Unknown_Type - { - string type; - }; - - exception Unknown_Key - { - string key; - }; - - exception Duplicate_Key - { - string key; - }; - - exception Not_Found - { - string key; - }; - - interface Entry - { - readonly attribute string name; - }; - - interface Employee : Entry - { - attribute long id; - }; - - /* - interface Machine : Entry - { - attribute string make; - }; - */ - - struct NamedValue - { - Identifier name; - any value; - Flags options; - }; - - typedef sequence<NamedValue> NVPairSequence; - - interface Agent - { - Entry create_entry (in string key, - in Identifier entry_type, - in NVPairSequence initial_attributes) - raises (Unknown_Type, - Duplicate_Key); - - Entry find_entry (in string key, - in Identifier entry_type) - raises (Unknown_Type, - Not_Found); - - void destroy_entry (in string key, - in Identifier entry_type) - raises (Unknown_Type, - Unknown_Key); - - oneway void shutdown (); - }; -}; diff --git a/TAO/examples/POA/DSI/Database_i.cpp b/TAO/examples/POA/DSI/Database_i.cpp deleted file mode 100644 index d4af66acb11..00000000000 --- a/TAO/examples/POA/DSI/Database_i.cpp +++ /dev/null @@ -1,415 +0,0 @@ -// $Id$ - -#include "Database_i.h" - -#include "tao/DynamicInterface/Server_Request.h" - -#include "tao/AnyTypeCode/NVList.h" -#include "tao/AnyTypeCode/TypeCode.h" -#include "ace/Null_Mutex.h" - -ACE_RCSID (DSI, - Database_i, - "$Id$") - -DatabaseImpl::Simpler_Database_Malloc::Simpler_Database_Malloc (void) - // : DATABASE_MALLOC () -{ -} - -DatabaseImpl::Simpler_Database_Malloc::~Simpler_Database_Malloc (void) -{ - this->remove (); -} - -DatabaseImpl::Entry::Entry (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa - ACE_ENV_ARG_DECL) - : orb_ (CORBA::ORB::_duplicate (orb)), - poa_ (PortableServer::POA::_duplicate (poa)) -{ - // Get the POA Current object reference - CORBA::Object_var obj = - this->orb_->resolve_initial_references ("POACurrent" - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // Narrow the object reference to a POA Current reference - this->poa_current_ = - PortableServer::Current::_narrow (obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -DatabaseImpl::Entry::~Entry (void) -{ -} - -void -DatabaseImpl::Entry::invoke (CORBA::ServerRequest_ptr request - ACE_ENV_ARG_DECL) -{ - // The servant determines the key associated with the database - // entry represented by self. - PortableServer::ObjectId_var oid = - this->poa_current_->get_object_id (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - // Now convert the id into a string - CORBA::String_var key = - PortableServer::ObjectId_to_string (oid.in ()); - - // Get the operation name for this request - const char *operation = - request->operation (); - - if (ACE_OS::strcmp (operation, - "_is_a") == 0) - { - this->is_a (request ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - else - ACE_THROW (CORBA::NO_IMPLEMENT ()); -} - -void -DatabaseImpl::Entry::is_a (CORBA::ServerRequest_ptr request - ACE_ENV_ARG_DECL) -{ - CORBA::NVList_ptr list; - this->orb_->create_list (0, list); - - CORBA::Any any_1; - any_1._tao_set_typecode (CORBA::_tc_string); - - list->add_value ("value", - any_1, - CORBA::ARG_IN - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - request->arguments (list - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - CORBA::NamedValue_ptr nv = list->item (0 - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - CORBA::Any_ptr ap = nv->value (); - const char *value; - *ap >>= value; - - const char *object_id = - CORBA::_tc_Object->id (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - CORBA::Boolean result; - if (ACE_OS::strcmp (value, "IDL:Database/Employee:1.0") == 0 - || ACE_OS::strcmp (value, "IDL:Database/Entry:1.0") == 0 - || ACE_OS::strcmp (value, object_id) == 0) - result = 1; - else - result = 0; - - CORBA::Any result_any; - CORBA::Any::from_boolean from_boolean (result); - result_any <<= from_boolean; - - request->set_result (result_any ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -CORBA::RepositoryId -DatabaseImpl::Entry::_primary_interface (const PortableServer::ObjectId &/*oid*/, - PortableServer::POA_ptr - ACE_ENV_ARG_DECL_NOT_USED) -{ - return 0; -} - -PortableServer::POA_ptr -DatabaseImpl::Entry::_default_POA (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - return PortableServer::POA::_duplicate (this->poa_.in ()); -} - -DatabaseImpl::Agent::Agent (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa - ACE_ENV_ARG_DECL) - : orb_ (CORBA::ORB::_duplicate (orb)), - poa_ (PortableServer::POA::_duplicate (poa)), - common_servant_ (orb, - poa - ACE_ENV_ARG_PARAMETER) -{ - ACE_CHECK; - - this->poa_->set_servant (&this->common_servant_ - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -DatabaseImpl::Agent::~Agent (void) -{ -} - -Database::Entry_ptr -DatabaseImpl::Agent::create_entry (const char *key, - const char *entry_type, - const Database::NVPairSequence &initial_attributes - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - Database::Unknown_Type, - Database::Duplicate_Key)) -{ - // Create a new entry in the database: - if (ACE_OS::strcmp (entry_type, "Employee") != 0 - || initial_attributes.length () != 2) - ACE_THROW_RETURN (Database::Unknown_Type (), - Database::Entry::_nil ()); - - const char *name = 0; - CORBA::Long id = 0; - - const Database::NamedValue &first = - initial_attributes[0]; - const Database::NamedValue &second = - initial_attributes[1]; - - if (ACE_OS::strcmp (first.name.in (), "name") != 0 - || ACE_OS::strcmp (second.name.in (), "id") != 0) - ACE_THROW_RETURN (Database::Unknown_Type (), - Database::Entry::_nil ()); - - first.value >>= name; - second.value >>= id; - - Employee *new_employee; - // This attempts to create a new Employee and throws an exception - // and returns a null value if it fails - ACE_NEW_THROW_EX (new_employee, - Employee (name, id), - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (Database::Entry::_nil ()); - - // @@ Should check the return value here and throw an exception if - // it fails. - DATABASE::instance ()->bind (key, - new_employee); - - ACE_DEBUG ((LM_DEBUG, - "New employee created with name = %s and id = %d\n", - name, - id)); - - // Creates a reference to the CORBA object used to encapsulate - // access to the new entry in the database. There is an interface - // for each entry type: - PortableServer::ObjectId_var obj_id = - PortableServer::string_to_ObjectId (key); - CORBA::String_var repository_id = - DatabaseImpl::entry_type_to_repository_id ("Entry"); - - CORBA::Object_var obj = - this->poa_->create_reference_with_id (obj_id.in (), - repository_id.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (Database::Entry::_nil ()); - - Database::Entry_var entry = Database::Entry::_narrow (obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (Database::Entry::_nil ()); - - return entry._retn (); -} - -Database::Entry_ptr -DatabaseImpl::Agent::find_entry (const char *key, - const char *entry_type - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - Database::Unknown_Type, - Database::Not_Found)) -{ - if (ACE_OS::strcmp (entry_type, - "Employee") != 0) - ACE_THROW_RETURN (Database::Unknown_Type (), - Database::Entry::_nil ()); - - void *temp; - Database::Entry_var entry; - if (DATABASE::instance ()->find (key, temp) == 0) - { - Employee *employee = - reinterpret_cast<Employee *> (temp); - ACE_DEBUG ((LM_DEBUG, - "Employee with key = %s found: name = %s and id = %d\n", - key, - employee->name (), - employee->id ())); - - // Creates a reference to the CORBA object used to encapsulate - // access to the new entry in the database. There is an - // interface for each entry type: - PortableServer::ObjectId_var obj_id = - PortableServer::string_to_ObjectId (key); - CORBA::String_var repository_id = - DatabaseImpl::entry_type_to_repository_id ("Entry"); - CORBA::Object_var obj = - this->poa_->create_reference_with_id (obj_id.in (), - repository_id.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (Database::Entry::_nil ()); - - entry = Database::Entry::_narrow (obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (Database::Entry::_nil ()); - } - else - { - ACE_DEBUG ((LM_DEBUG, - "Employee with key = %s not found\n", - key)); - - ACE_THROW_RETURN (Database::Not_Found (), - Database::Entry::_nil ()); - } - - return entry._retn (); -} - -void -DatabaseImpl::Agent::destroy_entry (const char *key, - const char *entry_type - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - Database::Unknown_Type, - Database::Unknown_Key)) -{ - if (ACE_OS::strcmp (entry_type, "Employee") != 0) - ACE_THROW (Database::Unknown_Type ()); - - void *temp; - if (DATABASE::instance ()->unbind (key, temp) == 0) - { - Employee *employee = - reinterpret_cast<Employee *> (temp); - ACE_DEBUG ((LM_DEBUG, - "Employee with key = %s will be removed from the database: " - "name = %s and id = %d \n", - key, - employee->name (), - employee->id ())); - - delete employee; - } - else - { - ACE_DEBUG ((LM_DEBUG, - "Employee with key = %s not found\n", - key)); - - ACE_THROW (Database::Unknown_Key ()); - } -} - -void -DatabaseImpl::Agent::shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->orb_->shutdown (); -} - -PortableServer::POA_ptr -DatabaseImpl::Agent::_default_POA (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - return PortableServer::POA::_duplicate (this->poa_.in ()); -} - -char * -DatabaseImpl::entry_type_to_repository_id (const char *entry_type) -{ - static const char *prefix = "IDL:Database/"; - static int prefix_length = ACE_OS::strlen (prefix); - static const char *suffix = ":1.0"; - static int suffix_length = ACE_OS::strlen (prefix); - - int len = - prefix_length + - ACE_OS::strlen (entry_type) + - suffix_length + - 1; - - char *result = CORBA::string_alloc (len); - ACE_OS::sprintf (result, - "%s%s%s", - prefix, - entry_type, - suffix); - return result; -} - -DatabaseImpl::Employee::Employee (const char* name, - CORBA::Long id) - : id_ (id), - name_ (0) -{ - this->name (name); -} - -DatabaseImpl::Employee::~Employee (void) -{ - DATABASE::instance ()->free (this->name_); -} - -const char * -DatabaseImpl::Employee::name (void) const - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->name_; -} - -void -DatabaseImpl::Employee::name (const char* name) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - DATABASE::instance ()->free (this->name_); - - this->name_ = - (char *) DATABASE::instance ()->malloc (ACE_OS::strlen (name) + 1); - - ACE_OS::strcpy (this->name_, - name); -} - -CORBA::Long -DatabaseImpl::Employee::id (void) const - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->id_; -} - -void -DatabaseImpl::Employee::id (CORBA::Long id) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->id_ = id; -} - -void * -DatabaseImpl::Employee::operator new (size_t size) -{ - return DATABASE::instance ()->malloc (size); -} - -void -DatabaseImpl::Employee::operator delete (void *pointer) -{ - DATABASE::instance ()->free (pointer); -} - -#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) -template ACE_Singleton<DatabaseImpl::Simpler_Database_Malloc, ACE_Null_Mutex> *ACE_Singleton<DatabaseImpl::Simpler_Database_Malloc, ACE_Null_Mutex>::singleton_; -#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ diff --git a/TAO/examples/POA/DSI/Database_i.h b/TAO/examples/POA/DSI/Database_i.h deleted file mode 100644 index 4ef67eb752d..00000000000 --- a/TAO/examples/POA/DSI/Database_i.h +++ /dev/null @@ -1,149 +0,0 @@ -// $Id$ - -#include "DatabaseS.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/DynamicInterface/Dynamic_Implementation.h" -#include "tao/PortableServer/PortableServer.h" -#include "ace/Singleton.h" -#include "ace/Local_Memory_Pool.h" -#include "ace/Malloc_T.h" - - -class DatabaseImpl -{ -public: - - //typedef ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> DATABASE_MALLOC; - typedef ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> DATABASE_MALLOC; - - class Simpler_Database_Malloc : public DATABASE_MALLOC - { - public: - Simpler_Database_Malloc (void); - ~Simpler_Database_Malloc (void); - }; - - typedef ACE_Singleton<Simpler_Database_Malloc, ACE_Null_Mutex> DATABASE; - //typedef ACE_Malloc_Iterator<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> DATABASE_ITERATOR; - typedef ACE_Malloc_Iterator<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> DATABASE_ITERATOR; - - class Entry : public TAO_DynamicImplementation - { - public: - Entry (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa - ACE_ENV_ARG_DECL_NOT_USED); - ~Entry (void); - - virtual void invoke (CORBA::ServerRequest_ptr request - ACE_ENV_ARG_DECL); - // The invoke() method receives requests issued to any CORBA - // object incarnated by the DSI servant and performs the - // processing necessary to execute the request. - - virtual CORBA::RepositoryId _primary_interface (const PortableServer::ObjectId &oid, - PortableServer::POA_ptr poa - ACE_ENV_ARG_DECL); - // The _primary_interface() method receives an ObjectId value and - // a POA_ptr as input parameters and returns a valid RepositoryId - // representing the most-derived interface for that oid. - - virtual PortableServer::POA_ptr _default_POA (ACE_ENV_SINGLE_ARG_DECL); - // Returns the default POA for this servant. - - virtual void is_a (CORBA::ServerRequest_ptr request - ACE_ENV_ARG_DECL); - // Handles the _is_a call - - protected: - CORBA::ORB_var orb_; - // ORB (auto) pointer - - PortableServer::POA_var poa_; - // Default POA - - PortableServer::Current_var poa_current_; - // POA Current. - }; - - class Agent : public POA_Database::Agent - { - public: - Agent (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa - ACE_ENV_ARG_DECL_NOT_USED); - ~Agent (void); - - virtual Database::Entry_ptr create_entry (const char *key, - const char *entry_type, - const Database::NVPairSequence &initial_attributes - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - Database::Unknown_Type, - Database::Duplicate_Key)); - - virtual Database::Entry_ptr find_entry (const char *key, - const char *entry_type - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - Database::Unknown_Type, - Database::Not_Found)); - - virtual void destroy_entry (const char *key, - const char *entry_type - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - Database::Unknown_Type, - Database::Unknown_Key)); - - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual PortableServer::POA_ptr _default_POA (ACE_ENV_SINGLE_ARG_DECL); - // Returns the default POA for this servant. - - protected: - CORBA::ORB_var orb_; - // ORB (auto) pointer - - PortableServer::POA_var poa_; - // Default POA - - Entry common_servant_; - }; - - static char *entry_type_to_repository_id (const char *entry_type); - - class Employee - { - public: - Employee (const char* name, - CORBA::Long id); - - ~Employee (void); - - const char *name (void) const - ACE_THROW_SPEC ((CORBA::SystemException)); - void name (const char* name) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CORBA::Long id (void) const - ACE_THROW_SPEC ((CORBA::SystemException)); - void id (CORBA::Long id) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void *operator new (size_t); - void operator delete (void *pointer); - - private: - CORBA::Long id_; - // Employee ID. - - char *name_; - // Employee name. - }; -}; diff --git a/TAO/examples/POA/DSI/Makefile.am b/TAO/examples/POA/DSI/Makefile.am deleted file mode 100644 index 4e949a08ed5..00000000000 --- a/TAO/examples/POA/DSI/Makefile.am +++ /dev/null @@ -1,121 +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_IDL = ACE_ROOT=$(ACE_ROOT) TAO_ROOT=$(TAO_ROOT) $(TAO_BUILDDIR)/TAO_IDL/tao_idl -TAO_IDL_DEP = $(TAO_BUILDDIR)/TAO_IDL/tao_idl -TAO_IDLFLAGS = -Ge 1 -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -I$(srcdir) -g $(ACE_BUILDDIR)/apps/gperf/src/gperf -TAO_ROOT = $(top_srcdir) - -noinst_PROGRAMS = - -## Makefile.POA_DSI_IDL.am - -BUILT_SOURCES = \ - DatabaseC.cpp \ - DatabaseC.h \ - DatabaseC.inl \ - DatabaseS.cpp \ - DatabaseS.h \ - DatabaseS.inl - -CLEANFILES = \ - Database-stamp \ - DatabaseC.cpp \ - DatabaseC.h \ - DatabaseC.inl \ - DatabaseS.cpp \ - DatabaseS.h \ - DatabaseS.inl - -DatabaseC.cpp DatabaseC.h DatabaseC.inl DatabaseS.cpp DatabaseS.h DatabaseS.inl: Database-stamp - -Database-stamp: $(srcdir)/Database.idl $(TAO_IDL_DEP) - $(TAO_IDL) $(TAO_IDLFLAGS) -Sa -St $(srcdir)/Database.idl - @touch $@ - - -noinst_HEADERS = \ - Database.idl - -## Makefile.POA_DSI_Client.am - -if BUILD_CORBA_MESSAGING -if !BUILD_MINIMUM_CORBA - -noinst_PROGRAMS += client - -client_CPPFLAGS = \ - -I$(ACE_ROOT) \ - -I$(ACE_BUILDDIR) \ - -I$(TAO_ROOT) \ - -I$(TAO_BUILDDIR) - -client_SOURCES = \ - DatabaseC.cpp \ - client.cpp \ - Database_i.h - -client_LDADD = \ - $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \ - $(TAO_BUILDDIR)/tao/libTAO_PI.la \ - $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \ - $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \ - $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \ - $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \ - $(TAO_BUILDDIR)/tao/libTAO.la \ - $(ACE_BUILDDIR)/ace/libACE.la - -endif !BUILD_MINIMUM_CORBA -endif BUILD_CORBA_MESSAGING - -## Makefile.POA_DSI_Server.am - -if BUILD_CORBA_MESSAGING -if !BUILD_MINIMUM_CORBA - -noinst_PROGRAMS += server - -server_CPPFLAGS = \ - -I$(ACE_ROOT) \ - -I$(ACE_BUILDDIR) \ - -I$(TAO_ROOT) \ - -I$(TAO_BUILDDIR) - -server_SOURCES = \ - DatabaseC.cpp \ - DatabaseS.cpp \ - Database_i.cpp \ - server.cpp \ - Database_i.h - -server_LDADD = \ - $(TAO_BUILDDIR)/tao/libTAO_DynamicInterface.la \ - $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \ - $(TAO_BUILDDIR)/tao/libTAO_PI.la \ - $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \ - $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \ - $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \ - $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \ - $(TAO_BUILDDIR)/tao/libTAO.la \ - $(ACE_BUILDDIR)/ace/libACE.la - -endif !BUILD_MINIMUM_CORBA -endif BUILD_CORBA_MESSAGING - -## 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/TAO/examples/POA/DSI/POA_DSI.mpc b/TAO/examples/POA/DSI/POA_DSI.mpc deleted file mode 100644 index 508a5b3f898..00000000000 --- a/TAO/examples/POA/DSI/POA_DSI.mpc +++ /dev/null @@ -1,29 +0,0 @@ -//$Id$ -project(*IDL): taoidldefaults { - IDL_Files { - Database.idl - } - custom_only = 1 -} - -project(*Client) : taoclient, messaging, minimum_corba { - after += *IDL - source_files { - DatabaseC.cpp - client.cpp - } - IDL_Files { - } -} - -project(*Server) : taoserver, messaging, dynamicinterface, minimum_corba { - after += *IDL - source_files { - Database_i.cpp - server.cpp - DatabaseS.cpp - DatabaseC.cpp - } - IDL_Files { - } -} diff --git a/TAO/examples/POA/DSI/README b/TAO/examples/POA/DSI/README deleted file mode 100644 index f2da382e968..00000000000 --- a/TAO/examples/POA/DSI/README +++ /dev/null @@ -1,4 +0,0 @@ -$Id$ -Note: If you run the test, and nothing happens, that's a good thing. This -is more of an example than a test, and therefore is not very -verbose. diff --git a/TAO/examples/POA/DSI/client.cpp b/TAO/examples/POA/DSI/client.cpp deleted file mode 100644 index f3361796b0b..00000000000 --- a/TAO/examples/POA/DSI/client.cpp +++ /dev/null @@ -1,233 +0,0 @@ -// $Id$ - -//=================================================================== -// = LIBRARY -// TAO/tests/POA/DSI/client -// -// = FILENAME -// client.cpp -// -// = DESCRIPTION -// A client program for the Database IDL module -// -// = AUTHOR -// Irfan Pyarali -// -//==================================================================== - -#include "ace/Get_Opt.h" -#include "ace/Read_Buffer.h" -#include "DatabaseC.h" -#include "ace/OS_NS_fcntl.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_string.h" - -ACE_RCSID(DSI, client, "$Id$") - -static char *IOR = 0; -static const char *IOR_file = 0; -static int shutdown_server = 0; - -static int -parse_args (int argc, char **argv) -{ - ACE_Get_Opt get_opts (argc, argv, "xk:f:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'k': - IOR = ACE_OS::strdup (get_opts.opt_arg ()); - break; - - case 'f': - IOR_file = get_opts.opt_arg (); - break; - - case 'x': - shutdown_server = 1; - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s" - "-k IOR " - "-f IOR file " - "-x [for shutting down the server] " - "\n", - argv [0]), - -1); - } - - if (IOR == 0 && IOR_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Please specify the IOR or IOR_file for the servant\n"), - -1); - - // Indicates successful parsing of command line. - return 0; -} - -int -read_IOR_from_file (void) -{ - // Open the file for reading. - ACE_HANDLE f_handle = - ACE_OS::open (IOR_file, 0); - - if (f_handle == ACE_INVALID_HANDLE) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to open %s for reading\n", - IOR_file), - -1); - - ACE_Read_Buffer ior_buffer (f_handle); - char *data = ior_buffer.read (); - - if (data == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to read ior\n"), - -1); - - IOR = ACE_OS::strdup (data); - ior_buffer.alloc ()->free (data); - - ACE_OS::close (f_handle); - - return 0; -} - -int -main (int argc, char **argv) -{ - ACE_DECLARE_NEW_CORBA_ENV; - - char str [255]; - // Initialize the ORB - ACE_TRY - { - ACE_OS::strcpy (str, - "CORBA::ORB_init"); - CORBA::ORB_var orb = CORBA::ORB_init (argc, - argv, - - 0 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Parse the command-line arguments to get the location of the - // IOR - if (parse_args (argc, argv) == -1) - return -1; - - if (IOR == 0) - { - int result = read_IOR_from_file (); - if (result != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot read IOR from %s\n", - IOR_file), - -1); - } - - ACE_OS::strcpy (str, - "CORBA::ORB::string_to_object"); - - // Get the object reference with the IOR - CORBA::Object_var object = orb->string_to_object (IOR - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_OS::strcpy (str, - "Database::Agent::_narrow"); - - // Narrow the object reference to a Database::Agent - Database::Agent_var database_agent = - Database::Agent::_narrow (object.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - Database::NVPairSequence employee_attributes (2); - employee_attributes.length (2); - - Database::NamedValue &first = - employee_attributes[0]; - Database::NamedValue &second = - employee_attributes[1]; - - const char *name = "irfan"; - CORBA::Long id = 555; - - first.name = CORBA::string_dup ("name"); - first.value <<= name; - second.name = CORBA::string_dup ("id"); - second.value <<= id; - - ACE_OS::strcpy (str, - "Database::Agent::create_entry"); - - // Create an employee - Database::Entry_var entry = - database_agent->create_entry ("irfan", - "Employee", - employee_attributes - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_OS::strcpy (str, "Database::Employee::_narrow"); - - Database::Employee_var employee = - Database::Employee::_narrow (entry.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - /* - * - * NOT IMPLEMENTED YET - * - * - */ - -#if 0 - // Reset the id - ACE_OS::strcpy (str, "Database::Employee::id"); - employee->id (666 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; -#endif /* 0 */ - - ACE_OS::strcpy (str, "Database::Entry::find"); - // Find the employee - entry = database_agent->find_entry ("irfan", - "Employee" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_OS::strcpy (str, "Database::Entry::destroy"); - // Destroy the employee - database_agent->destroy_entry ("irfan", - "Employee" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_OS::strcpy (str, "Shutdown server"); - - if (shutdown_server) - { - database_agent->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - - ACE_OS::free (IOR); - - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, str); - return -1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); - - return 0; -} diff --git a/TAO/examples/POA/DSI/run_test.pl b/TAO/examples/POA/DSI/run_test.pl deleted file mode 100755 index c044fbd4fe1..00000000000 --- a/TAO/examples/POA/DSI/run_test.pl +++ /dev/null @@ -1,42 +0,0 @@ -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -# $Id$ -# -*- perl -*- - -use lib '../../../../bin'; -use PerlACE::Run_Test; - -$status = 0; -$iorfile = PerlACE::LocalFile ("server.ior"); - -unlink $iorfile; - -$SV = new PerlACE::Process ("server", "-f $iorfile"); -$CL = new PerlACE::Process ("client", "-f $iorfile -x"); - -$SV->Spawn (); - -if (PerlACE::waitforfile_timed ($iorfile, 10) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); - exit 1; -} - -$client = $CL->SpawnWaitKill (60); -$server = $SV->WaitKill (5); - -unlink $iorfile; - -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; -} - -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; - $status = 1; -} - -exit $status; diff --git a/TAO/examples/POA/DSI/server.cpp b/TAO/examples/POA/DSI/server.cpp deleted file mode 100644 index 2e7bc06fe6e..00000000000 --- a/TAO/examples/POA/DSI/server.cpp +++ /dev/null @@ -1,204 +0,0 @@ -// $Id$ - -//=================================================================== -// = LIBRARY -// TAO/tests/POA/Default_Servant/server -// -// = FILENAME -// server.cpp -// -// = DESCRIPTION -// A server program for the File IDL module -// -// = AUTHOR -// Irfan Pyarali -// -//==================================================================== - -#include "Database_i.h" -#include "ace/Get_Opt.h" -#include "ace/SString.h" - -ACE_RCSID(DSI, server, "$Id$") - -static const char *ior_output_file = "ior"; - -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.opt_arg (); - 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) -{ - FILE *output_file = ACE_OS::fopen (ior_output_file, "w"); - - if (output_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output files for writing IOR: %s\n", - ior_output_file), - -1); - - int result = 0; - - result = ACE_OS::fprintf (output_file, - "%s", - first_ior); - if (result < 0 || - 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); - - ACE_OS::fclose (output_file); - - return 0; -} - -int -main (int argc, char **argv) -{ - ACE_DECLARE_NEW_CORBA_ENV; - - ACE_TRY - { - // Initialize the ORB - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0 ACE_ENV_ARG_PARAMETER); - 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" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Narrow the object reference to a POA reference - PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::PolicyList policies (5); - policies.length (5); - - // ID Assignment Policy - policies[0] = - root_poa->create_id_assignment_policy (PortableServer::USER_ID ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Lifespan Policy - policies[1] = - root_poa->create_lifespan_policy (PortableServer::PERSISTENT - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Request Processing Policy - policies[2] = - root_poa->create_request_processing_policy (PortableServer::USE_DEFAULT_SERVANT - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Servant Retention Policy - policies[3] = - root_poa->create_servant_retention_policy (PortableServer::RETAIN ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Id Uniqueness Policy - policies[4] = - root_poa->create_id_uniqueness_policy (PortableServer::MULTIPLE_ID ACE_ENV_ARG_PARAMETER); - - ACE_TRY_CHECK; - - ACE_CString name = "firstPOA"; - PortableServer::POA_var first_poa = root_poa->create_POA (name.c_str (), - poa_manager.in (), - policies - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - for (CORBA::ULong i = 0; - i < policies.length (); - ++i) - { - CORBA::Policy_ptr policy = policies[i]; - policy->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - - // Create a Database Agent Implementation object in first_poa - DatabaseImpl::Agent database_agent_impl (orb.in (), - first_poa.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::ObjectId_var database_agent_oid = - PortableServer::string_to_ObjectId ("DatabaseAgent"); - - first_poa->activate_object_with_id (database_agent_oid.in (), - &database_agent_impl - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var database_agent = - first_poa->id_to_reference (database_agent_oid.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Get the IOR for the "DatabaseAgent" object - CORBA::String_var database_agent_ior = - orb->object_to_string (database_agent.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG,"%s\n", - database_agent_ior.in ())); - - int write_result = write_iors_to_file (database_agent_ior.in ()); - if (write_result != 0) - return write_result; - - // set the state of the poa_manager to active i.e ready to process requests - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Run the ORB - orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught"); - return -1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); - - return 0; -} |