From 6043430680b8e81a9b9060586669e5fae32b916c Mon Sep 17 00:00:00 2001 From: nanbor Date: Thu, 23 Aug 2001 21:06:52 +0000 Subject: ChangeLogTag:Thu Aug 23 15:54:44 2001 Nanbor Wang --- TAO/ChangeLogs/ChangeLog-02a | 22 +++++++ TAO/tao/Abstract_Servant_Base.h | 5 ++ TAO/tao/Object.cpp | 12 ++++ TAO/tao/Object.h | 7 +++ TAO/tao/Object_Proxy_Impl.h | 5 ++ .../PortableServer/Direct_Object_Proxy_Impl.cpp | 24 ++++++++ TAO/tao/PortableServer/Direct_Object_Proxy_Impl.h | 7 ++- TAO/tao/PortableServer/Servant_Base.cpp | 6 ++ TAO/tao/PortableServer/Servant_Base.h | 5 ++ .../PortableServer/ThruPOA_Object_Proxy_Impl.cpp | 33 +++++++++++ TAO/tao/PortableServer/ThruPOA_Object_Proxy_Impl.h | 5 ++ TAO/tao/Remote_Object_Proxy_Impl.cpp | 68 +++++++++++++++++++++- TAO/tao/Remote_Object_Proxy_Impl.h | 5 ++ TAO/tao/TAO.dsp | 50 ++++++++-------- 14 files changed, 227 insertions(+), 27 deletions(-) diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index da016282716..061cc3f443d 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,25 @@ +Thu Aug 23 15:54:44 2001 Nanbor Wang + + * tao/TAO.dsp: Flipped on "generate browse information" flag. We + need to remove this setting when we merge the branch into the + main trunk. + + * tao/Abstract_Servant_Base.h: + * tao/Object.cpp: + * tao/Object.h: + * tao/Object_Proxy_Impl.h: + * tao/Remote_Object_Proxy_Impl.cpp: + * tao/Remote_Object_Proxy_Impl.h: + * tao/PortableServer/Direct_Object_Proxy_Impl.cpp: + * tao/PortableServer/Direct_Object_Proxy_Impl.h: + * tao/PortableServer/Servant_Base.cpp: + * tao/PortableServer/Servant_Base.h: + * tao/PortableServer/ThruPOA_Object_Proxy_Impl.cpp: + * tao/PortableServer/ThruPOA_Object_Proxy_Impl.h: Added + _get_component() as one of the default operations an CORBA + Object supports. The default implementation is to return a nil + object reference. + Fri Aug 17 14:04:20 2001 Nanbor Wang * TAO_IDL/be/be_sequence.cpp: diff --git a/TAO/tao/Abstract_Servant_Base.h b/TAO/tao/Abstract_Servant_Base.h index 126290e6801..285676096d8 100644 --- a/TAO/tao/Abstract_Servant_Base.h +++ b/TAO/tao/Abstract_Servant_Base.h @@ -49,6 +49,11 @@ public: CORBA_Environment &ACE_TRY_ENV = TAO_default_environment () ) = 0; + /// Acquire the component reference. + virtual CORBA_Object_ptr _get_component ( + CORBA_Environment &ACE_TRY_ENV = TAO_default_environment () + ) = 0; + //@{ /// @name Reference counting hooks: no-ops by default. virtual void _add_ref (CORBA_Environment &ACE_TRY_ENV = diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp index 449a05ef07b..d13c6966c36 100644 --- a/TAO/tao/Object.cpp +++ b/TAO/tao/Object.cpp @@ -381,6 +381,18 @@ CORBA_Object::_get_interface (CORBA::Environment &ACE_TRY_ENV) return the_proxy._get_interface (this, ACE_TRY_ENV); } +CORBA_Object_ptr +CORBA_Object::_get_component (CORBA::Environment &ACE_TRY_ENV) +{ + // Get the right Proxy. + TAO_Object_Proxy_Impl &the_proxy = + this->proxy_broker_->select_proxy (this, ACE_TRY_ENV); + ACE_CHECK_RETURN (0); + + // Perform the Call. + return the_proxy._get_component (this, ACE_TRY_ENV); +} + CORBA::ImplementationDef_ptr CORBA_Object::_get_implementation (CORBA::Environment &) { diff --git a/TAO/tao/Object.h b/TAO/tao/Object.h index c5f2998c831..a89c9637451 100644 --- a/TAO/tao/Object.h +++ b/TAO/tao/Object.h @@ -105,6 +105,13 @@ public: TAO_default_environment () ); + /// Get a reference to the component this interface is part of a + /// component. + virtual CORBA_Object_ptr _get_component ( + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment () + ); + // DII operations to create a request. // // The mapping for create_request is split into two forms, diff --git a/TAO/tao/Object_Proxy_Impl.h b/TAO/tao/Object_Proxy_Impl.h index 97a28bee81d..e6b1640214d 100644 --- a/TAO/tao/Object_Proxy_Impl.h +++ b/TAO/tao/Object_Proxy_Impl.h @@ -49,6 +49,11 @@ public: CORBA_Environment &ACE_TRY_ENV ) = 0; + virtual CORBA_Object_ptr _get_component ( + const CORBA::Object_ptr target, + CORBA_Environment &ACE_TRY_ENV + ) = 0; + #endif /* TAO_HAS_MINIMUM_CORBA == 0 */ protected: diff --git a/TAO/tao/PortableServer/Direct_Object_Proxy_Impl.cpp b/TAO/tao/PortableServer/Direct_Object_Proxy_Impl.cpp index 1d0abbacf2a..fa818da27e6 100644 --- a/TAO/tao/PortableServer/Direct_Object_Proxy_Impl.cpp +++ b/TAO/tao/PortableServer/Direct_Object_Proxy_Impl.cpp @@ -80,4 +80,28 @@ TAO_Direct_Object_Proxy_Impl::_get_interface (const CORBA::Object_ptr target, return 0; } +CORBA_Object_ptr +TAO_Direct_Object_Proxy_Impl::_get_component (const CORBA::Object_ptr target, + CORBA_Environment &ACE_TRY_ENV) +{ + ACE_TRY + { + if (target->_servant () != 0) + return target->_servant ()->_get_component (ACE_TRY_ENV); + + // @@ Maybe we want to change this exception... + ACE_THROW_RETURN (CORBA::INV_OBJREF (), 0); + } + ACE_CATCH (CORBA::OBJECT_NOT_EXIST, ex) + { + } + ACE_CATCHANY + { + ACE_RE_THROW; + } + ACE_ENDTRY; + + return 0; +} + #endif /* TAO_HAS_MINIMUM_CORBA == 0 */ diff --git a/TAO/tao/PortableServer/Direct_Object_Proxy_Impl.h b/TAO/tao/PortableServer/Direct_Object_Proxy_Impl.h index c8bd14f1a39..2fe1b143fba 100644 --- a/TAO/tao/PortableServer/Direct_Object_Proxy_Impl.h +++ b/TAO/tao/PortableServer/Direct_Object_Proxy_Impl.h @@ -34,7 +34,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -class TAO_PortableServer_Export TAO_Direct_Object_Proxy_Impl : +class TAO_PortableServer_Export TAO_Direct_Object_Proxy_Impl : public virtual TAO_Object_Proxy_Impl { // = TITLE @@ -63,6 +63,11 @@ public: CORBA_Environment &ACE_TRY_ENV ); + virtual CORBA_Object_ptr _get_component ( + const CORBA::Object_ptr target, + CORBA_Environment &ACE_TRY_ENV + ); + #endif /* TAO_HAS_MINIMUM_CORBA == 0 */ }; diff --git a/TAO/tao/PortableServer/Servant_Base.cpp b/TAO/tao/PortableServer/Servant_Base.cpp index f16a5be3f79..a2e6a850859 100644 --- a/TAO/tao/PortableServer/Servant_Base.cpp +++ b/TAO/tao/PortableServer/Servant_Base.cpp @@ -115,6 +115,12 @@ TAO_ServantBase::_get_interface (CORBA::Environment &ACE_TRY_ENV) ACE_TRY_ENV); } +CORBA_Object_ptr +TAO_ServantBase::_get_component (CORBA::Environment &ACE_TRY_ENV) +{ + return CORBA_Object::_nil (); +} + int TAO_ServantBase::_find (const char *opname, TAO_Skeleton& skelfunc, diff --git a/TAO/tao/PortableServer/Servant_Base.h b/TAO/tao/PortableServer/Servant_Base.h index 8b982192173..0c5514051ec 100644 --- a/TAO/tao/PortableServer/Servant_Base.h +++ b/TAO/tao/PortableServer/Servant_Base.h @@ -65,6 +65,11 @@ public: TAO_default_environment () ); + virtual CORBA_Object_ptr _get_component ( + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment () + ); + virtual void *_downcast (const char *repository_id) = 0; // Get the correct vtable. diff --git a/TAO/tao/PortableServer/ThruPOA_Object_Proxy_Impl.cpp b/TAO/tao/PortableServer/ThruPOA_Object_Proxy_Impl.cpp index 227c3c0092d..80d47e9925c 100644 --- a/TAO/tao/PortableServer/ThruPOA_Object_Proxy_Impl.cpp +++ b/TAO/tao/PortableServer/ThruPOA_Object_Proxy_Impl.cpp @@ -110,4 +110,37 @@ TAO_ThruPOA_Object_Proxy_Impl::_get_interface (const CORBA::Object_ptr target, return 0; } +CORBA_Object_ptr +TAO_ThruPOA_Object_Proxy_Impl::_get_component (const CORBA::Object_ptr target, + CORBA_Environment &ACE_TRY_ENV) +{ + ACE_TRY + { + TAO_Object_Adapter::Servant_Upcall servant_upcall ( + target->_stubobj ()->servant_orb_var ()->orb_core () + ); + + CORBA::Object_var forward_to; + + servant_upcall.prepare_for_upcall ( + target->_object_key (), + "_get_component", + forward_to.out (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + return servant_upcall.servant ()->_get_component (ACE_TRY_ENV); + } + ACE_CATCH (CORBA::OBJECT_NOT_EXIST, ex) + { + } + ACE_CATCHANY + { + ACE_RE_THROW; + } + ACE_ENDTRY; + + return 0; +} + #endif // TAO_HAS_MINIMUM_CORBA == 0 // diff --git a/TAO/tao/PortableServer/ThruPOA_Object_Proxy_Impl.h b/TAO/tao/PortableServer/ThruPOA_Object_Proxy_Impl.h index 93c0832c312..fadc2e665b4 100644 --- a/TAO/tao/PortableServer/ThruPOA_Object_Proxy_Impl.h +++ b/TAO/tao/PortableServer/ThruPOA_Object_Proxy_Impl.h @@ -61,6 +61,11 @@ public: CORBA_Environment &ACE_TRY_ENV ); + virtual CORBA_Object_ptr _get_component ( + const CORBA::Object_ptr target, + CORBA_Environment &ACE_TRY_ENV + ); + #endif /* TAO_HAS_MINIMUM_CORBA == 0 */ }; diff --git a/TAO/tao/Remote_Object_Proxy_Impl.cpp b/TAO/tao/Remote_Object_Proxy_Impl.cpp index 9953a9b6210..dab4c6c6a85 100644 --- a/TAO/tao/Remote_Object_Proxy_Impl.cpp +++ b/TAO/tao/Remote_Object_Proxy_Impl.cpp @@ -93,7 +93,7 @@ TAO_Remote_Object_Proxy_Impl::_is_a (const CORBA::Object_ptr target, #if (TAO_HAS_MINIMUM_CORBA == 0) -CORBA::Boolean +CORBA::Boolean TAO_Remote_Object_Proxy_Impl::_non_existent (const CORBA::Object_ptr target, CORBA_Environment &ACE_TRY_ENV) { @@ -183,4 +183,70 @@ TAO_Remote_Object_Proxy_Impl::_get_interface (const CORBA::Object_ptr target, ACE_TRY_ENV); } +CORBA::Object_ptr +TAO_Remote_Object_Proxy_Impl::_get_component (const CORBA::Object_ptr target, + CORBA_Environment &ACE_TRY_ENV) +{ + CORBA::Object_ptr _tao_retval = CORBA::Object::_nil (); + CORBA::Object_var _tao_safe_retval (_tao_retval); + + ACE_TRY + { + // Must catch exceptions, if the server raises a + // CORBA::OBJECT_NOT_EXIST then we must return 1, instead of + // propagating the exception. + TAO_Stub *istub = target->_stubobj (); + if (istub == 0) + ACE_THROW_RETURN (CORBA::INTERNAL ( + CORBA_SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + EINVAL), + CORBA::COMPLETED_NO), + _tao_retval); + + TAO_GIOP_Twoway_Invocation _tao_call (istub, + "_get_component", + 14, + 1, + istub->orb_core ()); + + // ACE_TRY_ENV.clear (); + for (;;) + { + _tao_call.start (ACE_TRY_ENV); + ACE_TRY_CHECK; + + CORBA::Short flag = TAO_TWOWAY_RESPONSE_FLAG; + + _tao_call.prepare_header (ACE_static_cast (CORBA::Octet, flag), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + int _invoke_status = + _tao_call.invoke (0, 0, ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (_invoke_status == TAO_INVOKE_RESTART) + continue; + ACE_ASSERT (_invoke_status != TAO_INVOKE_EXCEPTION); + if (_invoke_status != TAO_INVOKE_OK) + { + ACE_THROW_RETURN (CORBA::UNKNOWN (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_YES), + _tao_retval); + } + break; + } + TAO_InputCDR &_tao_in = _tao_call.inp_stream (); + if (! (_tao_in >> _tao_safe_retval.inout ())) + ACE_THROW_RETURN (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_YES), + _tao_retval); + } + ACE_CATCHANY + { + ACE_RE_THROW; + } + ACE_ENDTRY; + return _tao_safe_retval._retn (); +} #endif /* TAO_HAS_MINIMUM_CORBA == 0 */ diff --git a/TAO/tao/Remote_Object_Proxy_Impl.h b/TAO/tao/Remote_Object_Proxy_Impl.h index 94dddb2c76c..fd9cb854823 100644 --- a/TAO/tao/Remote_Object_Proxy_Impl.h +++ b/TAO/tao/Remote_Object_Proxy_Impl.h @@ -51,6 +51,11 @@ public: CORBA_Environment &ACE_TRY_ENV ); + virtual CORBA_Object_ptr _get_component ( + const CORBA::Object_ptr target, + CORBA_Environment &ACE_TRY_ENV + ); + #endif /* TAO_HAS_MINIMUM_CORBA == 0 */ }; diff --git a/TAO/tao/TAO.dsp b/TAO/tao/TAO.dsp index ae63a446401..692988db810 100644 --- a/TAO/tao/TAO.dsp +++ b/TAO/tao/TAO.dsp @@ -133,7 +133,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /Gy /I "../../" /I "../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "TAO_BUILD_DLL" /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /Gy /I "../../" /I "../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "TAO_BUILD_DLL" /FR /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "_DEBUG" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 @@ -387,14 +387,6 @@ SOURCE=.\Flushing_Strategy.cpp # End Source File # Begin Source File -SOURCE=.\LF_Follower.cpp -# End Source File -# Begin Source File - -SOURCE=.\LF_Follower_Auto_Ptr.cpp -# End Source File -# Begin Source File - SOURCE=.\GIOP_Message_Base.cpp # End Source File # Begin Source File @@ -535,10 +527,18 @@ SOURCE=.\LF_Event_Loop_Thread_Helper.cpp # End Source File # Begin Source File +SOURCE=.\LF_Follower.cpp +# End Source File +# Begin Source File + SOURCE=.\LF_Follower_Auto_Adder.cpp # End Source File # Begin Source File +SOURCE=.\LF_Follower_Auto_Ptr.cpp +# End Source File +# Begin Source File + SOURCE=.\LF_Strategy.cpp # End Source File # Begin Source File @@ -1147,22 +1147,6 @@ SOURCE=.\Flushing_Strategy.h # End Source File # Begin Source File -SOURCE=.\LF_Follower.h -# End Source File -# Begin Source File - -SOURCE=.\LF_Follower.inl -# End Source File -# Begin Source File - -SOURCE=.\LF_Follower_Auto_Ptr.h -# End Source File -# Begin Source File - -SOURCE=.\LF_Follower_Auto_Ptr.inl -# End Source File -# Begin Source File - SOURCE=.\giop.h # End Source File # Begin Source File @@ -1331,6 +1315,14 @@ SOURCE=.\LF_Event_Loop_Thread_Helper.inl # End Source File # Begin Source File +SOURCE=.\LF_Follower.h +# End Source File +# Begin Source File + +SOURCE=.\LF_Follower.inl +# End Source File +# Begin Source File + SOURCE=.\LF_Follower_Auto_Adder.h # End Source File # Begin Source File @@ -1339,6 +1331,14 @@ SOURCE=.\LF_Follower_Auto_Adder.inl # End Source File # Begin Source File +SOURCE=.\LF_Follower_Auto_Ptr.h +# End Source File +# Begin Source File + +SOURCE=.\LF_Follower_Auto_Ptr.inl +# End Source File +# Begin Source File + SOURCE=.\LF_Strategy.h # End Source File # Begin Source File -- cgit v1.2.1