diff options
author | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-11-01 18:16:36 +0000 |
---|---|---|
committer | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-11-01 18:16:36 +0000 |
commit | 6310bc89b6cc577bd2f03dab6507108d5e38de72 (patch) | |
tree | da83b013331325ff245f1667f7c4ec9924c36376 | |
parent | cf6d80c3d4ac392c4619cae0868928a2facb3028 (diff) | |
download | ATCD-6310bc89b6cc577bd2f03dab6507108d5e38de72.tar.gz |
ChangeLogTag:Wed Nov 1 10:14:26 2000 Darrell Brunsch <brunsch@uci.edu>
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 9 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp | 129 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.h | 41 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/implrepo.dsp | 2 |
4 files changed, 87 insertions, 94 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 697069ebe09..97f59146f76 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,12 @@ +Wed Nov 1 10:14:26 2000 Darrell Brunsch <brunsch@uci.edu> + + * orbsvcs/ImplRepo_Service/ImplRepo_i.cpp: + * orbsvcs/ImplRepo_Service/ImplRepo_i.h: + * orbsvcs/ImplRepo_Service/implrepo.dsp: + + Changed the ImplRepo_Service to use ServantLocators instead + of a default_servant. [Bug 668] + Wed Nov 1 10:04:27 2000 Priyanka Gontla <pgontla@ece.uci.edu> * tao/Messaging_Policy_i.cpp (relative_expiry): diff --git a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp index 4d401d9a0d8..868c36f9667 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp @@ -843,9 +843,7 @@ ImplRepo_i::init (int argc, retval = OPTIONS::instance()->parse_args (argc, argv); if (retval != 0) - { - return retval; - } + return retval; ACE_NEW_RETURN (this->forwarder_impl_, IMR_Forwarder (this->orb_.in (), @@ -853,11 +851,6 @@ ImplRepo_i::init (int argc, this), -1); - PortableServer::ObjectId_var forwarder_id = - this->root_poa_->activate_object (this->forwarder_impl_, ACE_TRY_ENV); - - ACE_TRY_CHECK; - PortableServer::ObjectId_var imr_id = PortableServer::string_to_ObjectId ("ImplRepoService"); @@ -1323,8 +1316,6 @@ ImplRepo_i::shutdown_server (const char *server, } } -// **************************************************************** - IMR_Locator::IMR_Locator (ImplRepo_i *repo) : repo_ (repo) { @@ -1339,7 +1330,6 @@ IMR_Locator::locate (const char *object_key, return this->repo_->find_ior (key, ACE_TRY_ENV); } -// **************************************************************** IMR_Adapter_Activator::IMR_Adapter_Activator (IMR_Forwarder *servant) : servant_ (servant) @@ -1353,35 +1343,23 @@ IMR_Adapter_Activator::unknown_adapter (PortableServer::POA_ptr parent, CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { - CORBA::PolicyList policies (4); - policies.length (4); + CORBA::PolicyList policies (2); + policies.length (2); const char *exception_message = "Null Message"; ACE_TRY { - // ID Assignment Policy - exception_message = "While PortableServer::POA::create_id_assignment_policy"; + // Servant Retention Policy + exception_message = "While PortableServer::POA::create_servant_retention_policy"; policies[0] = - parent->create_id_assignment_policy (PortableServer::USER_ID, ACE_TRY_ENV); - ACE_TRY_CHECK; - - // Lifespan Policy - exception_message = "While PortableServer::POA::create_lifespan_policy"; - policies[1] = - parent->create_lifespan_policy (PortableServer::PERSISTENT, ACE_TRY_ENV); + parent->create_servant_retention_policy (PortableServer::NON_RETAIN, ACE_TRY_ENV); ACE_TRY_CHECK; // Request Processing Policy exception_message = "While PortableServer::POA::create_request_processing_policy"; - policies[2] = - parent->create_request_processing_policy (PortableServer::USE_DEFAULT_SERVANT, ACE_TRY_ENV); - ACE_TRY_CHECK; - - // Id Uniqueness Policy - exception_message = "While PortableServer::POA::create_id_uniqueness_policy"; - policies[3] = - parent->create_id_uniqueness_policy (PortableServer::MULTIPLE_ID, ACE_TRY_ENV); + policies[1] = + parent->create_request_processing_policy (PortableServer::USE_SERVANT_MANAGER, ACE_TRY_ENV); ACE_TRY_CHECK; PortableServer::POAManager_var poa_manager = @@ -1407,13 +1385,15 @@ IMR_Adapter_Activator::unknown_adapter (PortableServer::POA_ptr parent, child->the_activator (this, ACE_TRY_ENV); ACE_TRY_CHECK; - exception_message = "While unknown_adapter, set_servant"; - child->set_servant (this->servant_, ACE_TRY_ENV); + exception_message = "While unknown_adapter, set_servant_manager"; + child->set_servant_manager(this->servant_, ACE_TRY_ENV); ACE_TRY_CHECK; } ACE_CATCHANY { - ACE_ERROR ((LM_ERROR, "IMR_Adapter_Activator::unknown_adapter - %s\n", exception_message)); + ACE_ERROR ((LM_ERROR, + "IMR_Adapter_Activator::unknown_adapter - %s\n", + exception_message)); ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "System Exception"); return 0; } @@ -1428,47 +1408,37 @@ IMR_Forwarder::IMR_Forwarder (CORBA::ORB_ptr orb_ptr, PortableServer::POA_ptr poa_ptr, ImplRepo_i *imr_impl) : imr_impl_ (imr_impl), - orb_var_ (CORBA::ORB::_duplicate (orb_ptr)), - poa_var_ (PortableServer::POA::_duplicate (poa_ptr)) + orb_var_ (CORBA::ORB::_duplicate (orb_ptr)) { -} + ACE_TRY_NEW_ENV + { + CORBA::Object_var tmp = + this->orb_var_->resolve_initial_references ("POACurrent", + ACE_TRY_ENV); + ACE_CHECK; -CORBA::RepositoryId -IMR_Forwarder::_primary_interface (const PortableServer::ObjectId &, - PortableServer::POA_ptr, - CORBA::Environment &) -{ - return 0; + this->poa_current_var_ = + PortableServer::Current::_narrow (tmp.in (), ACE_TRY_ENV); + ACE_CHECK; + } + ACE_CATCHANY + { + // Ignore + } + ACE_ENDTRY; } -void -IMR_Forwarder::invoke (CORBA::ServerRequest_ptr, - CORBA::Environment &ACE_TRY_ENV) +PortableServer::Servant +IMR_Forwarder::preinvoke (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr poa, + const char * operation, + PortableServer::ServantLocator::Cookie &cookie + TAO_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::ForwardRequest)) { - // @@ This could be optimized, the PortableServer::Current object - // can be cached.. - CORBA::Object_var tmp = - this->orb_var_->resolve_initial_references ("POACurrent", - ACE_TRY_ENV); - ACE_CHECK; + TAO_ENV_ARG_DEFN; - PortableServer::Current_var current = - PortableServer::Current::_narrow (tmp.in (), ACE_TRY_ENV); - ACE_CHECK; - - // The servant determines the key associated with the database entry - // represented by self - PortableServer::ObjectId_var oid = - current->get_object_id (ACE_TRY_ENV); - ACE_CHECK; - - // Now convert the id into a string - CORBA::String_var key = PortableServer::ObjectId_to_string (oid.in ()); - - PortableServer::POA_ptr poa = current->get_POA (ACE_TRY_ENV); - ACE_CHECK; - - // Now activate. + // Activate. ACE_TString ior; @@ -1481,10 +1451,9 @@ IMR_Forwarder::invoke (CORBA::ServerRequest_ptr, char *key_str = 0; - // @@ Even if the POA Current is cached the following code will - // work. But the implementation cannot be cached! - TAO_POA_Current *tao_current = - ACE_dynamic_cast(TAO_POA_Current*, current.in ()); + // Unlike POA Current, this implementation cannot be cached. + TAO_POA_Current *tao_current = + ACE_dynamic_cast(TAO_POA_Current*, this->poa_current_var_.in ()); TAO_POA_Current_Impl *impl = tao_current->implementation (); TAO_ObjectKey::encode_sequence_to_string (key_str, impl->object_key ()); @@ -1500,10 +1469,24 @@ IMR_Forwarder::invoke (CORBA::ServerRequest_ptr, ACE_CHECK; if (!CORBA::is_nil (forward_obj)) - ACE_THROW (PortableServer::ForwardRequest (forward_obj)); + ACE_THROW_RETURN (PortableServer::ForwardRequest (forward_obj), 0); else ACE_ERROR ((LM_ERROR, "Error: Forward_to reference is nil.\n")); + + ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (), 0); +} + +void +IMR_Forwarder::postinvoke (const PortableServer::ObjectId &, + PortableServer::POA_ptr , + const char * , + PortableServer::ServantLocator::Cookie , + PortableServer::Servant servant + TAO_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + delete servant; } diff --git a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.h b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.h index 6ba90c4a9b1..3e86deec9e1 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.h +++ b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.h @@ -24,7 +24,6 @@ #include "orbsvcs/IOR_Multicast.h" #include "tao/PortableServer/ImplRepoS.h" #include "tao/IORTable/IORTable.h" -#include "tao/DynamicInterface/Dynamic_Implementation.h" #include "ace/Process_Manager.h" // Forward declarations. @@ -61,8 +60,6 @@ private: // The object to use as the default servant. }; -// **************************************************************** - class ImplRepo_i; class IMR_Locator : public virtual IORTable::Locator, @@ -82,10 +79,7 @@ private: // The Implementation Repository implementation }; -// **************************************************************** - -class ImplRepo_i - : public POA_ImplementationRepository::Administration +class ImplRepo_i : public POA_ImplementationRepository::Administration { // = TITLE // Implementation Repository @@ -274,13 +268,14 @@ private: friend class IMR_Forwarder; }; -class IMR_Forwarder: public TAO_DynamicImplementation +class IMR_Forwarder: public PortableServer::ServantLocator // = TITLE // Implementation Repository Forwarder // // = DESCRIPTION - // This class is provides a DSI implementation that is used to handle - // arbitrary calls and forward them to the correct place. + // This class is provides a ServantLocator implementation that + // is used to handle arbitrary calls and forward them to the + // correct place. { public: IMR_Forwarder (CORBA::ORB_ptr orb_ptr, @@ -288,18 +283,24 @@ public: ImplRepo_i *ir_impl); // Constructor - virtual void invoke (CORBA::ServerRequest_ptr request, - CORBA::Environment &env); - // The invoke() method receives requests issued to any CORBA + virtual PortableServer::Servant + preinvoke (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr poa, + const char * operation, + PortableServer::ServantLocator::Cookie &cookie + TAO_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::ForwardRequest)); + // The preinvoke() method receives requests issued to any CORBA // object incarnated by the DSI servant and performs the // processing necessary to execute the request. - CORBA::RepositoryId _primary_interface ( - const PortableServer::ObjectId &oid, - PortableServer::POA_ptr poa, - CORBA::Environment &env = TAO_default_environment () - ); - // DynamicImplementation stuff + virtual void postinvoke (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr poa, + const char * operation, + PortableServer::ServantLocator::Cookie cookie, + PortableServer::Servant servant + TAO_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); private: class ImplRepo_i *imr_impl_; @@ -308,7 +309,7 @@ private: CORBA::ORB_var orb_var_; // ORB reference. - PortableServer::POA_var poa_var_; + PortableServer::Current_var poa_current_var_; // POA reference. }; diff --git a/TAO/orbsvcs/ImplRepo_Service/implrepo.dsp b/TAO/orbsvcs/ImplRepo_Service/implrepo.dsp index 1a57bbdf17f..7366a9894ed 100644 --- a/TAO/orbsvcs/ImplRepo_Service/implrepo.dsp +++ b/TAO/orbsvcs/ImplRepo_Service/implrepo.dsp @@ -76,7 +76,7 @@ BSC32=bscmake.exe # 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 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 TAO_Svc_Utilsd.lib TAO_DynamicInterfaced.lib TAO_IORTabled.lib TAO_PortableServerd.lib TAOd.lib aced.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"ImplRepo_Service.exe" /pdbtype:sept /libpath:"..\orbsvcs" /libpath:"..\..\tao\DynamicInterface" /libpath:"..\..\tao\IORTable" /libpath:"..\..\tao\PortableServer" /libpath:"..\..\tao" /libpath:"..\..\..\ace"
+# ADD LINK32 TAO_Svc_Utilsd.lib TAO_IORTabled.lib TAO_PortableServerd.lib TAOd.lib aced.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"ImplRepo_Service.exe" /pdbtype:sept /libpath:"..\orbsvcs" /libpath:"..\..\tao\DynamicInterface" /libpath:"..\..\tao\IORTable" /libpath:"..\..\tao\PortableServer" /libpath:"..\..\tao" /libpath:"..\..\..\ace"
!ENDIF
|