diff options
Diffstat (limited to 'TAO/CIAO/examples/UAV')
49 files changed, 15422 insertions, 34 deletions
diff --git a/TAO/CIAO/examples/UAV/Battle/Battle.mpc b/TAO/CIAO/examples/UAV/Battle/Battle.mpc index f8a69721334..57658c41da5 100644 --- a/TAO/CIAO/examples/UAV/Battle/Battle.mpc +++ b/TAO/CIAO/examples/UAV/Battle/Battle.mpc @@ -20,7 +20,7 @@ project(Battle_stub): ciao_client { project(Battle_svnt) : ciao_servant { after += BBN_UAV_svnt Battle_stub sharedname = Battle_svnt - libs += Battle_stub + libs += BBN_UAV_stub BBN_UAV_svnt Battle_stub idlflags += -Wb,export_macro=BATTLE_SVNT_Export -Wb,export_include=Battle_svnt_export.h dynamicflags = BATTLE_SVNT_BUILD_DLL @@ -44,17 +44,19 @@ project(Battle_svnt) : ciao_servant { project(Battle_exec) : ciao_component { after += BBN_UAV_svnt Battle_svnt sharedname = Battle_exec - libs += Battle_stub Battle_svnt + libs += BBN_UAV_stub BBN_UAV_svnt Battle_stub Battle_svnt idlflags += -Wb,export_macro=BATTLE_EXEC_Export -Wb,export_include=Battle_exec_export.h dynamicflags = BATTLE_EXEC_BUILD_DLL IDL_Files { - + BattleEI.idl } Source_Files { - + BattleES.cpp + BattleEIC.cpp + BattleEIS.cpp Battle_exec.cpp } } diff --git a/TAO/CIAO/examples/UAV/Battle/BattleEI.idl b/TAO/CIAO/examples/UAV/Battle/BattleEI.idl new file mode 100644 index 00000000000..0ca5f7c8856 --- /dev/null +++ b/TAO/CIAO/examples/UAV/Battle/BattleEI.idl @@ -0,0 +1,30 @@ +// $Id$ + +/** + * @file BattleEI.idl + * + * Definition of the Battle component implementation. + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ + +#ifndef CIAO_BATTLEI_IDL +#define CIAO_BATTLEI_IDL + +#include "BattleE.idl" + +module BBN_UAV +{ + /** + * @interface Battle_Exec + * + */ + local interface Battle_Exec : + CCM_Battle, + Components::SessionComponent + { + }; + +}; + +#endif /* CIAO_BATTLEI_IDL*/ diff --git a/TAO/CIAO/examples/UAV/Battle/Battle_exec.cpp b/TAO/CIAO/examples/UAV/Battle/Battle_exec.cpp new file mode 100644 index 00000000000..7fae6b83df3 --- /dev/null +++ b/TAO/CIAO/examples/UAV/Battle/Battle_exec.cpp @@ -0,0 +1,105 @@ +// $Id$ + +#include "CIAO_common.h" +#include "Battle_exec.h" + +#define DISPLACEMENT 256 + +/// Default constructor. +MyImpl::Battle_exec_i::Battle_exec_i (void) + : str_ ("BM DEVICE DATA") +{ + +} + +/// Default destructor. +MyImpl::Battle_exec_i::~Battle_exec_i () +{ +} + +void +MyImpl::Battle_exec_i::push_start_engage (BBN_UAV::StartEngage *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + +} + +// Operations from Components::SessionComponent +void +MyImpl::Battle_exec_i::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::Battle_exec_i::set_session_context\n")); + + this->context_ = + BBN_UAV::CCM_Battle_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::Battle_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::Battle_exec_i::ccm_activate\n")); + char *argv[1] = { "Battle_exec"}; + + int argc = sizeof(argv)/sizeof(argv[0]); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv ACE_ENV_ARG_PARAMETER); + + CIAO_REGISTER_VALUE_FACTORY (orb.in(), BBN_UAV::StartEngage_init, + BBN_UAV::StartEngage); +} + +void +MyImpl::Battle_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::Battle_exec_i::ccm_passivate\n")); +} + +void +MyImpl::Battle_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::Battle_exec_i::ccm_remove\n")); +} + +/// Default ctor. +MyImpl::BattleHome_exec_i::BattleHome_exec_i () +{ +} + +/// Default dtor. +MyImpl::BattleHome_exec_i::~BattleHome_exec_i () +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::BattleHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::Battle_exec_i; +} + + +extern "C" BATTLE_EXEC_Export ::Components::HomeExecutorBase_ptr +createBattleHome_Impl (void) +{ + return new MyImpl::BattleHome_exec_i; +} diff --git a/TAO/CIAO/examples/UAV/Battle/Battle_exec.h b/TAO/CIAO/examples/UAV/Battle/Battle_exec.h new file mode 100644 index 00000000000..ad693db0daf --- /dev/null +++ b/TAO/CIAO/examples/UAV/Battle/Battle_exec.h @@ -0,0 +1,110 @@ +// $Id$ + +//================================================================ +/** + * @file Battle_exec.h + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//================================================================ + +#ifndef CIAO_BATTLE_EXEC_H +#define CIAO_BATTLE_EXEC_H + +#include "BattleEIC.h" +#include "tao/LocalObject.h" + +// The namespace name for the actual implementation classes doesn't +// really matter. Since there may be several different +// implementations for a component, they can very well be in different +// namespaces. +namespace MyImpl +{ + /** + * @class Battle_exec_i + * + * The Battle implementation class. + */ + class BATTLE_EXEC_Export Battle_exec_i : + public virtual BBN_UAV::Battle_Exec, + // CIAO container implementation depends on correct reference + // counting of local interfaces, so we take a short cut to + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + Battle_exec_i (void); + + /// Default destructor. + ~Battle_exec_i (void); + + // Operations from BBN_UAV::Battle + + virtual void + push_start_engage (BBN_UAV::StartEngage *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from Components::SessionComponent + + virtual void + set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + protected: + CORBA::String_var str_; + + /// Copmponent specific context + BBN_UAV::CCM_Battle_Context_var context_; + }; + + /** + * @class BattleHome_exec_i + * + * Battle home executor implementation class. + */ + class BATTLE_EXEC_Export BattleHome_exec_i : + public virtual BBN_UAV::CCM_BattleHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + BattleHome_exec_i (); + + /// Default dtor. + ~BattleHome_exec_i (); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +// Executor DLL entry point. CIAO's deployment and assembly framework +// invokes this function on the resulting DLL to get the home executor. +extern "C" BATTLE_EXEC_Export ::Components::HomeExecutorBase_ptr +createBattleHome_Impl (void); + +#endif /* CIAO_BATTLE_EXEC_H*/ diff --git a/TAO/CIAO/examples/UAV/Battle/Battle_svnt.cpp b/TAO/CIAO/examples/UAV/Battle/Battle_svnt.cpp new file mode 100644 index 00000000000..4fae9c65473 --- /dev/null +++ b/TAO/CIAO/examples/UAV/Battle/Battle_svnt.cpp @@ -0,0 +1,989 @@ +// $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.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#include "Battle_svnt.h" +#include "Cookies.h" + +namespace Battle_Impl +{ + namespace CIAO_GLUE_BBN_UAV + { + Battle_Context::Battle_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + Battle_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) + { + } + + Battle_Context::~Battle_Context (void) + { + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + Battle_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 + Battle_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 + Battle_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 + Battle_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 + Battle_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 + Battle_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContext interface. + + CORBA::Object_ptr + Battle_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_ = + ::BBN_UAV::Battle::_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 ::BBN_UAV::Battle::_duplicate ( + this->component_.in ()); + } + + // Operations for Battle receptacles and event sources, + // defined in ::BBN_UAV::CCM_Battle_Context. + + // CIAO-specific. + + ::CIAO::Session_Container * + Battle_Context::_ciao_the_Container (void) const + { + return this->container_; + } + + Battle_Context * + Battle_Context::_narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_NOT_USED) + { + return dynamic_cast<Battle_Context *> (p); + } + } + + namespace CIAO_GLUE_BBN_UAV + { + Battle_Servant::Battle_Servant ( + ::BBN_UAV::CCM_Battle_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (::BBN_UAV::CCM_Battle::_duplicate (exe)), + container_ (c) + { + this->context_ = new Battle_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_CATCHANY + { + } + ACE_ENDTRY; + } + + Battle_Servant::~Battle_Servant (void) + { + ACE_TRY_NEW_ENV + { + ::Components::SessionComponent_var scom = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! ::CORBA::is_nil (scom.in ())) + { + scom->ccm_remove (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + ACE_CATCHANY + { + } + ACE_ENDTRY; + + this->context_->_remove_ref (); + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + Battle_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 * + Battle_Servant::get_all_facets ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::FacetDescriptions * + Battle_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); + } + + CORBA::Boolean + Battle_Servant::same_component ( + CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (::CORBA::is_nil (object_ref)) + { + ACE_THROW_RETURN (::CORBA::BAD_PARAM (), 0); + } + + ::CORBA::Object_var the_other = + object_ref->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::CORBA::Object_var me = + this->context_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return me->_is_equivalent ( + the_other.in () + ACE_ENV_ARG_PARAMETER); + } + + ::Components::EmitterDescriptions * + Battle_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + Battle_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); + } + + Battle_Servant::StartEngageConsumer_start_engage_Servant::StartEngageConsumer_start_engage_Servant ( + ::BBN_UAV::CCM_Battle_ptr executor, + ::BBN_UAV::CCM_Battle_Context_ptr c) + : executor_ (::BBN_UAV::CCM_Battle::_duplicate (executor)), + ctx_ (::BBN_UAV::CCM_Battle_Context::_duplicate (c)) + { + } + + Battle_Servant::StartEngageConsumer_start_engage_Servant::~StartEngageConsumer_start_engage_Servant (void) + { + } + + CORBA::Object_ptr + Battle_Servant::StartEngageConsumer_start_engage_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 + Battle_Servant::StartEngageConsumer_start_engage_Servant::push_StartEngage ( + ::BBN_UAV::StartEngage *evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->push_start_engage ( + evt + ACE_ENV_ARG_PARAMETER); + } + + // Inherited from ::Components::EventConsumerBase. + void + Battle_Servant::StartEngageConsumer_start_engage_Servant::push_event ( + ::Components::EventBase *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::BadEventType)) + { + ::BBN_UAV::StartEngage_var ev_type = + ::BBN_UAV::StartEngage::_downcast (ev); + + if (ev_type != 0) + { + this->push_StartEngage ( + ev_type.in () + ACE_ENV_ARG_PARAMETER); + + return; + } + + ACE_THROW (::Components::BadEventType ()); + } + + ::BBN_UAV::StartEngageConsumer_ptr + Battle_Servant::get_consumer_start_engage ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (CORBA::is_nil (this->consumes_start_engage_.in ())) + { + Battle_Servant::StartEngageConsumer_start_engage_Servant *svt = + new Battle_Servant::StartEngageConsumer_start_engage_Servant ( + this->executor_.in (), + this->context_); + PortableServer::ServantBase_var safe_servant (svt); + + CORBA::Object_var obj = + this->container_->install_servant ( + svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::StartEngageConsumer::_nil ()); + + ::BBN_UAV::StartEngageConsumer_var eco = + ::BBN_UAV::StartEngageConsumer::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::StartEngageConsumer::_nil ()); + + this->consumes_start_engage_ = eco; + } + + return ::BBN_UAV::StartEngageConsumer::_duplicate (this->consumes_start_engage_.in ()); + } + + ::Components::Cookie * + Battle_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 + Battle_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 ()); + } + + ::Components::ConnectionDescriptions * + Battle_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 * + Battle_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + Battle_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 + Battle_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, "start_engage") == 0) + { + return this->get_consumer_start_engage (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + void + Battle_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)) + { + ACE_THROW (::CORBA::NO_IMPLEMENT ()); + } + + ::Components::EventConsumerBase_ptr + Battle_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 * + Battle_Servant::get_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + Battle_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 * + Battle_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 + Battle_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 * + Battle_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + Battle_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 + Battle_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 + Battle_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 + Battle_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::Components::CCMHome_ptr + Battle_Servant::get_ccm_home ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->context_->get_CCM_home (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Components::PrimaryKeyBase * + Battle_Servant::get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)) + { + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); + } + + void + Battle_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + Battle_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + ::Components::ComponentPortDescription * + Battle_Servant::get_all_ports ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::ComponentPortDescription_var retv = + new OBV_Components::ComponentPortDescription; + + ::Components::FacetDescriptions_var facets_desc = + this->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ReceptacleDescriptions_var receptacle_desc = + this->get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ConsumerDescriptions_var consumer_desc = + this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::EmitterDescriptions_var emitter_desc = + this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::PublisherDescriptions_var publisher_desc = + this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv->facets (facets_desc.in ()); + retv->receptacles (receptacle_desc.in ()); + retv->consumers (consumer_desc.in ()); + retv->emitters (emitter_desc.in ()); + retv->publishers (publisher_desc.in ()); + + return retv._retn (); + } + + CORBA::Object_ptr + Battle_Servant::_get_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow ( + this->context_ + 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->context_ + 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 (), + ::CORBA::Object::_nil ()); + } + + // CIAO-specific operations. + + void + Battle_Servant::_ciao_activate ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! ::CORBA::is_nil (temp.in ())) + { + temp->ccm_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + + void + Battle_Servant::_ciao_passivate ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! ::CORBA::is_nil (temp.in ())) + { + temp->ccm_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + + // Supported operations. + + // Component attribute operations. + } + + namespace CIAO_GLUE_BBN_UAV + { + BattleHome_Servant::BattleHome_Servant ( + ::BBN_UAV::CCM_BattleHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::BBN_UAV::CCM_BattleHome::_duplicate (exe)), + container_ (c) + { + } + + BattleHome_Servant::~BattleHome_Servant (void) + { + } + + // Home factory and other operations. + + // Home attribute operations. + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + BattleHome_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. + + ::BBN_UAV::Battle_ptr + BattleHome_Servant::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BBN_UAV::Battle::_nil ()); + } + + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::Battle::_nil ()); + + ::BBN_UAV::CCM_Battle_var _ciao_comp = + ::BBN_UAV::CCM_Battle::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::Battle::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + BattleHome_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 + BattleHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + BattleHome_Servant::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + ::BBN_UAV::Battle_var _ciao_comp = + ::BBN_UAV::Battle::_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. + + ::BBN_UAV::Battle_ptr + BattleHome_Servant::_ciao_activate_component ( + ::BBN_UAV::CCM_Battle_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 (::BBN_UAV::Battle::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::Battle::_nil ()); + + Battle_Servant *svt = + new Battle_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 (::BBN_UAV::Battle::_nil ()); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::Battle::_nil ()); + + ::BBN_UAV::Battle_var ho = + ::BBN_UAV::Battle::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::Battle::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + BattleHome_Servant::_ciao_passivate_component ( + ::BBN_UAV::Battle_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; + + Battle_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" BATTLE_SVNT_Export ::PortableServer::Servant + createBattleHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) + { + if (p == 0) + { + return 0; + } + + ::BBN_UAV::CCM_BattleHome_var x = + ::BBN_UAV::CCM_BattleHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + CIAO_GLUE_BBN_UAV::BattleHome_Servant ( + x.in (), + c); + } +} diff --git a/TAO/CIAO/examples/UAV/Battle/Battle_svnt.h b/TAO/CIAO/examples/UAV/Battle/Battle_svnt.h new file mode 100644 index 00000000000..62b728fe9ed --- /dev/null +++ b/TAO/CIAO/examples/UAV/Battle/Battle_svnt.h @@ -0,0 +1,546 @@ +// $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.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#ifndef CIAO_GLUE_SESSION_BATTLE_SVNT_H +#define CIAO_GLUE_SESSION_BATTLE_SVNT_H + +#include /**/ "ace/pre.h" + +#include "BattleEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ciao/Container_Base.h" +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#include "BattleS.h" + +namespace Battle_Impl +{ + namespace CIAO_GLUE_BBN_UAV + { + class BATTLE_SVNT_Export Battle_Context + : public virtual ::BBN_UAV::CCM_Battle_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class Battle_Servant; + + Battle_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + Battle_Servant *sv); + + virtual ~Battle_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 Battle receptacles and event sources, + // defined in ::BBN_UAV::CCM_Battle_Context. + + // CIAO-specific. + + ::CIAO::Session_Container * + _ciao_the_Container (void) const; + + static Battle_Context * + _narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + protected: + // Methods that manage this component's connections and consumers. + + protected: + ::Components::CCMHome_var home_; + + ::CIAO::Session_Container *container_; + + Battle_Servant *servant_; + + ::BBN_UAV::Battle_var component_; + }; + } + + namespace CIAO_GLUE_BBN_UAV + { + class BATTLE_SVNT_Export Battle_Servant + : public virtual POA_BBN_UAV::Battle, + public virtual PortableServer::RefCountServantBase + { + public: + Battle_Servant ( + ::BBN_UAV::CCM_Battle_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~Battle_Servant (void); + + // Supported operations. + + // Public port operations. + + // Servant class for the start_engage consumer. + class BATTLE_SVNT_Export StartEngageConsumer_start_engage_Servant + : public virtual POA_BBN_UAV::StartEngageConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + StartEngageConsumer_start_engage_Servant ( + ::BBN_UAV::CCM_Battle_ptr executor, + ::BBN_UAV::CCM_Battle_Context_ptr c); + + virtual ~StartEngageConsumer_start_engage_Servant (void); + + virtual void + push_StartEngage ( + ::BBN_UAV::StartEngage *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: + ::BBN_UAV::CCM_Battle_var + executor_; + + ::BBN_UAV::CCM_Battle_Context_var + ctx_; + }; + + virtual ::BBN_UAV::StartEngageConsumer_ptr + get_consumer_start_engage ( + 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_all_facets ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::FacetDescriptions * + get_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual CORBA::Boolean + same_component ( + CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for Receptacles interface. + + virtual ::Components::Cookie * + connect ( + const char *name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::AlreadyConnected, + ::Components::ExceededConnectionLimit)); + + virtual CORBA::Object_ptr + disconnect ( + const char *name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::CookieRequired, + ::Components::NoConnection)); + + 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_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + 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 ::Components::CCMHome_ptr + get_ccm_home ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PrimaryKeyBase * + get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)); + + 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)); + + virtual ::Components::ComponentPortDescription * + get_all_ports( + 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)); + + // CIAO-specific operations. + + void + _ciao_activate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BBN_UAV::CCM_Battle_var + executor_; + + Battle_Context * + context_; + + ::CIAO::Session_Container * + container_; + ::BBN_UAV::StartEngageConsumer_var + consumes_start_engage_; + + ACE_CString component_UUID_; + }; + } + + namespace CIAO_GLUE_BBN_UAV + { + class BATTLE_SVNT_Export BattleHome_Servant + : public virtual POA_BBN_UAV::BattleHome, + public virtual PortableServer::RefCountServantBase + { + public: + BattleHome_Servant ( + ::BBN_UAV::CCM_BattleHome_ptr exe, + ::CIAO::Session_Container *c); + + virtual ~BattleHome_Servant (void); + + // Home factory and other 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 ::BBN_UAV::Battle_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. + + ::BBN_UAV::Battle_ptr + _ciao_activate_component ( + ::BBN_UAV::CCM_Battle_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::BBN_UAV::Battle_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BBN_UAV::CCM_BattleHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + Battle_Servant *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; + + extern "C" BATTLE_SVNT_Export ::PortableServer::Servant + createBattleHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + } +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_GLUE_SESSION_BATTLE_SVNT_H */ + diff --git a/TAO/CIAO/examples/UAV/CAOC/CAOC.mpc b/TAO/CIAO/examples/UAV/CAOC/CAOC.mpc index ef8cd5055e3..aa99b9eb8b0 100644 --- a/TAO/CIAO/examples/UAV/CAOC/CAOC.mpc +++ b/TAO/CIAO/examples/UAV/CAOC/CAOC.mpc @@ -20,7 +20,7 @@ project(CAOC_stub): ciao_client { project(CAOC_svnt) : ciao_servant { after += BBN_UAV_svnt CAOC_stub sharedname = CAOC_svnt - libs += BBN_UAV_svnt CAOC_stub + libs += BBN_UAV_stub BBN_UAV_svnt CAOC_stub idlflags += -Wb,export_macro=CAOC_SVNT_Export -Wb,export_include=CAOC_svnt_export.h dynamicflags = CAOC_SVNT_BUILD_DLL @@ -44,17 +44,19 @@ project(CAOC_svnt) : ciao_servant { project(CAOC_exec) : ciao_component { after += BBN_UAV_svnt CAOC_svnt sharedname = CAOC_exec - libs += CAOC_stub CAOC_svnt + libs += BBN_UAV_stub BBN_UAV_svnt CAOC_stub CAOC_svnt idlflags += -Wb,export_macro=CAOC_EXEC_Export -Wb,export_include=CAOC_exec_export.h dynamicflags = CAOC_EXEC_BUILD_DLL IDL_Files { - + CAOCEI.idl } Source_Files { - + CAOCES.cpp + CAOCEIC.cpp + CAOCEIS.cpp CAOC_exec.cpp } } diff --git a/TAO/CIAO/examples/UAV/CAOC/CAOCEI.idl b/TAO/CIAO/examples/UAV/CAOC/CAOCEI.idl new file mode 100644 index 00000000000..e6d3928c38a --- /dev/null +++ b/TAO/CIAO/examples/UAV/CAOC/CAOCEI.idl @@ -0,0 +1,30 @@ +// $Id$ + +/** + * @file CAOCEI.idl + * + * Definition of the CAOC component implementation. + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ + +#ifndef CIAO_CAOCI_IDL +#define CIAO_CAOCI_IDL + +#include "CAOCE.idl" + +module BBN_UAV +{ + /** + * @interface CAOC_Exec + * + */ + local interface CAOC_Exec : + CCM_CAOC, + Components::SessionComponent + { + }; + +}; + +#endif /* CIAO_CAOCI_IDL*/ diff --git a/TAO/CIAO/examples/UAV/CAOC/CAOC_exec.cpp b/TAO/CIAO/examples/UAV/CAOC/CAOC_exec.cpp new file mode 100644 index 00000000000..843390daea7 --- /dev/null +++ b/TAO/CIAO/examples/UAV/CAOC/CAOC_exec.cpp @@ -0,0 +1,112 @@ +// $Id$ + +#include "CIAO_common.h" +#include "CAOC_exec.h" + +#define DISPLACEMENT 256 + +/// Default constructor. +MyImpl::CAOC_exec_i::CAOC_exec_i (void) + : str_ ("BM DEVICE DATA") +{ + +} + +/// Default destructor. +MyImpl::CAOC_exec_i::~CAOC_exec_i () +{ +} + +void +MyImpl::CAOC_exec_i::push_target_located (BBN_UAV::TargetLocated *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Notify others + BBN_UAV::PrepareEngage_var event = new OBV_BBN_UAV::PrepareEngage; + + ACE_DEBUG ((LM_DEBUG, + "CAOC, received a TargetLocated from Satellite \n")); + + this->context_->push_prepare_engage (event + ACE_ENV_ARG_PARAMETER); +} + +// Operations from Components::SessionComponent +void +MyImpl::CAOC_exec_i::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::CAOC_exec_i::set_session_context\n")); + + this->context_ = + BBN_UAV::CCM_CAOC_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::CAOC_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::CAOC_exec_i::ccm_activate\n")); + char *argv[1] = { "CAOC_exec"}; + + int argc = sizeof(argv)/sizeof(argv[0]); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv ACE_ENV_ARG_PARAMETER); + + CIAO_REGISTER_VALUE_FACTORY (orb.in(), BBN_UAV::TargetLocated_init, + BBN_UAV::TargetLocated); +} + +void +MyImpl::CAOC_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::CAOC_exec_i::ccm_passivate\n")); +} + +void +MyImpl::CAOC_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::CAOC_exec_i::ccm_remove\n")); +} + +/// Default ctor. +MyImpl::CAOCHome_exec_i::CAOCHome_exec_i () +{ +} + +/// Default dtor. +MyImpl::CAOCHome_exec_i::~CAOCHome_exec_i () +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::CAOCHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::CAOC_exec_i; +} + + +extern "C" CAOC_EXEC_Export ::Components::HomeExecutorBase_ptr +createCAOCHome_Impl (void) +{ + return new MyImpl::CAOCHome_exec_i; +} diff --git a/TAO/CIAO/examples/UAV/CAOC/CAOC_exec.h b/TAO/CIAO/examples/UAV/CAOC/CAOC_exec.h new file mode 100644 index 00000000000..109e0edf4cb --- /dev/null +++ b/TAO/CIAO/examples/UAV/CAOC/CAOC_exec.h @@ -0,0 +1,110 @@ +// $Id$ + +//================================================================ +/** + * @file CAOC_exec.h + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//================================================================ + +#ifndef CIAO_CAOC_EXEC_H +#define CIAO_CAOC_EXEC_H + +#include "CAOCEIC.h" +#include "tao/LocalObject.h" + +// The namespace name for the actual implementation classes doesn't +// really matter. Since there may be several different +// implementations for a component, they can very well be in different +// namespaces. +namespace MyImpl +{ + /** + * @class CAOC_exec_i + * + * The Command and Operations Center implementation class. + */ + class CAOC_EXEC_Export CAOC_exec_i : + public virtual BBN_UAV::CAOC_Exec, + // CIAO container implementation depends on correct reference + // counting of local interfaces, so we take a short cut to + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + CAOC_exec_i (void); + + /// Default destructor. + ~CAOC_exec_i (void); + + // Operations from BBN_UAV::CAOC + + virtual void + push_target_located (BBN_UAV::TargetLocated *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from Components::SessionComponent + + virtual void + set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + protected: + CORBA::String_var str_; + + /// Copmponent specific context + BBN_UAV::CCM_CAOC_Context_var context_; + }; + + /** + * @class CAOCHome_exec_i + * + * CAOC home executor implementation class. + */ + class CAOC_EXEC_Export CAOCHome_exec_i : + public virtual BBN_UAV::CCM_CAOCHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + CAOCHome_exec_i (); + + /// Default dtor. + ~CAOCHome_exec_i (); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +// Executor DLL entry point. CIAO's deployment and assembly framework +// invokes this function on the resulting DLL to get the home executor. +extern "C" CAOC_EXEC_Export ::Components::HomeExecutorBase_ptr +createCAOCHome_Impl (void); + +#endif /* CIAO_CAOC_EXEC_H*/ diff --git a/TAO/CIAO/examples/UAV/CAOC/CAOC_svnt.cpp b/TAO/CIAO/examples/UAV/CAOC/CAOC_svnt.cpp new file mode 100644 index 00000000000..a87c44ad98f --- /dev/null +++ b/TAO/CIAO/examples/UAV/CAOC/CAOC_svnt.cpp @@ -0,0 +1,1261 @@ +// $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.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#include "CAOC_svnt.h" +#include "Cookies.h" + +namespace CAOC_Impl +{ + namespace CIAO_GLUE_BBN_UAV + { + CAOC_Context::CAOC_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + CAOC_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) + { + } + + CAOC_Context::~CAOC_Context (void) + { + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + CAOC_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 + CAOC_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 + CAOC_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 + CAOC_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 + CAOC_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 + CAOC_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContext interface. + + CORBA::Object_ptr + CAOC_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_ = + ::BBN_UAV::CAOC::_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 ::BBN_UAV::CAOC::_duplicate ( + this->component_.in ()); + } + + // Operations for CAOC receptacles and event sources, + // defined in ::BBN_UAV::CCM_CAOC_Context. + + void + CAOC_Context::push_prepare_capture ( + ::BBN_UAV::PrepareCapture *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_Active_Map_Manager< + ::BBN_UAV::PrepareCaptureConsumer_var>::iterator end = + this->ciao_publishes_prepare_capture_map_.end (); + + for (ACE_Active_Map_Manager< + ::BBN_UAV::PrepareCaptureConsumer_var>::iterator iter = + this->ciao_publishes_prepare_capture_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager< + ::BBN_UAV::PrepareCaptureConsumer_var>::ENTRY &entry = *iter; + + ::BBN_UAV::PrepareCaptureConsumer_var c = + ::BBN_UAV::PrepareCaptureConsumer::_narrow ( + entry.int_id_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + entry.int_id_->push_PrepareCapture ( + ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + + ::Components::Cookie * + CAOC_Context::subscribe_prepare_capture ( + ::BBN_UAV::PrepareCaptureConsumer_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); + } + + ::BBN_UAV::PrepareCaptureConsumer_var sub = + ::BBN_UAV::PrepareCaptureConsumer::_duplicate (c); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_prepare_capture_map_.bind (sub.in (), key); + sub._retn (); + + ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); + return retv._retn (); + } + + ::BBN_UAV::PrepareCaptureConsumer_ptr + CAOC_Context::unsubscribe_prepare_capture ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + ::BBN_UAV::PrepareCaptureConsumer_var retv; + ACE_Active_Map_Manager_Key key; + + if (ck == 0 || ::CIAO::Map_Key_Cookie::extract (ck, key) == -1) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BBN_UAV::PrepareCaptureConsumer::_nil ()); + } + + + if (this->ciao_publishes_prepare_capture_map_.unbind (key, retv) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BBN_UAV::PrepareCaptureConsumer::_nil ()); + } + + return retv._retn (); + } + + void + CAOC_Context::push_prepare_engage ( + ::BBN_UAV::PrepareEngage *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_Active_Map_Manager< + ::BBN_UAV::PrepareEngageConsumer_var>::iterator end = + this->ciao_publishes_prepare_engage_map_.end (); + + for (ACE_Active_Map_Manager< + ::BBN_UAV::PrepareEngageConsumer_var>::iterator iter = + this->ciao_publishes_prepare_engage_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager< + ::BBN_UAV::PrepareEngageConsumer_var>::ENTRY &entry = *iter; + + ::BBN_UAV::PrepareEngageConsumer_var c = + ::BBN_UAV::PrepareEngageConsumer::_narrow ( + entry.int_id_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + entry.int_id_->push_PrepareEngage ( + ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + + ::Components::Cookie * + CAOC_Context::subscribe_prepare_engage ( + ::BBN_UAV::PrepareEngageConsumer_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); + } + + ::BBN_UAV::PrepareEngageConsumer_var sub = + ::BBN_UAV::PrepareEngageConsumer::_duplicate (c); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_prepare_engage_map_.bind (sub.in (), key); + sub._retn (); + + ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); + return retv._retn (); + } + + ::BBN_UAV::PrepareEngageConsumer_ptr + CAOC_Context::unsubscribe_prepare_engage ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + ::BBN_UAV::PrepareEngageConsumer_var retv; + ACE_Active_Map_Manager_Key key; + + if (ck == 0 || ::CIAO::Map_Key_Cookie::extract (ck, key) == -1) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BBN_UAV::PrepareEngageConsumer::_nil ()); + } + + + if (this->ciao_publishes_prepare_engage_map_.unbind (key, retv) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BBN_UAV::PrepareEngageConsumer::_nil ()); + } + + return retv._retn (); + } + + // CIAO-specific. + + ::CIAO::Session_Container * + CAOC_Context::_ciao_the_Container (void) const + { + return this->container_; + } + + CAOC_Context * + CAOC_Context::_narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_NOT_USED) + { + return dynamic_cast<CAOC_Context *> (p); + } + } + + namespace CIAO_GLUE_BBN_UAV + { + CAOC_Servant::CAOC_Servant ( + ::BBN_UAV::CCM_CAOC_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (::BBN_UAV::CCM_CAOC::_duplicate (exe)), + container_ (c) + { + this->context_ = new CAOC_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_CATCHANY + { + } + ACE_ENDTRY; + } + + CAOC_Servant::~CAOC_Servant (void) + { + ACE_TRY_NEW_ENV + { + ::Components::SessionComponent_var scom = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! ::CORBA::is_nil (scom.in ())) + { + scom->ccm_remove (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + ACE_CATCHANY + { + } + ACE_ENDTRY; + + this->context_->_remove_ref (); + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + CAOC_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 * + CAOC_Servant::get_all_facets ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::FacetDescriptions * + CAOC_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); + } + + CORBA::Boolean + CAOC_Servant::same_component ( + CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (::CORBA::is_nil (object_ref)) + { + ACE_THROW_RETURN (::CORBA::BAD_PARAM (), 0); + } + + ::CORBA::Object_var the_other = + object_ref->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::CORBA::Object_var me = + this->context_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return me->_is_equivalent ( + the_other.in () + ACE_ENV_ARG_PARAMETER); + } + + ::Components::EmitterDescriptions * + CAOC_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + CAOC_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 * + CAOC_Servant::subscribe_prepare_capture ( + ::BBN_UAV::PrepareCaptureConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + return this->context_->subscribe_prepare_capture ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::BBN_UAV::PrepareCaptureConsumer_ptr + CAOC_Servant::unsubscribe_prepare_capture ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + return this->context_->unsubscribe_prepare_capture ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ::Components::Cookie * + CAOC_Servant::subscribe_prepare_engage ( + ::BBN_UAV::PrepareEngageConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + return this->context_->subscribe_prepare_engage ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::BBN_UAV::PrepareEngageConsumer_ptr + CAOC_Servant::unsubscribe_prepare_engage ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + return this->context_->unsubscribe_prepare_engage ( + ck + ACE_ENV_ARG_PARAMETER); + } + + CAOC_Servant::TargetLocatedConsumer_target_located_Servant::TargetLocatedConsumer_target_located_Servant ( + ::BBN_UAV::CCM_CAOC_ptr executor, + ::BBN_UAV::CCM_CAOC_Context_ptr c) + : executor_ (::BBN_UAV::CCM_CAOC::_duplicate (executor)), + ctx_ (::BBN_UAV::CCM_CAOC_Context::_duplicate (c)) + { + } + + CAOC_Servant::TargetLocatedConsumer_target_located_Servant::~TargetLocatedConsumer_target_located_Servant (void) + { + } + + CORBA::Object_ptr + CAOC_Servant::TargetLocatedConsumer_target_located_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 + CAOC_Servant::TargetLocatedConsumer_target_located_Servant::push_TargetLocated ( + ::BBN_UAV::TargetLocated *evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->push_target_located ( + evt + ACE_ENV_ARG_PARAMETER); + } + + // Inherited from ::Components::EventConsumerBase. + void + CAOC_Servant::TargetLocatedConsumer_target_located_Servant::push_event ( + ::Components::EventBase *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::BadEventType)) + { + ::BBN_UAV::TargetLocated_var ev_type = + ::BBN_UAV::TargetLocated::_downcast (ev); + + if (ev_type != 0) + { + this->push_TargetLocated ( + ev_type.in () + ACE_ENV_ARG_PARAMETER); + + return; + } + + ACE_THROW (::Components::BadEventType ()); + } + + ::BBN_UAV::TargetLocatedConsumer_ptr + CAOC_Servant::get_consumer_target_located ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (CORBA::is_nil (this->consumes_target_located_.in ())) + { + CAOC_Servant::TargetLocatedConsumer_target_located_Servant *svt = + new CAOC_Servant::TargetLocatedConsumer_target_located_Servant ( + this->executor_.in (), + this->context_); + PortableServer::ServantBase_var safe_servant (svt); + + CORBA::Object_var obj = + this->container_->install_servant ( + svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::TargetLocatedConsumer::_nil ()); + + ::BBN_UAV::TargetLocatedConsumer_var eco = + ::BBN_UAV::TargetLocatedConsumer::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::TargetLocatedConsumer::_nil ()); + + this->consumes_target_located_ = eco; + } + + return ::BBN_UAV::TargetLocatedConsumer::_duplicate (this->consumes_target_located_.in ()); + } + + ::Components::Cookie * + CAOC_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 + CAOC_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 ()); + } + + ::Components::ConnectionDescriptions * + CAOC_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 * + CAOC_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + CAOC_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 + CAOC_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, "target_located") == 0) + { + return this->get_consumer_target_located (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + void + CAOC_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)) + { + ACE_THROW (::CORBA::NO_IMPLEMENT ()); + } + + ::Components::EventConsumerBase_ptr + CAOC_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 * + CAOC_Servant::get_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + CAOC_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 * + CAOC_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, "prepare_capture") == 0) + { + ::BBN_UAV::PrepareCaptureConsumer_var _ciao_consumer = + ::BBN_UAV::PrepareCaptureConsumer::_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_prepare_capture ( + _ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } + + if (ACE_OS::strcmp (publisher_name, "prepare_engage") == 0) + { + ::BBN_UAV::PrepareEngageConsumer_var _ciao_consumer = + ::BBN_UAV::PrepareEngageConsumer::_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_prepare_engage ( + _ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ::Components::EventConsumerBase_ptr + CAOC_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, "prepare_capture") == 0) + { + return this->unsubscribe_prepare_capture ( + ck + ACE_ENV_ARG_PARAMETER); + } + + if (ACE_OS::strcmp (publisher_name, "prepare_engage") == 0) + { + return this->unsubscribe_prepare_engage ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ::Components::PublisherDescriptions * + CAOC_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + CAOC_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 + CAOC_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 + CAOC_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 + CAOC_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::Components::CCMHome_ptr + CAOC_Servant::get_ccm_home ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->context_->get_CCM_home (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Components::PrimaryKeyBase * + CAOC_Servant::get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)) + { + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); + } + + void + CAOC_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + CAOC_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + ::Components::ComponentPortDescription * + CAOC_Servant::get_all_ports ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::ComponentPortDescription_var retv = + new OBV_Components::ComponentPortDescription; + + ::Components::FacetDescriptions_var facets_desc = + this->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ReceptacleDescriptions_var receptacle_desc = + this->get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ConsumerDescriptions_var consumer_desc = + this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::EmitterDescriptions_var emitter_desc = + this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::PublisherDescriptions_var publisher_desc = + this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv->facets (facets_desc.in ()); + retv->receptacles (receptacle_desc.in ()); + retv->consumers (consumer_desc.in ()); + retv->emitters (emitter_desc.in ()); + retv->publishers (publisher_desc.in ()); + + return retv._retn (); + } + + CORBA::Object_ptr + CAOC_Servant::_get_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow ( + this->context_ + 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->context_ + 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 (), + ::CORBA::Object::_nil ()); + } + + // CIAO-specific operations. + + void + CAOC_Servant::_ciao_activate ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! ::CORBA::is_nil (temp.in ())) + { + temp->ccm_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + + void + CAOC_Servant::_ciao_passivate ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! ::CORBA::is_nil (temp.in ())) + { + temp->ccm_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + + // Supported operations. + + // Component attribute operations. + } + + namespace CIAO_GLUE_BBN_UAV + { + CAOCHome_Servant::CAOCHome_Servant ( + ::BBN_UAV::CCM_CAOCHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::BBN_UAV::CCM_CAOCHome::_duplicate (exe)), + container_ (c) + { + } + + CAOCHome_Servant::~CAOCHome_Servant (void) + { + } + + // Home factory and other operations. + + // Home attribute operations. + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + CAOCHome_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. + + ::BBN_UAV::CAOC_ptr + CAOCHome_Servant::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BBN_UAV::CAOC::_nil ()); + } + + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::CAOC::_nil ()); + + ::BBN_UAV::CCM_CAOC_var _ciao_comp = + ::BBN_UAV::CCM_CAOC::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::CAOC::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + CAOCHome_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 + CAOCHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + CAOCHome_Servant::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + ::BBN_UAV::CAOC_var _ciao_comp = + ::BBN_UAV::CAOC::_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. + + ::BBN_UAV::CAOC_ptr + CAOCHome_Servant::_ciao_activate_component ( + ::BBN_UAV::CCM_CAOC_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 (::BBN_UAV::CAOC::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::CAOC::_nil ()); + + CAOC_Servant *svt = + new CAOC_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 (::BBN_UAV::CAOC::_nil ()); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::CAOC::_nil ()); + + ::BBN_UAV::CAOC_var ho = + ::BBN_UAV::CAOC::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::CAOC::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + CAOCHome_Servant::_ciao_passivate_component ( + ::BBN_UAV::CAOC_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; + + CAOC_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" CAOC_SVNT_Export ::PortableServer::Servant + createCAOCHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) + { + if (p == 0) + { + return 0; + } + + ::BBN_UAV::CCM_CAOCHome_var x = + ::BBN_UAV::CCM_CAOCHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + CIAO_GLUE_BBN_UAV::CAOCHome_Servant ( + x.in (), + c); + } +} diff --git a/TAO/CIAO/examples/UAV/CAOC/CAOC_svnt.h b/TAO/CIAO/examples/UAV/CAOC/CAOC_svnt.h new file mode 100644 index 00000000000..bb1d728ea46 --- /dev/null +++ b/TAO/CIAO/examples/UAV/CAOC/CAOC_svnt.h @@ -0,0 +1,630 @@ +// $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.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#ifndef CIAO_GLUE_SESSION_CAOC_SVNT_H +#define CIAO_GLUE_SESSION_CAOC_SVNT_H + +#include /**/ "ace/pre.h" + +#include "CAOCEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ciao/Container_Base.h" +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#include "CAOCS.h" + +namespace CAOC_Impl +{ + namespace CIAO_GLUE_BBN_UAV + { + class CAOC_SVNT_Export CAOC_Context + : public virtual ::BBN_UAV::CCM_CAOC_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class CAOC_Servant; + + CAOC_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + CAOC_Servant *sv); + + virtual ~CAOC_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 CAOC receptacles and event sources, + // defined in ::BBN_UAV::CCM_CAOC_Context. + + virtual void + push_prepare_capture ( + ::BBN_UAV::PrepareCapture *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + push_prepare_engage ( + ::BBN_UAV::PrepareEngage *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO-specific. + + ::CIAO::Session_Container * + _ciao_the_Container (void) const; + + static CAOC_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_prepare_capture ( + ::BBN_UAV::PrepareCaptureConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BBN_UAV::PrepareCaptureConsumer_ptr + unsubscribe_prepare_capture ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + virtual ::Components::Cookie * + subscribe_prepare_engage ( + ::BBN_UAV::PrepareEngageConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BBN_UAV::PrepareEngageConsumer_ptr + unsubscribe_prepare_engage ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + protected: + ACE_Active_Map_Manager< + ::BBN_UAV::PrepareCaptureConsumer_var> + ciao_publishes_prepare_capture_map_; + + ACE_Active_Map_Manager< + ::BBN_UAV::PrepareEngageConsumer_var> + ciao_publishes_prepare_engage_map_; + + ::Components::CCMHome_var home_; + + ::CIAO::Session_Container *container_; + + CAOC_Servant *servant_; + + ::BBN_UAV::CAOC_var component_; + }; + } + + namespace CIAO_GLUE_BBN_UAV + { + class CAOC_SVNT_Export CAOC_Servant + : public virtual POA_BBN_UAV::CAOC, + public virtual PortableServer::RefCountServantBase + { + public: + CAOC_Servant ( + ::BBN_UAV::CCM_CAOC_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~CAOC_Servant (void); + + // Supported operations. + + // Public port operations. + + virtual ::Components::Cookie * + subscribe_prepare_capture ( + ::BBN_UAV::PrepareCaptureConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BBN_UAV::PrepareCaptureConsumer_ptr + unsubscribe_prepare_capture ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + virtual ::Components::Cookie * + subscribe_prepare_engage ( + ::BBN_UAV::PrepareEngageConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BBN_UAV::PrepareEngageConsumer_ptr + unsubscribe_prepare_engage ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + // Servant class for the target_located consumer. + class CAOC_SVNT_Export TargetLocatedConsumer_target_located_Servant + : public virtual POA_BBN_UAV::TargetLocatedConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + TargetLocatedConsumer_target_located_Servant ( + ::BBN_UAV::CCM_CAOC_ptr executor, + ::BBN_UAV::CCM_CAOC_Context_ptr c); + + virtual ~TargetLocatedConsumer_target_located_Servant (void); + + virtual void + push_TargetLocated ( + ::BBN_UAV::TargetLocated *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: + ::BBN_UAV::CCM_CAOC_var + executor_; + + ::BBN_UAV::CCM_CAOC_Context_var + ctx_; + }; + + virtual ::BBN_UAV::TargetLocatedConsumer_ptr + get_consumer_target_located ( + 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_all_facets ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::FacetDescriptions * + get_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual CORBA::Boolean + same_component ( + CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for Receptacles interface. + + virtual ::Components::Cookie * + connect ( + const char *name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::AlreadyConnected, + ::Components::ExceededConnectionLimit)); + + virtual CORBA::Object_ptr + disconnect ( + const char *name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::CookieRequired, + ::Components::NoConnection)); + + 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_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + 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 ::Components::CCMHome_ptr + get_ccm_home ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PrimaryKeyBase * + get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)); + + 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)); + + virtual ::Components::ComponentPortDescription * + get_all_ports( + 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)); + + // CIAO-specific operations. + + void + _ciao_activate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BBN_UAV::CCM_CAOC_var + executor_; + + CAOC_Context * + context_; + + ::CIAO::Session_Container * + container_; + ::BBN_UAV::TargetLocatedConsumer_var + consumes_target_located_; + + ACE_CString component_UUID_; + }; + } + + namespace CIAO_GLUE_BBN_UAV + { + class CAOC_SVNT_Export CAOCHome_Servant + : public virtual POA_BBN_UAV::CAOCHome, + public virtual PortableServer::RefCountServantBase + { + public: + CAOCHome_Servant ( + ::BBN_UAV::CCM_CAOCHome_ptr exe, + ::CIAO::Session_Container *c); + + virtual ~CAOCHome_Servant (void); + + // Home factory and other 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 ::BBN_UAV::CAOC_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. + + ::BBN_UAV::CAOC_ptr + _ciao_activate_component ( + ::BBN_UAV::CCM_CAOC_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::BBN_UAV::CAOC_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BBN_UAV::CCM_CAOCHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + CAOC_Servant *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; + + extern "C" CAOC_SVNT_Export ::PortableServer::Servant + createCAOCHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + } +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_GLUE_SESSION_CAOC_SVNT_H */ + diff --git a/TAO/CIAO/examples/UAV/Engagement/Engagement.mpc b/TAO/CIAO/examples/UAV/Engagement/Engagement.mpc index 354d8a6a1cb..f9938308686 100644 --- a/TAO/CIAO/examples/UAV/Engagement/Engagement.mpc +++ b/TAO/CIAO/examples/UAV/Engagement/Engagement.mpc @@ -20,7 +20,7 @@ project(Engagement_stub): ciao_client { project(Engagement_svnt) : ciao_servant { after += BBN_UAV_svnt Engagement_stub sharedname = Engagement_svnt - libs += Engagement_stub + libs += BBN_UAV_stub BBN_UAV_svnt Engagement_stub idlflags += -Wb,export_macro=ENGAGEMENT_SVNT_Export -Wb,export_include=Engagement_svnt_export.h dynamicflags = ENGAGEMENT_SVNT_BUILD_DLL @@ -44,17 +44,19 @@ project(Engagement_svnt) : ciao_servant { project(Engagement_exec) : ciao_component { after += BBN_UAV_svnt Engagement_svnt sharedname = Engagement_exec - libs += Engagement_stub Engagement_svnt + libs += BBN_UAV_stub BBN_UAV_svnt Engagement_stub Engagement_svnt idlflags += -Wb,export_macro=ENGAGEMENT_EXEC_Export -Wb,export_include=Engagement_exec_export.h dynamicflags = ENGAGEMENT_EXEC_BUILD_DLL IDL_Files { - + EngagementEI.idl } Source_Files { - + EngagementES.cpp + EngagementEIC.cpp + EngagementEIS.cpp Engagement_exec.cpp } } diff --git a/TAO/CIAO/examples/UAV/Engagement/EngagementEI.idl b/TAO/CIAO/examples/UAV/Engagement/EngagementEI.idl new file mode 100644 index 00000000000..8da8d9ffe88 --- /dev/null +++ b/TAO/CIAO/examples/UAV/Engagement/EngagementEI.idl @@ -0,0 +1,30 @@ +// $Id$ + +/** + * @file EngagementEI.idl + * + * Definition of the Engagement component implementation. + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ + +#ifndef CIAO_ENGAGEMENTI_IDL +#define CIAO_ENGAGEMENTI_IDL + +#include "EngagementE.idl" + +module BBN_UAV +{ + /** + * @interface Engagement_Exec + * + */ + local interface Engagement_Exec : + CCM_Engagement, + Components::SessionComponent + { + }; + +}; + +#endif /* CIAO_ENGAGEMENTI_IDL*/ diff --git a/TAO/CIAO/examples/UAV/Engagement/Engagement_exec.cpp b/TAO/CIAO/examples/UAV/Engagement/Engagement_exec.cpp new file mode 100644 index 00000000000..9a6fcc52e85 --- /dev/null +++ b/TAO/CIAO/examples/UAV/Engagement/Engagement_exec.cpp @@ -0,0 +1,117 @@ +// $Id$ + +#include "CIAO_common.h" +#include "Engagement_exec.h" + +#define DISPLACEMENT 256 + +/// Default constructor. +MyImpl::Engagement_exec_i::Engagement_exec_i (void) + : str_ ("BM DEVICE DATA") +{ + +} + +/// Default destructor. +MyImpl::Engagement_exec_i::~Engagement_exec_i () +{ +} + +void +MyImpl::Engagement_exec_i::push_prepare_engage (BBN_UAV::PrepareEngage *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Notify others + BBN_UAV::PrepareMove_var event1 = new OBV_BBN_UAV::PrepareMove; + + BBN_UAV::StartEngage_var event2 = new OBV_BBN_UAV::StartEngage; + + ACE_DEBUG ((LM_DEBUG, + "Engagement, received a PrepareEngage from CAOC \n")); + + this->context_->push_prepare_move (event1 + ACE_ENV_ARG_PARAMETER); + + this->context_->push_start_engage (event2 + ACE_ENV_ARG_PARAMETER); +} + +// Operations from Components::SessionComponent +void +MyImpl::Engagement_exec_i::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::Engagement_exec_i::set_session_context\n")); + + this->context_ = + BBN_UAV::CCM_Engagement_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::Engagement_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::Engagement_exec_i::ccm_activate\n")); + char *argv[1] = { "Engagement_exec"}; + + int argc = sizeof(argv)/sizeof(argv[0]); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv ACE_ENV_ARG_PARAMETER); + + CIAO_REGISTER_VALUE_FACTORY (orb.in(), BBN_UAV::PrepareEngage_init, + BBN_UAV::PrepareEngage); +} + +void +MyImpl::Engagement_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::Engagement_exec_i::ccm_passivate\n")); +} + +void +MyImpl::Engagement_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::Engagement_exec_i::ccm_remove\n")); +} + +/// Default ctor. +MyImpl::EngagementHome_exec_i::EngagementHome_exec_i () +{ +} + +/// Default dtor. +MyImpl::EngagementHome_exec_i::~EngagementHome_exec_i () +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::EngagementHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::Engagement_exec_i; +} + + +extern "C" ENGAGEMENT_EXEC_Export ::Components::HomeExecutorBase_ptr +createEngagementHome_Impl (void) +{ + return new MyImpl::EngagementHome_exec_i; +} diff --git a/TAO/CIAO/examples/UAV/Engagement/Engagement_exec.h b/TAO/CIAO/examples/UAV/Engagement/Engagement_exec.h new file mode 100644 index 00000000000..3ddc86e8c5a --- /dev/null +++ b/TAO/CIAO/examples/UAV/Engagement/Engagement_exec.h @@ -0,0 +1,110 @@ +// $Id$ + +//================================================================ +/** + * @file Engagement_exec.h + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//================================================================ + +#ifndef CIAO_ENGAGEMENT_EXEC_H +#define CIAO_ENGAGEMENT_EXEC_H + +#include "EngagementEIC.h" +#include "tao/LocalObject.h" + +// The namespace name for the actual implementation classes doesn't +// really matter. Since there may be several different +// implementations for a component, they can very well be in different +// namespaces. +namespace MyImpl +{ + /** + * @class Engagement_exec_i + * + * The Engagement implementation class. + */ + class ENGAGEMENT_EXEC_Export Engagement_exec_i : + public virtual BBN_UAV::Engagement_Exec, + // CIAO container implementation depends on correct reference + // counting of local interfaces, so we take a short cut to + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + Engagement_exec_i (void); + + /// Default destructor. + ~Engagement_exec_i (void); + + // Operations from BBN_UAV::Engagement + + virtual void + push_prepare_engage (BBN_UAV::PrepareEngage *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from Components::SessionComponent + + virtual void + set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + protected: + CORBA::String_var str_; + + /// Copmponent specific context + BBN_UAV::CCM_Engagement_Context_var context_; + }; + + /** + * @class EngagementHome_exec_i + * + * Engagement home executor implementation class. + */ + class ENGAGEMENT_EXEC_Export EngagementHome_exec_i : + public virtual BBN_UAV::CCM_EngagementHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + EngagementHome_exec_i (); + + /// Default dtor. + ~EngagementHome_exec_i (); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +// Executor DLL entry point. CIAO's deployment and assembly framework +// invokes this function on the resulting DLL to get the home executor. +extern "C" ENGAGEMENT_EXEC_Export ::Components::HomeExecutorBase_ptr +createEngagementHome_Impl (void); + +#endif /* CIAO_ENGAGEMENT_EXEC_H*/ diff --git a/TAO/CIAO/examples/UAV/Engagement/Engagement_svnt.cpp b/TAO/CIAO/examples/UAV/Engagement/Engagement_svnt.cpp new file mode 100644 index 00000000000..92f43bcd3cd --- /dev/null +++ b/TAO/CIAO/examples/UAV/Engagement/Engagement_svnt.cpp @@ -0,0 +1,1261 @@ +// $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.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#include "Engagement_svnt.h" +#include "Cookies.h" + +namespace Engagement_Impl +{ + namespace CIAO_GLUE_BBN_UAV + { + Engagement_Context::Engagement_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + Engagement_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) + { + } + + Engagement_Context::~Engagement_Context (void) + { + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + Engagement_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 + Engagement_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 + Engagement_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 + Engagement_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 + Engagement_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 + Engagement_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContext interface. + + CORBA::Object_ptr + Engagement_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_ = + ::BBN_UAV::Engagement::_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 ::BBN_UAV::Engagement::_duplicate ( + this->component_.in ()); + } + + // Operations for Engagement receptacles and event sources, + // defined in ::BBN_UAV::CCM_Engagement_Context. + + void + Engagement_Context::push_start_engage ( + ::BBN_UAV::StartEngage *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_Active_Map_Manager< + ::BBN_UAV::StartEngageConsumer_var>::iterator end = + this->ciao_publishes_start_engage_map_.end (); + + for (ACE_Active_Map_Manager< + ::BBN_UAV::StartEngageConsumer_var>::iterator iter = + this->ciao_publishes_start_engage_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager< + ::BBN_UAV::StartEngageConsumer_var>::ENTRY &entry = *iter; + + ::BBN_UAV::StartEngageConsumer_var c = + ::BBN_UAV::StartEngageConsumer::_narrow ( + entry.int_id_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + entry.int_id_->push_StartEngage ( + ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + + ::Components::Cookie * + Engagement_Context::subscribe_start_engage ( + ::BBN_UAV::StartEngageConsumer_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); + } + + ::BBN_UAV::StartEngageConsumer_var sub = + ::BBN_UAV::StartEngageConsumer::_duplicate (c); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_start_engage_map_.bind (sub.in (), key); + sub._retn (); + + ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); + return retv._retn (); + } + + ::BBN_UAV::StartEngageConsumer_ptr + Engagement_Context::unsubscribe_start_engage ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + ::BBN_UAV::StartEngageConsumer_var retv; + ACE_Active_Map_Manager_Key key; + + if (ck == 0 || ::CIAO::Map_Key_Cookie::extract (ck, key) == -1) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BBN_UAV::StartEngageConsumer::_nil ()); + } + + + if (this->ciao_publishes_start_engage_map_.unbind (key, retv) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BBN_UAV::StartEngageConsumer::_nil ()); + } + + return retv._retn (); + } + + void + Engagement_Context::push_prepare_move ( + ::BBN_UAV::PrepareMove *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_Active_Map_Manager< + ::BBN_UAV::PrepareMoveConsumer_var>::iterator end = + this->ciao_publishes_prepare_move_map_.end (); + + for (ACE_Active_Map_Manager< + ::BBN_UAV::PrepareMoveConsumer_var>::iterator iter = + this->ciao_publishes_prepare_move_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager< + ::BBN_UAV::PrepareMoveConsumer_var>::ENTRY &entry = *iter; + + ::BBN_UAV::PrepareMoveConsumer_var c = + ::BBN_UAV::PrepareMoveConsumer::_narrow ( + entry.int_id_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + entry.int_id_->push_PrepareMove ( + ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + + ::Components::Cookie * + Engagement_Context::subscribe_prepare_move ( + ::BBN_UAV::PrepareMoveConsumer_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); + } + + ::BBN_UAV::PrepareMoveConsumer_var sub = + ::BBN_UAV::PrepareMoveConsumer::_duplicate (c); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_prepare_move_map_.bind (sub.in (), key); + sub._retn (); + + ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); + return retv._retn (); + } + + ::BBN_UAV::PrepareMoveConsumer_ptr + Engagement_Context::unsubscribe_prepare_move ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + ::BBN_UAV::PrepareMoveConsumer_var retv; + ACE_Active_Map_Manager_Key key; + + if (ck == 0 || ::CIAO::Map_Key_Cookie::extract (ck, key) == -1) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BBN_UAV::PrepareMoveConsumer::_nil ()); + } + + + if (this->ciao_publishes_prepare_move_map_.unbind (key, retv) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BBN_UAV::PrepareMoveConsumer::_nil ()); + } + + return retv._retn (); + } + + // CIAO-specific. + + ::CIAO::Session_Container * + Engagement_Context::_ciao_the_Container (void) const + { + return this->container_; + } + + Engagement_Context * + Engagement_Context::_narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_NOT_USED) + { + return dynamic_cast<Engagement_Context *> (p); + } + } + + namespace CIAO_GLUE_BBN_UAV + { + Engagement_Servant::Engagement_Servant ( + ::BBN_UAV::CCM_Engagement_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (::BBN_UAV::CCM_Engagement::_duplicate (exe)), + container_ (c) + { + this->context_ = new Engagement_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_CATCHANY + { + } + ACE_ENDTRY; + } + + Engagement_Servant::~Engagement_Servant (void) + { + ACE_TRY_NEW_ENV + { + ::Components::SessionComponent_var scom = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! ::CORBA::is_nil (scom.in ())) + { + scom->ccm_remove (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + ACE_CATCHANY + { + } + ACE_ENDTRY; + + this->context_->_remove_ref (); + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + Engagement_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 * + Engagement_Servant::get_all_facets ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::FacetDescriptions * + Engagement_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); + } + + CORBA::Boolean + Engagement_Servant::same_component ( + CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (::CORBA::is_nil (object_ref)) + { + ACE_THROW_RETURN (::CORBA::BAD_PARAM (), 0); + } + + ::CORBA::Object_var the_other = + object_ref->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::CORBA::Object_var me = + this->context_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return me->_is_equivalent ( + the_other.in () + ACE_ENV_ARG_PARAMETER); + } + + ::Components::EmitterDescriptions * + Engagement_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + Engagement_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 * + Engagement_Servant::subscribe_start_engage ( + ::BBN_UAV::StartEngageConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + return this->context_->subscribe_start_engage ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::BBN_UAV::StartEngageConsumer_ptr + Engagement_Servant::unsubscribe_start_engage ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + return this->context_->unsubscribe_start_engage ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ::Components::Cookie * + Engagement_Servant::subscribe_prepare_move ( + ::BBN_UAV::PrepareMoveConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + return this->context_->subscribe_prepare_move ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::BBN_UAV::PrepareMoveConsumer_ptr + Engagement_Servant::unsubscribe_prepare_move ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + return this->context_->unsubscribe_prepare_move ( + ck + ACE_ENV_ARG_PARAMETER); + } + + Engagement_Servant::PrepareEngageConsumer_prepare_engage_Servant::PrepareEngageConsumer_prepare_engage_Servant ( + ::BBN_UAV::CCM_Engagement_ptr executor, + ::BBN_UAV::CCM_Engagement_Context_ptr c) + : executor_ (::BBN_UAV::CCM_Engagement::_duplicate (executor)), + ctx_ (::BBN_UAV::CCM_Engagement_Context::_duplicate (c)) + { + } + + Engagement_Servant::PrepareEngageConsumer_prepare_engage_Servant::~PrepareEngageConsumer_prepare_engage_Servant (void) + { + } + + CORBA::Object_ptr + Engagement_Servant::PrepareEngageConsumer_prepare_engage_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 + Engagement_Servant::PrepareEngageConsumer_prepare_engage_Servant::push_PrepareEngage ( + ::BBN_UAV::PrepareEngage *evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->push_prepare_engage ( + evt + ACE_ENV_ARG_PARAMETER); + } + + // Inherited from ::Components::EventConsumerBase. + void + Engagement_Servant::PrepareEngageConsumer_prepare_engage_Servant::push_event ( + ::Components::EventBase *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::BadEventType)) + { + ::BBN_UAV::PrepareEngage_var ev_type = + ::BBN_UAV::PrepareEngage::_downcast (ev); + + if (ev_type != 0) + { + this->push_PrepareEngage ( + ev_type.in () + ACE_ENV_ARG_PARAMETER); + + return; + } + + ACE_THROW (::Components::BadEventType ()); + } + + ::BBN_UAV::PrepareEngageConsumer_ptr + Engagement_Servant::get_consumer_prepare_engage ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (CORBA::is_nil (this->consumes_prepare_engage_.in ())) + { + Engagement_Servant::PrepareEngageConsumer_prepare_engage_Servant *svt = + new Engagement_Servant::PrepareEngageConsumer_prepare_engage_Servant ( + this->executor_.in (), + this->context_); + PortableServer::ServantBase_var safe_servant (svt); + + CORBA::Object_var obj = + this->container_->install_servant ( + svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::PrepareEngageConsumer::_nil ()); + + ::BBN_UAV::PrepareEngageConsumer_var eco = + ::BBN_UAV::PrepareEngageConsumer::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::PrepareEngageConsumer::_nil ()); + + this->consumes_prepare_engage_ = eco; + } + + return ::BBN_UAV::PrepareEngageConsumer::_duplicate (this->consumes_prepare_engage_.in ()); + } + + ::Components::Cookie * + Engagement_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 + Engagement_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 ()); + } + + ::Components::ConnectionDescriptions * + Engagement_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 * + Engagement_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + Engagement_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 + Engagement_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, "prepare_engage") == 0) + { + return this->get_consumer_prepare_engage (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + void + Engagement_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)) + { + ACE_THROW (::CORBA::NO_IMPLEMENT ()); + } + + ::Components::EventConsumerBase_ptr + Engagement_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 * + Engagement_Servant::get_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + Engagement_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 * + Engagement_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, "start_engage") == 0) + { + ::BBN_UAV::StartEngageConsumer_var _ciao_consumer = + ::BBN_UAV::StartEngageConsumer::_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_start_engage ( + _ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } + + if (ACE_OS::strcmp (publisher_name, "prepare_move") == 0) + { + ::BBN_UAV::PrepareMoveConsumer_var _ciao_consumer = + ::BBN_UAV::PrepareMoveConsumer::_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_prepare_move ( + _ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ::Components::EventConsumerBase_ptr + Engagement_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, "start_engage") == 0) + { + return this->unsubscribe_start_engage ( + ck + ACE_ENV_ARG_PARAMETER); + } + + if (ACE_OS::strcmp (publisher_name, "prepare_move") == 0) + { + return this->unsubscribe_prepare_move ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ::Components::PublisherDescriptions * + Engagement_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + Engagement_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 + Engagement_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 + Engagement_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 + Engagement_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::Components::CCMHome_ptr + Engagement_Servant::get_ccm_home ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->context_->get_CCM_home (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Components::PrimaryKeyBase * + Engagement_Servant::get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)) + { + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); + } + + void + Engagement_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + Engagement_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + ::Components::ComponentPortDescription * + Engagement_Servant::get_all_ports ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::ComponentPortDescription_var retv = + new OBV_Components::ComponentPortDescription; + + ::Components::FacetDescriptions_var facets_desc = + this->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ReceptacleDescriptions_var receptacle_desc = + this->get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ConsumerDescriptions_var consumer_desc = + this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::EmitterDescriptions_var emitter_desc = + this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::PublisherDescriptions_var publisher_desc = + this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv->facets (facets_desc.in ()); + retv->receptacles (receptacle_desc.in ()); + retv->consumers (consumer_desc.in ()); + retv->emitters (emitter_desc.in ()); + retv->publishers (publisher_desc.in ()); + + return retv._retn (); + } + + CORBA::Object_ptr + Engagement_Servant::_get_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow ( + this->context_ + 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->context_ + 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 (), + ::CORBA::Object::_nil ()); + } + + // CIAO-specific operations. + + void + Engagement_Servant::_ciao_activate ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! ::CORBA::is_nil (temp.in ())) + { + temp->ccm_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + + void + Engagement_Servant::_ciao_passivate ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! ::CORBA::is_nil (temp.in ())) + { + temp->ccm_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + + // Supported operations. + + // Component attribute operations. + } + + namespace CIAO_GLUE_BBN_UAV + { + EngagementHome_Servant::EngagementHome_Servant ( + ::BBN_UAV::CCM_EngagementHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::BBN_UAV::CCM_EngagementHome::_duplicate (exe)), + container_ (c) + { + } + + EngagementHome_Servant::~EngagementHome_Servant (void) + { + } + + // Home factory and other operations. + + // Home attribute operations. + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + EngagementHome_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. + + ::BBN_UAV::Engagement_ptr + EngagementHome_Servant::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BBN_UAV::Engagement::_nil ()); + } + + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::Engagement::_nil ()); + + ::BBN_UAV::CCM_Engagement_var _ciao_comp = + ::BBN_UAV::CCM_Engagement::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::Engagement::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + EngagementHome_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 + EngagementHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + EngagementHome_Servant::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + ::BBN_UAV::Engagement_var _ciao_comp = + ::BBN_UAV::Engagement::_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. + + ::BBN_UAV::Engagement_ptr + EngagementHome_Servant::_ciao_activate_component ( + ::BBN_UAV::CCM_Engagement_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 (::BBN_UAV::Engagement::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::Engagement::_nil ()); + + Engagement_Servant *svt = + new Engagement_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 (::BBN_UAV::Engagement::_nil ()); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::Engagement::_nil ()); + + ::BBN_UAV::Engagement_var ho = + ::BBN_UAV::Engagement::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::Engagement::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + EngagementHome_Servant::_ciao_passivate_component ( + ::BBN_UAV::Engagement_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; + + Engagement_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" ENGAGEMENT_SVNT_Export ::PortableServer::Servant + createEngagementHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) + { + if (p == 0) + { + return 0; + } + + ::BBN_UAV::CCM_EngagementHome_var x = + ::BBN_UAV::CCM_EngagementHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + CIAO_GLUE_BBN_UAV::EngagementHome_Servant ( + x.in (), + c); + } +} diff --git a/TAO/CIAO/examples/UAV/Engagement/Engagement_svnt.h b/TAO/CIAO/examples/UAV/Engagement/Engagement_svnt.h new file mode 100644 index 00000000000..e12fd6d55cf --- /dev/null +++ b/TAO/CIAO/examples/UAV/Engagement/Engagement_svnt.h @@ -0,0 +1,630 @@ +// $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.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#ifndef CIAO_GLUE_SESSION_ENGAGEMENT_SVNT_H +#define CIAO_GLUE_SESSION_ENGAGEMENT_SVNT_H + +#include /**/ "ace/pre.h" + +#include "EngagementEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ciao/Container_Base.h" +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#include "EngagementS.h" + +namespace Engagement_Impl +{ + namespace CIAO_GLUE_BBN_UAV + { + class ENGAGEMENT_SVNT_Export Engagement_Context + : public virtual ::BBN_UAV::CCM_Engagement_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class Engagement_Servant; + + Engagement_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + Engagement_Servant *sv); + + virtual ~Engagement_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 Engagement receptacles and event sources, + // defined in ::BBN_UAV::CCM_Engagement_Context. + + virtual void + push_start_engage ( + ::BBN_UAV::StartEngage *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + push_prepare_move ( + ::BBN_UAV::PrepareMove *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO-specific. + + ::CIAO::Session_Container * + _ciao_the_Container (void) const; + + static Engagement_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_start_engage ( + ::BBN_UAV::StartEngageConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BBN_UAV::StartEngageConsumer_ptr + unsubscribe_start_engage ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + virtual ::Components::Cookie * + subscribe_prepare_move ( + ::BBN_UAV::PrepareMoveConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BBN_UAV::PrepareMoveConsumer_ptr + unsubscribe_prepare_move ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + protected: + ACE_Active_Map_Manager< + ::BBN_UAV::StartEngageConsumer_var> + ciao_publishes_start_engage_map_; + + ACE_Active_Map_Manager< + ::BBN_UAV::PrepareMoveConsumer_var> + ciao_publishes_prepare_move_map_; + + ::Components::CCMHome_var home_; + + ::CIAO::Session_Container *container_; + + Engagement_Servant *servant_; + + ::BBN_UAV::Engagement_var component_; + }; + } + + namespace CIAO_GLUE_BBN_UAV + { + class ENGAGEMENT_SVNT_Export Engagement_Servant + : public virtual POA_BBN_UAV::Engagement, + public virtual PortableServer::RefCountServantBase + { + public: + Engagement_Servant ( + ::BBN_UAV::CCM_Engagement_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~Engagement_Servant (void); + + // Supported operations. + + // Public port operations. + + virtual ::Components::Cookie * + subscribe_start_engage ( + ::BBN_UAV::StartEngageConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BBN_UAV::StartEngageConsumer_ptr + unsubscribe_start_engage ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + virtual ::Components::Cookie * + subscribe_prepare_move ( + ::BBN_UAV::PrepareMoveConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BBN_UAV::PrepareMoveConsumer_ptr + unsubscribe_prepare_move ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + // Servant class for the prepare_engage consumer. + class ENGAGEMENT_SVNT_Export PrepareEngageConsumer_prepare_engage_Servant + : public virtual POA_BBN_UAV::PrepareEngageConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + PrepareEngageConsumer_prepare_engage_Servant ( + ::BBN_UAV::CCM_Engagement_ptr executor, + ::BBN_UAV::CCM_Engagement_Context_ptr c); + + virtual ~PrepareEngageConsumer_prepare_engage_Servant (void); + + virtual void + push_PrepareEngage ( + ::BBN_UAV::PrepareEngage *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: + ::BBN_UAV::CCM_Engagement_var + executor_; + + ::BBN_UAV::CCM_Engagement_Context_var + ctx_; + }; + + virtual ::BBN_UAV::PrepareEngageConsumer_ptr + get_consumer_prepare_engage ( + 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_all_facets ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::FacetDescriptions * + get_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual CORBA::Boolean + same_component ( + CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for Receptacles interface. + + virtual ::Components::Cookie * + connect ( + const char *name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::AlreadyConnected, + ::Components::ExceededConnectionLimit)); + + virtual CORBA::Object_ptr + disconnect ( + const char *name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::CookieRequired, + ::Components::NoConnection)); + + 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_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + 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 ::Components::CCMHome_ptr + get_ccm_home ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PrimaryKeyBase * + get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)); + + 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)); + + virtual ::Components::ComponentPortDescription * + get_all_ports( + 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)); + + // CIAO-specific operations. + + void + _ciao_activate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BBN_UAV::CCM_Engagement_var + executor_; + + Engagement_Context * + context_; + + ::CIAO::Session_Container * + container_; + ::BBN_UAV::PrepareEngageConsumer_var + consumes_prepare_engage_; + + ACE_CString component_UUID_; + }; + } + + namespace CIAO_GLUE_BBN_UAV + { + class ENGAGEMENT_SVNT_Export EngagementHome_Servant + : public virtual POA_BBN_UAV::EngagementHome, + public virtual PortableServer::RefCountServantBase + { + public: + EngagementHome_Servant ( + ::BBN_UAV::CCM_EngagementHome_ptr exe, + ::CIAO::Session_Container *c); + + virtual ~EngagementHome_Servant (void); + + // Home factory and other 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 ::BBN_UAV::Engagement_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. + + ::BBN_UAV::Engagement_ptr + _ciao_activate_component ( + ::BBN_UAV::CCM_Engagement_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::BBN_UAV::Engagement_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BBN_UAV::CCM_EngagementHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + Engagement_Servant *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; + + extern "C" ENGAGEMENT_SVNT_Export ::PortableServer::Servant + createEngagementHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + } +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_GLUE_SESSION_ENGAGEMENT_SVNT_H */ + diff --git a/TAO/CIAO/examples/UAV/Ground/UAV_GS.mpc b/TAO/CIAO/examples/UAV/Ground/UAV_GS.mpc index 4e7febd0b2c..a1e3bc3cf0c 100644 --- a/TAO/CIAO/examples/UAV/Ground/UAV_GS.mpc +++ b/TAO/CIAO/examples/UAV/Ground/UAV_GS.mpc @@ -20,7 +20,7 @@ project(UAV_GS_stub): ciao_client { project(UAV_GS_svnt) : ciao_servant { after += BBN_UAV_svnt UAV_GS_stub sharedname = UAV_GS_svnt - libs += UAV_GS_stub + libs += BBN_UAV_stub BBN_UAV_svnt UAV_GS_stub idlflags += -Wb,export_macro=UAV_GS_SVNT_Export -Wb,export_include=UAV_GS_svnt_export.h dynamicflags = UAV_GS_SVNT_BUILD_DLL @@ -44,17 +44,20 @@ project(UAV_GS_svnt) : ciao_servant { project(UAV_GS_exec) : ciao_component { after += BBN_UAV_svnt UAV_GS_svnt sharedname = UAV_GS_exec - libs += UAV_GS_stub UAV_GS_svnt + libs += BBN_UAV_stub BBN_UAV_svnt UAV_GS_stub UAV_GS_svnt idlflags += -Wb,export_macro=UAV_GS_EXEC_Export -Wb,export_include=UAV_GS_exec_export.h dynamicflags = UAV_GS_EXEC_BUILD_DLL + IDL_Files { - + UAV_GSEI.idl } Source_Files { - + UAV_GSES.cpp + UAV_GSEIC.cpp + UAV_GSEIS.cpp UAV_GS_exec.cpp } } diff --git a/TAO/CIAO/examples/UAV/Ground/UAV_GSEI.idl b/TAO/CIAO/examples/UAV/Ground/UAV_GSEI.idl new file mode 100644 index 00000000000..97e684ffef1 --- /dev/null +++ b/TAO/CIAO/examples/UAV/Ground/UAV_GSEI.idl @@ -0,0 +1,30 @@ +// $Id$ + +/** + * @file UAV_GSEI.idl + * + * Definition of the UAV_GS component implementation. + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ + +#ifndef CIAO_UAV_GSI_IDL +#define CIAO_UAV_GSI_IDL + +#include "UAV_GSE.idl" + +module BBN_UAV +{ + /** + * @interface UAV_GS_Exec + * + */ + local interface UAV_GS_Exec : + CCM_UAV_GS, + Components::SessionComponent + { + }; + +}; + +#endif /* CIAO_UAV_GSI_IDL*/ diff --git a/TAO/CIAO/examples/UAV/Ground/UAV_GS_exec.cpp b/TAO/CIAO/examples/UAV/Ground/UAV_GS_exec.cpp new file mode 100644 index 00000000000..bc17412763c --- /dev/null +++ b/TAO/CIAO/examples/UAV/Ground/UAV_GS_exec.cpp @@ -0,0 +1,113 @@ +// $Id$ + +#include "CIAO_common.h" +#include "UAV_GS_exec.h" + +#define DISPLACEMENT 256 + +/// Default constructor. +MyImpl::UAV_GS_exec_i::UAV_GS_exec_i (void) + : str_ ("BM DEVICE DATA") +{ + +} + +/// Default destructor. +MyImpl::UAV_GS_exec_i::~UAV_GS_exec_i () +{ +} + +void +MyImpl::UAV_GS_exec_i::push_prepare_capture (BBN_UAV::PrepareCapture *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Notify others + BBN_UAV::StartCapture_var event = new OBV_BBN_UAV::StartCapture; + + ACE_DEBUG ((LM_DEBUG, + "UAV_GS, received a PrepareCapture from CAOC \n")); + + this->context_->push_start_capture (event + ACE_ENV_ARG_PARAMETER); + +} + +// Operations from Components::SessionComponent +void +MyImpl::UAV_GS_exec_i::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::UAV_GS_exec_i::set_session_context\n")); + + this->context_ = + BBN_UAV::CCM_UAV_GS_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::UAV_GS_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::UAV_GS_exec_i::ccm_activate\n")); + char *argv[1] = { "UAV_GS_exec"}; + + int argc = sizeof(argv)/sizeof(argv[0]); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv ACE_ENV_ARG_PARAMETER); + + CIAO_REGISTER_VALUE_FACTORY (orb.in(), BBN_UAV::PrepareCapture_init, + BBN_UAV::PrepareCapture); +} + +void +MyImpl::UAV_GS_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::UAV_GS_exec_i::ccm_passivate\n")); +} + +void +MyImpl::UAV_GS_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::UAV_GS_exec_i::ccm_remove\n")); +} + +/// Default ctor. +MyImpl::UAV_GSHome_exec_i::UAV_GSHome_exec_i () +{ +} + +/// Default dtor. +MyImpl::UAV_GSHome_exec_i::~UAV_GSHome_exec_i () +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::UAV_GSHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::UAV_GS_exec_i; +} + + +extern "C" UAV_GS_EXEC_Export ::Components::HomeExecutorBase_ptr +createUAV_GSHome_Impl (void) +{ + return new MyImpl::UAV_GSHome_exec_i; +} diff --git a/TAO/CIAO/examples/UAV/Ground/UAV_GS_exec.h b/TAO/CIAO/examples/UAV/Ground/UAV_GS_exec.h new file mode 100644 index 00000000000..acf42c01a51 --- /dev/null +++ b/TAO/CIAO/examples/UAV/Ground/UAV_GS_exec.h @@ -0,0 +1,110 @@ +// $Id$ + +//================================================================ +/** + * @file UAV_GS_exec.h + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//================================================================ + +#ifndef CIAO_UAV_GS_EXEC_H +#define CIAO_UAV_GS_EXEC_H + +#include "UAV_GSEIC.h" +#include "tao/LocalObject.h" + +// The namespace name for the actual implementation classes doesn't +// really matter. Since there may be several different +// implementations for a component, they can very well be in different +// namespaces. +namespace MyImpl +{ + /** + * @class UAV_GS_exec_i + * + * The UAV_GS implementation class. + */ + class UAV_GS_EXEC_Export UAV_GS_exec_i : + public virtual BBN_UAV::UAV_GS_Exec, + // CIAO container implementation depends on correct reference + // counting of local interfaces, so we take a short cut to + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + UAV_GS_exec_i (void); + + /// Default destructor. + ~UAV_GS_exec_i (void); + + // Operations from BBN_UAV::UAV_GS + + virtual void + push_prepare_capture (BBN_UAV::PrepareCapture *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from Components::SessionComponent + + virtual void + set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + protected: + CORBA::String_var str_; + + /// Copmponent specific context + BBN_UAV::CCM_UAV_GS_Context_var context_; + }; + + /** + * @class UAV_GSHome_exec_i + * + * UAV_GS home executor implementation class. + */ + class UAV_GS_EXEC_Export UAV_GSHome_exec_i : + public virtual BBN_UAV::CCM_UAV_GSHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + UAV_GSHome_exec_i (); + + /// Default dtor. + ~UAV_GSHome_exec_i (); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +// Executor DLL entry point. CIAO's deployment and assembly framework +// invokes this function on the resulting DLL to get the home executor. +extern "C" UAV_GS_EXEC_Export ::Components::HomeExecutorBase_ptr +createUAV_GSHome_Impl (void); + +#endif /* CIAO_UAV_GS_EXEC_H*/ diff --git a/TAO/CIAO/examples/UAV/Ground/UAV_GS_svnt.cpp b/TAO/CIAO/examples/UAV/Ground/UAV_GS_svnt.cpp new file mode 100644 index 00000000000..0fd4180665d --- /dev/null +++ b/TAO/CIAO/examples/UAV/Ground/UAV_GS_svnt.cpp @@ -0,0 +1,1125 @@ +// $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.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#include "UAV_GS_svnt.h" +#include "Cookies.h" + +namespace UAV_GS_Impl +{ + namespace CIAO_GLUE_BBN_UAV + { + UAV_GS_Context::UAV_GS_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + UAV_GS_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) + { + } + + UAV_GS_Context::~UAV_GS_Context (void) + { + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + UAV_GS_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 + UAV_GS_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 + UAV_GS_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 + UAV_GS_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 + UAV_GS_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 + UAV_GS_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContext interface. + + CORBA::Object_ptr + UAV_GS_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_ = + ::BBN_UAV::UAV_GS::_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 ::BBN_UAV::UAV_GS::_duplicate ( + this->component_.in ()); + } + + // Operations for UAV_GS receptacles and event sources, + // defined in ::BBN_UAV::CCM_UAV_GS_Context. + + void + UAV_GS_Context::push_start_capture ( + ::BBN_UAV::StartCapture *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_Active_Map_Manager< + ::BBN_UAV::StartCaptureConsumer_var>::iterator end = + this->ciao_publishes_start_capture_map_.end (); + + for (ACE_Active_Map_Manager< + ::BBN_UAV::StartCaptureConsumer_var>::iterator iter = + this->ciao_publishes_start_capture_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager< + ::BBN_UAV::StartCaptureConsumer_var>::ENTRY &entry = *iter; + + ::BBN_UAV::StartCaptureConsumer_var c = + ::BBN_UAV::StartCaptureConsumer::_narrow ( + entry.int_id_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + entry.int_id_->push_StartCapture ( + ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + + ::Components::Cookie * + UAV_GS_Context::subscribe_start_capture ( + ::BBN_UAV::StartCaptureConsumer_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); + } + + ::BBN_UAV::StartCaptureConsumer_var sub = + ::BBN_UAV::StartCaptureConsumer::_duplicate (c); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_start_capture_map_.bind (sub.in (), key); + sub._retn (); + + ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); + return retv._retn (); + } + + ::BBN_UAV::StartCaptureConsumer_ptr + UAV_GS_Context::unsubscribe_start_capture ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + ::BBN_UAV::StartCaptureConsumer_var retv; + ACE_Active_Map_Manager_Key key; + + if (ck == 0 || ::CIAO::Map_Key_Cookie::extract (ck, key) == -1) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BBN_UAV::StartCaptureConsumer::_nil ()); + } + + + if (this->ciao_publishes_start_capture_map_.unbind (key, retv) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BBN_UAV::StartCaptureConsumer::_nil ()); + } + + return retv._retn (); + } + + // CIAO-specific. + + ::CIAO::Session_Container * + UAV_GS_Context::_ciao_the_Container (void) const + { + return this->container_; + } + + UAV_GS_Context * + UAV_GS_Context::_narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_NOT_USED) + { + return dynamic_cast<UAV_GS_Context *> (p); + } + } + + namespace CIAO_GLUE_BBN_UAV + { + UAV_GS_Servant::UAV_GS_Servant ( + ::BBN_UAV::CCM_UAV_GS_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (::BBN_UAV::CCM_UAV_GS::_duplicate (exe)), + container_ (c) + { + this->context_ = new UAV_GS_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_CATCHANY + { + } + ACE_ENDTRY; + } + + UAV_GS_Servant::~UAV_GS_Servant (void) + { + ACE_TRY_NEW_ENV + { + ::Components::SessionComponent_var scom = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! ::CORBA::is_nil (scom.in ())) + { + scom->ccm_remove (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + ACE_CATCHANY + { + } + ACE_ENDTRY; + + this->context_->_remove_ref (); + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + UAV_GS_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 * + UAV_GS_Servant::get_all_facets ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::FacetDescriptions * + UAV_GS_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); + } + + CORBA::Boolean + UAV_GS_Servant::same_component ( + CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (::CORBA::is_nil (object_ref)) + { + ACE_THROW_RETURN (::CORBA::BAD_PARAM (), 0); + } + + ::CORBA::Object_var the_other = + object_ref->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::CORBA::Object_var me = + this->context_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return me->_is_equivalent ( + the_other.in () + ACE_ENV_ARG_PARAMETER); + } + + ::Components::EmitterDescriptions * + UAV_GS_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + UAV_GS_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 * + UAV_GS_Servant::subscribe_start_capture ( + ::BBN_UAV::StartCaptureConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + return this->context_->subscribe_start_capture ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::BBN_UAV::StartCaptureConsumer_ptr + UAV_GS_Servant::unsubscribe_start_capture ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + return this->context_->unsubscribe_start_capture ( + ck + ACE_ENV_ARG_PARAMETER); + } + + UAV_GS_Servant::PrepareCaptureConsumer_prepare_capture_Servant::PrepareCaptureConsumer_prepare_capture_Servant ( + ::BBN_UAV::CCM_UAV_GS_ptr executor, + ::BBN_UAV::CCM_UAV_GS_Context_ptr c) + : executor_ (::BBN_UAV::CCM_UAV_GS::_duplicate (executor)), + ctx_ (::BBN_UAV::CCM_UAV_GS_Context::_duplicate (c)) + { + } + + UAV_GS_Servant::PrepareCaptureConsumer_prepare_capture_Servant::~PrepareCaptureConsumer_prepare_capture_Servant (void) + { + } + + CORBA::Object_ptr + UAV_GS_Servant::PrepareCaptureConsumer_prepare_capture_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 + UAV_GS_Servant::PrepareCaptureConsumer_prepare_capture_Servant::push_PrepareCapture ( + ::BBN_UAV::PrepareCapture *evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->push_prepare_capture ( + evt + ACE_ENV_ARG_PARAMETER); + } + + // Inherited from ::Components::EventConsumerBase. + void + UAV_GS_Servant::PrepareCaptureConsumer_prepare_capture_Servant::push_event ( + ::Components::EventBase *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::BadEventType)) + { + ::BBN_UAV::PrepareCapture_var ev_type = + ::BBN_UAV::PrepareCapture::_downcast (ev); + + if (ev_type != 0) + { + this->push_PrepareCapture ( + ev_type.in () + ACE_ENV_ARG_PARAMETER); + + return; + } + + ACE_THROW (::Components::BadEventType ()); + } + + ::BBN_UAV::PrepareCaptureConsumer_ptr + UAV_GS_Servant::get_consumer_prepare_capture ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (CORBA::is_nil (this->consumes_prepare_capture_.in ())) + { + UAV_GS_Servant::PrepareCaptureConsumer_prepare_capture_Servant *svt = + new UAV_GS_Servant::PrepareCaptureConsumer_prepare_capture_Servant ( + this->executor_.in (), + this->context_); + PortableServer::ServantBase_var safe_servant (svt); + + CORBA::Object_var obj = + this->container_->install_servant ( + svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::PrepareCaptureConsumer::_nil ()); + + ::BBN_UAV::PrepareCaptureConsumer_var eco = + ::BBN_UAV::PrepareCaptureConsumer::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::PrepareCaptureConsumer::_nil ()); + + this->consumes_prepare_capture_ = eco; + } + + return ::BBN_UAV::PrepareCaptureConsumer::_duplicate (this->consumes_prepare_capture_.in ()); + } + + ::Components::Cookie * + UAV_GS_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 + UAV_GS_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 ()); + } + + ::Components::ConnectionDescriptions * + UAV_GS_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 * + UAV_GS_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + UAV_GS_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 + UAV_GS_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, "prepare_capture") == 0) + { + return this->get_consumer_prepare_capture (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + void + UAV_GS_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)) + { + ACE_THROW (::CORBA::NO_IMPLEMENT ()); + } + + ::Components::EventConsumerBase_ptr + UAV_GS_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 * + UAV_GS_Servant::get_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + UAV_GS_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 * + UAV_GS_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, "start_capture") == 0) + { + ::BBN_UAV::StartCaptureConsumer_var _ciao_consumer = + ::BBN_UAV::StartCaptureConsumer::_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_start_capture ( + _ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ::Components::EventConsumerBase_ptr + UAV_GS_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, "start_capture") == 0) + { + return this->unsubscribe_start_capture ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ::Components::PublisherDescriptions * + UAV_GS_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + UAV_GS_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 + UAV_GS_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 + UAV_GS_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 + UAV_GS_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::Components::CCMHome_ptr + UAV_GS_Servant::get_ccm_home ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->context_->get_CCM_home (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Components::PrimaryKeyBase * + UAV_GS_Servant::get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)) + { + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); + } + + void + UAV_GS_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + UAV_GS_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + ::Components::ComponentPortDescription * + UAV_GS_Servant::get_all_ports ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::ComponentPortDescription_var retv = + new OBV_Components::ComponentPortDescription; + + ::Components::FacetDescriptions_var facets_desc = + this->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ReceptacleDescriptions_var receptacle_desc = + this->get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ConsumerDescriptions_var consumer_desc = + this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::EmitterDescriptions_var emitter_desc = + this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::PublisherDescriptions_var publisher_desc = + this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv->facets (facets_desc.in ()); + retv->receptacles (receptacle_desc.in ()); + retv->consumers (consumer_desc.in ()); + retv->emitters (emitter_desc.in ()); + retv->publishers (publisher_desc.in ()); + + return retv._retn (); + } + + CORBA::Object_ptr + UAV_GS_Servant::_get_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow ( + this->context_ + 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->context_ + 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 (), + ::CORBA::Object::_nil ()); + } + + // CIAO-specific operations. + + void + UAV_GS_Servant::_ciao_activate ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! ::CORBA::is_nil (temp.in ())) + { + temp->ccm_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + + void + UAV_GS_Servant::_ciao_passivate ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! ::CORBA::is_nil (temp.in ())) + { + temp->ccm_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + + // Supported operations. + + // Component attribute operations. + } + + namespace CIAO_GLUE_BBN_UAV + { + UAV_GSHome_Servant::UAV_GSHome_Servant ( + ::BBN_UAV::CCM_UAV_GSHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::BBN_UAV::CCM_UAV_GSHome::_duplicate (exe)), + container_ (c) + { + } + + UAV_GSHome_Servant::~UAV_GSHome_Servant (void) + { + } + + // Home factory and other operations. + + // Home attribute operations. + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + UAV_GSHome_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. + + ::BBN_UAV::UAV_GS_ptr + UAV_GSHome_Servant::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BBN_UAV::UAV_GS::_nil ()); + } + + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UAV_GS::_nil ()); + + ::BBN_UAV::CCM_UAV_GS_var _ciao_comp = + ::BBN_UAV::CCM_UAV_GS::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UAV_GS::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + UAV_GSHome_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 + UAV_GSHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + UAV_GSHome_Servant::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + ::BBN_UAV::UAV_GS_var _ciao_comp = + ::BBN_UAV::UAV_GS::_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. + + ::BBN_UAV::UAV_GS_ptr + UAV_GSHome_Servant::_ciao_activate_component ( + ::BBN_UAV::CCM_UAV_GS_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 (::BBN_UAV::UAV_GS::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UAV_GS::_nil ()); + + UAV_GS_Servant *svt = + new UAV_GS_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 (::BBN_UAV::UAV_GS::_nil ()); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UAV_GS::_nil ()); + + ::BBN_UAV::UAV_GS_var ho = + ::BBN_UAV::UAV_GS::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UAV_GS::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + UAV_GSHome_Servant::_ciao_passivate_component ( + ::BBN_UAV::UAV_GS_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; + + UAV_GS_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" UAV_GS_SVNT_Export ::PortableServer::Servant + createUAV_GSHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) + { + if (p == 0) + { + return 0; + } + + ::BBN_UAV::CCM_UAV_GSHome_var x = + ::BBN_UAV::CCM_UAV_GSHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + CIAO_GLUE_BBN_UAV::UAV_GSHome_Servant ( + x.in (), + c); + } +} diff --git a/TAO/CIAO/examples/UAV/Ground/UAV_GS_svnt.h b/TAO/CIAO/examples/UAV/Ground/UAV_GS_svnt.h new file mode 100644 index 00000000000..07724a62795 --- /dev/null +++ b/TAO/CIAO/examples/UAV/Ground/UAV_GS_svnt.h @@ -0,0 +1,588 @@ +// $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.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#ifndef CIAO_GLUE_SESSION_UAV_GS_SVNT_H +#define CIAO_GLUE_SESSION_UAV_GS_SVNT_H + +#include /**/ "ace/pre.h" + +#include "UAV_GSEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ciao/Container_Base.h" +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#include "UAV_GSS.h" + +namespace UAV_GS_Impl +{ + namespace CIAO_GLUE_BBN_UAV + { + class UAV_GS_SVNT_Export UAV_GS_Context + : public virtual ::BBN_UAV::CCM_UAV_GS_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class UAV_GS_Servant; + + UAV_GS_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + UAV_GS_Servant *sv); + + virtual ~UAV_GS_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 UAV_GS receptacles and event sources, + // defined in ::BBN_UAV::CCM_UAV_GS_Context. + + virtual void + push_start_capture ( + ::BBN_UAV::StartCapture *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO-specific. + + ::CIAO::Session_Container * + _ciao_the_Container (void) const; + + static UAV_GS_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_start_capture ( + ::BBN_UAV::StartCaptureConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BBN_UAV::StartCaptureConsumer_ptr + unsubscribe_start_capture ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + protected: + ACE_Active_Map_Manager< + ::BBN_UAV::StartCaptureConsumer_var> + ciao_publishes_start_capture_map_; + + ::Components::CCMHome_var home_; + + ::CIAO::Session_Container *container_; + + UAV_GS_Servant *servant_; + + ::BBN_UAV::UAV_GS_var component_; + }; + } + + namespace CIAO_GLUE_BBN_UAV + { + class UAV_GS_SVNT_Export UAV_GS_Servant + : public virtual POA_BBN_UAV::UAV_GS, + public virtual PortableServer::RefCountServantBase + { + public: + UAV_GS_Servant ( + ::BBN_UAV::CCM_UAV_GS_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~UAV_GS_Servant (void); + + // Supported operations. + + // Public port operations. + + virtual ::Components::Cookie * + subscribe_start_capture ( + ::BBN_UAV::StartCaptureConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BBN_UAV::StartCaptureConsumer_ptr + unsubscribe_start_capture ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + // Servant class for the prepare_capture consumer. + class UAV_GS_SVNT_Export PrepareCaptureConsumer_prepare_capture_Servant + : public virtual POA_BBN_UAV::PrepareCaptureConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + PrepareCaptureConsumer_prepare_capture_Servant ( + ::BBN_UAV::CCM_UAV_GS_ptr executor, + ::BBN_UAV::CCM_UAV_GS_Context_ptr c); + + virtual ~PrepareCaptureConsumer_prepare_capture_Servant (void); + + virtual void + push_PrepareCapture ( + ::BBN_UAV::PrepareCapture *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: + ::BBN_UAV::CCM_UAV_GS_var + executor_; + + ::BBN_UAV::CCM_UAV_GS_Context_var + ctx_; + }; + + virtual ::BBN_UAV::PrepareCaptureConsumer_ptr + get_consumer_prepare_capture ( + 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_all_facets ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::FacetDescriptions * + get_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual CORBA::Boolean + same_component ( + CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for Receptacles interface. + + virtual ::Components::Cookie * + connect ( + const char *name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::AlreadyConnected, + ::Components::ExceededConnectionLimit)); + + virtual CORBA::Object_ptr + disconnect ( + const char *name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::CookieRequired, + ::Components::NoConnection)); + + 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_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + 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 ::Components::CCMHome_ptr + get_ccm_home ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PrimaryKeyBase * + get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)); + + 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)); + + virtual ::Components::ComponentPortDescription * + get_all_ports( + 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)); + + // CIAO-specific operations. + + void + _ciao_activate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BBN_UAV::CCM_UAV_GS_var + executor_; + + UAV_GS_Context * + context_; + + ::CIAO::Session_Container * + container_; + ::BBN_UAV::PrepareCaptureConsumer_var + consumes_prepare_capture_; + + ACE_CString component_UUID_; + }; + } + + namespace CIAO_GLUE_BBN_UAV + { + class UAV_GS_SVNT_Export UAV_GSHome_Servant + : public virtual POA_BBN_UAV::UAV_GSHome, + public virtual PortableServer::RefCountServantBase + { + public: + UAV_GSHome_Servant ( + ::BBN_UAV::CCM_UAV_GSHome_ptr exe, + ::CIAO::Session_Container *c); + + virtual ~UAV_GSHome_Servant (void); + + // Home factory and other 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 ::BBN_UAV::UAV_GS_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. + + ::BBN_UAV::UAV_GS_ptr + _ciao_activate_component ( + ::BBN_UAV::CCM_UAV_GS_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::BBN_UAV::UAV_GS_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BBN_UAV::CCM_UAV_GSHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + UAV_GS_Servant *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; + + extern "C" UAV_GS_SVNT_Export ::PortableServer::Servant + createUAV_GSHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + } +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_GLUE_SESSION_UAV_GS_SVNT_H */ + diff --git a/TAO/CIAO/examples/UAV/Satellite/Satellite.mpc b/TAO/CIAO/examples/UAV/Satellite/Satellite.mpc index 9c788584ec6..cd9744d99d6 100644 --- a/TAO/CIAO/examples/UAV/Satellite/Satellite.mpc +++ b/TAO/CIAO/examples/UAV/Satellite/Satellite.mpc @@ -20,7 +20,7 @@ project(Satellite_stub): ciao_client { project(Satellite_svnt) : ciao_servant { after += BBN_UAV_svnt Satellite_stub sharedname = Satellite_svnt - libs += Satellite_stub + libs += BBN_UAV_stub BBN_UAV_svnt Satellite_stub idlflags += -Wb,export_macro=SATELLITE_SVNT_Export -Wb,export_include=Satellite_svnt_export.h dynamicflags = SATELLITE_SVNT_BUILD_DLL @@ -44,17 +44,19 @@ project(Satellite_svnt) : ciao_servant { project(Satellite_exec) : ciao_component { after += BBN_UAV_svnt Satellite_svnt sharedname = Satellite_exec - libs += Satellite_stub Satellite_svnt + libs += BBN_UAV_stub BBN_UAV_svnt Satellite_stub Satellite_svnt idlflags += -Wb,export_macro=SATELLITE_EXEC_Export -Wb,export_include=Satellite_exec_export.h dynamicflags = SATELLITE_EXEC_BUILD_DLL IDL_Files { - + SatelliteEI.idl } Source_Files { - + SatelliteES.cpp + SatelliteEIC.cpp + SatelliteEIS.cpp Satellite_exec.cpp } } diff --git a/TAO/CIAO/examples/UAV/Satellite/SatelliteEI.idl b/TAO/CIAO/examples/UAV/Satellite/SatelliteEI.idl new file mode 100644 index 00000000000..0b8ba54ef46 --- /dev/null +++ b/TAO/CIAO/examples/UAV/Satellite/SatelliteEI.idl @@ -0,0 +1,30 @@ +// $Id$ + +/** + * @file SatelliteEI.idl + * + * Definition of the Satellite component implementation. + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ + +#ifndef CIAO_SATELLITEI_IDL +#define CIAO_SATELLITEI_IDL + +#include "SatelliteE.idl" + +module BBN_UAV +{ + /** + * @interface Satellite_Exec + * + */ + local interface Satellite_Exec : + CCM_Satellite, + Components::SessionComponent + { + }; + +}; + +#endif /* CIAO_SATELLITEI_IDL*/ diff --git a/TAO/CIAO/examples/UAV/Satellite/Satellite_exec.cpp b/TAO/CIAO/examples/UAV/Satellite/Satellite_exec.cpp new file mode 100644 index 00000000000..ca0453af87f --- /dev/null +++ b/TAO/CIAO/examples/UAV/Satellite/Satellite_exec.cpp @@ -0,0 +1,95 @@ +// $Id$ + +#include "CIAO_common.h" +#include "Satellite_exec.h" + +#define DISPLACEMENT 256 + +/// Default constructor. +MyImpl::Satellite_exec_i::Satellite_exec_i (void) + : str_ ("BM DEVICE DATA") +{ + +} + +/// Default destructor. +MyImpl::Satellite_exec_i::~Satellite_exec_i () +{ +} + +// Operations from Components::SessionComponent +void +MyImpl::Satellite_exec_i::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::Satellite_exec_i::set_session_context\n")); + + this->context_ = + BBN_UAV::CCM_Satellite_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::Satellite_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::Satellite_exec_i::ccm_activate\n")); + char *argv[1] = { "Satellite_exec"}; + + int argc = sizeof(argv)/sizeof(argv[0]); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv ACE_ENV_ARG_PARAMETER); + +} + +void +MyImpl::Satellite_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::Satellite_exec_i::ccm_passivate\n")); +} + +void +MyImpl::Satellite_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::Satellite_exec_i::ccm_remove\n")); +} + +/// Default ctor. +MyImpl::SatelliteHome_exec_i::SatelliteHome_exec_i () +{ +} + +/// Default dtor. +MyImpl::SatelliteHome_exec_i::~SatelliteHome_exec_i () +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::SatelliteHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::Satellite_exec_i; +} + + +extern "C" SATELLITE_EXEC_Export ::Components::HomeExecutorBase_ptr +createSatelliteHome_Impl (void) +{ + return new MyImpl::SatelliteHome_exec_i; +} diff --git a/TAO/CIAO/examples/UAV/Satellite/Satellite_exec.h b/TAO/CIAO/examples/UAV/Satellite/Satellite_exec.h new file mode 100644 index 00000000000..baa9b51804c --- /dev/null +++ b/TAO/CIAO/examples/UAV/Satellite/Satellite_exec.h @@ -0,0 +1,103 @@ +// $Id$ + +//================================================================ +/** + * @file Satellite_exec.h + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//================================================================ + +#ifndef CIAO_SATELLITE_EXEC_H +#define CIAO_SATELLITE_EXEC_H + +#include "SatelliteEIC.h" +#include "tao/LocalObject.h" + +// The namespace name for the actual implementation classes doesn't +// really matter. Since there may be several different +// implementations for a component, they can very well be in different +// namespaces. +namespace MyImpl +{ + /** + * @class Satellite_exec_i + * + * The Satellite implementation class. + */ + class SATELLITE_EXEC_Export Satellite_exec_i : + public virtual BBN_UAV::Satellite_Exec, + // CIAO container implementation depends on correct reference + // counting of local interfaces, so we take a short cut to + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + Satellite_exec_i (void); + + /// Default destructor. + ~Satellite_exec_i (void); + + // Operations from Components::SessionComponent + + virtual void + set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + protected: + CORBA::String_var str_; + + /// Copmponent specific context + BBN_UAV::CCM_Satellite_Context_var context_; + }; + + /** + * @class SatelliteHome_exec_i + * + * Satellite home executor implementation class. + */ + class SATELLITE_EXEC_Export SatelliteHome_exec_i : + public virtual BBN_UAV::CCM_SatelliteHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + SatelliteHome_exec_i (); + + /// Default dtor. + ~SatelliteHome_exec_i (); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +// Executor DLL entry point. CIAO's deployment and assembly framework +// invokes this function on the resulting DLL to get the home executor. +extern "C" SATELLITE_EXEC_Export ::Components::HomeExecutorBase_ptr +createSatelliteHome_Impl (void); + +#endif /* CIAO_SATELLITE_EXEC_H*/ diff --git a/TAO/CIAO/examples/UAV/Satellite/Satellite_svnt.cpp b/TAO/CIAO/examples/UAV/Satellite/Satellite_svnt.cpp new file mode 100644 index 00000000000..670b255d33e --- /dev/null +++ b/TAO/CIAO/examples/UAV/Satellite/Satellite_svnt.cpp @@ -0,0 +1,1034 @@ +// $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.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#include "Satellite_svnt.h" +#include "Cookies.h" + +namespace Satellite_Impl +{ + namespace CIAO_GLUE_BBN_UAV + { + Satellite_Context::Satellite_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + Satellite_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) + { + } + + Satellite_Context::~Satellite_Context (void) + { + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + Satellite_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 + Satellite_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 + Satellite_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 + Satellite_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 + Satellite_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 + Satellite_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContext interface. + + CORBA::Object_ptr + Satellite_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_ = + ::BBN_UAV::Satellite::_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 ::BBN_UAV::Satellite::_duplicate ( + this->component_.in ()); + } + + // Operations for Satellite receptacles and event sources, + // defined in ::BBN_UAV::CCM_Satellite_Context. + + void + Satellite_Context::push_target_located ( + ::BBN_UAV::TargetLocated *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_Active_Map_Manager< + ::BBN_UAV::TargetLocatedConsumer_var>::iterator end = + this->ciao_publishes_target_located_map_.end (); + + for (ACE_Active_Map_Manager< + ::BBN_UAV::TargetLocatedConsumer_var>::iterator iter = + this->ciao_publishes_target_located_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager< + ::BBN_UAV::TargetLocatedConsumer_var>::ENTRY &entry = *iter; + + ::BBN_UAV::TargetLocatedConsumer_var c = + ::BBN_UAV::TargetLocatedConsumer::_narrow ( + entry.int_id_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + entry.int_id_->push_TargetLocated ( + ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + + ::Components::Cookie * + Satellite_Context::subscribe_target_located ( + ::BBN_UAV::TargetLocatedConsumer_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); + } + + ::BBN_UAV::TargetLocatedConsumer_var sub = + ::BBN_UAV::TargetLocatedConsumer::_duplicate (c); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_target_located_map_.bind (sub.in (), key); + sub._retn (); + + ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); + return retv._retn (); + } + + ::BBN_UAV::TargetLocatedConsumer_ptr + Satellite_Context::unsubscribe_target_located ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + ::BBN_UAV::TargetLocatedConsumer_var retv; + ACE_Active_Map_Manager_Key key; + + if (ck == 0 || ::CIAO::Map_Key_Cookie::extract (ck, key) == -1) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BBN_UAV::TargetLocatedConsumer::_nil ()); + } + + + if (this->ciao_publishes_target_located_map_.unbind (key, retv) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BBN_UAV::TargetLocatedConsumer::_nil ()); + } + + return retv._retn (); + } + + // CIAO-specific. + + ::CIAO::Session_Container * + Satellite_Context::_ciao_the_Container (void) const + { + return this->container_; + } + + Satellite_Context * + Satellite_Context::_narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_NOT_USED) + { + return dynamic_cast<Satellite_Context *> (p); + } + } + + namespace CIAO_GLUE_BBN_UAV + { + Satellite_Servant::Satellite_Servant ( + ::BBN_UAV::CCM_Satellite_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (::BBN_UAV::CCM_Satellite::_duplicate (exe)), + container_ (c) + { + this->context_ = new Satellite_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_CATCHANY + { + } + ACE_ENDTRY; + } + + Satellite_Servant::~Satellite_Servant (void) + { + ACE_TRY_NEW_ENV + { + ::Components::SessionComponent_var scom = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! ::CORBA::is_nil (scom.in ())) + { + scom->ccm_remove (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + ACE_CATCHANY + { + } + ACE_ENDTRY; + + this->context_->_remove_ref (); + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + Satellite_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 * + Satellite_Servant::get_all_facets ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::FacetDescriptions * + Satellite_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); + } + + CORBA::Boolean + Satellite_Servant::same_component ( + CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (::CORBA::is_nil (object_ref)) + { + ACE_THROW_RETURN (::CORBA::BAD_PARAM (), 0); + } + + ::CORBA::Object_var the_other = + object_ref->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::CORBA::Object_var me = + this->context_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return me->_is_equivalent ( + the_other.in () + ACE_ENV_ARG_PARAMETER); + } + + ::Components::EmitterDescriptions * + Satellite_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + Satellite_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 * + Satellite_Servant::subscribe_target_located ( + ::BBN_UAV::TargetLocatedConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + return this->context_->subscribe_target_located ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::BBN_UAV::TargetLocatedConsumer_ptr + Satellite_Servant::unsubscribe_target_located ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + return this->context_->unsubscribe_target_located ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ::Components::Cookie * + Satellite_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 + Satellite_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 ()); + } + + ::Components::ConnectionDescriptions * + Satellite_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 * + Satellite_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + Satellite_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 + Satellite_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 + Satellite_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)) + { + ACE_THROW (::CORBA::NO_IMPLEMENT ()); + } + + ::Components::EventConsumerBase_ptr + Satellite_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 * + Satellite_Servant::get_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + Satellite_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 * + Satellite_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, "target_located") == 0) + { + ::BBN_UAV::TargetLocatedConsumer_var _ciao_consumer = + ::BBN_UAV::TargetLocatedConsumer::_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_target_located ( + _ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ::Components::EventConsumerBase_ptr + Satellite_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, "target_located") == 0) + { + return this->unsubscribe_target_located ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ::Components::PublisherDescriptions * + Satellite_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + Satellite_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 + Satellite_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 + Satellite_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 + Satellite_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::Components::CCMHome_ptr + Satellite_Servant::get_ccm_home ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->context_->get_CCM_home (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Components::PrimaryKeyBase * + Satellite_Servant::get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)) + { + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); + } + + void + Satellite_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + Satellite_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + ::Components::ComponentPortDescription * + Satellite_Servant::get_all_ports ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::ComponentPortDescription_var retv = + new OBV_Components::ComponentPortDescription; + + ::Components::FacetDescriptions_var facets_desc = + this->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ReceptacleDescriptions_var receptacle_desc = + this->get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ConsumerDescriptions_var consumer_desc = + this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::EmitterDescriptions_var emitter_desc = + this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::PublisherDescriptions_var publisher_desc = + this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv->facets (facets_desc.in ()); + retv->receptacles (receptacle_desc.in ()); + retv->consumers (consumer_desc.in ()); + retv->emitters (emitter_desc.in ()); + retv->publishers (publisher_desc.in ()); + + return retv._retn (); + } + + CORBA::Object_ptr + Satellite_Servant::_get_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow ( + this->context_ + 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->context_ + 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 (), + ::CORBA::Object::_nil ()); + } + + // CIAO-specific operations. + + void + Satellite_Servant::_ciao_activate ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! ::CORBA::is_nil (temp.in ())) + { + temp->ccm_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + + void + Satellite_Servant::_ciao_passivate ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! ::CORBA::is_nil (temp.in ())) + { + temp->ccm_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + + // Supported operations. + + // Component attribute operations. + } + + namespace CIAO_GLUE_BBN_UAV + { + SatelliteHome_Servant::SatelliteHome_Servant ( + ::BBN_UAV::CCM_SatelliteHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::BBN_UAV::CCM_SatelliteHome::_duplicate (exe)), + container_ (c) + { + } + + SatelliteHome_Servant::~SatelliteHome_Servant (void) + { + } + + // Home factory and other operations. + + // Home attribute operations. + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + SatelliteHome_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. + + ::BBN_UAV::Satellite_ptr + SatelliteHome_Servant::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BBN_UAV::Satellite::_nil ()); + } + + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::Satellite::_nil ()); + + ::BBN_UAV::CCM_Satellite_var _ciao_comp = + ::BBN_UAV::CCM_Satellite::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::Satellite::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + SatelliteHome_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 + SatelliteHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + SatelliteHome_Servant::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + ::BBN_UAV::Satellite_var _ciao_comp = + ::BBN_UAV::Satellite::_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. + + ::BBN_UAV::Satellite_ptr + SatelliteHome_Servant::_ciao_activate_component ( + ::BBN_UAV::CCM_Satellite_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 (::BBN_UAV::Satellite::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::Satellite::_nil ()); + + Satellite_Servant *svt = + new Satellite_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 (::BBN_UAV::Satellite::_nil ()); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::Satellite::_nil ()); + + ::BBN_UAV::Satellite_var ho = + ::BBN_UAV::Satellite::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::Satellite::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + SatelliteHome_Servant::_ciao_passivate_component ( + ::BBN_UAV::Satellite_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; + + Satellite_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" SATELLITE_SVNT_Export ::PortableServer::Servant + createSatelliteHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) + { + if (p == 0) + { + return 0; + } + + ::BBN_UAV::CCM_SatelliteHome_var x = + ::BBN_UAV::CCM_SatelliteHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + CIAO_GLUE_BBN_UAV::SatelliteHome_Servant ( + x.in (), + c); + } +} diff --git a/TAO/CIAO/examples/UAV/Satellite/Satellite_svnt.h b/TAO/CIAO/examples/UAV/Satellite/Satellite_svnt.h new file mode 100644 index 00000000000..81306b5fc41 --- /dev/null +++ b/TAO/CIAO/examples/UAV/Satellite/Satellite_svnt.h @@ -0,0 +1,541 @@ +// $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.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#ifndef CIAO_GLUE_SESSION_SATELLITE_SVNT_H +#define CIAO_GLUE_SESSION_SATELLITE_SVNT_H + +#include /**/ "ace/pre.h" + +#include "SatelliteEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ciao/Container_Base.h" +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#include "SatelliteS.h" + +namespace Satellite_Impl +{ + namespace CIAO_GLUE_BBN_UAV + { + class SATELLITE_SVNT_Export Satellite_Context + : public virtual ::BBN_UAV::CCM_Satellite_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class Satellite_Servant; + + Satellite_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + Satellite_Servant *sv); + + virtual ~Satellite_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 Satellite receptacles and event sources, + // defined in ::BBN_UAV::CCM_Satellite_Context. + + virtual void + push_target_located ( + ::BBN_UAV::TargetLocated *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO-specific. + + ::CIAO::Session_Container * + _ciao_the_Container (void) const; + + static Satellite_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_target_located ( + ::BBN_UAV::TargetLocatedConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BBN_UAV::TargetLocatedConsumer_ptr + unsubscribe_target_located ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + protected: + ACE_Active_Map_Manager< + ::BBN_UAV::TargetLocatedConsumer_var> + ciao_publishes_target_located_map_; + + ::Components::CCMHome_var home_; + + ::CIAO::Session_Container *container_; + + Satellite_Servant *servant_; + + ::BBN_UAV::Satellite_var component_; + }; + } + + namespace CIAO_GLUE_BBN_UAV + { + class SATELLITE_SVNT_Export Satellite_Servant + : public virtual POA_BBN_UAV::Satellite, + public virtual PortableServer::RefCountServantBase + { + public: + Satellite_Servant ( + ::BBN_UAV::CCM_Satellite_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~Satellite_Servant (void); + + // Supported operations. + + // Public port operations. + + virtual ::Components::Cookie * + subscribe_target_located ( + ::BBN_UAV::TargetLocatedConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BBN_UAV::TargetLocatedConsumer_ptr + unsubscribe_target_located ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + // 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_all_facets ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::FacetDescriptions * + get_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual CORBA::Boolean + same_component ( + CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for Receptacles interface. + + virtual ::Components::Cookie * + connect ( + const char *name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::AlreadyConnected, + ::Components::ExceededConnectionLimit)); + + virtual CORBA::Object_ptr + disconnect ( + const char *name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::CookieRequired, + ::Components::NoConnection)); + + 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_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + 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 ::Components::CCMHome_ptr + get_ccm_home ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PrimaryKeyBase * + get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)); + + 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)); + + virtual ::Components::ComponentPortDescription * + get_all_ports( + 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)); + + // CIAO-specific operations. + + void + _ciao_activate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BBN_UAV::CCM_Satellite_var + executor_; + + Satellite_Context * + context_; + + ::CIAO::Session_Container * + container_; + + ACE_CString component_UUID_; + }; + } + + namespace CIAO_GLUE_BBN_UAV + { + class SATELLITE_SVNT_Export SatelliteHome_Servant + : public virtual POA_BBN_UAV::SatelliteHome, + public virtual PortableServer::RefCountServantBase + { + public: + SatelliteHome_Servant ( + ::BBN_UAV::CCM_SatelliteHome_ptr exe, + ::CIAO::Session_Container *c); + + virtual ~SatelliteHome_Servant (void); + + // Home factory and other 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 ::BBN_UAV::Satellite_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. + + ::BBN_UAV::Satellite_ptr + _ciao_activate_component ( + ::BBN_UAV::CCM_Satellite_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::BBN_UAV::Satellite_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BBN_UAV::CCM_SatelliteHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + Satellite_Servant *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; + + extern "C" SATELLITE_SVNT_Export ::PortableServer::Servant + createSatelliteHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + } +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_GLUE_SESSION_SATELLITE_SVNT_H */ + diff --git a/TAO/CIAO/examples/UAV/UAV/UAV.mpc b/TAO/CIAO/examples/UAV/UAV/UAV.mpc index 7b68615ad61..5fe438d4ee6 100644 --- a/TAO/CIAO/examples/UAV/UAV/UAV.mpc +++ b/TAO/CIAO/examples/UAV/UAV/UAV.mpc @@ -20,7 +20,7 @@ project(UAV_stub): ciao_client { project(UAV_svnt) : ciao_servant { after += BBN_UAV_svnt UAV_stub sharedname = UAV_svnt - libs += UAV_stub + libs += BBN_UAV_stub BBN_UAV_svnt UAV_stub idlflags += -Wb,export_macro=UAV_SVNT_Export -Wb,export_include=UAV_svnt_export.h dynamicflags = UAV_SVNT_BUILD_DLL @@ -44,17 +44,19 @@ project(UAV_svnt) : ciao_servant { project(UAV_exec) : ciao_component { after += BBN_UAV_svnt UAV_svnt sharedname = UAV_exec - libs += UAV_stub UAV_svnt + libs += BBN_UAV_stub BBN_UAV_svnt UAV_stub UAV_svnt idlflags += -Wb,export_macro=UAV_EXEC_Export -Wb,export_include=UAV_exec_export.h dynamicflags = UAV_EXEC_BUILD_DLL IDL_Files { - + UAVEI.idl } Source_Files { - + UAVES.cpp + UAVEIC.cpp + UAVEIS.cpp UAV_exec.cpp } } diff --git a/TAO/CIAO/examples/UAV/UAV/UAVEI.idl b/TAO/CIAO/examples/UAV/UAV/UAVEI.idl new file mode 100644 index 00000000000..1e25507a41c --- /dev/null +++ b/TAO/CIAO/examples/UAV/UAV/UAVEI.idl @@ -0,0 +1,30 @@ +// $Id$ + +/** + * @file UAVEI.idl + * + * Definition of the UAV component implementation. + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ + +#ifndef CIAO_UAVI_IDL +#define CIAO_UAVI_IDL + +#include "UAVE.idl" + +module BBN_UAV +{ + /** + * @interface UAV_Exec + * + */ + local interface UAV_Exec : + CCM_UAV, + Components::SessionComponent + { + }; + +}; + +#endif /* CIAO_UAVI_IDL*/ diff --git a/TAO/CIAO/examples/UAV/UAV/UAV_exec.cpp b/TAO/CIAO/examples/UAV/UAV/UAV_exec.cpp new file mode 100644 index 00000000000..0445ee9f073 --- /dev/null +++ b/TAO/CIAO/examples/UAV/UAV/UAV_exec.cpp @@ -0,0 +1,107 @@ +// $Id$ + +#include "CIAO_common.h" +#include "UAV_exec.h" + +#define DISPLACEMENT 256 + +/// Default constructor. +MyImpl::UAV_exec_i::UAV_exec_i (void) + : str_ ("BM DEVICE DATA") +{ + +} + +/// Default destructor. +MyImpl::UAV_exec_i::~UAV_exec_i () +{ +} + +void +MyImpl::UAV_exec_i::push_start_capture (BBN_UAV::StartCapture *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + + ACE_DEBUG ((LM_DEBUG, + "UAV, received a StartCapture from UAV_GS \n")); +} + +// Operations from Components::SessionComponent +void +MyImpl::UAV_exec_i::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::UAV_exec_i::set_session_context\n")); + + this->context_ = + BBN_UAV::CCM_UAV_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::UAV_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::UAV_exec_i::ccm_activate\n")); + char *argv[1] = { "UAV_exec"}; + + int argc = sizeof(argv)/sizeof(argv[0]); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv ACE_ENV_ARG_PARAMETER); + + CIAO_REGISTER_VALUE_FACTORY (orb.in(), BBN_UAV::StartCapture_init, + BBN_UAV::StartCapture); +} + +void +MyImpl::UAV_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::UAV_exec_i::ccm_passivate\n")); +} + +void +MyImpl::UAV_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::UAV_exec_i::ccm_remove\n")); +} + +/// Default ctor. +MyImpl::UAVHome_exec_i::UAVHome_exec_i () +{ +} + +/// Default dtor. +MyImpl::UAVHome_exec_i::~UAVHome_exec_i () +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::UAVHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::UAV_exec_i; +} + + +extern "C" UAV_EXEC_Export ::Components::HomeExecutorBase_ptr +createUAVHome_Impl (void) +{ + return new MyImpl::UAVHome_exec_i; +} diff --git a/TAO/CIAO/examples/UAV/UAV/UAV_exec.h b/TAO/CIAO/examples/UAV/UAV/UAV_exec.h new file mode 100644 index 00000000000..9e98360953d --- /dev/null +++ b/TAO/CIAO/examples/UAV/UAV/UAV_exec.h @@ -0,0 +1,110 @@ +// $Id$ + +//================================================================ +/** + * @file UAV_exec.h + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//================================================================ + +#ifndef CIAO_UAV_EXEC_H +#define CIAO_UAV_EXEC_H + +#include "UAVEIC.h" +#include "tao/LocalObject.h" + +// The namespace name for the actual implementation classes doesn't +// really matter. Since there may be several different +// implementations for a component, they can very well be in different +// namespaces. +namespace MyImpl +{ + /** + * @class UAV_exec_i + * + * The UAV implementation class. + */ + class UAV_EXEC_Export UAV_exec_i : + public virtual BBN_UAV::UAV_Exec, + // CIAO container implementation depends on correct reference + // counting of local interfaces, so we take a short cut to + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + UAV_exec_i (void); + + /// Default destructor. + ~UAV_exec_i (void); + + // Operations from BBN_UAV::UAV + + virtual void + push_start_capture (BBN_UAV::StartCapture *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from Components::SessionComponent + + virtual void + set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + protected: + CORBA::String_var str_; + + /// Copmponent specific context + BBN_UAV::CCM_UAV_Context_var context_; + }; + + /** + * @class UAVHome_exec_i + * + * UAV home executor implementation class. + */ + class UAV_EXEC_Export UAVHome_exec_i : + public virtual BBN_UAV::CCM_UAVHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + UAVHome_exec_i (); + + /// Default dtor. + ~UAVHome_exec_i (); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +// Executor DLL entry point. CIAO's deployment and assembly framework +// invokes this function on the resulting DLL to get the home executor. +extern "C" UAV_EXEC_Export ::Components::HomeExecutorBase_ptr +createUAVHome_Impl (void); + +#endif /* CIAO_UAV_EXEC_H*/ diff --git a/TAO/CIAO/examples/UAV/UAV/UAV_svnt.cpp b/TAO/CIAO/examples/UAV/UAV/UAV_svnt.cpp new file mode 100644 index 00000000000..50c8ae261c0 --- /dev/null +++ b/TAO/CIAO/examples/UAV/UAV/UAV_svnt.cpp @@ -0,0 +1,989 @@ +// $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.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#include "UAV_svnt.h" +#include "Cookies.h" + +namespace UAV_Impl +{ + namespace CIAO_GLUE_BBN_UAV + { + UAV_Context::UAV_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + UAV_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) + { + } + + UAV_Context::~UAV_Context (void) + { + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + UAV_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 + UAV_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 + UAV_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 + UAV_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 + UAV_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 + UAV_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContext interface. + + CORBA::Object_ptr + UAV_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_ = + ::BBN_UAV::UAV::_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 ::BBN_UAV::UAV::_duplicate ( + this->component_.in ()); + } + + // Operations for UAV receptacles and event sources, + // defined in ::BBN_UAV::CCM_UAV_Context. + + // CIAO-specific. + + ::CIAO::Session_Container * + UAV_Context::_ciao_the_Container (void) const + { + return this->container_; + } + + UAV_Context * + UAV_Context::_narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_NOT_USED) + { + return dynamic_cast<UAV_Context *> (p); + } + } + + namespace CIAO_GLUE_BBN_UAV + { + UAV_Servant::UAV_Servant ( + ::BBN_UAV::CCM_UAV_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (::BBN_UAV::CCM_UAV::_duplicate (exe)), + container_ (c) + { + this->context_ = new UAV_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_CATCHANY + { + } + ACE_ENDTRY; + } + + UAV_Servant::~UAV_Servant (void) + { + ACE_TRY_NEW_ENV + { + ::Components::SessionComponent_var scom = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! ::CORBA::is_nil (scom.in ())) + { + scom->ccm_remove (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + ACE_CATCHANY + { + } + ACE_ENDTRY; + + this->context_->_remove_ref (); + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + UAV_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 * + UAV_Servant::get_all_facets ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::FacetDescriptions * + UAV_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); + } + + CORBA::Boolean + UAV_Servant::same_component ( + CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (::CORBA::is_nil (object_ref)) + { + ACE_THROW_RETURN (::CORBA::BAD_PARAM (), 0); + } + + ::CORBA::Object_var the_other = + object_ref->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::CORBA::Object_var me = + this->context_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return me->_is_equivalent ( + the_other.in () + ACE_ENV_ARG_PARAMETER); + } + + ::Components::EmitterDescriptions * + UAV_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + UAV_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); + } + + UAV_Servant::StartCaptureConsumer_start_capture_Servant::StartCaptureConsumer_start_capture_Servant ( + ::BBN_UAV::CCM_UAV_ptr executor, + ::BBN_UAV::CCM_UAV_Context_ptr c) + : executor_ (::BBN_UAV::CCM_UAV::_duplicate (executor)), + ctx_ (::BBN_UAV::CCM_UAV_Context::_duplicate (c)) + { + } + + UAV_Servant::StartCaptureConsumer_start_capture_Servant::~StartCaptureConsumer_start_capture_Servant (void) + { + } + + CORBA::Object_ptr + UAV_Servant::StartCaptureConsumer_start_capture_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 + UAV_Servant::StartCaptureConsumer_start_capture_Servant::push_StartCapture ( + ::BBN_UAV::StartCapture *evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->push_start_capture ( + evt + ACE_ENV_ARG_PARAMETER); + } + + // Inherited from ::Components::EventConsumerBase. + void + UAV_Servant::StartCaptureConsumer_start_capture_Servant::push_event ( + ::Components::EventBase *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::BadEventType)) + { + ::BBN_UAV::StartCapture_var ev_type = + ::BBN_UAV::StartCapture::_downcast (ev); + + if (ev_type != 0) + { + this->push_StartCapture ( + ev_type.in () + ACE_ENV_ARG_PARAMETER); + + return; + } + + ACE_THROW (::Components::BadEventType ()); + } + + ::BBN_UAV::StartCaptureConsumer_ptr + UAV_Servant::get_consumer_start_capture ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (CORBA::is_nil (this->consumes_start_capture_.in ())) + { + UAV_Servant::StartCaptureConsumer_start_capture_Servant *svt = + new UAV_Servant::StartCaptureConsumer_start_capture_Servant ( + this->executor_.in (), + this->context_); + PortableServer::ServantBase_var safe_servant (svt); + + CORBA::Object_var obj = + this->container_->install_servant ( + svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::StartCaptureConsumer::_nil ()); + + ::BBN_UAV::StartCaptureConsumer_var eco = + ::BBN_UAV::StartCaptureConsumer::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::StartCaptureConsumer::_nil ()); + + this->consumes_start_capture_ = eco; + } + + return ::BBN_UAV::StartCaptureConsumer::_duplicate (this->consumes_start_capture_.in ()); + } + + ::Components::Cookie * + UAV_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 + UAV_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 ()); + } + + ::Components::ConnectionDescriptions * + UAV_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 * + UAV_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + UAV_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 + UAV_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, "start_capture") == 0) + { + return this->get_consumer_start_capture (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + void + UAV_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)) + { + ACE_THROW (::CORBA::NO_IMPLEMENT ()); + } + + ::Components::EventConsumerBase_ptr + UAV_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 * + UAV_Servant::get_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + UAV_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 * + UAV_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 + UAV_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 * + UAV_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + UAV_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 + UAV_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 + UAV_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 + UAV_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::Components::CCMHome_ptr + UAV_Servant::get_ccm_home ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->context_->get_CCM_home (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Components::PrimaryKeyBase * + UAV_Servant::get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)) + { + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); + } + + void + UAV_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + UAV_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + ::Components::ComponentPortDescription * + UAV_Servant::get_all_ports ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::ComponentPortDescription_var retv = + new OBV_Components::ComponentPortDescription; + + ::Components::FacetDescriptions_var facets_desc = + this->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ReceptacleDescriptions_var receptacle_desc = + this->get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ConsumerDescriptions_var consumer_desc = + this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::EmitterDescriptions_var emitter_desc = + this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::PublisherDescriptions_var publisher_desc = + this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv->facets (facets_desc.in ()); + retv->receptacles (receptacle_desc.in ()); + retv->consumers (consumer_desc.in ()); + retv->emitters (emitter_desc.in ()); + retv->publishers (publisher_desc.in ()); + + return retv._retn (); + } + + CORBA::Object_ptr + UAV_Servant::_get_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow ( + this->context_ + 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->context_ + 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 (), + ::CORBA::Object::_nil ()); + } + + // CIAO-specific operations. + + void + UAV_Servant::_ciao_activate ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! ::CORBA::is_nil (temp.in ())) + { + temp->ccm_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + + void + UAV_Servant::_ciao_passivate ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! ::CORBA::is_nil (temp.in ())) + { + temp->ccm_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + + // Supported operations. + + // Component attribute operations. + } + + namespace CIAO_GLUE_BBN_UAV + { + UAVHome_Servant::UAVHome_Servant ( + ::BBN_UAV::CCM_UAVHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::BBN_UAV::CCM_UAVHome::_duplicate (exe)), + container_ (c) + { + } + + UAVHome_Servant::~UAVHome_Servant (void) + { + } + + // Home factory and other operations. + + // Home attribute operations. + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + UAVHome_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. + + ::BBN_UAV::UAV_ptr + UAVHome_Servant::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BBN_UAV::UAV::_nil ()); + } + + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UAV::_nil ()); + + ::BBN_UAV::CCM_UAV_var _ciao_comp = + ::BBN_UAV::CCM_UAV::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UAV::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + UAVHome_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 + UAVHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + UAVHome_Servant::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + ::BBN_UAV::UAV_var _ciao_comp = + ::BBN_UAV::UAV::_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. + + ::BBN_UAV::UAV_ptr + UAVHome_Servant::_ciao_activate_component ( + ::BBN_UAV::CCM_UAV_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 (::BBN_UAV::UAV::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UAV::_nil ()); + + UAV_Servant *svt = + new UAV_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 (::BBN_UAV::UAV::_nil ()); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UAV::_nil ()); + + ::BBN_UAV::UAV_var ho = + ::BBN_UAV::UAV::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UAV::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + UAVHome_Servant::_ciao_passivate_component ( + ::BBN_UAV::UAV_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; + + UAV_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" UAV_SVNT_Export ::PortableServer::Servant + createUAVHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) + { + if (p == 0) + { + return 0; + } + + ::BBN_UAV::CCM_UAVHome_var x = + ::BBN_UAV::CCM_UAVHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + CIAO_GLUE_BBN_UAV::UAVHome_Servant ( + x.in (), + c); + } +} diff --git a/TAO/CIAO/examples/UAV/UAV/UAV_svnt.h b/TAO/CIAO/examples/UAV/UAV/UAV_svnt.h new file mode 100644 index 00000000000..3b08eb345b4 --- /dev/null +++ b/TAO/CIAO/examples/UAV/UAV/UAV_svnt.h @@ -0,0 +1,546 @@ +// $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.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#ifndef CIAO_GLUE_SESSION_UAV_SVNT_H +#define CIAO_GLUE_SESSION_UAV_SVNT_H + +#include /**/ "ace/pre.h" + +#include "UAVEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ciao/Container_Base.h" +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#include "UAVS.h" + +namespace UAV_Impl +{ + namespace CIAO_GLUE_BBN_UAV + { + class UAV_SVNT_Export UAV_Context + : public virtual ::BBN_UAV::CCM_UAV_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class UAV_Servant; + + UAV_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + UAV_Servant *sv); + + virtual ~UAV_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 UAV receptacles and event sources, + // defined in ::BBN_UAV::CCM_UAV_Context. + + // CIAO-specific. + + ::CIAO::Session_Container * + _ciao_the_Container (void) const; + + static UAV_Context * + _narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + protected: + // Methods that manage this component's connections and consumers. + + protected: + ::Components::CCMHome_var home_; + + ::CIAO::Session_Container *container_; + + UAV_Servant *servant_; + + ::BBN_UAV::UAV_var component_; + }; + } + + namespace CIAO_GLUE_BBN_UAV + { + class UAV_SVNT_Export UAV_Servant + : public virtual POA_BBN_UAV::UAV, + public virtual PortableServer::RefCountServantBase + { + public: + UAV_Servant ( + ::BBN_UAV::CCM_UAV_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~UAV_Servant (void); + + // Supported operations. + + // Public port operations. + + // Servant class for the start_capture consumer. + class UAV_SVNT_Export StartCaptureConsumer_start_capture_Servant + : public virtual POA_BBN_UAV::StartCaptureConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + StartCaptureConsumer_start_capture_Servant ( + ::BBN_UAV::CCM_UAV_ptr executor, + ::BBN_UAV::CCM_UAV_Context_ptr c); + + virtual ~StartCaptureConsumer_start_capture_Servant (void); + + virtual void + push_StartCapture ( + ::BBN_UAV::StartCapture *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: + ::BBN_UAV::CCM_UAV_var + executor_; + + ::BBN_UAV::CCM_UAV_Context_var + ctx_; + }; + + virtual ::BBN_UAV::StartCaptureConsumer_ptr + get_consumer_start_capture ( + 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_all_facets ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::FacetDescriptions * + get_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual CORBA::Boolean + same_component ( + CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for Receptacles interface. + + virtual ::Components::Cookie * + connect ( + const char *name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::AlreadyConnected, + ::Components::ExceededConnectionLimit)); + + virtual CORBA::Object_ptr + disconnect ( + const char *name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::CookieRequired, + ::Components::NoConnection)); + + 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_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + 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 ::Components::CCMHome_ptr + get_ccm_home ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PrimaryKeyBase * + get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)); + + 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)); + + virtual ::Components::ComponentPortDescription * + get_all_ports( + 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)); + + // CIAO-specific operations. + + void + _ciao_activate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BBN_UAV::CCM_UAV_var + executor_; + + UAV_Context * + context_; + + ::CIAO::Session_Container * + container_; + ::BBN_UAV::StartCaptureConsumer_var + consumes_start_capture_; + + ACE_CString component_UUID_; + }; + } + + namespace CIAO_GLUE_BBN_UAV + { + class UAV_SVNT_Export UAVHome_Servant + : public virtual POA_BBN_UAV::UAVHome, + public virtual PortableServer::RefCountServantBase + { + public: + UAVHome_Servant ( + ::BBN_UAV::CCM_UAVHome_ptr exe, + ::CIAO::Session_Container *c); + + virtual ~UAVHome_Servant (void); + + // Home factory and other 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 ::BBN_UAV::UAV_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. + + ::BBN_UAV::UAV_ptr + _ciao_activate_component ( + ::BBN_UAV::CCM_UAV_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::BBN_UAV::UAV_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BBN_UAV::CCM_UAVHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + UAV_Servant *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; + + extern "C" UAV_SVNT_Export ::PortableServer::Servant + createUAVHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + } +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_GLUE_SESSION_UAV_SVNT_H */ + diff --git a/TAO/CIAO/examples/UAV/UCAV/UCAV.mpc b/TAO/CIAO/examples/UAV/UCAV/UCAV.mpc index 3bd63866920..c26848ee864 100644 --- a/TAO/CIAO/examples/UAV/UCAV/UCAV.mpc +++ b/TAO/CIAO/examples/UAV/UCAV/UCAV.mpc @@ -3,7 +3,7 @@ project(UCAV_stub): ciao_client { - after += BBN_UAV_svnt + after += BBN_UAV_stub sharedname = UCAV_stub idlflags += -Wb,stub_export_macro=UCAV_STUB_Export -Wb,stub_export_include=UCAV_stub_export.h -Wb,skel_export_macro=UCAV_SVNT_Export -Wb,skel_export_include=UCAV_svnt_export.h dynamicflags = UCAV_STUB_BUILD_DLL @@ -20,7 +20,7 @@ project(UCAV_stub): ciao_client { project(UCAV_svnt) : ciao_servant { after += BBN_UAV_svnt UCAV_stub sharedname = UCAV_svnt - libs += UCAV_stub + libs += BBN_UAV_stub BBN_UAV_svnt UCAV_stub idlflags += -Wb,export_macro=UCAV_SVNT_Export -Wb,export_include=UCAV_svnt_export.h dynamicflags = UCAV_SVNT_BUILD_DLL @@ -44,17 +44,19 @@ project(UCAV_svnt) : ciao_servant { project(UCAV_exec) : ciao_component { after += BBN_UAV_svnt UCAV_svnt sharedname = UCAV_exec - libs += UCAV_stub UCAV_svnt + libs += BBN_UAV_stub BBN_UAV_svnt UCAV_stub UCAV_svnt idlflags += -Wb,export_macro=UCAV_EXEC_Export -Wb,export_include=UCAV_exec_export.h dynamicflags = UCAV_EXEC_BUILD_DLL IDL_Files { - + UCAVEI.idl } Source_Files { - + UCAVES.cpp + UCAVEIC.cpp + UCAVEIS.cpp UCAV_exec.cpp } } diff --git a/TAO/CIAO/examples/UAV/UCAV/UCAVEI.idl b/TAO/CIAO/examples/UAV/UCAV/UCAVEI.idl new file mode 100644 index 00000000000..9d07fae3ec8 --- /dev/null +++ b/TAO/CIAO/examples/UAV/UCAV/UCAVEI.idl @@ -0,0 +1,30 @@ +// $Id$ + +/** + * @file UCAVEI.idl + * + * Definition of the UCAV component implementation. + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ + +#ifndef CIAO_UCAVI_IDL +#define CIAO_UCAVI_IDL + +#include "UCAVE.idl" + +module BBN_UAV +{ + /** + * @interface UCAV_Exec + * + */ + local interface UCAV_Exec : + CCM_UCAV, + Components::SessionComponent + { + }; + +}; + +#endif /* CIAO_UCAVI_IDL*/ diff --git a/TAO/CIAO/examples/UAV/UCAV/UCAV_exec.cpp b/TAO/CIAO/examples/UAV/UCAV/UCAV_exec.cpp new file mode 100644 index 00000000000..55ffe02b858 --- /dev/null +++ b/TAO/CIAO/examples/UAV/UCAV/UCAV_exec.cpp @@ -0,0 +1,106 @@ +// $Id$ + +#include "CIAO_common.h" +#include "UCAV_exec.h" + +#define DISPLACEMENT 256 + +/// Default constructor. +MyImpl::UCAV_exec_i::UCAV_exec_i (void) + : str_ ("BM DEVICE DATA") +{ + +} + +/// Default destructor. +MyImpl::UCAV_exec_i::~UCAV_exec_i () +{ +} + +void +MyImpl::UCAV_exec_i::push_start_move (BBN_UAV::StartMove *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_DEBUG ((LM_DEBUG, + "UCAV, received a StartMove from CAOC \n")); +} + +// Operations from Components::SessionComponent +void +MyImpl::UCAV_exec_i::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::UCAV_exec_i::set_session_context\n")); + + this->context_ = + BBN_UAV::CCM_UCAV_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::UCAV_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::UCAV_exec_i::ccm_activate\n")); + char *argv[1] = { "UCAV_exec"}; + + int argc = sizeof(argv)/sizeof(argv[0]); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv ACE_ENV_ARG_PARAMETER); + + CIAO_REGISTER_VALUE_FACTORY (orb.in(), BBN_UAV::StartMove_init, + BBN_UAV::StartMove); +} + +void +MyImpl::UCAV_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::UCAV_exec_i::ccm_passivate\n")); +} + +void +MyImpl::UCAV_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::UCAV_exec_i::ccm_remove\n")); +} + +/// Default ctor. +MyImpl::UCAVHome_exec_i::UCAVHome_exec_i () +{ +} + +/// Default dtor. +MyImpl::UCAVHome_exec_i::~UCAVHome_exec_i () +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::UCAVHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::UCAV_exec_i; +} + + +extern "C" UCAV_EXEC_Export ::Components::HomeExecutorBase_ptr +createUCAVHome_Impl (void) +{ + return new MyImpl::UCAVHome_exec_i; +} diff --git a/TAO/CIAO/examples/UAV/UCAV/UCAV_exec.h b/TAO/CIAO/examples/UAV/UCAV/UCAV_exec.h new file mode 100644 index 00000000000..c10bdd27162 --- /dev/null +++ b/TAO/CIAO/examples/UAV/UCAV/UCAV_exec.h @@ -0,0 +1,110 @@ +// $Id$ + +//================================================================ +/** + * @file UCAV_exec.h + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//================================================================ + +#ifndef CIAO_UCAV_EXEC_H +#define CIAO_UCAV_EXEC_H + +#include "UCAVEIC.h" +#include "tao/LocalObject.h" + +// The namespace name for the actual implementation classes doesn't +// really matter. Since there may be several different +// implementations for a component, they can very well be in different +// namespaces. +namespace MyImpl +{ + /** + * @class UCAV_exec_i + * + * The UCAV implementation class. + */ + class UCAV_EXEC_Export UCAV_exec_i : + public virtual BBN_UAV::UCAV_Exec, + // CIAO container implementation depends on correct reference + // counting of local interfaces, so we take a short cut to + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + UCAV_exec_i (void); + + /// Default destructor. + ~UCAV_exec_i (void); + + // Operations from BBN_UAV::UCAV + + virtual void + push_start_move (BBN_UAV::StartMove *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from Components::SessionComponent + + virtual void + set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + protected: + CORBA::String_var str_; + + /// Copmponent specific context + BBN_UAV::CCM_UCAV_Context_var context_; + }; + + /** + * @class UCAVHome_exec_i + * + * UCAV home executor implementation class. + */ + class UCAV_EXEC_Export UCAVHome_exec_i : + public virtual BBN_UAV::CCM_UCAVHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + UCAVHome_exec_i (); + + /// Default dtor. + ~UCAVHome_exec_i (); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +// Executor DLL entry point. CIAO's deployment and assembly framework +// invokes this function on the resulting DLL to get the home executor. +extern "C" UCAV_EXEC_Export ::Components::HomeExecutorBase_ptr +createUCAVHome_Impl (void); + +#endif /* CIAO_UCAV_EXEC_H*/ diff --git a/TAO/CIAO/examples/UAV/UCAV/UCAV_svnt.cpp b/TAO/CIAO/examples/UAV/UCAV/UCAV_svnt.cpp new file mode 100644 index 00000000000..c4cd9c79a76 --- /dev/null +++ b/TAO/CIAO/examples/UAV/UCAV/UCAV_svnt.cpp @@ -0,0 +1,990 @@ +// $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.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#include "UCAV_svnt.h" +#include "Cookies.h" + +namespace UCAV_Impl +{ + namespace CIAO_GLUE_BBN_UAV + { + UCAV_Context::UCAV_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + UCAV_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) + { + } + + UCAV_Context::~UCAV_Context (void) + { + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + UCAV_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 + UCAV_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 + UCAV_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 + UCAV_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 + UCAV_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 + UCAV_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContext interface. + + CORBA::Object_ptr + UCAV_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_ = + ::BBN_UAV::UCAV::_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 ::BBN_UAV::UCAV::_duplicate ( + this->component_.in ()); + } + + // Operations for UCAV receptacles and event sources, + // defined in ::BBN_UAV::CCM_UCAV_Context. + + // CIAO-specific. + + ::CIAO::Session_Container * + UCAV_Context::_ciao_the_Container (void) const + { + return this->container_; + } + + UCAV_Context * + UCAV_Context::_narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_NOT_USED) + { + return dynamic_cast<UCAV_Context *> (p); + } + } + + namespace CIAO_GLUE_BBN_UAV + { + UCAV_Servant::UCAV_Servant ( + ::BBN_UAV::CCM_UCAV_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (::BBN_UAV::CCM_UCAV::_duplicate (exe)), + container_ (c) + { + this->context_ = new UCAV_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_CATCHANY + { + } + ACE_ENDTRY; + } + + UCAV_Servant::~UCAV_Servant (void) + { + ACE_TRY_NEW_ENV + { + ::Components::SessionComponent_var scom = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! ::CORBA::is_nil (scom.in ())) + { + scom->ccm_remove (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + ACE_CATCHANY + { + } + ACE_ENDTRY; + + this->context_->_remove_ref (); + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + UCAV_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 * + UCAV_Servant::get_all_facets ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::FacetDescriptions * + UCAV_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); + } + + CORBA::Boolean + UCAV_Servant::same_component ( + CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (::CORBA::is_nil (object_ref)) + { + ACE_THROW_RETURN (::CORBA::BAD_PARAM (), 0); + } + + ::CORBA::Object_var the_other = + object_ref->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::CORBA::Object_var me = + this->context_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return me->_is_equivalent ( + the_other.in () + ACE_ENV_ARG_PARAMETER); + } + + ::Components::EmitterDescriptions * + UCAV_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + UCAV_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); + } + + UCAV_Servant::StartMoveConsumer_start_move_Servant::StartMoveConsumer_start_move_Servant ( + ::BBN_UAV::CCM_UCAV_ptr executor, + ::BBN_UAV::CCM_UCAV_Context_ptr c) + : executor_ (::BBN_UAV::CCM_UCAV::_duplicate (executor)), + ctx_ (::BBN_UAV::CCM_UCAV_Context::_duplicate (c)) + { + } + + UCAV_Servant::StartMoveConsumer_start_move_Servant::~StartMoveConsumer_start_move_Servant (void) + { + } + + CORBA::Object_ptr + UCAV_Servant::StartMoveConsumer_start_move_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 + UCAV_Servant::StartMoveConsumer_start_move_Servant::push_StartMove ( + ::BBN_UAV::StartMove *evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->push_start_move ( + evt + ACE_ENV_ARG_PARAMETER); + } + + // Inherited from ::Components::EventConsumerBase. + void + UCAV_Servant::StartMoveConsumer_start_move_Servant::push_event ( + ::Components::EventBase *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::BadEventType)) + { + ::BBN_UAV::StartMove_var ev_type = + ::BBN_UAV::StartMove::_downcast (ev); + + if (ev_type != 0) + { + this->push_StartMove ( + ev_type.in () + ACE_ENV_ARG_PARAMETER); + + return; + } + + ACE_THROW (::Components::BadEventType ()); + } + + ::BBN_UAV::StartMoveConsumer_ptr + UCAV_Servant::get_consumer_start_move ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (CORBA::is_nil (this->consumes_start_move_.in ())) + { + UCAV_Servant::StartMoveConsumer_start_move_Servant *svt = + new UCAV_Servant::StartMoveConsumer_start_move_Servant ( + this->executor_.in (), + this->context_); + PortableServer::ServantBase_var safe_servant (svt); + + CORBA::Object_var obj = + this->container_->install_servant ( + svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::StartMoveConsumer::_nil ()); + + ::BBN_UAV::StartMoveConsumer_var eco = + ::BBN_UAV::StartMoveConsumer::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::StartMoveConsumer::_nil ()); + + this->consumes_start_move_ = eco; + } + + return ::BBN_UAV::StartMoveConsumer::_duplicate (this->consumes_start_move_.in ()); + } + + ::Components::Cookie * + UCAV_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 + UCAV_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 ()); + } + + ::Components::ConnectionDescriptions * + UCAV_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 * + UCAV_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + UCAV_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 + UCAV_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, "start_move") == 0) + { + return this->get_consumer_start_move (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + void + UCAV_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)) + { + ACE_THROW (::CORBA::NO_IMPLEMENT ()); + } + + ::Components::EventConsumerBase_ptr + UCAV_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 * + UCAV_Servant::get_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + UCAV_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 * + UCAV_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 + UCAV_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 * + UCAV_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + UCAV_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 + UCAV_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 + UCAV_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 + UCAV_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::Components::CCMHome_ptr + UCAV_Servant::get_ccm_home ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->context_->get_CCM_home (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Components::PrimaryKeyBase * + UCAV_Servant::get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)) + { + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); + } + + void + UCAV_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + UCAV_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + ::Components::ComponentPortDescription * + UCAV_Servant::get_all_ports ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::ComponentPortDescription_var retv = + new OBV_Components::ComponentPortDescription; + + ::Components::FacetDescriptions_var facets_desc = + this->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ReceptacleDescriptions_var receptacle_desc = + this->get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ConsumerDescriptions_var consumer_desc = + this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::EmitterDescriptions_var emitter_desc = + this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::PublisherDescriptions_var publisher_desc = + this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv->facets (facets_desc.in ()); + retv->receptacles (receptacle_desc.in ()); + retv->consumers (consumer_desc.in ()); + retv->emitters (emitter_desc.in ()); + retv->publishers (publisher_desc.in ()); + + return retv._retn (); + } + + CORBA::Object_ptr + UCAV_Servant::_get_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow ( + this->context_ + 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->context_ + 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 (), + ::CORBA::Object::_nil ()); + } + + // CIAO-specific operations. + + void + UCAV_Servant::_ciao_activate ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! ::CORBA::is_nil (temp.in ())) + { + temp->ccm_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + + void + UCAV_Servant::_ciao_passivate ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! ::CORBA::is_nil (temp.in ())) + { + temp->ccm_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + + // Supported operations. + + // Component attribute operations. + } + + namespace CIAO_GLUE_BBN_UAV + { + UCAVHome_Servant::UCAVHome_Servant ( + ::BBN_UAV::CCM_UCAVHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::BBN_UAV::CCM_UCAVHome::_duplicate (exe)), + container_ (c) + { + } + + UCAVHome_Servant::~UCAVHome_Servant (void) + { + } + + // Home factory and other operations. + + // Home attribute operations. + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + UCAVHome_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. + + ::BBN_UAV::UCAV_ptr + UCAVHome_Servant::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BBN_UAV::UCAV::_nil ()); + } + + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UCAV::_nil ()); + + ::BBN_UAV::CCM_UCAV_var _ciao_comp = + ::BBN_UAV::CCM_UCAV::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UCAV::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + UCAVHome_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 + UCAVHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + UCAVHome_Servant::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + ::BBN_UAV::UCAV_var _ciao_comp = + ::BBN_UAV::UCAV::_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. + + ::BBN_UAV::UCAV_ptr + UCAVHome_Servant::_ciao_activate_component ( + ::BBN_UAV::CCM_UCAV_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 (::BBN_UAV::UCAV::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UCAV::_nil ()); + + UCAV_Servant *svt = + new UCAV_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 (::BBN_UAV::UCAV::_nil ()); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UCAV::_nil ()); + + ::BBN_UAV::UCAV_var ho = + ::BBN_UAV::UCAV::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UCAV::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + UCAVHome_Servant::_ciao_passivate_component ( + ::BBN_UAV::UCAV_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; + + UCAV_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" UCAV_SVNT_Export ::PortableServer::Servant + createUCAVHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) + { + if (p == 0) + { + return 0; + } + + ::BBN_UAV::CCM_UCAVHome_var x = + ::BBN_UAV::CCM_UCAVHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + CIAO_GLUE_BBN_UAV::UCAVHome_Servant ( + x.in (), + c); + } +} diff --git a/TAO/CIAO/examples/UAV/UCAV/UCAV_svnt.h b/TAO/CIAO/examples/UAV/UCAV/UCAV_svnt.h new file mode 100644 index 00000000000..de88f0cc4bd --- /dev/null +++ b/TAO/CIAO/examples/UAV/UCAV/UCAV_svnt.h @@ -0,0 +1,546 @@ +// $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.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#ifndef CIAO_GLUE_SESSION_UCAV_SVNT_H +#define CIAO_GLUE_SESSION_UCAV_SVNT_H + +#include /**/ "ace/pre.h" + +#include "UCAVEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ciao/Container_Base.h" +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#include "UCAVS.h" + +namespace UCAV_Impl +{ + namespace CIAO_GLUE_BBN_UAV + { + class UCAV_SVNT_Export UCAV_Context + : public virtual ::BBN_UAV::CCM_UCAV_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class UCAV_Servant; + + UCAV_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + UCAV_Servant *sv); + + virtual ~UCAV_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 UCAV receptacles and event sources, + // defined in ::BBN_UAV::CCM_UCAV_Context. + + // CIAO-specific. + + ::CIAO::Session_Container * + _ciao_the_Container (void) const; + + static UCAV_Context * + _narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + protected: + // Methods that manage this component's connections and consumers. + + protected: + ::Components::CCMHome_var home_; + + ::CIAO::Session_Container *container_; + + UCAV_Servant *servant_; + + ::BBN_UAV::UCAV_var component_; + }; + } + + namespace CIAO_GLUE_BBN_UAV + { + class UCAV_SVNT_Export UCAV_Servant + : public virtual POA_BBN_UAV::UCAV, + public virtual PortableServer::RefCountServantBase + { + public: + UCAV_Servant ( + ::BBN_UAV::CCM_UCAV_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~UCAV_Servant (void); + + // Supported operations. + + // Public port operations. + + // Servant class for the start_move consumer. + class UCAV_SVNT_Export StartMoveConsumer_start_move_Servant + : public virtual POA_BBN_UAV::StartMoveConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + StartMoveConsumer_start_move_Servant ( + ::BBN_UAV::CCM_UCAV_ptr executor, + ::BBN_UAV::CCM_UCAV_Context_ptr c); + + virtual ~StartMoveConsumer_start_move_Servant (void); + + virtual void + push_StartMove ( + ::BBN_UAV::StartMove *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: + ::BBN_UAV::CCM_UCAV_var + executor_; + + ::BBN_UAV::CCM_UCAV_Context_var + ctx_; + }; + + virtual ::BBN_UAV::StartMoveConsumer_ptr + get_consumer_start_move ( + 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_all_facets ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::FacetDescriptions * + get_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual CORBA::Boolean + same_component ( + CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for Receptacles interface. + + virtual ::Components::Cookie * + connect ( + const char *name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::AlreadyConnected, + ::Components::ExceededConnectionLimit)); + + virtual CORBA::Object_ptr + disconnect ( + const char *name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::CookieRequired, + ::Components::NoConnection)); + + 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_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + 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 ::Components::CCMHome_ptr + get_ccm_home ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PrimaryKeyBase * + get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)); + + 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)); + + virtual ::Components::ComponentPortDescription * + get_all_ports( + 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)); + + // CIAO-specific operations. + + void + _ciao_activate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BBN_UAV::CCM_UCAV_var + executor_; + + UCAV_Context * + context_; + + ::CIAO::Session_Container * + container_; + ::BBN_UAV::StartMoveConsumer_var + consumes_start_move_; + + ACE_CString component_UUID_; + }; + } + + namespace CIAO_GLUE_BBN_UAV + { + class UCAV_SVNT_Export UCAVHome_Servant + : public virtual POA_BBN_UAV::UCAVHome, + public virtual PortableServer::RefCountServantBase + { + public: + UCAVHome_Servant ( + ::BBN_UAV::CCM_UCAVHome_ptr exe, + ::CIAO::Session_Container *c); + + virtual ~UCAVHome_Servant (void); + + // Home factory and other 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 ::BBN_UAV::UCAV_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. + + ::BBN_UAV::UCAV_ptr + _ciao_activate_component ( + ::BBN_UAV::CCM_UCAV_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::BBN_UAV::UCAV_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BBN_UAV::CCM_UCAVHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + UCAV_Servant *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; + + extern "C" UCAV_SVNT_Export ::PortableServer::Servant + createUCAVHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + } +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_GLUE_SESSION_UCAV_SVNT_H */ + diff --git a/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS.idl b/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS.idl index f46800c0790..5a4853df02b 100644 --- a/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS.idl +++ b/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS.idl @@ -18,7 +18,8 @@ module BBN_UAV { component UCAV_GS { - consumes StartMove start_move; + publishes StartMove start_move; + consumes PrepareMove prepare_move; }; home UCAV_GSHome manages UCAV_GS diff --git a/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS.mpc b/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS.mpc index 049aee0863e..c8e786475ae 100644 --- a/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS.mpc +++ b/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS.mpc @@ -20,7 +20,7 @@ project(UCAV_GS_stub): ciao_client { project(UCAV_GS_svnt) : ciao_servant { after += BBN_UAV_svnt UCAV_GS_stub sharedname = UCAV_GS_svnt - libs += UCAV_GS_stub + libs += BBN_UAV_stub BBN_UAV_svnt UCAV_GS_stub idlflags += -Wb,export_macro=UCAV_GS_SVNT_Export -Wb,export_include=UCAV_GS_svnt_export.h dynamicflags = UCAV_GS_SVNT_BUILD_DLL @@ -44,17 +44,19 @@ project(UCAV_GS_svnt) : ciao_servant { project(UCAV_GS_exec) : ciao_component { after += BBN_UAV_svnt UCAV_GS_svnt sharedname = UCAV_GS_exec - libs += UCAV_GS_stub UCAV_GS_svnt + libs += BBN_UAV_stub BBN_UAV_svnt UCAV_GS_stub UCAV_GS_svnt idlflags += -Wb,export_macro=UCAV_GS_EXEC_Export -Wb,export_include=UCAV_GS_exec_export.h dynamicflags = UCAV_GS_EXEC_BUILD_DLL IDL_Files { - + UCAV_GSEI.idl } Source_Files { - + UCAV_GSES.cpp + UCAV_GSEIC.cpp + UCAV_GSEIS.cpp UCAV_GS_exec.cpp } } diff --git a/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GSEI.idl b/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GSEI.idl new file mode 100644 index 00000000000..c99422a3e1c --- /dev/null +++ b/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GSEI.idl @@ -0,0 +1,30 @@ +// $Id$ + +/** + * @file UCAV_GSEI.idl + * + * Definition of the UCAV_GS component implementation. + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ + +#ifndef CIAO_UCAV_GSI_IDL +#define CIAO_UCAV_GSI_IDL + +#include "UCAV_GSE.idl" + +module BBN_UAV +{ + /** + * @interface UCAV_GS_Exec + * + */ + local interface UCAV_GS_Exec : + CCM_UCAV_GS, + Components::SessionComponent + { + }; + +}; + +#endif /* CIAO_UCAV_GSI_IDL*/ diff --git a/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS_exec.cpp b/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS_exec.cpp new file mode 100644 index 00000000000..4ba3cc2370c --- /dev/null +++ b/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS_exec.cpp @@ -0,0 +1,113 @@ +// $Id$ + +#include "CIAO_common.h" +#include "UCAV_GS_exec.h" + +#define DISPLACEMENT 256 + +/// Default constructor. +MyImpl::UCAV_GS_exec_i::UCAV_GS_exec_i (void) + : str_ ("BM DEVICE DATA") +{ + +} + +/// Default destructor. +MyImpl::UCAV_GS_exec_i::~UCAV_GS_exec_i () +{ +} + +void +MyImpl::UCAV_GS_exec_i::push_prepare_move (BBN_UAV::PrepareMove *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Notify others + BBN_UAV::StartMove_var event = new OBV_BBN_UAV::StartMove; + + ACE_DEBUG ((LM_DEBUG, + "UCAV_GS, received a PrepareMove from Engagement \n")); + + this->context_->push_start_move (event + ACE_ENV_ARG_PARAMETER); + +} + +// Operations from Components::SessionComponent +void +MyImpl::UCAV_GS_exec_i::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::UCAV_GS_exec_i::set_session_context\n")); + + this->context_ = + BBN_UAV::CCM_UCAV_GS_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::UCAV_GS_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::UCAV_GS_exec_i::ccm_activate\n")); + char *argv[1] = { "UCAV_GS_exec"}; + + int argc = sizeof(argv)/sizeof(argv[0]); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv ACE_ENV_ARG_PARAMETER); + + CIAO_REGISTER_VALUE_FACTORY (orb.in(), BBN_UAV::PrepareMove_init, + BBN_UAV::PrepareMove); +} + +void +MyImpl::UCAV_GS_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::UCAV_GS_exec_i::ccm_passivate\n")); +} + +void +MyImpl::UCAV_GS_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::UCAV_GS_exec_i::ccm_remove\n")); +} + +/// Default ctor. +MyImpl::UCAV_GSHome_exec_i::UCAV_GSHome_exec_i () +{ +} + +/// Default dtor. +MyImpl::UCAV_GSHome_exec_i::~UCAV_GSHome_exec_i () +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::UCAV_GSHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::UCAV_GS_exec_i; +} + + +extern "C" UCAV_GS_EXEC_Export ::Components::HomeExecutorBase_ptr +createUCAV_GSHome_Impl (void) +{ + return new MyImpl::UCAV_GSHome_exec_i; +} diff --git a/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS_exec.h b/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS_exec.h new file mode 100644 index 00000000000..8d9f4802262 --- /dev/null +++ b/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS_exec.h @@ -0,0 +1,110 @@ +// $Id$ + +//================================================================ +/** + * @file UCAV_GS_exec.h + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//================================================================ + +#ifndef CIAO_UCAV_GS_EXEC_H +#define CIAO_UCAV_GS_EXEC_H + +#include "UCAV_GSEIC.h" +#include "tao/LocalObject.h" + +// The namespace name for the actual implementation classes doesn't +// really matter. Since there may be several different +// implementations for a component, they can very well be in different +// namespaces. +namespace MyImpl +{ + /** + * @class UCAV_GS_exec_i + * + * The UCAV_GS implementation class. + */ + class UCAV_GS_EXEC_Export UCAV_GS_exec_i : + public virtual BBN_UAV::UCAV_GS_Exec, + // CIAO container implementation depends on correct reference + // counting of local interfaces, so we take a short cut to + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + UCAV_GS_exec_i (void); + + /// Default destructor. + ~UCAV_GS_exec_i (void); + + // Operations from BBN_UAV::UCAV_GS + + virtual void + push_prepare_move (BBN_UAV::PrepareMove *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from Components::SessionComponent + + virtual void + set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + protected: + CORBA::String_var str_; + + /// Copmponent specific context + BBN_UAV::CCM_UCAV_GS_Context_var context_; + }; + + /** + * @class UCAV_GSHome_exec_i + * + * UCAV_GS home executor implementation class. + */ + class UCAV_GS_EXEC_Export UCAV_GSHome_exec_i : + public virtual BBN_UAV::CCM_UCAV_GSHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + UCAV_GSHome_exec_i (); + + /// Default dtor. + ~UCAV_GSHome_exec_i (); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +// Executor DLL entry point. CIAO's deployment and assembly framework +// invokes this function on the resulting DLL to get the home executor. +extern "C" UCAV_GS_EXEC_Export ::Components::HomeExecutorBase_ptr +createUCAV_GSHome_Impl (void); + +#endif /* CIAO_UCAV_GS_EXEC_H*/ diff --git a/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS_svnt.cpp b/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS_svnt.cpp new file mode 100644 index 00000000000..4c0f7893ed4 --- /dev/null +++ b/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS_svnt.cpp @@ -0,0 +1,1125 @@ +// $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.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#include "UCAV_GS_svnt.h" +#include "Cookies.h" + +namespace UCAV_GS_Impl +{ + namespace CIAO_GLUE_BBN_UAV + { + UCAV_GS_Context::UCAV_GS_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + UCAV_GS_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) + { + } + + UCAV_GS_Context::~UCAV_GS_Context (void) + { + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + UCAV_GS_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 + UCAV_GS_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 + UCAV_GS_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 + UCAV_GS_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 + UCAV_GS_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 + UCAV_GS_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContext interface. + + CORBA::Object_ptr + UCAV_GS_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_ = + ::BBN_UAV::UCAV_GS::_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 ::BBN_UAV::UCAV_GS::_duplicate ( + this->component_.in ()); + } + + // Operations for UCAV_GS receptacles and event sources, + // defined in ::BBN_UAV::CCM_UCAV_GS_Context. + + void + UCAV_GS_Context::push_start_move ( + ::BBN_UAV::StartMove *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_Active_Map_Manager< + ::BBN_UAV::StartMoveConsumer_var>::iterator end = + this->ciao_publishes_start_move_map_.end (); + + for (ACE_Active_Map_Manager< + ::BBN_UAV::StartMoveConsumer_var>::iterator iter = + this->ciao_publishes_start_move_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager< + ::BBN_UAV::StartMoveConsumer_var>::ENTRY &entry = *iter; + + ::BBN_UAV::StartMoveConsumer_var c = + ::BBN_UAV::StartMoveConsumer::_narrow ( + entry.int_id_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + entry.int_id_->push_StartMove ( + ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + + ::Components::Cookie * + UCAV_GS_Context::subscribe_start_move ( + ::BBN_UAV::StartMoveConsumer_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); + } + + ::BBN_UAV::StartMoveConsumer_var sub = + ::BBN_UAV::StartMoveConsumer::_duplicate (c); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_start_move_map_.bind (sub.in (), key); + sub._retn (); + + ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); + return retv._retn (); + } + + ::BBN_UAV::StartMoveConsumer_ptr + UCAV_GS_Context::unsubscribe_start_move ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + ::BBN_UAV::StartMoveConsumer_var retv; + ACE_Active_Map_Manager_Key key; + + if (ck == 0 || ::CIAO::Map_Key_Cookie::extract (ck, key) == -1) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BBN_UAV::StartMoveConsumer::_nil ()); + } + + + if (this->ciao_publishes_start_move_map_.unbind (key, retv) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BBN_UAV::StartMoveConsumer::_nil ()); + } + + return retv._retn (); + } + + // CIAO-specific. + + ::CIAO::Session_Container * + UCAV_GS_Context::_ciao_the_Container (void) const + { + return this->container_; + } + + UCAV_GS_Context * + UCAV_GS_Context::_narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_NOT_USED) + { + return dynamic_cast<UCAV_GS_Context *> (p); + } + } + + namespace CIAO_GLUE_BBN_UAV + { + UCAV_GS_Servant::UCAV_GS_Servant ( + ::BBN_UAV::CCM_UCAV_GS_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (::BBN_UAV::CCM_UCAV_GS::_duplicate (exe)), + container_ (c) + { + this->context_ = new UCAV_GS_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_CATCHANY + { + } + ACE_ENDTRY; + } + + UCAV_GS_Servant::~UCAV_GS_Servant (void) + { + ACE_TRY_NEW_ENV + { + ::Components::SessionComponent_var scom = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! ::CORBA::is_nil (scom.in ())) + { + scom->ccm_remove (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + ACE_CATCHANY + { + } + ACE_ENDTRY; + + this->context_->_remove_ref (); + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + UCAV_GS_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 * + UCAV_GS_Servant::get_all_facets ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::FacetDescriptions * + UCAV_GS_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); + } + + CORBA::Boolean + UCAV_GS_Servant::same_component ( + CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (::CORBA::is_nil (object_ref)) + { + ACE_THROW_RETURN (::CORBA::BAD_PARAM (), 0); + } + + ::CORBA::Object_var the_other = + object_ref->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::CORBA::Object_var me = + this->context_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return me->_is_equivalent ( + the_other.in () + ACE_ENV_ARG_PARAMETER); + } + + ::Components::EmitterDescriptions * + UCAV_GS_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + UCAV_GS_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 * + UCAV_GS_Servant::subscribe_start_move ( + ::BBN_UAV::StartMoveConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + return this->context_->subscribe_start_move ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::BBN_UAV::StartMoveConsumer_ptr + UCAV_GS_Servant::unsubscribe_start_move ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + return this->context_->unsubscribe_start_move ( + ck + ACE_ENV_ARG_PARAMETER); + } + + UCAV_GS_Servant::PrepareMoveConsumer_prepare_move_Servant::PrepareMoveConsumer_prepare_move_Servant ( + ::BBN_UAV::CCM_UCAV_GS_ptr executor, + ::BBN_UAV::CCM_UCAV_GS_Context_ptr c) + : executor_ (::BBN_UAV::CCM_UCAV_GS::_duplicate (executor)), + ctx_ (::BBN_UAV::CCM_UCAV_GS_Context::_duplicate (c)) + { + } + + UCAV_GS_Servant::PrepareMoveConsumer_prepare_move_Servant::~PrepareMoveConsumer_prepare_move_Servant (void) + { + } + + CORBA::Object_ptr + UCAV_GS_Servant::PrepareMoveConsumer_prepare_move_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 + UCAV_GS_Servant::PrepareMoveConsumer_prepare_move_Servant::push_PrepareMove ( + ::BBN_UAV::PrepareMove *evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->push_prepare_move ( + evt + ACE_ENV_ARG_PARAMETER); + } + + // Inherited from ::Components::EventConsumerBase. + void + UCAV_GS_Servant::PrepareMoveConsumer_prepare_move_Servant::push_event ( + ::Components::EventBase *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::BadEventType)) + { + ::BBN_UAV::PrepareMove_var ev_type = + ::BBN_UAV::PrepareMove::_downcast (ev); + + if (ev_type != 0) + { + this->push_PrepareMove ( + ev_type.in () + ACE_ENV_ARG_PARAMETER); + + return; + } + + ACE_THROW (::Components::BadEventType ()); + } + + ::BBN_UAV::PrepareMoveConsumer_ptr + UCAV_GS_Servant::get_consumer_prepare_move ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (CORBA::is_nil (this->consumes_prepare_move_.in ())) + { + UCAV_GS_Servant::PrepareMoveConsumer_prepare_move_Servant *svt = + new UCAV_GS_Servant::PrepareMoveConsumer_prepare_move_Servant ( + this->executor_.in (), + this->context_); + PortableServer::ServantBase_var safe_servant (svt); + + CORBA::Object_var obj = + this->container_->install_servant ( + svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::PrepareMoveConsumer::_nil ()); + + ::BBN_UAV::PrepareMoveConsumer_var eco = + ::BBN_UAV::PrepareMoveConsumer::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::PrepareMoveConsumer::_nil ()); + + this->consumes_prepare_move_ = eco; + } + + return ::BBN_UAV::PrepareMoveConsumer::_duplicate (this->consumes_prepare_move_.in ()); + } + + ::Components::Cookie * + UCAV_GS_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 + UCAV_GS_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 ()); + } + + ::Components::ConnectionDescriptions * + UCAV_GS_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 * + UCAV_GS_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + UCAV_GS_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 + UCAV_GS_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, "prepare_move") == 0) + { + return this->get_consumer_prepare_move (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + void + UCAV_GS_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)) + { + ACE_THROW (::CORBA::NO_IMPLEMENT ()); + } + + ::Components::EventConsumerBase_ptr + UCAV_GS_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 * + UCAV_GS_Servant::get_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + UCAV_GS_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 * + UCAV_GS_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, "start_move") == 0) + { + ::BBN_UAV::StartMoveConsumer_var _ciao_consumer = + ::BBN_UAV::StartMoveConsumer::_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_start_move ( + _ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ::Components::EventConsumerBase_ptr + UCAV_GS_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, "start_move") == 0) + { + return this->unsubscribe_start_move ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ::Components::PublisherDescriptions * + UCAV_GS_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + UCAV_GS_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 + UCAV_GS_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 + UCAV_GS_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 + UCAV_GS_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::Components::CCMHome_ptr + UCAV_GS_Servant::get_ccm_home ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->context_->get_CCM_home (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Components::PrimaryKeyBase * + UCAV_GS_Servant::get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)) + { + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); + } + + void + UCAV_GS_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + UCAV_GS_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + ::Components::ComponentPortDescription * + UCAV_GS_Servant::get_all_ports ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::ComponentPortDescription_var retv = + new OBV_Components::ComponentPortDescription; + + ::Components::FacetDescriptions_var facets_desc = + this->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ReceptacleDescriptions_var receptacle_desc = + this->get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ConsumerDescriptions_var consumer_desc = + this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::EmitterDescriptions_var emitter_desc = + this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::PublisherDescriptions_var publisher_desc = + this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv->facets (facets_desc.in ()); + retv->receptacles (receptacle_desc.in ()); + retv->consumers (consumer_desc.in ()); + retv->emitters (emitter_desc.in ()); + retv->publishers (publisher_desc.in ()); + + return retv._retn (); + } + + CORBA::Object_ptr + UCAV_GS_Servant::_get_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow ( + this->context_ + 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->context_ + 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 (), + ::CORBA::Object::_nil ()); + } + + // CIAO-specific operations. + + void + UCAV_GS_Servant::_ciao_activate ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! ::CORBA::is_nil (temp.in ())) + { + temp->ccm_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + + void + UCAV_GS_Servant::_ciao_passivate ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow ( + this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! ::CORBA::is_nil (temp.in ())) + { + temp->ccm_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + + // Supported operations. + + // Component attribute operations. + } + + namespace CIAO_GLUE_BBN_UAV + { + UCAV_GSHome_Servant::UCAV_GSHome_Servant ( + ::BBN_UAV::CCM_UCAV_GSHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::BBN_UAV::CCM_UCAV_GSHome::_duplicate (exe)), + container_ (c) + { + } + + UCAV_GSHome_Servant::~UCAV_GSHome_Servant (void) + { + } + + // Home factory and other operations. + + // Home attribute operations. + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + UCAV_GSHome_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. + + ::BBN_UAV::UCAV_GS_ptr + UCAV_GSHome_Servant::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BBN_UAV::UCAV_GS::_nil ()); + } + + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UCAV_GS::_nil ()); + + ::BBN_UAV::CCM_UCAV_GS_var _ciao_comp = + ::BBN_UAV::CCM_UCAV_GS::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UCAV_GS::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + UCAV_GSHome_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 + UCAV_GSHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + UCAV_GSHome_Servant::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + ::BBN_UAV::UCAV_GS_var _ciao_comp = + ::BBN_UAV::UCAV_GS::_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. + + ::BBN_UAV::UCAV_GS_ptr + UCAV_GSHome_Servant::_ciao_activate_component ( + ::BBN_UAV::CCM_UCAV_GS_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 (::BBN_UAV::UCAV_GS::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UCAV_GS::_nil ()); + + UCAV_GS_Servant *svt = + new UCAV_GS_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 (::BBN_UAV::UCAV_GS::_nil ()); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UCAV_GS::_nil ()); + + ::BBN_UAV::UCAV_GS_var ho = + ::BBN_UAV::UCAV_GS::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BBN_UAV::UCAV_GS::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + UCAV_GSHome_Servant::_ciao_passivate_component ( + ::BBN_UAV::UCAV_GS_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; + + UCAV_GS_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" UCAV_GS_SVNT_Export ::PortableServer::Servant + createUCAV_GSHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) + { + if (p == 0) + { + return 0; + } + + ::BBN_UAV::CCM_UCAV_GSHome_var x = + ::BBN_UAV::CCM_UCAV_GSHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + CIAO_GLUE_BBN_UAV::UCAV_GSHome_Servant ( + x.in (), + c); + } +} diff --git a/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS_svnt.h b/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS_svnt.h new file mode 100644 index 00000000000..ecb6e357ab8 --- /dev/null +++ b/TAO/CIAO/examples/UAV/UCAV_GS/UCAV_GS_svnt.h @@ -0,0 +1,588 @@ +// $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.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#ifndef CIAO_GLUE_SESSION_UCAV_GS_SVNT_H +#define CIAO_GLUE_SESSION_UCAV_GS_SVNT_H + +#include /**/ "ace/pre.h" + +#include "UCAV_GSEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ciao/Container_Base.h" +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#include "UCAV_GSS.h" + +namespace UCAV_GS_Impl +{ + namespace CIAO_GLUE_BBN_UAV + { + class UCAV_GS_SVNT_Export UCAV_GS_Context + : public virtual ::BBN_UAV::CCM_UCAV_GS_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class UCAV_GS_Servant; + + UCAV_GS_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + UCAV_GS_Servant *sv); + + virtual ~UCAV_GS_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 UCAV_GS receptacles and event sources, + // defined in ::BBN_UAV::CCM_UCAV_GS_Context. + + virtual void + push_start_move ( + ::BBN_UAV::StartMove *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO-specific. + + ::CIAO::Session_Container * + _ciao_the_Container (void) const; + + static UCAV_GS_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_start_move ( + ::BBN_UAV::StartMoveConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BBN_UAV::StartMoveConsumer_ptr + unsubscribe_start_move ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + protected: + ACE_Active_Map_Manager< + ::BBN_UAV::StartMoveConsumer_var> + ciao_publishes_start_move_map_; + + ::Components::CCMHome_var home_; + + ::CIAO::Session_Container *container_; + + UCAV_GS_Servant *servant_; + + ::BBN_UAV::UCAV_GS_var component_; + }; + } + + namespace CIAO_GLUE_BBN_UAV + { + class UCAV_GS_SVNT_Export UCAV_GS_Servant + : public virtual POA_BBN_UAV::UCAV_GS, + public virtual PortableServer::RefCountServantBase + { + public: + UCAV_GS_Servant ( + ::BBN_UAV::CCM_UCAV_GS_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~UCAV_GS_Servant (void); + + // Supported operations. + + // Public port operations. + + virtual ::Components::Cookie * + subscribe_start_move ( + ::BBN_UAV::StartMoveConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BBN_UAV::StartMoveConsumer_ptr + unsubscribe_start_move ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + // Servant class for the prepare_move consumer. + class UCAV_GS_SVNT_Export PrepareMoveConsumer_prepare_move_Servant + : public virtual POA_BBN_UAV::PrepareMoveConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + PrepareMoveConsumer_prepare_move_Servant ( + ::BBN_UAV::CCM_UCAV_GS_ptr executor, + ::BBN_UAV::CCM_UCAV_GS_Context_ptr c); + + virtual ~PrepareMoveConsumer_prepare_move_Servant (void); + + virtual void + push_PrepareMove ( + ::BBN_UAV::PrepareMove *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: + ::BBN_UAV::CCM_UCAV_GS_var + executor_; + + ::BBN_UAV::CCM_UCAV_GS_Context_var + ctx_; + }; + + virtual ::BBN_UAV::PrepareMoveConsumer_ptr + get_consumer_prepare_move ( + 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_all_facets ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::FacetDescriptions * + get_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + virtual CORBA::Boolean + same_component ( + CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for Receptacles interface. + + virtual ::Components::Cookie * + connect ( + const char *name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::AlreadyConnected, + ::Components::ExceededConnectionLimit)); + + virtual CORBA::Object_ptr + disconnect ( + const char *name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::CookieRequired, + ::Components::NoConnection)); + + 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_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + 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 ::Components::CCMHome_ptr + get_ccm_home ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PrimaryKeyBase * + get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)); + + 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)); + + virtual ::Components::ComponentPortDescription * + get_all_ports( + 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)); + + // CIAO-specific operations. + + void + _ciao_activate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BBN_UAV::CCM_UCAV_GS_var + executor_; + + UCAV_GS_Context * + context_; + + ::CIAO::Session_Container * + container_; + ::BBN_UAV::PrepareMoveConsumer_var + consumes_prepare_move_; + + ACE_CString component_UUID_; + }; + } + + namespace CIAO_GLUE_BBN_UAV + { + class UCAV_GS_SVNT_Export UCAV_GSHome_Servant + : public virtual POA_BBN_UAV::UCAV_GSHome, + public virtual PortableServer::RefCountServantBase + { + public: + UCAV_GSHome_Servant ( + ::BBN_UAV::CCM_UCAV_GSHome_ptr exe, + ::CIAO::Session_Container *c); + + virtual ~UCAV_GSHome_Servant (void); + + // Home factory and other 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 ::BBN_UAV::UCAV_GS_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. + + ::BBN_UAV::UCAV_GS_ptr + _ciao_activate_component ( + ::BBN_UAV::CCM_UCAV_GS_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::BBN_UAV::UCAV_GS_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BBN_UAV::CCM_UCAV_GSHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + UCAV_GS_Servant *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; + + extern "C" UCAV_GS_SVNT_Export ::PortableServer::Servant + createUCAV_GSHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + } +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_GLUE_SESSION_UCAV_GS_SVNT_H */ + |