diff options
author | jai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-11-23 22:05:03 +0000 |
---|---|---|
committer | jai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-11-23 22:05:03 +0000 |
commit | 40c47226c8d8e90fbf375052cad7d322aa6f9a01 (patch) | |
tree | 566b0bdf95dd04be720152673c141727349daaf2 | |
parent | 7eb23cfffe93d6131468b57806367666c3dbfb08 (diff) | |
download | ATCD-40c47226c8d8e90fbf375052cad7d322aa6f9a01.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.h | 3 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.cpp | 64 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.h | 13 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.cpp | 17 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.h | 12 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Servant_Impl_T.cpp | 24 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Servant_Impl_T.h | 6 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/examples/Hello/Receiver/Receiver_svnt.cpp.new_impl | 585 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/examples/Hello/Receiver/Receiver_svnt.h.new_impl | 356 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.cpp.new_impl | 645 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.h.new_impl | 366 |
11 files changed, 2045 insertions, 46 deletions
diff --git a/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.h b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.h index bbca2a430ad..8fb03deb168 100644 --- a/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.h +++ b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.h @@ -59,6 +59,9 @@ namespace CIAO get_home_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); + virtual void + update_component_map (PortableServer::ObjectId &oid) = 0; + protected: Session_Container *container_; }; diff --git a/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.cpp b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.cpp index 0f5799fd4e7..aebfbef88c4 100644 --- a/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.cpp +++ b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.cpp @@ -91,13 +91,10 @@ namespace CIAO ACE_ENV_ARG_PARAMETER); ACE_CHECK; - Components::CCMObject_var ccm_obj_ptr; - COMP_SVNT *servant = 0; - - if (objref_map_.unbind (oid.in (), ccm_obj_ptr) != 0) + Components::CCMObject_ptr ccm_obj_ptr; + if (objref_map_.find (oid.in (), ccm_obj_ptr) != 0) { - // @@ JAI do error handling like printing out debug statements - // etc. + ACE_DEBUG ((LM_DEBUG, "Invalid component object reference\n")); return; } @@ -108,23 +105,40 @@ namespace CIAO if (CORBA::is_nil (_ciao_comp.in ())) { - // @@ Jai, This should not be thrown by applications like - // this. Try a beter one, mostly CCM specific. - ACE_THROW (CORBA::INTERNAL ()); + ACE_THROW (Components::RemoveFailure ()); } - // @@ Jai, could you please add a line of documentation to say - // what this is supposed to be doing? _ciao_comp->remove (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; + } - if (component_map_.unbind (oid.in (), servant) == 0) + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename COMP, + typename COMP_VAR, + typename COMP_EXEC, + typename COMP_EXEC_VAR, + typename COMP_SVNT> + void + Home_Servant_Impl<BASE_SKEL, + EXEC, + EXEC_VAR, + COMP, + COMP_VAR, + COMP_EXEC, + COMP_EXEC_VAR, + COMP_SVNT>::update_component_map ( + PortableServer::ObjectId &oid) + { + Components::CCMObject_var ccm_obj_ptr; + if (objref_map_.unbind (oid, ccm_obj_ptr) != 0) { - - PortableServer::ServantBase_var safe (servant); - servant->_ciao_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + ACE_DEBUG ((LM_DEBUG, "Invalid component object reference\n")); + return; } + ACE_DEBUG ((LM_DEBUG, "updated the map\n")); + return; } // Operations for keyless home interface. @@ -235,6 +249,7 @@ namespace CIAO ACE_NEW_RETURN (svt, COMP_SVNT (exe, home.in (), + this, this->container_), COMP::_nil ()); @@ -258,12 +273,7 @@ namespace CIAO this->objref_map_.bind (oid.in (), Components::CCMObject::_duplicate (ccmobjref.in ())); - - if (this->component_map_.bind (oid.in (), svt) == 0) - { - safe._retn (); - } - + return ho._retn (); } @@ -294,16 +304,6 @@ namespace CIAO oid.out () ACE_ENV_ARG_PARAMETER); ACE_CHECK; - - COMP_SVNT *servant = 0; - - if (this->component_map_.unbind (oid.in (), servant) == 0) - { - PortableServer::ServantBase_var safe (servant); - - servant->_ciao_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - } } } diff --git a/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.h b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.h index 241f6e71338..4264c16af55 100644 --- a/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.h +++ b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.h @@ -81,6 +81,9 @@ namespace CIAO ACE_THROW_SPEC ((CORBA::SystemException, Components::CreateFailure)); + virtual void + update_component_map (PortableServer::ObjectId &oid); + protected: // CIAO-specific operations. @@ -97,16 +100,6 @@ namespace CIAO protected: EXEC_VAR executor_; - - // @@ Jai, why do you need two maps? Can't you derive one from the - // other? Its a waste of memory to do TWO things if it can be done - // by one. - ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId, - COMP_SVNT *, - TAO_ObjectId_Hash, - ACE_Equal_To<PortableServer::ObjectId>, - ACE_SYNCH_MUTEX> - component_map_; typedef ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId, Components::CCMObject_ptr, TAO_ObjectId_Hash, diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.cpp b/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.cpp index 3a293d042b3..ad111ae19e6 100644 --- a/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.cpp +++ b/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.cpp @@ -11,8 +11,12 @@ namespace CIAO ACE_ASSERT (0); } - Servant_Impl_Base::Servant_Impl_Base (Session_Container * c) - : container_ (c) + Servant_Impl_Base::Servant_Impl_Base (Components::CCMHome_ptr home, + Home_Servant_Impl_Base *home_servant, + Session_Container * c) + : home_ (Components::CCMHome::_duplicate (home)), + home_servant_ (home_servant), + container_ (c) { } @@ -61,6 +65,11 @@ namespace CIAO ACE_THROW_SPEC ((CORBA::SystemException, Components::RemoveFailure)) { + Components::SessionComponent_var temp = this->get_executor (); + temp->ccm_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_DEBUG ((LM_DEBUG, "called passivate\n")); + CORBA::Object_var objref = this->container_->get_objref (this); @@ -72,6 +81,10 @@ namespace CIAO this->container_->uninstall_component ( ccmobjref.in (), oid.out () ACE_ENV_ARG_PARAMETER); + ACE_DEBUG ((LM_DEBUG, "called uninstall\n")); + this->home_servant_->update_component_map (oid); + ACE_DEBUG ((LM_DEBUG, "called update\n")); + } ::Components::ConnectionDescriptions * diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.h b/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.h index 67b736d99b2..0b21e6b3a4d 100644 --- a/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.h +++ b/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.h @@ -28,6 +28,8 @@ #include "CCM_EventC.h" #include "CIAO_Server_Export.h" #include "CCM_ComponentS.h" +#include "CCM_ContainerS.h" +#include "Home_Servant_Impl_Base.h" namespace CIAO { @@ -47,7 +49,9 @@ namespace CIAO public: explicit Servant_Impl_Base (void); - Servant_Impl_Base (Session_Container * c); + Servant_Impl_Base (Components::CCMHome_ptr home, + Home_Servant_Impl_Base *home_servant, + Session_Container * c); virtual ~Servant_Impl_Base (void); @@ -62,6 +66,10 @@ namespace CIAO get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); + virtual Components::SessionComponent_ptr + get_executor (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) = 0; + virtual void configuration_complete (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, @@ -205,6 +213,8 @@ namespace CIAO FacetTable facet_table_; ConsumerTable consumer_table_; + Components::CCMHome_var home_; + Home_Servant_Impl_Base *home_servant_; Session_Container * container_; }; } diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.cpp b/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.cpp index 045d44b0040..6ee8cdde15d 100644 --- a/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.cpp +++ b/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.cpp @@ -13,9 +13,11 @@ namespace CIAO typename CONTEXT> Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::Servant_Impl ( EXEC * exe, + Components::CCMHome_ptr home, + Home_Servant_Impl_Base *home_servant, Session_Container * c ) - : Servant_Impl_Base (c), + : Servant_Impl_Base (home, home_servant, c), executor_ (EXEC::_duplicate (exe)) { } @@ -95,6 +97,25 @@ namespace CIAO typename EXEC, typename EXEC_VAR, typename CONTEXT> + Components::SessionComponent_ptr + Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::get_executor ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER + ); + ACE_CHECK; + return temp._retn (); + } + + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename CONTEXT> CORBA::Object_ptr Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::_get_component ( ACE_ENV_SINGLE_ARG_DECL @@ -209,6 +230,7 @@ namespace CIAO ) ACE_THROW_SPEC ((CORBA::SystemException)) { + ACE_DEBUG ((LM_DEBUG, "i am about to passivate\n")); // @@ Jai, could you please see why this is required? ::Components::SessionComponent_var temp = ::Components::SessionComponent::_narrow ( diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.h b/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.h index 45f223f57b5..19a17a5b33a 100644 --- a/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.h +++ b/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.h @@ -47,6 +47,8 @@ namespace CIAO { public: Servant_Impl (EXEC * exe, + Components::CCMHome_ptr home, + Home_Servant_Impl_Base *home_servant, Session_Container * c); virtual ~Servant_Impl (void); @@ -66,6 +68,10 @@ namespace CIAO _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); + virtual Components::SessionComponent_ptr + get_executor (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + // CIAO-specific operations. void diff --git a/TAO/CIAO/DAnCE/examples/Hello/Receiver/Receiver_svnt.cpp.new_impl b/TAO/CIAO/DAnCE/examples/Hello/Receiver/Receiver_svnt.cpp.new_impl new file mode 100644 index 00000000000..6a24be74c1c --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Hello/Receiver/Receiver_svnt.cpp.new_impl @@ -0,0 +1,585 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#include "Receiver_svnt.h" +#include "Cookies.h" +#include "ciao/Servant_Activator.h" +#include "ciao/Port_Activator_T.h" + +namespace Receiver_Impl +{ + namespace CIAO_GLUE_Hello + { + Receiver_Context::Receiver_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + Receiver_Servant *sv) + : ACE_NESTED_CLASS (CIAO, Context_Impl_Base (home, c)), + ctx_svnt_base (home, c, sv) + { + } + + Receiver_Context::~Receiver_Context (void) + { + } + + // Operations for Receiver receptacles and event sources, + // defined in ::Hello::CCM_Receiver_Context. + + ::Hello::ReadMessage_ptr + Receiver_Context::get_connection_read_message ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return ::Hello::ReadMessage::_duplicate ( + this->ciao_uses_read_message_.in ()); + } + + void + Receiver_Context::connect_read_message ( + ::Hello::ReadMessage_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) + { + if (!CORBA::is_nil (this->ciao_uses_read_message_.in ())) + { + ACE_THROW (::Components::AlreadyConnected ()); + } + + if (CORBA::is_nil (c)) + { + ACE_THROW (::Components::InvalidConnection ()); + } + + this->ciao_uses_read_message_ = + ::Hello::ReadMessage::_duplicate (c); + } + + ::Hello::ReadMessage_ptr + Receiver_Context::disconnect_read_message ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoConnection)) + { + if (CORBA::is_nil (this->ciao_uses_read_message_.in ())) + { + ACE_THROW_RETURN ( + ::Components::NoConnection (), + ::Hello::ReadMessage::_nil ()); + } + + return this->ciao_uses_read_message_._retn (); + } + + // CIAO-specific. + + Receiver_Context * + Receiver_Context::_narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_NOT_USED) + { + return dynamic_cast<Receiver_Context *> (p); + } + } + + namespace CIAO_GLUE_Hello + { + Receiver_Servant::Receiver_Servant ( + ::Hello::CCM_Receiver_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Home_Servant_Impl_Base *home_servant, + ::CIAO::Session_Container *c) + : ACE_NESTED_CLASS (CIAO, Servant_Impl_Base (h, home_servant, c)), + comp_svnt_base (exe, h, home_servant, c) + { + this->context_ = new Receiver_Context (h, c, this); + + CIAO_REGISTER_OBV_FACTORY ( + ::Hello::TimeOut_init, + ::Hello::TimeOut); + + ACE_TRY_NEW_ENV + { + ::Components::SessionComponent_var scom = + ::Components::SessionComponent::_narrow ( + exe + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! ::CORBA::is_nil (scom.in ())) + { + scom->set_session_context ( + this->context_ + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + + this->populate_port_tables ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + + ACE_CATCHANY + { + } + + ACE_ENDTRY; + } + + Receiver_Servant::~Receiver_Servant (void) + { + } + + void + Receiver_Servant::set_attributes ( + const ::Components::ConfigValues &descr + ACE_ENV_ARG_DECL_NOT_USED) + { + for (CORBA::ULong i = 0; + i < descr.length (); + ++i) + { + const char *descr_name = descr[i]->name (); + ::CORBA::Any &descr_value = descr[i]->value (); + + ACE_UNUSED_ARG (descr_name); + ACE_UNUSED_ARG (descr_value); + } + } + + Receiver_Servant::TimeOutConsumer_click_in_Servant::TimeOutConsumer_click_in_Servant ( + ::Hello::CCM_Receiver_ptr executor, + ::Hello::CCM_Receiver_Context_ptr c) + : executor_ (::Hello::CCM_Receiver::_duplicate (executor)), + ctx_ (::Hello::CCM_Receiver_Context::_duplicate (c)) + { + } + + Receiver_Servant::TimeOutConsumer_click_in_Servant::~TimeOutConsumer_click_in_Servant (void) + { + } + + CORBA::Object_ptr + Receiver_Servant::TimeOutConsumer_click_in_Servant::_get_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->ctx_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + void + Receiver_Servant::TimeOutConsumer_click_in_Servant::push_TimeOut ( + ::Hello::TimeOut *evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->push_click_in ( + evt + ACE_ENV_ARG_PARAMETER); + } + + // Inherited from ::Components::EventConsumerBase. + void + Receiver_Servant::TimeOutConsumer_click_in_Servant::push_event ( + ::Components::EventBase *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::BadEventType)) + { + ::Hello::TimeOut_var ev_type = + ::Hello::TimeOut::_downcast (ev); + + if (ev_type.in () != 0) + { + this->push_TimeOut ( + ev_type.in () + ACE_ENV_ARG_PARAMETER); + + return; + } + + ACE_THROW (::Components::BadEventType ()); + } + + ::Hello::TimeOutConsumer_ptr + Receiver_Servant::get_consumer_click_in ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (! ::CORBA::is_nil (this->consumes_click_in_.in ())) + { + return ::Hello::TimeOutConsumer::_duplicate (this->consumes_click_in_.in ()); + } + + ::Components::EventConsumerBase_var obj = + this->get_consumer_click_in_i ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::Hello::TimeOutConsumer::_nil ()); + + ::Hello::TimeOutConsumer_var eco = + ::Hello::TimeOutConsumer::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::Hello::TimeOutConsumer::_nil ()); + + this->consumes_click_in_ = eco; + return ::Hello::TimeOutConsumer::_duplicate (this->consumes_click_in_.in ()); + } + + ::Components::EventConsumerBase_ptr + Receiver_Servant::get_consumer_click_in_i ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::EventConsumerBase_ptr ret = + this->lookup_consumer ("click_in"); + + if (! ::CORBA::is_nil (ret)) + { + return ret; + } + + CIAO::Port_Activator_T< + Receiver_Servant::TimeOutConsumer_click_in_Servant, + ::Hello::CCM_Receiver, + ::Hello::CCM_Receiver_Context, + Receiver_Servant > *tmp = 0; + + typedef CIAO::Port_Activator_T< + Receiver_Servant::TimeOutConsumer_click_in_Servant, + ::Hello::CCM_Receiver, + ::Hello::CCM_Receiver_Context, + Receiver_Servant > + MACRO_MADNESS_TYPEDEF; + + + ACE_NEW_THROW_EX ( + tmp, + MACRO_MADNESS_TYPEDEF ( + "Hello_Receiver_click_in", + "click_in", + CIAO::Port_Activator::Sink, + this->executor_.in (), + this->context_, + this), + CORBA::NO_MEMORY ()); + + + CIAO::Servant_Activator *sa = + this->container_->ports_servant_activator (); + + if (!sa->register_port_activator (tmp)) + { + return 0; + } + + ::CORBA::Object_var obj = + this->container_->generate_reference ( + "Hello_Receiver_click_in", + "IDL:Hello/TimeOutConsumer:1.0", + CIAO::Container::Facet_Consumer + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::Hello::TimeOutConsumer::_nil ()); + + ::Components::EventConsumerBase_var ecb = + ::Components::EventConsumerBase::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::Hello::TimeOutConsumer::_nil ()); + + this->add_consumer ( + "click_in", + ecb.in ()); + + return ecb._retn (); + } + + ::Components::Cookie * + Receiver_Servant::connect ( + const char *name, + ::CORBA::Object_ptr connection + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::AlreadyConnected, + ::Components::ExceededConnectionLimit)) + { + // If the component has no receptacles, this will be unused. + ACE_UNUSED_ARG (connection); + + if (name == 0) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + if (ACE_OS::strcmp (name, "read_message") == 0) + { + ::Hello::ReadMessage_var _ciao_conn = + ::Hello::ReadMessage::_narrow ( + connection + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (_ciao_conn.in ())) + { + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + } + + // Simplex connect. + this->connect_read_message ( + _ciao_conn.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return 0; + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + CORBA::Object_ptr + Receiver_Servant::disconnect ( + const char *name, + ::Components::Cookie * ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::CookieRequired, + ::Components::NoConnection)) + { + if (name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + if (ACE_OS::strcmp (name, "read_message") == 0) + { + // Simplex disconnect. + return this->disconnect_read_message (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + + ACE_UNUSED_ARG (ck); + } + + void + Receiver_Servant::connect_read_message ( + ::Hello::ReadMessage_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) + { + this->context_->connect_read_message ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::Hello::ReadMessage_ptr + Receiver_Servant::disconnect_read_message ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoConnection)) + { + return this->context_->disconnect_read_message ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Hello::ReadMessage_ptr + Receiver_Servant::get_connection_read_message ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->context_->get_connection_read_message ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + void + Receiver_Servant::connect_consumer ( + const char * emitter_name, + ::Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) + { + if (emitter_name == 0) + { + ACE_THROW (::CORBA::BAD_PARAM ()); + } + + ACE_UNUSED_ARG (consumer); + ACE_THROW (::Components::InvalidName ()); + } + + ::Components::Cookie * + Receiver_Servant::subscribe ( + const char *publisher_name, + ::Components::EventConsumerBase_ptr subscribe + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::ExceededConnectionLimit)) + { + // Just in case there are no if blocks + ACE_UNUSED_ARG (subscribe); + + if (publisher_name == 0) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ::Components::EventConsumerBase_ptr + Receiver_Servant::unsubscribe ( + const char *publisher_name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection)) + { + // Just in case there are no if blocks + ACE_UNUSED_ARG (ck); + + if (publisher_name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + CORBA::Object_ptr + Receiver_Servant::get_facet_executor (const char *name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException)) + { + if (name == 0) + { + ACE_THROW_RETURN ( + ::CORBA::BAD_PARAM (), + ::CORBA::Object::_nil ()); + } + + return CORBA::Object::_nil (); + } + + // Supported operations. + + // Component attribute operations. + + // Private method to populate the port tables. + void + Receiver_Servant::populate_port_tables ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_ENV_ARG_NOT_USED; + ::CORBA::Object_var obj_var; + ::Components::EventConsumerBase_var ecb_var; + + ecb_var = + this->get_consumer_click_in_i ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + } + + namespace CIAO_GLUE_Hello + { + ReceiverHome_Servant::ReceiverHome_Servant ( + ::Hello::CCM_ReceiverHome_ptr exe, + ::CIAO::Session_Container *c) + : ACE_NESTED_CLASS (CIAO, Home_Servant_Impl_Base (c)), + home_svnt_base (exe, c) + { + } + + ReceiverHome_Servant::~ReceiverHome_Servant (void) + { + } + + // Home operations. + + // Home supported interface operations. + + // Home factory and finder operations. + + // Home attribute operations. + } + + extern "C" RECEIVER_SVNT_Export ::PortableServer::Servant + createReceiverHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) + { + if (p == 0) + { + return 0; + } + + ::Hello::CCM_ReceiverHome_var x = + ::Hello::CCM_ReceiverHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + CIAO_GLUE_Hello::ReceiverHome_Servant ( + x.in (), + c); + } +} + diff --git a/TAO/CIAO/DAnCE/examples/Hello/Receiver/Receiver_svnt.h.new_impl b/TAO/CIAO/DAnCE/examples/Hello/Receiver/Receiver_svnt.h.new_impl new file mode 100644 index 00000000000..4f6b91009c4 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Hello/Receiver/Receiver_svnt.h.new_impl @@ -0,0 +1,356 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#ifndef CIAO_GLUE_SESSION_RECEIVER_SVNT_H +#define CIAO_GLUE_SESSION_RECEIVER_SVNT_H + +#include /**/ "ace/pre.h" + +#include "ReceiverEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ciao/Container_Base.h" +#include "ciao/Servant_Impl_T.h" +#include "ciao/Context_Impl_T.h" +#include "Home_Servant_Impl_Base.h" +#include "ciao/Home_Servant_Impl_T.h" +#include "ace/Active_Map_Manager_T.h" + +#include "ReceiverS.h" + +namespace Receiver_Impl +{ + namespace CIAO_GLUE_Hello + { + class Receiver_Servant; + + class RECEIVER_SVNT_Export Receiver_Context + : public virtual CIAO::Context_Impl< + ::Hello::CCM_Receiver_Context, + Receiver_Servant, + ::Hello::Receiver, + ::Hello::Receiver_var + > + { + public: + // We will allow the servant glue code we generate to access our state. + friend class Receiver_Servant; + + /// Hack for VC6. + typedef CIAO::Context_Impl< + ::Hello::CCM_Receiver_Context, + Receiver_Servant, + ::Hello::Receiver, + ::Hello::Receiver_var + > ctx_svnt_base; + + Receiver_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + Receiver_Servant *sv); + + virtual ~Receiver_Context (void); + + // Operations for Receiver receptacles and event sources, + // defined in ::Hello::CCM_Receiver_Context. + + virtual ::Hello::ReadMessage_ptr + get_connection_read_message ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO-specific. + + static Receiver_Context * + _narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + protected: + // Methods that manage this component's connections and consumers. + + virtual void + connect_read_message ( + ::Hello::ReadMessage_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + virtual ::Hello::ReadMessage_ptr + disconnect_read_message ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoConnection)); + + protected: + // Simplex read_message connection. + ::Hello::ReadMessage_var + ciao_uses_read_message_; + }; + } + + namespace CIAO_GLUE_Hello + { + class RECEIVER_SVNT_Export Receiver_Servant + : public virtual CIAO::Servant_Impl< + POA_Hello::Receiver, + ::Hello::CCM_Receiver, + ::Hello::CCM_Receiver_var, + Receiver_Context + > + { + public: + /// Hack for VC6. + typedef CIAO::Servant_Impl< + POA_Hello::Receiver, + ::Hello::CCM_Receiver, + ::Hello::CCM_Receiver_var, + Receiver_Context + > comp_svnt_base; + + Receiver_Servant ( + ::Hello::CCM_Receiver_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Home_Servant_Impl_Base *home_servant, + ::CIAO::Session_Container *c); + + virtual ~Receiver_Servant (void); + + virtual void + set_attributes ( + const ::Components::ConfigValues &descr + ACE_ENV_ARG_DECL); + + // Supported operations. + + // Public port operations. + + virtual void + connect_read_message ( + ::Hello::ReadMessage_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + virtual ::Hello::ReadMessage_ptr + disconnect_read_message ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoConnection)); + + virtual ::Hello::ReadMessage_ptr + get_connection_read_message ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Servant class for the click_in consumer. + class RECEIVER_SVNT_Export TimeOutConsumer_click_in_Servant + : public virtual POA_Hello::TimeOutConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + TimeOutConsumer_click_in_Servant ( + ::Hello::CCM_Receiver_ptr executor, + ::Hello::CCM_Receiver_Context_ptr c); + + virtual ~TimeOutConsumer_click_in_Servant (void); + + virtual void + push_TimeOut ( + ::Hello::TimeOut *evt + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Inherited from ::Components::EventConsumerBase. + virtual void + push_event (::Components::EventBase *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::BadEventType)); + + // Get component implementation. + virtual CORBA::Object_ptr + _get_component ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::Hello::CCM_Receiver_var + executor_; + + ::Hello::CCM_Receiver_Context_var + ctx_; + }; + + virtual ::Hello::TimeOutConsumer_ptr + get_consumer_click_in ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Component attribute operations. + + // Operations for Receptacles interface. + + virtual ::Components::Cookie * + connect ( + const char *name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::AlreadyConnected, + ::Components::ExceededConnectionLimit)); + + virtual CORBA::Object_ptr + disconnect ( + const char *name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::CookieRequired, + ::Components::NoConnection)); + + // Operations for Events interface. + + virtual ::Components::Cookie * + subscribe ( + const char *publisher_name, + ::Components::EventConsumerBase_ptr subscriber + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::ExceededConnectionLimit)); + + virtual ::Components::EventConsumerBase_ptr + unsubscribe ( + const char *publisher_name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection)); + + virtual void + connect_consumer ( + const char *emitter_name, + ::Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + // CIAO specific operations on the servant + CORBA::Object_ptr + get_facet_executor (const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException)); + + private: + + ::Hello::TimeOutConsumer_var + consumes_click_in_; + + private: + + void + populate_port_tables ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + ::Components::EventConsumerBase_ptr + get_consumer_click_in_i ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + }; + } + + namespace CIAO_GLUE_Hello + { + class RECEIVER_SVNT_Export ReceiverHome_Servant + : public virtual CIAO::Home_Servant_Impl< + POA_Hello::ReceiverHome, + ::Hello::CCM_ReceiverHome, + ::Hello::CCM_ReceiverHome_var, + ::Hello::Receiver, + ::Hello::Receiver_var, + ::Hello::CCM_Receiver, + ::Hello::CCM_Receiver_var, + Receiver_Servant + > + { + public: + /// Hack for VC6. + typedef CIAO::Home_Servant_Impl< + POA_Hello::ReceiverHome, + ::Hello::CCM_ReceiverHome, + ::Hello::CCM_ReceiverHome_var, + ::Hello::Receiver, + ::Hello::Receiver_var, + ::Hello::CCM_Receiver, + ::Hello::CCM_Receiver_var, + Receiver_Servant + > home_svnt_base; + + ReceiverHome_Servant ( + ::Hello::CCM_ReceiverHome_ptr exe, + ::CIAO::Session_Container *c); + + virtual ~ReceiverHome_Servant (void); + + // Home operations. + + // Home factory and finder operations. + + // Attribute operations. + }; + + extern "C" RECEIVER_SVNT_Export ::PortableServer::Servant + createReceiverHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + } +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_GLUE_SESSION_RECEIVER_SVNT_H */ + diff --git a/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.cpp.new_impl b/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.cpp.new_impl new file mode 100644 index 00000000000..9c934f3cfc3 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.cpp.new_impl @@ -0,0 +1,645 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#include "Sender_svnt.h" +#include "Cookies.h" +#include "ciao/Servant_Activator.h" +#include "ciao/Port_Activator_T.h" + +namespace Sender_Impl +{ + namespace CIAO_GLUE_Hello + { + template <typename T> + ReadMessage_Servant_T<T>::ReadMessage_Servant_T ( + ::Hello::CCM_ReadMessage_ptr executor, + ::Components::CCMContext_ptr c) + : executor_ (::Hello::CCM_ReadMessage::_duplicate (executor)), + ctx_ (::Components::CCMContext::_duplicate (c)) + { + } + + template <typename T> + ReadMessage_Servant_T<T>::~ReadMessage_Servant_T (void) + { + } + + template <typename T> + char * + ReadMessage_Servant_T<T>::get_message ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->executor_->get_message ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + template <typename T> + CORBA::Object_ptr + ReadMessage_Servant_T<T>::_get_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow ( + this->ctx_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + if (! CORBA::is_nil (sc.in ())) + { + return sc->get_CCM_object ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Components::EntityContext_var ec = + ::Components::EntityContext::_narrow ( + this->ctx_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + if (! CORBA::is_nil (ec.in ())) + { + return ec->get_CCM_object ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + } + } + + namespace CIAO_GLUE_Hello + { + Sender_Context::Sender_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + Sender_Servant *sv) + : ACE_NESTED_CLASS (CIAO, Context_Impl_Base (home, c)), + ctx_svnt_base (home, c, sv) + { + } + + Sender_Context::~Sender_Context (void) + { + } + + // Operations for Sender receptacles and event sources, + // defined in ::Hello::CCM_Sender_Context. + + void + Sender_Context::push_click_out ( + ::Hello::TimeOut *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_Active_Map_Manager< + ::Hello::TimeOutConsumer_var>::iterator end = + this->ciao_publishes_click_out_map_.end (); + + for (ACE_Active_Map_Manager< + ::Hello::TimeOutConsumer_var>::iterator iter = + this->ciao_publishes_click_out_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager< + ::Hello::TimeOutConsumer_var>::ENTRY &entry = *iter; + + ::Hello::TimeOutConsumer_var c = + ::Hello::TimeOutConsumer::_narrow ( + entry.int_id_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + entry.int_id_->push_TimeOut ( + ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + + ::Components::Cookie * + Sender_Context::subscribe_click_out ( + ::Hello::TimeOutConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + if (CORBA::is_nil (c)) + { + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + } + + ::Hello::TimeOutConsumer_var sub = + ::Hello::TimeOutConsumer::_duplicate (c); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_click_out_map_.bind (sub.in (), key); + sub._retn (); + + ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); + return retv._retn (); + } + + ::Hello::TimeOutConsumer_ptr + Sender_Context::unsubscribe_click_out ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + ::Hello::TimeOutConsumer_var retv; + ACE_Active_Map_Manager_Key key; + + if (ck == 0 || ::CIAO::Map_Key_Cookie::extract (ck, key) == false) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::Hello::TimeOutConsumer::_nil ()); + } + + if (this->ciao_publishes_click_out_map_.unbind (key, retv) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::Hello::TimeOutConsumer::_nil ()); + } + + return retv._retn (); + } + + // CIAO-specific. + + Sender_Context * + Sender_Context::_narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_NOT_USED) + { + return dynamic_cast<Sender_Context *> (p); + } + } + + namespace CIAO_GLUE_Hello + { + Sender_Servant::Sender_Servant ( + ::Hello::CCM_Sender_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Home_Servant_Impl_Base *home_servant, + ::CIAO::Session_Container *c) + : ACE_NESTED_CLASS (CIAO, Servant_Impl_Base (h, home_servant, c)), + comp_svnt_base (exe, h, home_servant, c) + { + this->context_ = new Sender_Context (h, c, this); + + ACE_TRY_NEW_ENV + { + ::Components::SessionComponent_var scom = + ::Components::SessionComponent::_narrow ( + exe + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! ::CORBA::is_nil (scom.in ())) + { + scom->set_session_context ( + this->context_ + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + + this->populate_port_tables ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + + ACE_CATCHANY + { + } + + ACE_ENDTRY; + } + + Sender_Servant::~Sender_Servant (void) + { + } + + void + Sender_Servant::set_attributes ( + const ::Components::ConfigValues &descr + ACE_ENV_ARG_DECL_NOT_USED) + { + for (CORBA::ULong i = 0; + i < descr.length (); + ++i) + { + const char *descr_name = descr[i]->name (); + ::CORBA::Any &descr_value = descr[i]->value (); + + if (ACE_OS::strcmp (descr_name, "local_message") == 0) + { + const char * _ciao_extract_val = 0; + descr_value >>= _ciao_extract_val; + this->local_message (_ciao_extract_val); + continue; + } + + ACE_UNUSED_ARG (descr_name); + ACE_UNUSED_ARG (descr_value); + } + } + + ::Hello::ReadMessage_ptr + Sender_Servant::provide_push_message ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (! ::CORBA::is_nil (this->provide_push_message_.in ())) + { + return ::Hello::ReadMessage::_duplicate (this->provide_push_message_.in ()); + } + + ::CORBA::Object_var obj = + this->provide_push_message_i (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::Hello::ReadMessage::_nil ()); + + ::Hello::ReadMessage_var fo = + ::Hello::ReadMessage::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::Hello::ReadMessage::_nil ()); + + this->provide_push_message_ = fo; + return ::Hello::ReadMessage::_duplicate (this->provide_push_message_.in ()); + } + + ::CORBA::Object_ptr + Sender_Servant::provide_push_message_i ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::CORBA::Object_ptr ret = + this->lookup_facet ("push_message"); + + if (! ::CORBA::is_nil (ret)) + { + return ret; + } + + CIAO::Port_Activator_T< + CIAO_GLUE_Hello::ReadMessage_Servant, + ::Hello::CCM_ReadMessage, + ::Components::CCMContext, + Sender_Servant + > *tmp = 0; + + typedef CIAO::Port_Activator_T< + CIAO_GLUE_Hello::ReadMessage_Servant, + ::Hello::CCM_ReadMessage, + ::Components::CCMContext, + Sender_Servant + > + MACRO_MADNESS_TYPEDEF; + + ACE_NEW_THROW_EX ( + tmp, + MACRO_MADNESS_TYPEDEF ( + "Hello_Sender_push_message", + "push_message", + CIAO::Port_Activator::Facet, + 0, + this->context_, + this), + CORBA::NO_MEMORY ()); + + CIAO::Servant_Activator *sa = + this->container_->ports_servant_activator (); + + if (!sa->register_port_activator (tmp)) + { + return 0; + } + + ::CORBA::Object_var obj = + this->container_->generate_reference ( + "Hello_Sender_push_message", + "IDL:Hello/ReadMessage:1.0", + CIAO::Container::Facet_Consumer + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::Hello::ReadMessage::_nil ()); + + this->add_facet ( + "push_message", + obj.in ()); + + return obj._retn (); + } + + ::Components::Cookie * + Sender_Servant::subscribe_click_out ( + ::Hello::TimeOutConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + return this->context_->subscribe_click_out ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::Hello::TimeOutConsumer_ptr + Sender_Servant::unsubscribe_click_out ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + return this->context_->unsubscribe_click_out ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ::Components::Cookie * + Sender_Servant::connect ( + const char *name, + ::CORBA::Object_ptr connection + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::AlreadyConnected, + ::Components::ExceededConnectionLimit)) + { + // If the component has no receptacles, this will be unused. + ACE_UNUSED_ARG (connection); + + if (name == 0) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + CORBA::Object_ptr + Sender_Servant::disconnect ( + const char *name, + ::Components::Cookie * ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::CookieRequired, + ::Components::NoConnection)) + { + if (name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + + ACE_UNUSED_ARG (ck); + } + + void + Sender_Servant::connect_consumer ( + const char * emitter_name, + ::Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) + { + if (emitter_name == 0) + { + ACE_THROW (::CORBA::BAD_PARAM ()); + } + + ACE_UNUSED_ARG (consumer); + ACE_THROW (::Components::InvalidName ()); + } + + ::Components::Cookie * + Sender_Servant::subscribe ( + const char *publisher_name, + ::Components::EventConsumerBase_ptr subscribe + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::ExceededConnectionLimit)) + { + // Just in case there are no if blocks + ACE_UNUSED_ARG (subscribe); + + if (publisher_name == 0) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + if (ACE_OS::strcmp (publisher_name, "click_out") == 0) + { + ::Hello::TimeOutConsumer_var _ciao_consumer = + ::Hello::TimeOutConsumer::_narrow ( + subscribe + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (_ciao_consumer.in ())) + { + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + } + + return this->subscribe_click_out ( + _ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ::Components::EventConsumerBase_ptr + Sender_Servant::unsubscribe ( + const char *publisher_name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection)) + { + // Just in case there are no if blocks + ACE_UNUSED_ARG (ck); + + if (publisher_name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + if (ACE_OS::strcmp (publisher_name, "click_out") == 0) + { + return this->unsubscribe_click_out ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + CORBA::Object_ptr + Sender_Servant::get_facet_executor (const char *name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException)) + { + if (name == 0) + { + ACE_THROW_RETURN ( + ::CORBA::BAD_PARAM (), + ::CORBA::Object::_nil ()); + } + + if (ACE_OS::strcmp (name, "push_message") == 0) + { + return this->executor_->get_push_message (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + return CORBA::Object::_nil (); + } + + // Supported operations. + + void + Sender_Servant::start ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->start ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + // Component attribute operations. + + char * + Sender_Servant::local_message ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->executor_->local_message ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + void + Sender_Servant::local_message ( + const char * local_message + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->local_message ( + local_message + ACE_ENV_ARG_PARAMETER); + } + + // Private method to populate the port tables. + void + Sender_Servant::populate_port_tables ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_ENV_ARG_NOT_USED; + ::CORBA::Object_var obj_var; + ::Components::EventConsumerBase_var ecb_var; + + obj_var = + this->provide_push_message_i ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + } + + namespace CIAO_GLUE_Hello + { + SenderHome_Servant::SenderHome_Servant ( + ::Hello::CCM_SenderHome_ptr exe, + ::CIAO::Session_Container *c) + : ACE_NESTED_CLASS (CIAO, Home_Servant_Impl_Base (c)), + home_svnt_base (exe, c) + { + } + + SenderHome_Servant::~SenderHome_Servant (void) + { + } + + // Home operations. + + // Home supported interface operations. + + // Home factory and finder operations. + + // Home attribute operations. + } + + extern "C" SENDER_SVNT_Export ::PortableServer::Servant + createSenderHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) + { + if (p == 0) + { + return 0; + } + + ::Hello::CCM_SenderHome_var x = + ::Hello::CCM_SenderHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + CIAO_GLUE_Hello::SenderHome_Servant ( + x.in (), + c); + } +} + diff --git a/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.h.new_impl b/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.h.new_impl new file mode 100644 index 00000000000..35e25cf9fe0 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.h.new_impl @@ -0,0 +1,366 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.dre.vanderbilt.edu/CIAO + +#ifndef CIAO_GLUE_SESSION_SENDER_SVNT_H +#define CIAO_GLUE_SESSION_SENDER_SVNT_H + +#include /**/ "ace/pre.h" + +#include "SenderEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ciao/Container_Base.h" +#include "ciao/Servant_Impl_T.h" +#include "ciao/Context_Impl_T.h" +#include "ciao/Home_Servant_Impl_Base.h" +#include "ciao/Home_Servant_Impl_T.h" +#include "ace/Active_Map_Manager_T.h" + +#include "SenderS.h" + +namespace Sender_Impl +{ + namespace CIAO_GLUE_Hello + { + template <typename T> + class ReadMessage_Servant_T + : public virtual POA_Hello::ReadMessage, + public virtual PortableServer::RefCountServantBase + { + public: + ReadMessage_Servant_T ( + ::Hello::CCM_ReadMessage_ptr executor, + ::Components::CCMContext_ptr ctx); + + virtual ~ReadMessage_Servant_T (void); + + virtual char * + get_message ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + + // Get component implementation. + virtual CORBA::Object_ptr + _get_component ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + + protected: + // Facet executor. + ::Hello::CCM_ReadMessage_var executor_; + + // Context object. + ::Components::CCMContext_var ctx_; + }; + + typedef SENDER_SVNT_Export ReadMessage_Servant_T<int> ReadMessage_Servant; + } + + namespace CIAO_GLUE_Hello + { + class Sender_Servant; + + class SENDER_SVNT_Export Sender_Context + : public virtual CIAO::Context_Impl< + ::Hello::CCM_Sender_Context, + Sender_Servant, + ::Hello::Sender, + ::Hello::Sender_var + > + { + public: + // We will allow the servant glue code we generate to access our state. + friend class Sender_Servant; + + /// Hack for VC6. + typedef CIAO::Context_Impl< + ::Hello::CCM_Sender_Context, + Sender_Servant, + ::Hello::Sender, + ::Hello::Sender_var + > ctx_svnt_base; + + Sender_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + Sender_Servant *sv); + + virtual ~Sender_Context (void); + + // Operations for Sender receptacles and event sources, + // defined in ::Hello::CCM_Sender_Context. + + virtual void + push_click_out ( + ::Hello::TimeOut *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO-specific. + + static Sender_Context * + _narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + protected: + // Methods that manage this component's connections and consumers. + + virtual ::Components::Cookie * + subscribe_click_out ( + ::Hello::TimeOutConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::Hello::TimeOutConsumer_ptr + unsubscribe_click_out ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + protected: + ACE_Active_Map_Manager< + ::Hello::TimeOutConsumer_var> + ciao_publishes_click_out_map_; + }; + } + + namespace CIAO_GLUE_Hello + { + class SENDER_SVNT_Export Sender_Servant + : public virtual CIAO::Servant_Impl< + POA_Hello::Sender, + ::Hello::CCM_Sender, + ::Hello::CCM_Sender_var, + Sender_Context + > + { + public: + /// Hack for VC6. + typedef CIAO::Servant_Impl< + POA_Hello::Sender, + ::Hello::CCM_Sender, + ::Hello::CCM_Sender_var, + Sender_Context + > comp_svnt_base; + + Sender_Servant ( + ::Hello::CCM_Sender_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Home_Servant_Impl_Base *home_servant, + ::CIAO::Session_Container *c); + + virtual ~Sender_Servant (void); + + virtual void + set_attributes ( + const ::Components::ConfigValues &descr + ACE_ENV_ARG_DECL); + + // Supported operations. + + virtual void + start ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Public port operations. + + virtual ::Hello::ReadMessage_ptr + provide_push_message ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::Cookie * + subscribe_click_out ( + ::Hello::TimeOutConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::Hello::TimeOutConsumer_ptr + unsubscribe_click_out ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + // Component attribute operations. + + virtual char * + local_message ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + local_message ( + const char * + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for Receptacles interface. + + virtual ::Components::Cookie * + connect ( + const char *name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::AlreadyConnected, + ::Components::ExceededConnectionLimit)); + + virtual CORBA::Object_ptr + disconnect ( + const char *name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::CookieRequired, + ::Components::NoConnection)); + + // Operations for Events interface. + + virtual ::Components::Cookie * + subscribe ( + const char *publisher_name, + ::Components::EventConsumerBase_ptr subscriber + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::ExceededConnectionLimit)); + + virtual ::Components::EventConsumerBase_ptr + unsubscribe ( + const char *publisher_name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection)); + + virtual void + connect_consumer ( + const char *emitter_name, + ::Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + // CIAO specific operations on the servant + CORBA::Object_ptr + get_facet_executor (const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException)); + + private: + + ::Hello::ReadMessage_var + provide_push_message_; + + private: + + void + populate_port_tables ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + ::CORBA::Object_ptr + provide_push_message_i ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + }; + } + + namespace CIAO_GLUE_Hello + { + class SENDER_SVNT_Export SenderHome_Servant + : public virtual CIAO::Home_Servant_Impl< + POA_Hello::SenderHome, + ::Hello::CCM_SenderHome, + ::Hello::CCM_SenderHome_var, + ::Hello::Sender, + ::Hello::Sender_var, + ::Hello::CCM_Sender, + ::Hello::CCM_Sender_var, + Sender_Servant + > + { + public: + /// Hack for VC6. + typedef CIAO::Home_Servant_Impl< + POA_Hello::SenderHome, + ::Hello::CCM_SenderHome, + ::Hello::CCM_SenderHome_var, + ::Hello::Sender, + ::Hello::Sender_var, + ::Hello::CCM_Sender, + ::Hello::CCM_Sender_var, + Sender_Servant + > home_svnt_base; + + SenderHome_Servant ( + ::Hello::CCM_SenderHome_ptr exe, + ::CIAO::Session_Container *c); + + virtual ~SenderHome_Servant (void); + + // Home operations. + + // Home factory and finder operations. + + // Attribute operations. + }; + + extern "C" SENDER_SVNT_Export ::PortableServer::Servant + createSenderHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + } +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_GLUE_SESSION_SENDER_SVNT_H */ + |