diff options
-rw-r--r-- | TAO/CIAO/DAnCE/examples/BasicSP/BMClosedED/BMClosedED_svnt.cpp | 1313 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/examples/BasicSP/BMClosedED/BMClosedED_svnt.h | 656 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/examples/BasicSP/BMDevice/BMDevice_svnt.cpp | 1202 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/examples/BasicSP/BMDevice/BMDevice_svnt.h | 610 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/examples/BasicSP/BMDisplay/BMDisplay_svnt.cpp | 1016 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/examples/BasicSP/BMDisplay/BMDisplay_svnt.h | 564 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/examples/BasicSP/EC/EC_svnt.cpp | 974 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/examples/BasicSP/EC/EC_svnt.h | 532 |
8 files changed, 6867 insertions, 0 deletions
diff --git a/TAO/CIAO/DAnCE/examples/BasicSP/BMClosedED/BMClosedED_svnt.cpp b/TAO/CIAO/DAnCE/examples/BasicSP/BMClosedED/BMClosedED_svnt.cpp new file mode 100644 index 00000000000..678d5b5d306 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/BasicSP/BMClosedED/BMClosedED_svnt.cpp @@ -0,0 +1,1313 @@ +// $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 "BMClosedED_svnt.h" +#include "Cookies.h" + +namespace BMClosedED_Impl +{ + namespace CIAO_GLUE_BasicSP + { + template <typename T> + ReadData_Servant_T<T>::ReadData_Servant_T ( + ::BasicSP::CCM_ReadData_ptr executor, + ::Components::CCMContext_ptr c) + : executor_ (::BasicSP::CCM_ReadData::_duplicate (executor)), + ctx_ (::Components::CCMContext::_duplicate (c)) + { + } + + template <typename T> + ReadData_Servant_T<T>::~ReadData_Servant_T (void) + { + } + + template <typename T> + char * + ReadData_Servant_T<T>::get_data ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->executor_->get_data ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + template <typename T> + CORBA::Object_ptr + ReadData_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_BasicSP + { + BMClosedED_Context::BMClosedED_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + BMClosedED_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) + { + } + + BMClosedED_Context::~BMClosedED_Context (void) + { + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + BMClosedED_Context::get_caller_principal ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::Components::Principal::_nil ()); + } + + ::Components::CCMHome_ptr + BMClosedED_Context::get_CCM_home ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return ::Components::CCMHome::_duplicate (this->home_.in ()); + } + + CORBA::Boolean + BMClosedED_Context::get_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::Transaction::UserTransaction_ptr + BMClosedED_Context::get_user_transaction ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::Components::Transaction::UserTransaction::_nil ()); + } + + CORBA::Boolean + BMClosedED_Context::is_caller_in_role ( + const char * /* role */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + void + BMClosedED_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContextinterface. + + CORBA::Object_ptr + BMClosedED_Context::get_CCM_object ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + if (CORBA::is_nil (this->component_.in ())) + { + CORBA::Object_var obj = + this->container_->get_objref ( + this->servant_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + this->component_ = + ::BasicSP::BMClosedED::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + if (CORBA::is_nil (this->component_.in ())) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::CORBA::Object::_nil ()); + } + } + + return ::BasicSP::BMClosedED::_duplicate ( + this->component_.in ()); + } + + // Operations for BMClosedED receptacles and event sources, + // defined in ::BasicSP::CCM_BMClosedED_Context. + + ::BasicSP::ReadData_ptr + BMClosedED_Context::get_connection_datain ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return ::BasicSP::ReadData::_duplicate ( + this->ciao_uses_datain_.in ()); + } + + void + BMClosedED_Context::connect_datain ( + ::BasicSP::ReadData_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) + { + if (!CORBA::is_nil (this->ciao_uses_datain_.in ())) + { + ACE_THROW (::Components::AlreadyConnected ()); + } + + if (CORBA::is_nil (c)) + { + ACE_THROW (::Components::InvalidConnection ()); + } + + this->ciao_uses_datain_ = + ::BasicSP::ReadData::_duplicate (c); + } + + ::BasicSP::ReadData_ptr + BMClosedED_Context::disconnect_datain ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoConnection)) + { + if (CORBA::is_nil (this->ciao_uses_datain_.in ())) + { + ACE_THROW_RETURN ( + ::Components::NoConnection (), + ::BasicSP::ReadData::_nil ()); + } + + return this->ciao_uses_datain_._retn (); + } + + void + BMClosedED_Context::push_out_avail ( + ::BasicSP::DataAvailable *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_CString my_uuid = this->servant_->component_UUID (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + my_uuid += "_out_avail_publisher"; + + this->container_->push_event (ev, + my_uuid.c_str () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + /* + ACE_Active_Map_Manager< + ::BasicSP::DataAvailableConsumer_var>::iterator end = + this->ciao_publishes_out_avail_map_.end (); + + for (ACE_Active_Map_Manager< + ::BasicSP::DataAvailableConsumer_var>::iterator iter = + this->ciao_publishes_out_avail_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager< + ::BasicSP::DataAvailableConsumer_var>::ENTRY &entry = *iter; + + ::BasicSP::DataAvailableConsumer_var c = + ::BasicSP::DataAvailableConsumer::_narrow ( + entry.int_id_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + entry.int_id_->push_DataAvailable ( + ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + */ + } + + ::Components::Cookie * + BMClosedED_Context::subscribe_out_avail ( + ::BasicSP::DataAvailableConsumer_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); + } + + ::BasicSP::DataAvailableConsumer_var sub = + ::BasicSP::DataAvailableConsumer::_duplicate (c); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_out_avail_map_.bind (sub.in (), key); + sub._retn (); + + ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); + return retv._retn (); + } + + ::BasicSP::DataAvailableConsumer_ptr + BMClosedED_Context::unsubscribe_out_avail ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + ::BasicSP::DataAvailableConsumer_var retv; + ACE_Active_Map_Manager_Key key; + + if (ck == 0 || ::CIAO::Map_Key_Cookie::extract (ck, key) == false) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BasicSP::DataAvailableConsumer::_nil ()); + } + + if (this->ciao_publishes_out_avail_map_.unbind (key, retv) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BasicSP::DataAvailableConsumer::_nil ()); + } + + return retv._retn (); + } + + // CIAO-specific. + + ::CIAO::Session_Container * + BMClosedED_Context::_ciao_the_Container (void) const + { + return this->container_; + } + + BMClosedED_Context * + BMClosedED_Context::_narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_NOT_USED) + { + return dynamic_cast<BMClosedED_Context *> (p); + } + } + + namespace CIAO_GLUE_BasicSP + { + BMClosedED_Servant::BMClosedED_Servant ( + ::BasicSP::CCM_BMClosedED_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : our_base (exe, c) + { + this->context_ = new BMClosedED_Context (h, c, this); + + CIAO_REGISTER_OBV_FACTORY ( + ::BasicSP::DataAvailable_init, + ::BasicSP::DataAvailable); + + 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; + } + + BMClosedED_Servant::~BMClosedED_Servant (void) + { + } + + void + BMClosedED_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); + } + } + + ::BasicSP::ReadData_ptr + BMClosedED_Servant::provide_dataout ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (! ::CORBA::is_nil (this->provide_dataout_.in ())) + { + return ::BasicSP::ReadData::_duplicate (this->provide_dataout_.in ()); + } + + ::BasicSP::CCM_ReadData_var fexe = + this->executor_->get_dataout (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::ReadData::_nil ()); + + if (::CORBA::is_nil (fexe.in ())) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BasicSP::ReadData::_nil ()); + } + + ::CORBA::Object_var obj = + this->provide_dataout_i (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::ReadData::_nil ()); + + CIAO_GLUE_BasicSP::ReadData_Servant *svt = 0; + + ACE_NEW_RETURN ( + svt, + CIAO_GLUE_BasicSP::ReadData_Servant ( + fexe.in (), + this->context_), + ::BasicSP::ReadData::_nil ()); + + PortableServer::ServantBase_var safe_servant (svt); + + PortableServer::ObjectId_var oid = + PortableServer::string_to_ObjectId ("BasicSP_BMClosedED_dataout"); + + this->container_->_ciao_the_POA ()->activate_object_with_id ( + oid.in (), + svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::ReadData::_nil ()); + + ::BasicSP::ReadData_var fo = + ::BasicSP::ReadData::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::ReadData::_nil ()); + + this->provide_dataout_ = fo; + return ::BasicSP::ReadData::_duplicate (this->provide_dataout_.in ()); + } + + ::CORBA::Object_ptr + BMClosedED_Servant::provide_dataout_i ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::CORBA::Object_ptr ret = + this->lookup_facet ("dataout"); + + if (! ::CORBA::is_nil (ret)) + { + return ret; + } + + ::CORBA::Object_var obj = + this->container_->generate_reference ( + "BasicSP_BMClosedED_dataout", + "IDL:BasicSP/ReadData:1.0" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::ReadData::_nil ()); + + this->add_facet ( + "dataout", + obj.in ()); + + return obj._retn (); + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + BMClosedED_Servant::provide_facet ( + const char *name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + if (name == 0) + { + ACE_THROW_RETURN ( + ::CORBA::BAD_PARAM (), + ::CORBA::Object::_nil ()); + } + + if (ACE_OS::strcmp (name, "dataout") == 0) + { + return this->provide_dataout (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + ::Components::FacetDescriptions * + BMClosedED_Servant::get_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + BMClosedED_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + BMClosedED_Servant::get_named_emitters ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::Cookie * + BMClosedED_Servant::subscribe_out_avail ( + ::BasicSP::DataAvailableConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + return this->context_->subscribe_out_avail ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::BasicSP::DataAvailableConsumer_ptr + BMClosedED_Servant::unsubscribe_out_avail ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + return this->context_->unsubscribe_out_avail ( + ck + ACE_ENV_ARG_PARAMETER); + } + + BMClosedED_Servant::DataAvailableConsumer_in_avail_Servant::DataAvailableConsumer_in_avail_Servant ( + ::BasicSP::CCM_BMClosedED_ptr executor, + ::BasicSP::CCM_BMClosedED_Context_ptr c) + : executor_ (::BasicSP::CCM_BMClosedED::_duplicate (executor)), + ctx_ (::BasicSP::CCM_BMClosedED_Context::_duplicate (c)) + { + } + + BMClosedED_Servant::DataAvailableConsumer_in_avail_Servant::~DataAvailableConsumer_in_avail_Servant (void) + { + } + + CORBA::Object_ptr + BMClosedED_Servant::DataAvailableConsumer_in_avail_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 + BMClosedED_Servant::DataAvailableConsumer_in_avail_Servant::push_DataAvailable ( + ::BasicSP::DataAvailable *evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->push_in_avail ( + evt + ACE_ENV_ARG_PARAMETER); + } + + // Inherited from ::Components::EventConsumerBase. + void + BMClosedED_Servant::DataAvailableConsumer_in_avail_Servant::push_event ( + ::Components::EventBase *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::BadEventType)) + { + ::BasicSP::DataAvailable_var ev_type = + ::BasicSP::DataAvailable::_downcast (ev); + + if (ev_type != 0) + { + this->push_DataAvailable ( + ev_type.in () + ACE_ENV_ARG_PARAMETER); + + return; + } + + ACE_THROW (::Components::BadEventType ()); + } + + ::BasicSP::DataAvailableConsumer_ptr + BMClosedED_Servant::get_consumer_in_avail ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (! ::CORBA::is_nil (this->consumes_in_avail_.in ())) + { + return ::BasicSP::DataAvailableConsumer::_duplicate (this->consumes_in_avail_.in ()); + } + + ::Components::EventConsumerBase_var obj = + this->get_consumer_in_avail_i ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::DataAvailableConsumer::_nil ()); + + BMClosedED_Servant::DataAvailableConsumer_in_avail_Servant *svt = 0; + ACE_NEW_RETURN ( + svt, + BMClosedED_Servant::DataAvailableConsumer_in_avail_Servant ( + this->executor_.in (), + this->context_), + ::BasicSP::DataAvailableConsumer::_nil ()); + + PortableServer::ServantBase_var safe_servant (svt); + + PortableServer::ObjectId_var oid = + PortableServer::string_to_ObjectId ("BasicSP_BMClosedED_in_avail"); + + this->container_->_ciao_the_POA ()->activate_object_with_id ( + oid.in (), + svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::DataAvailableConsumer::_nil ()); + + ::BasicSP::DataAvailableConsumer_var eco = + ::BasicSP::DataAvailableConsumer::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::DataAvailableConsumer::_nil ()); + + this->consumes_in_avail_ = eco; + return ::BasicSP::DataAvailableConsumer::_duplicate (this->consumes_in_avail_.in ()); + } + + ::Components::EventConsumerBase_ptr + BMClosedED_Servant::get_consumer_in_avail_i ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::EventConsumerBase_ptr ret = + this->lookup_consumer ("in_avail"); + + if (! ::CORBA::is_nil (ret)) + { + return ret; + } + + ::CORBA::Object_var obj = + this->container_->generate_reference ( + "BasicSP_BMClosedED_in_avail", + "IDL:BasicSP/DataAvailableConsumer:1.0" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::DataAvailableConsumer::_nil ()); + + ::Components::EventConsumerBase_var ecb = + ::Components::EventConsumerBase::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::DataAvailableConsumer::_nil ()); + + this->add_consumer ( + "in_avail", + ecb.in ()); + + return ecb._retn (); + } + + ::Components::Cookie * + BMClosedED_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, "datain") == 0) + { + ::BasicSP::ReadData_var _ciao_conn = + ::BasicSP::ReadData::_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_datain ( + _ciao_conn.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return 0; + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + CORBA::Object_ptr + BMClosedED_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, "datain") == 0) + { + // Simplex disconnect. + return this->disconnect_datain (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + + ACE_UNUSED_ARG (ck); + } + + ::Components::ConnectionDescriptions * + BMClosedED_Servant::get_connections ( + const char * /* name */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + BMClosedED_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + BMClosedED_Servant::get_named_receptacles ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + void + BMClosedED_Servant::connect_datain ( + ::BasicSP::ReadData_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) + { + this->context_->connect_datain ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::BasicSP::ReadData_ptr + BMClosedED_Servant::disconnect_datain ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoConnection)) + { + return this->context_->disconnect_datain ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::BasicSP::ReadData_ptr + BMClosedED_Servant::get_connection_datain ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->context_->get_connection_datain ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Components::EventConsumerBase_ptr + BMClosedED_Servant::get_consumer ( + const char *sink_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + if (sink_name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + if (ACE_OS::strcmp (sink_name, "in_avail") == 0) + { + return this->get_consumer_in_avail (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + void + BMClosedED_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::EventConsumerBase_ptr + BMClosedED_Servant::disconnect_consumer ( + const char * /* source_name */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::NoConnection)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + BMClosedED_Servant::get_named_consumers ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::Cookie * + BMClosedED_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, "out_avail") == 0) + { + ::BasicSP::DataAvailableConsumer_var _ciao_consumer = + ::BasicSP::DataAvailableConsumer::_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_out_avail ( + _ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ::Components::EventConsumerBase_ptr + BMClosedED_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, "out_avail") == 0) + { + return this->unsubscribe_out_avail ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ::Components::PublisherDescriptions * + BMClosedED_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + BMClosedED_Servant::get_named_publishers ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + // Operations for CCMObject interface. + + void + BMClosedED_Servant::component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->component_UUID_ = new_component_UUID; + } + + CIAO::CONNECTION_ID + BMClosedED_Servant::component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return CORBA::string_dup (this->component_UUID_.c_str ()); + } + + CORBA::IRObject_ptr + BMClosedED_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + BMClosedED_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + BMClosedED_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + // Supported operations. + + // Component attribute operations. + + // Private method to populate the port tables. + void + BMClosedED_Servant::populate_port_tables ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::CORBA::Object_var obj_var; + ::Components::EventConsumerBase_var ecb_var; + + obj_var = + this->provide_dataout_i ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ecb_var = + this->get_consumer_in_avail_i ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + } + + namespace CIAO_GLUE_BasicSP + { + BMClosedEDHome_Servant::BMClosedEDHome_Servant ( + ::BasicSP::CCM_BMClosedEDHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::BasicSP::CCM_BMClosedEDHome::_duplicate (exe)), + container_ (c) + { + } + + BMClosedEDHome_Servant::~BMClosedEDHome_Servant (void) + { + } + + // Home operations. + + // Home supported interface operations. + + // Home factory and finder operations. + + // Home attribute operations. + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + BMClosedEDHome_Servant::create_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + return this->create (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + // Operations for implicit home interface. + + ::BasicSP::BMClosedED_ptr + BMClosedEDHome_Servant::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BasicSP::BMClosedED::_nil ()); + } + + ::Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMClosedED::_nil ()); + + ::BasicSP::CCM_BMClosedED_var _ciao_comp = + ::BasicSP::CCM_BMClosedED::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMClosedED::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + BMClosedEDHome_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::CORBA::IRObject_ptr + BMClosedEDHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + BMClosedEDHome_Servant::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + ::BasicSP::BMClosedED_var _ciao_comp = + ::BasicSP::BMClosedED::_narrow ( + comp + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (_ciao_comp.in ())) + { + ACE_THROW (CORBA::INTERNAL ()); + } + + _ciao_comp->remove (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->_ciao_passivate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // CIAO-specific operations. + + ::BasicSP::BMClosedED_ptr + BMClosedEDHome_Servant::_ciao_activate_component ( + ::BasicSP::CCM_BMClosedED_ptr exe + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::CORBA::Object_var hobj = + this->container_->get_objref ( + this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMClosedED::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMClosedED::_nil ()); + + BMClosedED_Servant *svt = + new BMClosedED_Servant ( + exe, + home.in (), + this->container_); + + PortableServer::ServantBase_var safe (svt); + PortableServer::ObjectId_var oid; + + CORBA::Object_var objref = + this->container_->install_component ( + svt, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMClosedED::_nil ()); + + ::BasicSP::BMClosedED_var ho = + ::BasicSP::BMClosedED::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMClosedED::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + BMClosedEDHome_Servant::_ciao_passivate_component ( + ::BasicSP::BMClosedED_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + PortableServer::ObjectId_var oid; + + this->container_->uninstall_component ( + comp, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + BMClosedED_Servant *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; + } + } + } + + extern "C" BMCLOSEDED_SVNT_Export ::PortableServer::Servant + createBMClosedEDHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) + { + if (p == 0) + { + return 0; + } + + ::BasicSP::CCM_BMClosedEDHome_var x = + ::BasicSP::CCM_BMClosedEDHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + CIAO_GLUE_BasicSP::BMClosedEDHome_Servant ( + x.in (), + c); + } +} + diff --git a/TAO/CIAO/DAnCE/examples/BasicSP/BMClosedED/BMClosedED_svnt.h b/TAO/CIAO/DAnCE/examples/BasicSP/BMClosedED/BMClosedED_svnt.h new file mode 100644 index 00000000000..4772366ddb8 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/BasicSP/BMClosedED/BMClosedED_svnt.h @@ -0,0 +1,656 @@ +// $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_BMCLOSEDED_SVNT_H +#define CIAO_GLUE_SESSION_BMCLOSEDED_SVNT_H + +#include /**/ "ace/pre.h" + +#include "BMClosedEDEC.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 "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#include "../BasicSPS.h" +#include "BMClosedEDS.h" + +namespace BMClosedED_Impl +{ + namespace CIAO_GLUE_BasicSP + { + template <typename T> + class ReadData_Servant_T + : public virtual POA_BasicSP::ReadData, + public virtual PortableServer::RefCountServantBase + { + public: + ReadData_Servant_T ( + ::BasicSP::CCM_ReadData_ptr executor, + ::Components::CCMContext_ptr ctx); + + virtual ~ReadData_Servant_T (void); + + virtual char * + get_data ( + 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. + ::BasicSP::CCM_ReadData_var executor_; + + // Context object. + ::Components::CCMContext_var ctx_; + }; + + typedef BMCLOSEDED_SVNT_Export ReadData_Servant_T<int> ReadData_Servant; + } + + namespace CIAO_GLUE_BasicSP + { + class BMCLOSEDED_SVNT_Export BMClosedED_Context + : public virtual ::BasicSP::CCM_BMClosedED_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class BMClosedED_Servant; + + BMClosedED_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + BMClosedED_Servant *sv); + + virtual ~BMClosedED_Context (void); + + // Operations from ::Components::CCMContext. + + virtual ::Components::Principal_ptr + get_caller_principal ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::CCMHome_ptr + get_CCM_home ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Boolean + get_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + virtual ::Components::Transaction::UserTransaction_ptr + get_user_transaction ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + virtual CORBA::Boolean + is_caller_in_role ( + const char *role + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + // Operations from ::Components::SessionContext interface. + + virtual CORBA::Object_ptr + get_CCM_object ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + // Operations for BMClosedED receptacles and event sources, + // defined in ::BasicSP::CCM_BMClosedED_Context. + + virtual ::BasicSP::ReadData_ptr + get_connection_datain ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + push_out_avail ( + ::BasicSP::DataAvailable *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO-specific. + + ::CIAO::Session_Container * + _ciao_the_Container (void) const; + + static BMClosedED_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_datain ( + ::BasicSP::ReadData_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + virtual ::BasicSP::ReadData_ptr + disconnect_datain ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoConnection)); + + virtual ::Components::Cookie * + subscribe_out_avail ( + ::BasicSP::DataAvailableConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BasicSP::DataAvailableConsumer_ptr + unsubscribe_out_avail ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + protected: + // Simplex datain connection. + ::BasicSP::ReadData_var + ciao_uses_datain_; + + ACE_Active_Map_Manager< + ::BasicSP::DataAvailableConsumer_var> + ciao_publishes_out_avail_map_; + + ::Components::CCMHome_var home_; + ::CIAO::Session_Container *container_; + + BMClosedED_Servant *servant_; + ::BasicSP::BMClosedED_var component_; + }; + } + + namespace CIAO_GLUE_BasicSP + { + class BMCLOSEDED_SVNT_Export BMClosedED_Servant + : public virtual CIAO::Servant_Impl< + POA_BasicSP::BMClosedED, + ::BasicSP::CCM_BMClosedED, + ::BasicSP::CCM_BMClosedED_var, + BMClosedED_Context + >, + public virtual PortableServer::RefCountServantBase + { + public: + /// Hack for VC6 the most sucky compiler + typedef CIAO::Servant_Impl< + POA_BasicSP::BMClosedED, + ::BasicSP::CCM_BMClosedED, + ::BasicSP::CCM_BMClosedED_var, + BMClosedED_Context + > our_base; + + BMClosedED_Servant ( + ::BasicSP::CCM_BMClosedED_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~BMClosedED_Servant (void); + + virtual void + set_attributes ( + const ::Components::ConfigValues &descr + ACE_ENV_ARG_DECL); + + // Supported operations. + + // Public port operations. + + virtual ::BasicSP::ReadData_ptr + provide_dataout ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + connect_datain ( + ::BasicSP::ReadData_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + virtual ::BasicSP::ReadData_ptr + disconnect_datain ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoConnection)); + + virtual ::BasicSP::ReadData_ptr + get_connection_datain ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::Cookie * + subscribe_out_avail ( + ::BasicSP::DataAvailableConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BasicSP::DataAvailableConsumer_ptr + unsubscribe_out_avail ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + // Servant class for the in_avail consumer. + class BMCLOSEDED_SVNT_Export DataAvailableConsumer_in_avail_Servant + : public virtual POA_BasicSP::DataAvailableConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + DataAvailableConsumer_in_avail_Servant ( + ::BasicSP::CCM_BMClosedED_ptr executor, + ::BasicSP::CCM_BMClosedED_Context_ptr c); + + virtual ~DataAvailableConsumer_in_avail_Servant (void); + + virtual void + push_DataAvailable ( + ::BasicSP::DataAvailable *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: + ::BasicSP::CCM_BMClosedED_var + executor_; + + ::BasicSP::CCM_BMClosedED_Context_var + ctx_; + }; + + virtual ::BasicSP::DataAvailableConsumer_ptr + get_consumer_in_avail ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Component attribute operations. + + // Operations for Navigation interface. + + virtual CORBA::Object_ptr + provide_facet ( + const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual ::Components::FacetDescriptions * + get_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + // 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)); + + virtual ::Components::ConnectionDescriptions * + get_connections ( + const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual ::Components::ReceptacleDescriptions * + get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::ReceptacleDescriptions * + get_named_receptacles ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + // Operations for Events interface. + + virtual ::Components::EventConsumerBase_ptr + get_consumer ( + const char *sink_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + 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)); + + virtual ::Components::EventConsumerBase_ptr + disconnect_consumer ( + const char *source_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::NoConnection)); + + virtual ::Components::ConsumerDescriptions * + get_named_consumers ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual ::Components::EmitterDescriptions * + get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::EmitterDescriptions * + get_named_emitters( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual ::Components::PublisherDescriptions * + get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PublisherDescriptions * + get_named_publishers ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + // Operations for CCMObject interface. + + virtual void + component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CIAO::CONNECTION_ID + component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::IRObject_ptr + get_component_def ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)); + + virtual void + remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)); + + private: + + ::BasicSP::ReadData_var + provide_dataout_; + + ::BasicSP::DataAvailableConsumer_var + consumes_in_avail_; + + private: + + void + populate_port_tables ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + ::CORBA::Object_ptr + provide_dataout_i ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + ::Components::EventConsumerBase_ptr + get_consumer_in_avail_i ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + ACE_CString component_UUID_; + }; + } + + namespace CIAO_GLUE_BasicSP + { + class BMCLOSEDED_SVNT_Export BMClosedEDHome_Servant + : public virtual POA_BasicSP::BMClosedEDHome, + public virtual PortableServer::RefCountServantBase + { + public: + BMClosedEDHome_Servant ( + ::BasicSP::CCM_BMClosedEDHome_ptr exe, + ::CIAO::Session_Container *c); + virtual ~BMClosedEDHome_Servant (void); + + // Home operations. + + // Home factory and finder operations. + + // Attribute operations. + + // Operations for keyless home interface. + + virtual ::Components::CCMObject_ptr + create_component ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)); + + // Operations for implicit home interface. + + virtual ::BasicSP::BMClosedED_ptr + create ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)); + + // Operations for CCMHome interface. + + virtual ::CORBA::IRObject_ptr + get_component_def ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::CORBA::IRObject_ptr + get_home_def ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)); + + // Supported operations. + + protected: + // CIAO-specific operations. + + ::BasicSP::BMClosedED_ptr + _ciao_activate_component ( + ::BasicSP::CCM_BMClosedED_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::BasicSP::BMClosedED_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BasicSP::CCM_BMClosedEDHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + BMClosedED_Servant *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; + + extern "C" BMCLOSEDED_SVNT_Export ::PortableServer::Servant + createBMClosedEDHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + } +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_GLUE_SESSION_BMCLOSEDED_SVNT_H */ + diff --git a/TAO/CIAO/DAnCE/examples/BasicSP/BMDevice/BMDevice_svnt.cpp b/TAO/CIAO/DAnCE/examples/BasicSP/BMDevice/BMDevice_svnt.cpp new file mode 100644 index 00000000000..453fd726b1c --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/BasicSP/BMDevice/BMDevice_svnt.cpp @@ -0,0 +1,1202 @@ +// $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 "BMDevice_svnt.h" +#include "Cookies.h" + +namespace BMDevice_Impl +{ + namespace CIAO_GLUE_BasicSP + { + template <typename T> + ReadData_Servant_T<T>::ReadData_Servant_T ( + ::BasicSP::CCM_ReadData_ptr executor, + ::Components::CCMContext_ptr c) + : executor_ (::BasicSP::CCM_ReadData::_duplicate (executor)), + ctx_ (::Components::CCMContext::_duplicate (c)) + { + } + + template <typename T> + ReadData_Servant_T<T>::~ReadData_Servant_T (void) + { + } + + template <typename T> + char * + ReadData_Servant_T<T>::get_data ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->executor_->get_data ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + template <typename T> + CORBA::Object_ptr + ReadData_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_BasicSP + { + BMDevice_Context::BMDevice_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + BMDevice_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) + { + } + + BMDevice_Context::~BMDevice_Context (void) + { + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + BMDevice_Context::get_caller_principal ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::Components::Principal::_nil ()); + } + + ::Components::CCMHome_ptr + BMDevice_Context::get_CCM_home ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return ::Components::CCMHome::_duplicate (this->home_.in ()); + } + + CORBA::Boolean + BMDevice_Context::get_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::Transaction::UserTransaction_ptr + BMDevice_Context::get_user_transaction ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::Components::Transaction::UserTransaction::_nil ()); + } + + CORBA::Boolean + BMDevice_Context::is_caller_in_role ( + const char * /* role */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + void + BMDevice_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContextinterface. + + CORBA::Object_ptr + BMDevice_Context::get_CCM_object ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + if (CORBA::is_nil (this->component_.in ())) + { + CORBA::Object_var obj = + this->container_->get_objref ( + this->servant_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + this->component_ = + ::BasicSP::BMDevice::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + if (CORBA::is_nil (this->component_.in ())) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::CORBA::Object::_nil ()); + } + } + + return ::BasicSP::BMDevice::_duplicate ( + this->component_.in ()); + } + + // Operations for BMDevice receptacles and event sources, + // defined in ::BasicSP::CCM_BMDevice_Context. + + void + BMDevice_Context::push_data_available ( + ::BasicSP::DataAvailable *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_CString my_uuid = this->servant_->component_UUID (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + my_uuid += "_data_available_publisher"; + + this->container_->push_event (ev, + my_uuid.c_str () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + /* + ACE_Active_Map_Manager< + ::BasicSP::DataAvailableConsumer_var>::iterator end = + this->ciao_publishes_data_available_map_.end (); + + for (ACE_Active_Map_Manager< + ::BasicSP::DataAvailableConsumer_var>::iterator iter = + this->ciao_publishes_data_available_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager< + ::BasicSP::DataAvailableConsumer_var>::ENTRY &entry = *iter; + + ::BasicSP::DataAvailableConsumer_var c = + ::BasicSP::DataAvailableConsumer::_narrow ( + entry.int_id_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + entry.int_id_->push_DataAvailable ( + ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + */ + } + + ::Components::Cookie * + BMDevice_Context::subscribe_data_available ( + ::BasicSP::DataAvailableConsumer_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); + } + + ::BasicSP::DataAvailableConsumer_var sub = + ::BasicSP::DataAvailableConsumer::_duplicate (c); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_data_available_map_.bind (sub.in (), key); + sub._retn (); + + ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); + return retv._retn (); + } + + ::BasicSP::DataAvailableConsumer_ptr + BMDevice_Context::unsubscribe_data_available ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + ::BasicSP::DataAvailableConsumer_var retv; + ACE_Active_Map_Manager_Key key; + + if (ck == 0 || ::CIAO::Map_Key_Cookie::extract (ck, key) == false) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BasicSP::DataAvailableConsumer::_nil ()); + } + + if (this->ciao_publishes_data_available_map_.unbind (key, retv) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BasicSP::DataAvailableConsumer::_nil ()); + } + + return retv._retn (); + } + + // CIAO-specific. + + ::CIAO::Session_Container * + BMDevice_Context::_ciao_the_Container (void) const + { + return this->container_; + } + + BMDevice_Context * + BMDevice_Context::_narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_NOT_USED) + { + return dynamic_cast<BMDevice_Context *> (p); + } + } + + namespace CIAO_GLUE_BasicSP + { + BMDevice_Servant::BMDevice_Servant ( + ::BasicSP::CCM_BMDevice_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : our_base (exe, c) + { + this->context_ = new BMDevice_Context (h, c, this); + + CIAO_REGISTER_OBV_FACTORY ( + ::BasicSP::TimeOut_init, + ::BasicSP::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; + } + + BMDevice_Servant::~BMDevice_Servant (void) + { + } + + void + BMDevice_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); + } + } + + ::BasicSP::ReadData_ptr + BMDevice_Servant::provide_data_read ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (! ::CORBA::is_nil (this->provide_data_read_.in ())) + { + return ::BasicSP::ReadData::_duplicate (this->provide_data_read_.in ()); + } + + ::BasicSP::CCM_ReadData_var fexe = + this->executor_->get_data_read (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::ReadData::_nil ()); + + if (::CORBA::is_nil (fexe.in ())) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BasicSP::ReadData::_nil ()); + } + + ::CORBA::Object_var obj = + this->provide_data_read_i (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::ReadData::_nil ()); + + CIAO_GLUE_BasicSP::ReadData_Servant *svt = 0; + + ACE_NEW_RETURN ( + svt, + CIAO_GLUE_BasicSP::ReadData_Servant ( + fexe.in (), + this->context_), + ::BasicSP::ReadData::_nil ()); + + PortableServer::ServantBase_var safe_servant (svt); + + PortableServer::ObjectId_var oid = + PortableServer::string_to_ObjectId ("BasicSP_BMDevice_data_read"); + + this->container_->_ciao_the_POA ()->activate_object_with_id ( + oid.in (), + svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::ReadData::_nil ()); + + ::BasicSP::ReadData_var fo = + ::BasicSP::ReadData::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::ReadData::_nil ()); + + this->provide_data_read_ = fo; + return ::BasicSP::ReadData::_duplicate (this->provide_data_read_.in ()); + } + + ::CORBA::Object_ptr + BMDevice_Servant::provide_data_read_i ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::CORBA::Object_ptr ret = + this->lookup_facet ("data_read"); + + if (! ::CORBA::is_nil (ret)) + { + return ret; + } + + ::CORBA::Object_var obj = + this->container_->generate_reference ( + "BasicSP_BMDevice_data_read", + "IDL:BasicSP/ReadData:1.0" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::ReadData::_nil ()); + + this->add_facet ( + "data_read", + obj.in ()); + + return obj._retn (); + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + BMDevice_Servant::provide_facet ( + const char *name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + if (name == 0) + { + ACE_THROW_RETURN ( + ::CORBA::BAD_PARAM (), + ::CORBA::Object::_nil ()); + } + + if (ACE_OS::strcmp (name, "data_read") == 0) + { + return this->provide_data_read (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + ::Components::FacetDescriptions * + BMDevice_Servant::get_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + BMDevice_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + BMDevice_Servant::get_named_emitters ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::Cookie * + BMDevice_Servant::subscribe_data_available ( + ::BasicSP::DataAvailableConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + return this->context_->subscribe_data_available ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::BasicSP::DataAvailableConsumer_ptr + BMDevice_Servant::unsubscribe_data_available ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + return this->context_->unsubscribe_data_available ( + ck + ACE_ENV_ARG_PARAMETER); + } + + BMDevice_Servant::TimeOutConsumer_timeout_Servant::TimeOutConsumer_timeout_Servant ( + ::BasicSP::CCM_BMDevice_ptr executor, + ::BasicSP::CCM_BMDevice_Context_ptr c) + : executor_ (::BasicSP::CCM_BMDevice::_duplicate (executor)), + ctx_ (::BasicSP::CCM_BMDevice_Context::_duplicate (c)) + { + } + + BMDevice_Servant::TimeOutConsumer_timeout_Servant::~TimeOutConsumer_timeout_Servant (void) + { + } + + CORBA::Object_ptr + BMDevice_Servant::TimeOutConsumer_timeout_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 + BMDevice_Servant::TimeOutConsumer_timeout_Servant::push_TimeOut ( + ::BasicSP::TimeOut *evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->push_timeout ( + evt + ACE_ENV_ARG_PARAMETER); + } + + // Inherited from ::Components::EventConsumerBase. + void + BMDevice_Servant::TimeOutConsumer_timeout_Servant::push_event ( + ::Components::EventBase *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::BadEventType)) + { + ::BasicSP::TimeOut_var ev_type = + ::BasicSP::TimeOut::_downcast (ev); + + if (ev_type != 0) + { + this->push_TimeOut ( + ev_type.in () + ACE_ENV_ARG_PARAMETER); + + return; + } + + ACE_THROW (::Components::BadEventType ()); + } + + ::BasicSP::TimeOutConsumer_ptr + BMDevice_Servant::get_consumer_timeout ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (! ::CORBA::is_nil (this->consumes_timeout_.in ())) + { + return ::BasicSP::TimeOutConsumer::_duplicate (this->consumes_timeout_.in ()); + } + + ::Components::EventConsumerBase_var obj = + this->get_consumer_timeout_i ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::TimeOutConsumer::_nil ()); + + BMDevice_Servant::TimeOutConsumer_timeout_Servant *svt = 0; + ACE_NEW_RETURN ( + svt, + BMDevice_Servant::TimeOutConsumer_timeout_Servant ( + this->executor_.in (), + this->context_), + ::BasicSP::TimeOutConsumer::_nil ()); + + PortableServer::ServantBase_var safe_servant (svt); + + PortableServer::ObjectId_var oid = + PortableServer::string_to_ObjectId ("BasicSP_BMDevice_timeout"); + + this->container_->_ciao_the_POA ()->activate_object_with_id ( + oid.in (), + svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::TimeOutConsumer::_nil ()); + + ::BasicSP::TimeOutConsumer_var eco = + ::BasicSP::TimeOutConsumer::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::TimeOutConsumer::_nil ()); + + this->consumes_timeout_ = eco; + return ::BasicSP::TimeOutConsumer::_duplicate (this->consumes_timeout_.in ()); + } + + ::Components::EventConsumerBase_ptr + BMDevice_Servant::get_consumer_timeout_i ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::EventConsumerBase_ptr ret = + this->lookup_consumer ("timeout"); + + if (! ::CORBA::is_nil (ret)) + { + return ret; + } + + ::CORBA::Object_var obj = + this->container_->generate_reference ( + "BasicSP_BMDevice_timeout", + "IDL:BasicSP/TimeOutConsumer:1.0" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::TimeOutConsumer::_nil ()); + + ::Components::EventConsumerBase_var ecb = + ::Components::EventConsumerBase::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::TimeOutConsumer::_nil ()); + + this->add_consumer ( + "timeout", + ecb.in ()); + + return ecb._retn (); + } + + ::Components::Cookie * + BMDevice_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 + BMDevice_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); + } + + ::Components::ConnectionDescriptions * + BMDevice_Servant::get_connections ( + const char * /* name */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + BMDevice_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + BMDevice_Servant::get_named_receptacles ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EventConsumerBase_ptr + BMDevice_Servant::get_consumer ( + const char *sink_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + if (sink_name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + if (ACE_OS::strcmp (sink_name, "timeout") == 0) + { + return this->get_consumer_timeout (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + void + BMDevice_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::EventConsumerBase_ptr + BMDevice_Servant::disconnect_consumer ( + const char * /* source_name */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::NoConnection)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + BMDevice_Servant::get_named_consumers ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::Cookie * + BMDevice_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, "data_available") == 0) + { + ::BasicSP::DataAvailableConsumer_var _ciao_consumer = + ::BasicSP::DataAvailableConsumer::_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_data_available ( + _ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ::Components::EventConsumerBase_ptr + BMDevice_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, "data_available") == 0) + { + return this->unsubscribe_data_available ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ::Components::PublisherDescriptions * + BMDevice_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + BMDevice_Servant::get_named_publishers ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + // Operations for CCMObject interface. + + void + BMDevice_Servant::component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->component_UUID_ = new_component_UUID; + } + + CIAO::CONNECTION_ID + BMDevice_Servant::component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return CORBA::string_dup (this->component_UUID_.c_str ()); + } + + CORBA::IRObject_ptr + BMDevice_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + BMDevice_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + BMDevice_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + // Supported operations. + + // Component attribute operations. + + // Private method to populate the port tables. + void + BMDevice_Servant::populate_port_tables ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::CORBA::Object_var obj_var; + ::Components::EventConsumerBase_var ecb_var; + + obj_var = + this->provide_data_read_i ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ecb_var = + this->get_consumer_timeout_i ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + } + + namespace CIAO_GLUE_BasicSP + { + BMDeviceHome_Servant::BMDeviceHome_Servant ( + ::BasicSP::CCM_BMDeviceHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::BasicSP::CCM_BMDeviceHome::_duplicate (exe)), + container_ (c) + { + } + + BMDeviceHome_Servant::~BMDeviceHome_Servant (void) + { + } + + // Home operations. + + // Home supported interface operations. + + // Home factory and finder operations. + + // Home attribute operations. + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + BMDeviceHome_Servant::create_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + return this->create (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + // Operations for implicit home interface. + + ::BasicSP::BMDevice_ptr + BMDeviceHome_Servant::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BasicSP::BMDevice::_nil ()); + } + + ::Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDevice::_nil ()); + + ::BasicSP::CCM_BMDevice_var _ciao_comp = + ::BasicSP::CCM_BMDevice::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDevice::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + BMDeviceHome_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::CORBA::IRObject_ptr + BMDeviceHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + BMDeviceHome_Servant::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + ::BasicSP::BMDevice_var _ciao_comp = + ::BasicSP::BMDevice::_narrow ( + comp + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (_ciao_comp.in ())) + { + ACE_THROW (CORBA::INTERNAL ()); + } + + _ciao_comp->remove (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->_ciao_passivate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // CIAO-specific operations. + + ::BasicSP::BMDevice_ptr + BMDeviceHome_Servant::_ciao_activate_component ( + ::BasicSP::CCM_BMDevice_ptr exe + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::CORBA::Object_var hobj = + this->container_->get_objref ( + this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDevice::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDevice::_nil ()); + + BMDevice_Servant *svt = + new BMDevice_Servant ( + exe, + home.in (), + this->container_); + + PortableServer::ServantBase_var safe (svt); + PortableServer::ObjectId_var oid; + + CORBA::Object_var objref = + this->container_->install_component ( + svt, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDevice::_nil ()); + + ::BasicSP::BMDevice_var ho = + ::BasicSP::BMDevice::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDevice::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + BMDeviceHome_Servant::_ciao_passivate_component ( + ::BasicSP::BMDevice_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + PortableServer::ObjectId_var oid; + + this->container_->uninstall_component ( + comp, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + BMDevice_Servant *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; + } + } + } + + extern "C" BMDEVICE_SVNT_Export ::PortableServer::Servant + createBMDeviceHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) + { + if (p == 0) + { + return 0; + } + + ::BasicSP::CCM_BMDeviceHome_var x = + ::BasicSP::CCM_BMDeviceHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + CIAO_GLUE_BasicSP::BMDeviceHome_Servant ( + x.in (), + c); + } +} + diff --git a/TAO/CIAO/DAnCE/examples/BasicSP/BMDevice/BMDevice_svnt.h b/TAO/CIAO/DAnCE/examples/BasicSP/BMDevice/BMDevice_svnt.h new file mode 100644 index 00000000000..056d4f7f19d --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/BasicSP/BMDevice/BMDevice_svnt.h @@ -0,0 +1,610 @@ +// $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_BMDEVICE_SVNT_H +#define CIAO_GLUE_SESSION_BMDEVICE_SVNT_H + +#include /**/ "ace/pre.h" + +#include "BMDeviceEC.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 "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#include "../BasicSPS.h" +#include "BMDeviceS.h" + +namespace BMDevice_Impl +{ + namespace CIAO_GLUE_BasicSP + { + template <typename T> + class ReadData_Servant_T + : public virtual POA_BasicSP::ReadData, + public virtual PortableServer::RefCountServantBase + { + public: + ReadData_Servant_T ( + ::BasicSP::CCM_ReadData_ptr executor, + ::Components::CCMContext_ptr ctx); + + virtual ~ReadData_Servant_T (void); + + virtual char * + get_data ( + 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. + ::BasicSP::CCM_ReadData_var executor_; + + // Context object. + ::Components::CCMContext_var ctx_; + }; + + typedef BMDEVICE_SVNT_Export ReadData_Servant_T<int> ReadData_Servant; + } + + namespace CIAO_GLUE_BasicSP + { + class BMDEVICE_SVNT_Export BMDevice_Context + : public virtual ::BasicSP::CCM_BMDevice_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class BMDevice_Servant; + + BMDevice_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + BMDevice_Servant *sv); + + virtual ~BMDevice_Context (void); + + // Operations from ::Components::CCMContext. + + virtual ::Components::Principal_ptr + get_caller_principal ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::CCMHome_ptr + get_CCM_home ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Boolean + get_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + virtual ::Components::Transaction::UserTransaction_ptr + get_user_transaction ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + virtual CORBA::Boolean + is_caller_in_role ( + const char *role + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + // Operations from ::Components::SessionContext interface. + + virtual CORBA::Object_ptr + get_CCM_object ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + // Operations for BMDevice receptacles and event sources, + // defined in ::BasicSP::CCM_BMDevice_Context. + + virtual void + push_data_available ( + ::BasicSP::DataAvailable *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO-specific. + + ::CIAO::Session_Container * + _ciao_the_Container (void) const; + + static BMDevice_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_data_available ( + ::BasicSP::DataAvailableConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BasicSP::DataAvailableConsumer_ptr + unsubscribe_data_available ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + protected: + ACE_Active_Map_Manager< + ::BasicSP::DataAvailableConsumer_var> + ciao_publishes_data_available_map_; + + ::Components::CCMHome_var home_; + ::CIAO::Session_Container *container_; + + BMDevice_Servant *servant_; + ::BasicSP::BMDevice_var component_; + }; + } + + namespace CIAO_GLUE_BasicSP + { + class BMDEVICE_SVNT_Export BMDevice_Servant + : public virtual CIAO::Servant_Impl< + POA_BasicSP::BMDevice, + ::BasicSP::CCM_BMDevice, + ::BasicSP::CCM_BMDevice_var, + BMDevice_Context + >, + public virtual PortableServer::RefCountServantBase + { + public: + /// Hack for VC6 the most sucky compiler + typedef CIAO::Servant_Impl< + POA_BasicSP::BMDevice, + ::BasicSP::CCM_BMDevice, + ::BasicSP::CCM_BMDevice_var, + BMDevice_Context + > our_base; + + BMDevice_Servant ( + ::BasicSP::CCM_BMDevice_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~BMDevice_Servant (void); + + virtual void + set_attributes ( + const ::Components::ConfigValues &descr + ACE_ENV_ARG_DECL); + + // Supported operations. + + // Public port operations. + + virtual ::BasicSP::ReadData_ptr + provide_data_read ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::Cookie * + subscribe_data_available ( + ::BasicSP::DataAvailableConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BasicSP::DataAvailableConsumer_ptr + unsubscribe_data_available ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + // Servant class for the timeout consumer. + class BMDEVICE_SVNT_Export TimeOutConsumer_timeout_Servant + : public virtual POA_BasicSP::TimeOutConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + TimeOutConsumer_timeout_Servant ( + ::BasicSP::CCM_BMDevice_ptr executor, + ::BasicSP::CCM_BMDevice_Context_ptr c); + + virtual ~TimeOutConsumer_timeout_Servant (void); + + virtual void + push_TimeOut ( + ::BasicSP::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: + ::BasicSP::CCM_BMDevice_var + executor_; + + ::BasicSP::CCM_BMDevice_Context_var + ctx_; + }; + + virtual ::BasicSP::TimeOutConsumer_ptr + get_consumer_timeout ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Component attribute operations. + + // Operations for Navigation interface. + + virtual CORBA::Object_ptr + provide_facet ( + const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual ::Components::FacetDescriptions * + get_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + // 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)); + + virtual ::Components::ConnectionDescriptions * + get_connections ( + const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual ::Components::ReceptacleDescriptions * + get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::ReceptacleDescriptions * + get_named_receptacles ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + // Operations for Events interface. + + virtual ::Components::EventConsumerBase_ptr + get_consumer ( + const char *sink_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + 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)); + + virtual ::Components::EventConsumerBase_ptr + disconnect_consumer ( + const char *source_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::NoConnection)); + + virtual ::Components::ConsumerDescriptions * + get_named_consumers ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual ::Components::EmitterDescriptions * + get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::EmitterDescriptions * + get_named_emitters( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual ::Components::PublisherDescriptions * + get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PublisherDescriptions * + get_named_publishers ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + // Operations for CCMObject interface. + + virtual void + component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CIAO::CONNECTION_ID + component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::IRObject_ptr + get_component_def ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)); + + virtual void + remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)); + + private: + + ::BasicSP::ReadData_var + provide_data_read_; + + ::BasicSP::TimeOutConsumer_var + consumes_timeout_; + + private: + + void + populate_port_tables ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + ::CORBA::Object_ptr + provide_data_read_i ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + ::Components::EventConsumerBase_ptr + get_consumer_timeout_i ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + ACE_CString component_UUID_; + }; + } + + namespace CIAO_GLUE_BasicSP + { + class BMDEVICE_SVNT_Export BMDeviceHome_Servant + : public virtual POA_BasicSP::BMDeviceHome, + public virtual PortableServer::RefCountServantBase + { + public: + BMDeviceHome_Servant ( + ::BasicSP::CCM_BMDeviceHome_ptr exe, + ::CIAO::Session_Container *c); + virtual ~BMDeviceHome_Servant (void); + + // Home operations. + + // Home factory and finder operations. + + // Attribute operations. + + // Operations for keyless home interface. + + virtual ::Components::CCMObject_ptr + create_component ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)); + + // Operations for implicit home interface. + + virtual ::BasicSP::BMDevice_ptr + create ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)); + + // Operations for CCMHome interface. + + virtual ::CORBA::IRObject_ptr + get_component_def ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::CORBA::IRObject_ptr + get_home_def ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)); + + // Supported operations. + + protected: + // CIAO-specific operations. + + ::BasicSP::BMDevice_ptr + _ciao_activate_component ( + ::BasicSP::CCM_BMDevice_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::BasicSP::BMDevice_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BasicSP::CCM_BMDeviceHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + BMDevice_Servant *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; + + extern "C" BMDEVICE_SVNT_Export ::PortableServer::Servant + createBMDeviceHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + } +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_GLUE_SESSION_BMDEVICE_SVNT_H */ + diff --git a/TAO/CIAO/DAnCE/examples/BasicSP/BMDisplay/BMDisplay_svnt.cpp b/TAO/CIAO/DAnCE/examples/BasicSP/BMDisplay/BMDisplay_svnt.cpp new file mode 100644 index 00000000000..2121b24b7a5 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/BasicSP/BMDisplay/BMDisplay_svnt.cpp @@ -0,0 +1,1016 @@ +// $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 "BMDisplay_svnt.h" +#include "Cookies.h" + +namespace BMDisplay_Impl +{ + namespace CIAO_GLUE_BasicSP + { + BMDisplay_Context::BMDisplay_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + BMDisplay_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) + { + } + + BMDisplay_Context::~BMDisplay_Context (void) + { + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + BMDisplay_Context::get_caller_principal ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::Components::Principal::_nil ()); + } + + ::Components::CCMHome_ptr + BMDisplay_Context::get_CCM_home ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return ::Components::CCMHome::_duplicate (this->home_.in ()); + } + + CORBA::Boolean + BMDisplay_Context::get_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::Transaction::UserTransaction_ptr + BMDisplay_Context::get_user_transaction ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::Components::Transaction::UserTransaction::_nil ()); + } + + CORBA::Boolean + BMDisplay_Context::is_caller_in_role ( + const char * /* role */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + void + BMDisplay_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContextinterface. + + CORBA::Object_ptr + BMDisplay_Context::get_CCM_object ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + if (CORBA::is_nil (this->component_.in ())) + { + CORBA::Object_var obj = + this->container_->get_objref ( + this->servant_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + this->component_ = + ::BasicSP::BMDisplay::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + if (CORBA::is_nil (this->component_.in ())) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::CORBA::Object::_nil ()); + } + } + + return ::BasicSP::BMDisplay::_duplicate ( + this->component_.in ()); + } + + // Operations for BMDisplay receptacles and event sources, + // defined in ::BasicSP::CCM_BMDisplay_Context. + + ::BasicSP::ReadData_ptr + BMDisplay_Context::get_connection_comp_data ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return ::BasicSP::ReadData::_duplicate ( + this->ciao_uses_comp_data_.in ()); + } + + void + BMDisplay_Context::connect_comp_data ( + ::BasicSP::ReadData_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) + { + if (!CORBA::is_nil (this->ciao_uses_comp_data_.in ())) + { + ACE_THROW (::Components::AlreadyConnected ()); + } + + if (CORBA::is_nil (c)) + { + ACE_THROW (::Components::InvalidConnection ()); + } + + this->ciao_uses_comp_data_ = + ::BasicSP::ReadData::_duplicate (c); + } + + ::BasicSP::ReadData_ptr + BMDisplay_Context::disconnect_comp_data ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoConnection)) + { + if (CORBA::is_nil (this->ciao_uses_comp_data_.in ())) + { + ACE_THROW_RETURN ( + ::Components::NoConnection (), + ::BasicSP::ReadData::_nil ()); + } + + return this->ciao_uses_comp_data_._retn (); + } + + // CIAO-specific. + + ::CIAO::Session_Container * + BMDisplay_Context::_ciao_the_Container (void) const + { + return this->container_; + } + + BMDisplay_Context * + BMDisplay_Context::_narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_NOT_USED) + { + return dynamic_cast<BMDisplay_Context *> (p); + } + } + + namespace CIAO_GLUE_BasicSP + { + BMDisplay_Servant::BMDisplay_Servant ( + ::BasicSP::CCM_BMDisplay_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : our_base (exe, c) + { + this->context_ = new BMDisplay_Context (h, c, this); + + CIAO_REGISTER_OBV_FACTORY ( + ::BasicSP::DataAvailable_init, + ::BasicSP::DataAvailable); + + 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; + } + + BMDisplay_Servant::~BMDisplay_Servant (void) + { + } + + void + BMDisplay_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); + } + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + BMDisplay_Servant::provide_facet ( + const char *name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + if (name == 0) + { + ACE_THROW_RETURN ( + ::CORBA::BAD_PARAM (), + ::CORBA::Object::_nil ()); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + ::Components::FacetDescriptions * + BMDisplay_Servant::get_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + BMDisplay_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + BMDisplay_Servant::get_named_emitters ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + BMDisplay_Servant::DataAvailableConsumer_data_ready_Servant::DataAvailableConsumer_data_ready_Servant ( + ::BasicSP::CCM_BMDisplay_ptr executor, + ::BasicSP::CCM_BMDisplay_Context_ptr c) + : executor_ (::BasicSP::CCM_BMDisplay::_duplicate (executor)), + ctx_ (::BasicSP::CCM_BMDisplay_Context::_duplicate (c)) + { + } + + BMDisplay_Servant::DataAvailableConsumer_data_ready_Servant::~DataAvailableConsumer_data_ready_Servant (void) + { + } + + CORBA::Object_ptr + BMDisplay_Servant::DataAvailableConsumer_data_ready_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 + BMDisplay_Servant::DataAvailableConsumer_data_ready_Servant::push_DataAvailable ( + ::BasicSP::DataAvailable *evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->push_data_ready ( + evt + ACE_ENV_ARG_PARAMETER); + } + + // Inherited from ::Components::EventConsumerBase. + void + BMDisplay_Servant::DataAvailableConsumer_data_ready_Servant::push_event ( + ::Components::EventBase *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::BadEventType)) + { + ::BasicSP::DataAvailable_var ev_type = + ::BasicSP::DataAvailable::_downcast (ev); + + if (ev_type != 0) + { + this->push_DataAvailable ( + ev_type.in () + ACE_ENV_ARG_PARAMETER); + + return; + } + + ACE_THROW (::Components::BadEventType ()); + } + + ::BasicSP::DataAvailableConsumer_ptr + BMDisplay_Servant::get_consumer_data_ready ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (! ::CORBA::is_nil (this->consumes_data_ready_.in ())) + { + return ::BasicSP::DataAvailableConsumer::_duplicate (this->consumes_data_ready_.in ()); + } + + ::Components::EventConsumerBase_var obj = + this->get_consumer_data_ready_i ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::DataAvailableConsumer::_nil ()); + + BMDisplay_Servant::DataAvailableConsumer_data_ready_Servant *svt = 0; + ACE_NEW_RETURN ( + svt, + BMDisplay_Servant::DataAvailableConsumer_data_ready_Servant ( + this->executor_.in (), + this->context_), + ::BasicSP::DataAvailableConsumer::_nil ()); + + PortableServer::ServantBase_var safe_servant (svt); + + PortableServer::ObjectId_var oid = + PortableServer::string_to_ObjectId ("BasicSP_BMDisplay_data_ready"); + + this->container_->_ciao_the_POA ()->activate_object_with_id ( + oid.in (), + svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::DataAvailableConsumer::_nil ()); + + ::BasicSP::DataAvailableConsumer_var eco = + ::BasicSP::DataAvailableConsumer::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::DataAvailableConsumer::_nil ()); + + this->consumes_data_ready_ = eco; + return ::BasicSP::DataAvailableConsumer::_duplicate (this->consumes_data_ready_.in ()); + } + + ::Components::EventConsumerBase_ptr + BMDisplay_Servant::get_consumer_data_ready_i ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::EventConsumerBase_ptr ret = + this->lookup_consumer ("data_ready"); + + if (! ::CORBA::is_nil (ret)) + { + return ret; + } + + ::CORBA::Object_var obj = + this->container_->generate_reference ( + "BasicSP_BMDisplay_data_ready", + "IDL:BasicSP/DataAvailableConsumer:1.0" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::DataAvailableConsumer::_nil ()); + + ::Components::EventConsumerBase_var ecb = + ::Components::EventConsumerBase::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::DataAvailableConsumer::_nil ()); + + this->add_consumer ( + "data_ready", + ecb.in ()); + + return ecb._retn (); + } + + ::Components::Cookie * + BMDisplay_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, "comp_data") == 0) + { + ::BasicSP::ReadData_var _ciao_conn = + ::BasicSP::ReadData::_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_comp_data ( + _ciao_conn.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return 0; + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + CORBA::Object_ptr + BMDisplay_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, "comp_data") == 0) + { + // Simplex disconnect. + return this->disconnect_comp_data (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + + ACE_UNUSED_ARG (ck); + } + + ::Components::ConnectionDescriptions * + BMDisplay_Servant::get_connections ( + const char * /* name */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + BMDisplay_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + BMDisplay_Servant::get_named_receptacles ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + void + BMDisplay_Servant::connect_comp_data ( + ::BasicSP::ReadData_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) + { + this->context_->connect_comp_data ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::BasicSP::ReadData_ptr + BMDisplay_Servant::disconnect_comp_data ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoConnection)) + { + return this->context_->disconnect_comp_data ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::BasicSP::ReadData_ptr + BMDisplay_Servant::get_connection_comp_data ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->context_->get_connection_comp_data ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Components::EventConsumerBase_ptr + BMDisplay_Servant::get_consumer ( + const char *sink_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + if (sink_name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + if (ACE_OS::strcmp (sink_name, "data_ready") == 0) + { + return this->get_consumer_data_ready (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + void + BMDisplay_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::EventConsumerBase_ptr + BMDisplay_Servant::disconnect_consumer ( + const char * /* source_name */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::NoConnection)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + BMDisplay_Servant::get_named_consumers ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::Cookie * + BMDisplay_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 + BMDisplay_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 ()); + } + + ::Components::PublisherDescriptions * + BMDisplay_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + BMDisplay_Servant::get_named_publishers ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + // Operations for CCMObject interface. + + void + BMDisplay_Servant::component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->component_UUID_ = new_component_UUID; + } + + CIAO::CONNECTION_ID + BMDisplay_Servant::component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return CORBA::string_dup (this->component_UUID_.c_str ()); + } + + CORBA::IRObject_ptr + BMDisplay_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + BMDisplay_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + BMDisplay_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + // Supported operations. + + // Component attribute operations. + + // Private method to populate the port tables. + void + BMDisplay_Servant::populate_port_tables ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::CORBA::Object_var obj_var; + ::Components::EventConsumerBase_var ecb_var; + + ecb_var = + this->get_consumer_data_ready_i ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + } + + namespace CIAO_GLUE_BasicSP + { + BMDisplayHome_Servant::BMDisplayHome_Servant ( + ::BasicSP::CCM_BMDisplayHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::BasicSP::CCM_BMDisplayHome::_duplicate (exe)), + container_ (c) + { + } + + BMDisplayHome_Servant::~BMDisplayHome_Servant (void) + { + } + + // Home operations. + + // Home supported interface operations. + + // Home factory and finder operations. + + // Home attribute operations. + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + BMDisplayHome_Servant::create_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + return this->create (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + // Operations for implicit home interface. + + ::BasicSP::BMDisplay_ptr + BMDisplayHome_Servant::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BasicSP::BMDisplay::_nil ()); + } + + ::Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDisplay::_nil ()); + + ::BasicSP::CCM_BMDisplay_var _ciao_comp = + ::BasicSP::CCM_BMDisplay::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDisplay::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + BMDisplayHome_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::CORBA::IRObject_ptr + BMDisplayHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + BMDisplayHome_Servant::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + ::BasicSP::BMDisplay_var _ciao_comp = + ::BasicSP::BMDisplay::_narrow ( + comp + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (_ciao_comp.in ())) + { + ACE_THROW (CORBA::INTERNAL ()); + } + + _ciao_comp->remove (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->_ciao_passivate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // CIAO-specific operations. + + ::BasicSP::BMDisplay_ptr + BMDisplayHome_Servant::_ciao_activate_component ( + ::BasicSP::CCM_BMDisplay_ptr exe + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::CORBA::Object_var hobj = + this->container_->get_objref ( + this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDisplay::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDisplay::_nil ()); + + BMDisplay_Servant *svt = + new BMDisplay_Servant ( + exe, + home.in (), + this->container_); + + PortableServer::ServantBase_var safe (svt); + PortableServer::ObjectId_var oid; + + CORBA::Object_var objref = + this->container_->install_component ( + svt, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDisplay::_nil ()); + + ::BasicSP::BMDisplay_var ho = + ::BasicSP::BMDisplay::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDisplay::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + BMDisplayHome_Servant::_ciao_passivate_component ( + ::BasicSP::BMDisplay_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + PortableServer::ObjectId_var oid; + + this->container_->uninstall_component ( + comp, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + BMDisplay_Servant *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; + } + } + } + + extern "C" BMDISPLAY_SVNT_Export ::PortableServer::Servant + createBMDisplayHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) + { + if (p == 0) + { + return 0; + } + + ::BasicSP::CCM_BMDisplayHome_var x = + ::BasicSP::CCM_BMDisplayHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + CIAO_GLUE_BasicSP::BMDisplayHome_Servant ( + x.in (), + c); + } +} + diff --git a/TAO/CIAO/DAnCE/examples/BasicSP/BMDisplay/BMDisplay_svnt.h b/TAO/CIAO/DAnCE/examples/BasicSP/BMDisplay/BMDisplay_svnt.h new file mode 100644 index 00000000000..1d82bfd14bb --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/BasicSP/BMDisplay/BMDisplay_svnt.h @@ -0,0 +1,564 @@ +// $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_BMDISPLAY_SVNT_H +#define CIAO_GLUE_SESSION_BMDISPLAY_SVNT_H + +#include /**/ "ace/pre.h" + +#include "BMDisplayEC.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 "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#include "BMDisplayS.h" + +namespace BMDisplay_Impl +{ + namespace CIAO_GLUE_BasicSP + { + class BMDISPLAY_SVNT_Export BMDisplay_Context + : public virtual ::BasicSP::CCM_BMDisplay_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class BMDisplay_Servant; + + BMDisplay_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + BMDisplay_Servant *sv); + + virtual ~BMDisplay_Context (void); + + // Operations from ::Components::CCMContext. + + virtual ::Components::Principal_ptr + get_caller_principal ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::CCMHome_ptr + get_CCM_home ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Boolean + get_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + virtual ::Components::Transaction::UserTransaction_ptr + get_user_transaction ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + virtual CORBA::Boolean + is_caller_in_role ( + const char *role + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + // Operations from ::Components::SessionContext interface. + + virtual CORBA::Object_ptr + get_CCM_object ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + // Operations for BMDisplay receptacles and event sources, + // defined in ::BasicSP::CCM_BMDisplay_Context. + + virtual ::BasicSP::ReadData_ptr + get_connection_comp_data ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO-specific. + + ::CIAO::Session_Container * + _ciao_the_Container (void) const; + + static BMDisplay_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_comp_data ( + ::BasicSP::ReadData_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + virtual ::BasicSP::ReadData_ptr + disconnect_comp_data ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoConnection)); + + protected: + // Simplex comp_data connection. + ::BasicSP::ReadData_var + ciao_uses_comp_data_; + + ::Components::CCMHome_var home_; + ::CIAO::Session_Container *container_; + + BMDisplay_Servant *servant_; + ::BasicSP::BMDisplay_var component_; + }; + } + + namespace CIAO_GLUE_BasicSP + { + class BMDISPLAY_SVNT_Export BMDisplay_Servant + : public virtual CIAO::Servant_Impl< + POA_BasicSP::BMDisplay, + ::BasicSP::CCM_BMDisplay, + ::BasicSP::CCM_BMDisplay_var, + BMDisplay_Context + >, + public virtual PortableServer::RefCountServantBase + { + public: + /// Hack for VC6 the most sucky compiler + typedef CIAO::Servant_Impl< + POA_BasicSP::BMDisplay, + ::BasicSP::CCM_BMDisplay, + ::BasicSP::CCM_BMDisplay_var, + BMDisplay_Context + > our_base; + + BMDisplay_Servant ( + ::BasicSP::CCM_BMDisplay_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~BMDisplay_Servant (void); + + virtual void + set_attributes ( + const ::Components::ConfigValues &descr + ACE_ENV_ARG_DECL); + + // Supported operations. + + // Public port operations. + + // Servant class for the data_ready consumer. + class BMDISPLAY_SVNT_Export DataAvailableConsumer_data_ready_Servant + : public virtual POA_BasicSP::DataAvailableConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + DataAvailableConsumer_data_ready_Servant ( + ::BasicSP::CCM_BMDisplay_ptr executor, + ::BasicSP::CCM_BMDisplay_Context_ptr c); + + virtual ~DataAvailableConsumer_data_ready_Servant (void); + + virtual void + push_DataAvailable ( + ::BasicSP::DataAvailable *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: + ::BasicSP::CCM_BMDisplay_var + executor_; + + ::BasicSP::CCM_BMDisplay_Context_var + ctx_; + }; + + virtual ::BasicSP::DataAvailableConsumer_ptr + get_consumer_data_ready ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + connect_comp_data ( + ::BasicSP::ReadData_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + virtual ::BasicSP::ReadData_ptr + disconnect_comp_data ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoConnection)); + + virtual ::BasicSP::ReadData_ptr + get_connection_comp_data ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Component attribute operations. + + // Operations for Navigation interface. + + virtual CORBA::Object_ptr + provide_facet ( + const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual ::Components::FacetDescriptions * + get_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + // 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)); + + virtual ::Components::ConnectionDescriptions * + get_connections ( + const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual ::Components::ReceptacleDescriptions * + get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::ReceptacleDescriptions * + get_named_receptacles ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + // Operations for Events interface. + + virtual ::Components::EventConsumerBase_ptr + get_consumer ( + const char *sink_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + 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)); + + virtual ::Components::EventConsumerBase_ptr + disconnect_consumer ( + const char *source_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::NoConnection)); + + virtual ::Components::ConsumerDescriptions * + get_named_consumers ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual ::Components::EmitterDescriptions * + get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::EmitterDescriptions * + get_named_emitters( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual ::Components::PublisherDescriptions * + get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PublisherDescriptions * + get_named_publishers ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + // Operations for CCMObject interface. + + virtual void + component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CIAO::CONNECTION_ID + component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::IRObject_ptr + get_component_def ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)); + + virtual void + remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)); + + private: + + ::BasicSP::DataAvailableConsumer_var + consumes_data_ready_; + + private: + + void + populate_port_tables ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + ::Components::EventConsumerBase_ptr + get_consumer_data_ready_i ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + ACE_CString component_UUID_; + }; + } + + namespace CIAO_GLUE_BasicSP + { + class BMDISPLAY_SVNT_Export BMDisplayHome_Servant + : public virtual POA_BasicSP::BMDisplayHome, + public virtual PortableServer::RefCountServantBase + { + public: + BMDisplayHome_Servant ( + ::BasicSP::CCM_BMDisplayHome_ptr exe, + ::CIAO::Session_Container *c); + virtual ~BMDisplayHome_Servant (void); + + // Home operations. + + // Home factory and finder operations. + + // Attribute operations. + + // Operations for keyless home interface. + + virtual ::Components::CCMObject_ptr + create_component ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)); + + // Operations for implicit home interface. + + virtual ::BasicSP::BMDisplay_ptr + create ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)); + + // Operations for CCMHome interface. + + virtual ::CORBA::IRObject_ptr + get_component_def ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::CORBA::IRObject_ptr + get_home_def ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)); + + // Supported operations. + + protected: + // CIAO-specific operations. + + ::BasicSP::BMDisplay_ptr + _ciao_activate_component ( + ::BasicSP::CCM_BMDisplay_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::BasicSP::BMDisplay_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BasicSP::CCM_BMDisplayHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + BMDisplay_Servant *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; + + extern "C" BMDISPLAY_SVNT_Export ::PortableServer::Servant + createBMDisplayHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + } +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_GLUE_SESSION_BMDISPLAY_SVNT_H */ + diff --git a/TAO/CIAO/DAnCE/examples/BasicSP/EC/EC_svnt.cpp b/TAO/CIAO/DAnCE/examples/BasicSP/EC/EC_svnt.cpp new file mode 100644 index 00000000000..7cff4733aaa --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/BasicSP/EC/EC_svnt.cpp @@ -0,0 +1,974 @@ +// $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 "EC_svnt.h" +#include "Cookies.h" + +namespace EC_Impl +{ + namespace CIAO_GLUE_BasicSP + { + EC_Context::EC_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + EC_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) + { + } + + EC_Context::~EC_Context (void) + { + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + EC_Context::get_caller_principal ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::Components::Principal::_nil ()); + } + + ::Components::CCMHome_ptr + EC_Context::get_CCM_home ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return ::Components::CCMHome::_duplicate (this->home_.in ()); + } + + CORBA::Boolean + EC_Context::get_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::Transaction::UserTransaction_ptr + EC_Context::get_user_transaction ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::Components::Transaction::UserTransaction::_nil ()); + } + + CORBA::Boolean + EC_Context::is_caller_in_role ( + const char * /* role */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + void + EC_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContextinterface. + + CORBA::Object_ptr + EC_Context::get_CCM_object ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + if (CORBA::is_nil (this->component_.in ())) + { + CORBA::Object_var obj = + this->container_->get_objref ( + this->servant_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + this->component_ = + ::BasicSP::EC::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + if (CORBA::is_nil (this->component_.in ())) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::CORBA::Object::_nil ()); + } + } + + return ::BasicSP::EC::_duplicate ( + this->component_.in ()); + } + + // Operations for EC receptacles and event sources, + // defined in ::BasicSP::CCM_EC_Context. + + void + EC_Context::push_timeout ( + ::BasicSP::TimeOut *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_CString my_uuid = this->servant_->component_UUID (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + my_uuid += "_timeout_publisher"; + + this->container_->push_event (ev, + my_uuid.c_str () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + /* + ACE_Active_Map_Manager< + ::BasicSP::TimeOutConsumer_var>::iterator end = + this->ciao_publishes_timeout_map_.end (); + + for (ACE_Active_Map_Manager< + ::BasicSP::TimeOutConsumer_var>::iterator iter = + this->ciao_publishes_timeout_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager< + ::BasicSP::TimeOutConsumer_var>::ENTRY &entry = *iter; + + ::BasicSP::TimeOutConsumer_var c = + ::BasicSP::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 * + EC_Context::subscribe_timeout ( + ::BasicSP::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); + } + + ::BasicSP::TimeOutConsumer_var sub = + ::BasicSP::TimeOutConsumer::_duplicate (c); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_timeout_map_.bind (sub.in (), key); + sub._retn (); + + ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); + return retv._retn (); + } + + ::BasicSP::TimeOutConsumer_ptr + EC_Context::unsubscribe_timeout ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + ::BasicSP::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 (), + ::BasicSP::TimeOutConsumer::_nil ()); + } + + if (this->ciao_publishes_timeout_map_.unbind (key, retv) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BasicSP::TimeOutConsumer::_nil ()); + } + + return retv._retn (); + } + + // CIAO-specific. + + ::CIAO::Session_Container * + EC_Context::_ciao_the_Container (void) const + { + return this->container_; + } + + EC_Context * + EC_Context::_narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_NOT_USED) + { + return dynamic_cast<EC_Context *> (p); + } + } + + namespace CIAO_GLUE_BasicSP + { + EC_Servant::EC_Servant ( + ::BasicSP::CCM_EC_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : our_base (exe, c) + { + this->context_ = new EC_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; + } + + EC_Servant::~EC_Servant (void) + { + } + + void + EC_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, "hertz") == 0) + { + ::CORBA::Long _ciao_extract_val = 0; + descr_value >>= _ciao_extract_val; + this->hertz (_ciao_extract_val); + continue; + } + + ACE_UNUSED_ARG (descr_name); + ACE_UNUSED_ARG (descr_value); + } + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + EC_Servant::provide_facet ( + const char *name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + if (name == 0) + { + ACE_THROW_RETURN ( + ::CORBA::BAD_PARAM (), + ::CORBA::Object::_nil ()); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + ::Components::FacetDescriptions * + EC_Servant::get_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + EC_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + EC_Servant::get_named_emitters ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::Cookie * + EC_Servant::subscribe_timeout ( + ::BasicSP::TimeOutConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + return this->context_->subscribe_timeout ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::BasicSP::TimeOutConsumer_ptr + EC_Servant::unsubscribe_timeout ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + return this->context_->unsubscribe_timeout ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ::Components::Cookie * + EC_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 + EC_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); + } + + ::Components::ConnectionDescriptions * + EC_Servant::get_connections ( + const char * /* name */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + EC_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + EC_Servant::get_named_receptacles ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EventConsumerBase_ptr + EC_Servant::get_consumer ( + const char *sink_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + if (sink_name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + void + EC_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::EventConsumerBase_ptr + EC_Servant::disconnect_consumer ( + const char * /* source_name */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::NoConnection)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + EC_Servant::get_named_consumers ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::Cookie * + EC_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, "timeout") == 0) + { + ::BasicSP::TimeOutConsumer_var _ciao_consumer = + ::BasicSP::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_timeout ( + _ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ::Components::EventConsumerBase_ptr + EC_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, "timeout") == 0) + { + return this->unsubscribe_timeout ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ::Components::PublisherDescriptions * + EC_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + EC_Servant::get_named_publishers ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + // Operations for CCMObject interface. + + void + EC_Servant::component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->component_UUID_ = new_component_UUID; + } + + CIAO::CONNECTION_ID + EC_Servant::component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return CORBA::string_dup (this->component_UUID_.c_str ()); + } + + CORBA::IRObject_ptr + EC_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + EC_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + EC_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + // Supported operations. + + void + EC_Servant::start ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->start ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + void + EC_Servant::stop ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->stop ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + // Component attribute operations. + + ::CORBA::Long + EC_Servant::hertz ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->executor_->hertz ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + void + EC_Servant::hertz ( + ::CORBA::Long hertz + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->hertz ( + hertz + ACE_ENV_ARG_PARAMETER); + } + + // Private method to populate the port tables. + void + EC_Servant::populate_port_tables ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::CORBA::Object_var obj_var; + ::Components::EventConsumerBase_var ecb_var; + } + } + + namespace CIAO_GLUE_BasicSP + { + ECHome_Servant::ECHome_Servant ( + ::BasicSP::CCM_ECHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::BasicSP::CCM_ECHome::_duplicate (exe)), + container_ (c) + { + } + + ECHome_Servant::~ECHome_Servant (void) + { + } + + // Home operations. + + // Home supported interface operations. + + // Home factory and finder operations. + + ::BasicSP::EC_ptr + ECHome_Servant::new_EC ( + ::CORBA::Long hertz + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::EnterpriseComponent_var _ciao_ec = + this->executor_->new_EC ( + hertz + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::EC_ptr::_nil ()); + + ::BasicSP::CCM_EC_var _ciao_comp = + ::BasicSP::CCM_EC::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + + ACE_CHECK_RETURN (::BasicSP::EC_ptr::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Home attribute operations. + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + ECHome_Servant::create_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + return this->create (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + // Operations for implicit home interface. + + ::BasicSP::EC_ptr + ECHome_Servant::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BasicSP::EC::_nil ()); + } + + ::Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::EC::_nil ()); + + ::BasicSP::CCM_EC_var _ciao_comp = + ::BasicSP::CCM_EC::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::EC::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + ECHome_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::CORBA::IRObject_ptr + ECHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + ECHome_Servant::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + ::BasicSP::EC_var _ciao_comp = + ::BasicSP::EC::_narrow ( + comp + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (_ciao_comp.in ())) + { + ACE_THROW (CORBA::INTERNAL ()); + } + + _ciao_comp->remove (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->_ciao_passivate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // CIAO-specific operations. + + ::BasicSP::EC_ptr + ECHome_Servant::_ciao_activate_component ( + ::BasicSP::CCM_EC_ptr exe + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::CORBA::Object_var hobj = + this->container_->get_objref ( + this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::EC::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::EC::_nil ()); + + EC_Servant *svt = + new EC_Servant ( + exe, + home.in (), + this->container_); + + PortableServer::ServantBase_var safe (svt); + PortableServer::ObjectId_var oid; + + CORBA::Object_var objref = + this->container_->install_component ( + svt, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::EC::_nil ()); + + ::BasicSP::EC_var ho = + ::BasicSP::EC::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::EC::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + ECHome_Servant::_ciao_passivate_component ( + ::BasicSP::EC_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + PortableServer::ObjectId_var oid; + + this->container_->uninstall_component ( + comp, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + EC_Servant *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; + } + } + } + + extern "C" EC_SVNT_Export ::PortableServer::Servant + createECHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) + { + if (p == 0) + { + return 0; + } + + ::BasicSP::CCM_ECHome_var x = + ::BasicSP::CCM_ECHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + CIAO_GLUE_BasicSP::ECHome_Servant ( + x.in (), + c); + } +} + diff --git a/TAO/CIAO/DAnCE/examples/BasicSP/EC/EC_svnt.h b/TAO/CIAO/DAnCE/examples/BasicSP/EC/EC_svnt.h new file mode 100644 index 00000000000..bce768688ff --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/BasicSP/EC/EC_svnt.h @@ -0,0 +1,532 @@ +// $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_EC_SVNT_H +#define CIAO_GLUE_SESSION_EC_SVNT_H + +#include /**/ "ace/pre.h" + +#include "ECEC.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 "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#include "ECS.h" + +namespace EC_Impl +{ + namespace CIAO_GLUE_BasicSP + { + class EC_SVNT_Export EC_Context + : public virtual ::BasicSP::CCM_EC_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class EC_Servant; + + EC_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + EC_Servant *sv); + + virtual ~EC_Context (void); + + // Operations from ::Components::CCMContext. + + virtual ::Components::Principal_ptr + get_caller_principal ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::CCMHome_ptr + get_CCM_home ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Boolean + get_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + virtual ::Components::Transaction::UserTransaction_ptr + get_user_transaction ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + virtual CORBA::Boolean + is_caller_in_role ( + const char *role + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + // Operations from ::Components::SessionContext interface. + + virtual CORBA::Object_ptr + get_CCM_object ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + // Operations for EC receptacles and event sources, + // defined in ::BasicSP::CCM_EC_Context. + + virtual void + push_timeout ( + ::BasicSP::TimeOut *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO-specific. + + ::CIAO::Session_Container * + _ciao_the_Container (void) const; + + static EC_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_timeout ( + ::BasicSP::TimeOutConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BasicSP::TimeOutConsumer_ptr + unsubscribe_timeout ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + protected: + ACE_Active_Map_Manager< + ::BasicSP::TimeOutConsumer_var> + ciao_publishes_timeout_map_; + + ::Components::CCMHome_var home_; + ::CIAO::Session_Container *container_; + + EC_Servant *servant_; + ::BasicSP::EC_var component_; + }; + } + + namespace CIAO_GLUE_BasicSP + { + class EC_SVNT_Export EC_Servant + : public virtual CIAO::Servant_Impl< + POA_BasicSP::EC, + ::BasicSP::CCM_EC, + ::BasicSP::CCM_EC_var, + EC_Context + >, + public virtual PortableServer::RefCountServantBase + { + public: + /// Hack for VC6 the most sucky compiler + typedef CIAO::Servant_Impl< + POA_BasicSP::EC, + ::BasicSP::CCM_EC, + ::BasicSP::CCM_EC_var, + EC_Context + > our_base; + + EC_Servant ( + ::BasicSP::CCM_EC_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~EC_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)); + virtual void + stop ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + // Public port operations. + + virtual ::Components::Cookie * + subscribe_timeout ( + ::BasicSP::TimeOutConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BasicSP::TimeOutConsumer_ptr + unsubscribe_timeout ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + // Component attribute operations. + + virtual ::CORBA::Long + hertz ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + hertz ( + ::CORBA::Long + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for Navigation interface. + + virtual CORBA::Object_ptr + provide_facet ( + const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual ::Components::FacetDescriptions * + get_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + // 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)); + + virtual ::Components::ConnectionDescriptions * + get_connections ( + const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual ::Components::ReceptacleDescriptions * + get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::ReceptacleDescriptions * + get_named_receptacles ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + // Operations for Events interface. + + virtual ::Components::EventConsumerBase_ptr + get_consumer ( + const char *sink_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + 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)); + + virtual ::Components::EventConsumerBase_ptr + disconnect_consumer ( + const char *source_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::NoConnection)); + + virtual ::Components::ConsumerDescriptions * + get_named_consumers ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual ::Components::EmitterDescriptions * + get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::EmitterDescriptions * + get_named_emitters( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual ::Components::PublisherDescriptions * + get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PublisherDescriptions * + get_named_publishers ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + // Operations for CCMObject interface. + + virtual void + component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CIAO::CONNECTION_ID + component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::IRObject_ptr + get_component_def ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)); + + virtual void + remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)); + + private: + + private: + + void + populate_port_tables ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + ACE_CString component_UUID_; + }; + } + + namespace CIAO_GLUE_BasicSP + { + class EC_SVNT_Export ECHome_Servant + : public virtual POA_BasicSP::ECHome, + public virtual PortableServer::RefCountServantBase + { + public: + ECHome_Servant ( + ::BasicSP::CCM_ECHome_ptr exe, + ::CIAO::Session_Container *c); + virtual ~ECHome_Servant (void); + + // Home operations. + + // Home factory and finder operations. + + virtual ::BasicSP::EC_ptr + new_EC ( + ::CORBA::Long hertz + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Attribute operations. + + // Operations for keyless home interface. + + virtual ::Components::CCMObject_ptr + create_component ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)); + + // Operations for implicit home interface. + + virtual ::BasicSP::EC_ptr + create ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)); + + // Operations for CCMHome interface. + + virtual ::CORBA::IRObject_ptr + get_component_def ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::CORBA::IRObject_ptr + get_home_def ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)); + + // Supported operations. + + protected: + // CIAO-specific operations. + + ::BasicSP::EC_ptr + _ciao_activate_component ( + ::BasicSP::CCM_EC_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::BasicSP::EC_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BasicSP::CCM_ECHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + EC_Servant *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; + + extern "C" EC_SVNT_Export ::PortableServer::Servant + createECHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + } +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_GLUE_SESSION_EC_SVNT_H */ + |