diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-09-14 20:03:51 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-09-14 20:03:51 +0000 |
commit | 664222ef7971a1ec2648477e14552a0196c729c7 (patch) | |
tree | d178fe0f9c33644a93522af1ca96cc6e223a01f2 | |
parent | 08ddeafad66255976abd21bc450d4fd357c12728 (diff) | |
download | ATCD-664222ef7971a1ec2648477e14552a0196c729c7.tar.gz |
ChangeLogTag: Tue Sep 14 15:02:24 2004 Jeff Parsons <j.parsons@vanderbilt.edu>
29 files changed, 2909 insertions, 1349 deletions
diff --git a/TAO/CIAO/CIDLC/ServantHeaderGenerator.cpp b/TAO/CIAO/CIDLC/ServantHeaderGenerator.cpp index b24cccd7f10..0678c8cccd7 100644 --- a/TAO/CIAO/CIDLC/ServantHeaderGenerator.cpp +++ b/TAO/CIAO/CIDLC/ServantHeaderGenerator.cpp @@ -736,21 +736,33 @@ namespace os << STRS[GLUE_NS] << regex::perl_s (t.scoped_name ().scope_name ().str (), "/::/_/") << "{"; + + os << "class " << t.name () << "_Servant;" << endl; os << "class " << ctx.export_macro () << " " << t.name () << "_Context" << endl - << ": public virtual " << t.scoped_name ().scope_name () << "::CCM_" - << t.name () << "_Context," - << endl - << "public virtual TAO_Local_RefCounted_Object" - << endl + << " : public virtual CIAO::Context_Impl<" << endl + << " " << t.scoped_name ().scope_name () << "::CCM_" + << t.name () << "_Context," << endl + << " " << t.name () << "_Servant," << endl + << " " << t.scoped_name () << "," << endl + << " " << t.scoped_name () << "_var" << endl + << " >" << endl << "{" << "public:" << endl; os << "// We will allow the servant glue code we generate to " << "access our state." << endl - << "friend class " << t.name () << "_Servant;" - << endl; + << "friend class " << t.name () << "_Servant;" << endl; + + os << "/// Hack for VC6." << endl + << "typedef CIAO::Context_Impl<" << endl + << " " << t.scoped_name ().scope_name () << "::CCM_" + << t.name () << "_Context," << endl + << " " << t.name () << "_Servant," << endl + << " " << t.scoped_name () << "," << endl + << " " << t.scoped_name () << "_var" << endl + << " > ctx_svnt_base;" << endl; os << t.name () << "_Context (" << endl << "::Components::CCMHome_ptr home," << endl @@ -760,55 +772,6 @@ namespace os << "virtual ~" << t.name () << "_Context (void);" << endl; - os << "// Operations from ::Components::CCMContext." << endl << endl; - - os << "virtual ::Components::Principal_ptr" << endl - << "get_caller_principal (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl; - - os << "virtual ::Components::CCMHome_ptr" << endl - << "get_CCM_home (" << endl - << STRS[ENV_SNGL_HDR_NOTUSED] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl ; - - os << "virtual CORBA::Boolean" << endl - << "get_rollback_only (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IS] << "));" << endl; - - os << "virtual ::Components::Transaction::UserTransaction_ptr" << endl - << "get_user_transaction (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IS] << "));" << endl; - - os << "virtual CORBA::Boolean" << endl - << "is_caller_in_role (" << endl - << "const char *role" << endl - << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl; - - os << "virtual void" << endl - << "set_rollback_only (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IS] << "));" << endl; - - os << "// Operations from " << STRS[COMP_SC] << " interface." - << endl << endl; - - os << "virtual CORBA::Object_ptr" << endl - << "get_CCM_object (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IS] << "));" << endl; - os << "// Operations for " << t.name () << " receptacles" << " and event sources," << endl << "// defined in " << t.scoped_name ().scope_name () << "::CCM_" @@ -831,9 +794,7 @@ namespace component_emitter.traverse (t); } - os << "// CIAO-specific." << endl << endl - << "::CIAO::Session_Container *" << endl - << "_ciao_the_Container (void) const;" << endl; + os << "// CIAO-specific." << endl << endl; os << "static " << t.name () << "_Context *" << endl << "_narrow (" << endl @@ -882,11 +843,6 @@ namespace virtual void post (Type& t) { - os << "::Components::CCMHome_var home_;" << endl - << "::CIAO::Session_Container *container_;" << endl << endl - << t.name () << "_Servant *servant_;" << endl - << t.scoped_name () << "_var component_;" << endl; - // Component context class closer. os << "};"; @@ -1276,12 +1232,11 @@ namespace << " " << t.scoped_name ().scope_name () << "::CCM_" << t.name () << "_var," << endl << " " << t.name () << "_Context" << endl - << " >," << endl - << " " << STRS[INH_RCSB] << endl + << " >" << endl << "{" << "public:" << endl; - os << "/// Hack for VC6 the most sucky compiler" << endl + os << "/// Hack for VC6." << endl << "typedef CIAO::Servant_Impl<" << endl << " POA_" << stripped << "," << endl << " " << t.scoped_name ().scope_name () << "::CCM_" @@ -1289,7 +1244,7 @@ namespace << " " << t.scoped_name ().scope_name () << "::CCM_" << t.name () << "_var," << endl << " " << t.name () << "_Context" << endl - << " > our_base;" << endl << endl; + << " > comp_svnt_base;" << endl << endl; os << t.name () << "_Servant (" << endl << t.scoped_name ().scope_name () << "::CCM_" << t.name () @@ -1409,24 +1364,6 @@ namespace component_emitter.traverse (t); } - os << "// Operations for Navigation interface." << endl << endl; - - os << "virtual CORBA::Object_ptr" << endl - << "provide_facet (" << endl - << "const char *name" << endl - << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "));" << endl << endl; - - os << "virtual ::Components::FacetDescriptions *" << endl - << "get_named_facets (" << endl - << "const " << STRS[COMP_NAMES] << endl - << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "));" << endl << endl; - os << "// Operations for Receptacles interface." << endl << endl; os << "virtual " << STRS[COMP_CK] << " *" << endl @@ -1453,37 +1390,8 @@ namespace << STRS[EXCP_CR] << "," << endl << STRS[EXCP_NC] << "));" << endl << endl; - os << "virtual ::Components::ConnectionDescriptions *" << endl - << "get_connections (" << endl - << "const char *name" << endl - << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "));" << endl << endl; - - os << "virtual ::Components::ReceptacleDescriptions *" << endl - << "get_all_receptacles (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; - - os << "virtual ::Components::ReceptacleDescriptions *" << endl - << "get_named_receptacles (" << endl - << "const " << STRS[COMP_NAMES] << endl - << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "));" << endl << endl; - os << "// Operations for Events interface." << endl << endl; - os << "virtual " << STRS[COMP_ECB] << "_ptr" << endl - << "get_consumer (" << endl - << "const char *sink_name" << endl - << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "));" << endl << endl; - os << "virtual " << STRS[COMP_CK] << " *" << endl << "subscribe (" << endl << "const char *publisher_name," << endl @@ -1516,70 +1424,6 @@ namespace << STRS[EXCP_AC] << "," << endl << STRS[EXCP_IC] << "));" << endl << endl; - os << "virtual " << STRS[COMP_ECB] << "_ptr" << endl - << "disconnect_consumer (" << endl - << "const char *source_name" << endl - << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "," << endl - << STRS[EXCP_NC] << "));" << endl << endl; - - os << "virtual ::Components::ConsumerDescriptions *" << endl - << "get_named_consumers (" << endl - << "const " << STRS[COMP_NAMES] << endl - << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "));" << endl << endl; - - os << "virtual ::Components::EmitterDescriptions *" << endl - << "get_all_emitters (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; - - os << "virtual ::Components::EmitterDescriptions *" << endl - << "get_named_emitters(" << endl - << "const " << STRS[COMP_NAMES] << endl - << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "));" << endl << endl; - - os << "virtual ::Components::PublisherDescriptions *" << endl - << "get_all_publishers (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; - - os << "virtual ::Components::PublisherDescriptions *" << endl - << "get_named_publishers (" << endl - << "const " << STRS[COMP_NAMES] << endl - << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "));" << endl << endl; - - os << "// Operations for CCMObject interface." << endl << endl; - - os << "virtual CORBA::IRObject_ptr" << endl - << "get_component_def (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; - - os << "virtual void" << endl - << "configuration_complete (" << endl - << STRS[ENV_SNGL_HDR_NOTUSED] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_ICF] << "));" << endl << endl; - - os << "virtual void" << endl - << "remove (" << endl - << STRS[ENV_SNGL_HDR_NOTUSED] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_RF] << "));" << endl << endl; - os << "// CIAO specific operations on the servant " << endl << "CORBA::Object_ptr" << endl << "get_facet_executor (const char *name" << endl @@ -1861,15 +1705,94 @@ namespace os << "class " << ctx.export_macro () << " " << t.name () << "_Servant" << endl - << ": public virtual POA_" << stripped << "," << endl - << STRS[INH_RCSB] << endl + << " : public virtual CIAO::Home_Servant_Impl<" << endl + << " POA_" << stripped << "," << endl + << " " << t.scoped_name ().scope_name () << "::CCM_" + << t.name () << "," << endl + << " " << t.scoped_name ().scope_name () << "::CCM_" + << t.name () << "_var," << endl + << " "; + + Traversal::Home::manages (t, manages_); + + os << "," << endl + << " "; + + Traversal::Home::manages (t, manages_); + + os << "_var," << endl + << " "; + + Traversal::Home::manages (t, enclosing_manages_); + + os << "::CCM_"; + + Traversal::Home::manages (t, simple_manages_); + + os << "," << endl + << " "; + + Traversal::Home::manages (t, enclosing_manages_); + + os << "::CCM_"; + + Traversal::Home::manages (t, simple_manages_); + + os << "_var," << endl + << " "; + + Traversal::Home::manages (t, simple_manages_); + + os << "_Servant" << endl + << " >" << endl << "{" - << "public:" << endl; + << "public:" << endl + << "/// Hack for VC6." << endl + << "typedef CIAO::Home_Servant_Impl<" << endl + << " POA_" << stripped << "," << endl + << " " << t.scoped_name ().scope_name () << "::CCM_" + << t.name () << "," << endl + << " " << t.scoped_name ().scope_name () << "::CCM_" + << t.name () << "_var," << endl + << " "; + + Traversal::Home::manages (t, manages_); + + os << "," << endl + << " "; + + Traversal::Home::manages (t, manages_); + + os << "_var," << endl + << " "; + + Traversal::Home::manages (t, enclosing_manages_); + + os << "::CCM_"; + + Traversal::Home::manages (t, simple_manages_); + + os << "," << endl + << " "; + + Traversal::Home::manages (t, enclosing_manages_); + + os << "::CCM_"; + + Traversal::Home::manages (t, simple_manages_); + + os << "_var," << endl + << " "; + + Traversal::Home::manages (t, simple_manages_); + + os << "_Servant" << endl + << " > home_svnt_base;" << endl << endl; os << t.name () << "_Servant (" << endl << t.scoped_name ().scope_name () << "::CCM_" << t.name () << "_ptr exe," << endl - << "::CIAO::Session_Container *c);" << endl; + << "::CIAO::Session_Container *c);" << endl << endl; os << "virtual ~" << t.name () << "_Servant (void);" << endl << endl; @@ -2002,51 +1925,6 @@ namespace home_emitter.traverse (t); } - // @@@ (JP) Need primary key support. - os << "// Operations for keyless home interface." << endl << endl; - - os << "virtual ::Components::CCMObject_ptr" << endl - << "create_component (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << "::Components::CreateFailure));" << endl << endl; - - os << "// Operations for implicit home interface." << endl << endl; - - os << "virtual "; - - Traversal::Home::manages (t, manages_); - - os << "_ptr" << endl - << "create (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << "::Components::CreateFailure));" << endl << endl; - - os << "// Operations for CCMHome interface." << endl << endl; - - os << "virtual ::CORBA::IRObject_ptr" << endl - << "get_component_def (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; - - os << "virtual ::CORBA::IRObject_ptr" << endl - << "get_home_def (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; - - os << "virtual void" << endl - << "remove_component (" << endl - << "::Components::CCMObject_ptr comp" << endl - << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_RF] << "));" << endl << endl; - - os << "// Supported operations." << endl << endl; - // Generate operations for all supported interfaces. { Traversal::Home home_emitter; @@ -2109,53 +1987,6 @@ namespace home_emitter.traverse (t); } - os << "protected:" << endl - << "// CIAO-specific operations." << endl << endl; - - Traversal::Home::manages (t, manages_); - - os << "_ptr" << endl - << "_ciao_activate_component (" << endl; - - Traversal::Home::manages (t, enclosing_manages_); - - os << "::CCM_"; - - Traversal::Home::manages (t, simple_manages_); - - os << "_ptr exe" << endl - << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; - - os << "void" << endl - << "_ciao_passivate_component (" << endl; - - Traversal::Home::manages (t, manages_); - - os << "_ptr comp" << endl - << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; - - os << "protected:" << endl; - - os << t.scoped_name ().scope_name () << "::CCM_" - << t.name () << "_var" << endl - << "executor_;" << endl << endl; - - os << "::CIAO::Session_Container *" << endl - << "container_;" << endl << endl; - - os << "ACE_Hash_Map_Manager_Ex<" << endl - << "PortableServer::ObjectId," << endl; - - Traversal::Home::manages (t, simple_manages_); - - os << "_Servant *," << endl - << "TAO_ObjectId_Hash," << endl - << "ACE_Equal_To<PortableServer::ObjectId>," << endl - << "ACE_SYNCH_MUTEX>" << endl - << "component_map_;" << endl << endl; - // Home servant class closer. os << "};"; @@ -2314,8 +2145,8 @@ ServantHeaderEmitter::pre (TranslationUnit& u) os << "#include \"ciao/Container_Base.h\"" << endl << "#include \"ciao/Servant_Impl_T.h\"" << endl - << "#include \"tao/LocalObject.h\"" << endl - << "#include \"tao/PortableServer/Key_Adapters.h\"" << endl + << "#include \"ciao/Context_Impl_T.h\"" << endl + << "#include \"ciao/Home_Servant_Impl_T.h\"" << endl << "#include \"ace/Active_Map_Manager_T.h\"" << endl << endl; } diff --git a/TAO/CIAO/CIDLC/ServantSourceGenerator.cpp b/TAO/CIAO/CIDLC/ServantSourceGenerator.cpp index fbee906ef9a..ed7ea448eae 100644 --- a/TAO/CIAO/CIDLC/ServantSourceGenerator.cpp +++ b/TAO/CIAO/CIDLC/ServantSourceGenerator.cpp @@ -1166,9 +1166,8 @@ namespace << "::Components::CCMHome_ptr home," << endl << "::CIAO::Session_Container *c," << endl << t.name () << "_Servant *sv)" << endl - << ": home_ (::Components::CCMHome::_duplicate (home))," << endl - << "container_ (c)," << endl - << "servant_ (sv)" << endl + << " : Context_Impl_Base (home, c)," << endl + << " ctx_svnt_base (home, c, sv)" << endl << "{" << "}"; @@ -1177,108 +1176,6 @@ namespace << "{" << "}"; - os << "// Operations from ::Components::CCMContext." << endl << endl; - - os << "::Components::Principal_ptr" << endl - << t.name () << "_Context::" - << "get_caller_principal (" << endl - << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_SNGL] << endl - << "{" - << "ACE_THROW_RETURN (" << endl - << "::CORBA::NO_IMPLEMENT ()," << endl - << "::Components::Principal::_nil ());" << endl - << "}"; - - os << "::Components::CCMHome_ptr" << endl - << t.name () << "_Context::" - << "get_CCM_home (" << endl - << STRS[ENV_SNGL_SRC_NOTUSED] << ")" << endl - << STRS[EXCP_SNGL] << endl - << "{" - << "return ::Components::CCMHome::_duplicate (this->home_.in ());" - << endl - << "}"; - - os << "CORBA::Boolean" << endl - << t.name () << "_Context::" - << "get_rollback_only (" << endl - << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IS] << "))" << endl - << "{" - << "ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);" << endl - << "}"; - - os << "::Components::Transaction::UserTransaction_ptr" << endl - << t.name () << "_Context::" - << "get_user_transaction (" << endl - << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IS] << "))" << endl - << "{" - << "ACE_THROW_RETURN (" << endl - << "::CORBA::NO_IMPLEMENT ()," << endl - << "::Components::Transaction::UserTransaction::_nil ());" << endl - << "}"; - - os << "CORBA::Boolean" << endl - << t.name () << "_Context::" - << "is_caller_in_role (" << endl - << "const char * /* role */" << endl - << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_SNGL] << endl - << "{" - << "ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);" << endl - << "}"; - - os << "void" << endl - << t.name () << "_Context::" - << "set_rollback_only (" << endl - << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IS] << "))" << endl - << "{" - << "ACE_THROW (CORBA::NO_IMPLEMENT ());" << endl - << "}"; - - os << "// Operations from " << STRS[COMP_SC] << "interface." - << endl << endl; - - os << "CORBA::Object_ptr" << endl - << t.name () << "_Context::" - << "get_CCM_object (" << endl - << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IS] << "))" << endl - << "{" - << "if (CORBA::is_nil (this->component_.in ()))" << endl - << "{" - << "CORBA::Object_var obj =" << endl - << "this->container_->get_objref (" << endl - << "this->servant_" << endl - << STRS[ENV_ARG] << ");" - << "ACE_CHECK_RETURN (CORBA::Object::_nil ());" << endl - << "this->component_ =" << endl - << t.scoped_name () << "::_narrow (" << endl - << "obj.in ()" << endl - << STRS[ENV_ARG] << ");" - << "ACE_CHECK_RETURN (CORBA::Object::_nil ());" << endl - << "if (CORBA::is_nil (this->component_.in ()))" << endl - << "{" - << "ACE_THROW_RETURN (" << endl - << "::CORBA::INTERNAL ()," << endl - << "::CORBA::Object::_nil ());" << endl - << "}" - << "}" - << "return " << t.scoped_name () << "::_duplicate (" << endl - << "this->component_.in ());" << endl - << "}"; - os << "// Operations for " << t.name () << " receptacles" << " and event sources," << endl << "// defined in " << t.scoped_name ().scope_name () << "::CCM_" @@ -1302,13 +1199,7 @@ namespace component_emitter.traverse (t); } - os << "// CIAO-specific." << endl << endl - << "::CIAO::Session_Container *" << endl - << t.name () << "_Context::" - << "_ciao_the_Container (void) const" << endl - << "{" - << "return this->container_;" << endl - << "}"; + os << "// CIAO-specific." << endl << endl; os << t.name () << "_Context *" << endl << t.name () << "_Context::_narrow (" << endl @@ -1381,25 +1272,6 @@ namespace Traversal::Belongs belongs_; }; - struct NavigationProvidesEmitter : Traversal::ProviderData, - EmitterBase - { - NavigationProvidesEmitter (Context& c) - : EmitterBase (c) - {} - - virtual void - traverse (Type& t) - { - os << "if (ACE_OS::strcmp (name, \"" - << t.name () << "\") == 0)" << endl - << "{" - << "return this->provide_" << t.name () - << " (" << STRS[ENV_SNGL_ARG] << ");" << endl - << "}"; - } - }; - struct NavigationGetFacetExecEmitter : Traversal::ProviderData, EmitterBase { @@ -1708,25 +1580,6 @@ namespace SemanticGraph::Component& scope_; }; - struct ConsumesGetEmitter : Traversal::ConsumerData, - EmitterBase - { - ConsumesGetEmitter (Context& c) - : EmitterBase (c) - {} - - virtual void - traverse (Type& c) - { - os << "if (ACE_OS::strcmp (sink_name, \"" - << c.name () << "\") == 0)" << endl - << "{" - << "return this->get_consumer_" << c.name () - << " (" << STRS[ENV_SNGL_ARG] << ");" << endl - << "}"; - } - }; - struct PublishesSubscribeEmitter : Traversal::PublisherData, EmitterBase { @@ -1994,48 +1847,61 @@ namespace << "return ret;" << "}"; - os << "CIAO::Port_Activator_T< " ; + os << "CIAO::Port_Activator_T<" << endl + << " "; + Traversal::ProviderData::belongs (p, servant_belongs_); - os << "," << endl; + + os << "," << endl + << " "; + Traversal::ProviderData::belongs (p, enclosing_belongs_); os << "::CCM_"; Traversal::ProviderData::belongs (p, simple_belongs_); - os << "," <<endl - << " ::Components::CCMContext," << endl - << scope_.name () << "_Servant" - << " > *tmp = 0;" << endl - << "typedef CIAO::Port_Activator_T<" << endl; + os << "," << endl + << " ::Components::CCMContext," << endl + << " " << scope_.name () << "_Servant" << endl + << " > *tmp = 0;" << endl + << "typedef CIAO::Port_Activator_T<" << endl + << " "; Traversal::ProviderData::belongs (p, servant_belongs_); - os << "," << endl; + + os << "," << endl + << " "; + Traversal::ProviderData::belongs (p, enclosing_belongs_); + os << "::CCM_"; + Traversal::ProviderData::belongs (p, simple_belongs_); - os << "," <<endl - << " ::Components::CCMContext," << endl - << scope_.name () << "_Servant" - << " >" << endl - << " MACRO_MADNESS_TYPEDEF;" - << endl << endl; + + os << "," << endl + << " ::Components::CCMContext," << endl + << " " << scope_.name () << "_Servant" << endl + << " >" << endl + << "MACRO_MADNESS_TYPEDEF;" << endl; os << "ACE_NEW_THROW_EX ( " << endl - << " tmp," << endl - << " MACRO_MADNESS_TYPEDEF (" << endl + << "tmp," << endl + << "MACRO_MADNESS_TYPEDEF (" << endl << "\"" << unique_obj_name << "\"," << endl << "\"" << p.name () << "\"," << endl << "CIAO::Port_Activator::Facet," << endl << "0," << endl << "this->context_," << endl << "this)," << endl - << "CORBA::NO_MEMORY ());" << endl << endl; + << "CORBA::NO_MEMORY ());" << endl; os << "CIAO::Servant_Activator *sa = " << endl - << "this->container_->ports_servant_activator ();" <<endl + << "this->container_->ports_servant_activator ();" << endl << "if (!sa->register_port_activator (tmp))" << endl - << "return 0;" <<endl; + << "{" + << "return 0;" << endl + << "}"; os << "::CORBA::Object_var obj =" << endl << "this->container_->generate_reference (" << endl @@ -2329,7 +2195,9 @@ namespace os << "CIAO::Servant_Activator *sa = " << endl << "this->container_->ports_servant_activator ();" <<endl << "if (!sa->register_port_activator (tmp))" << endl - << "return 0;" << endl; + << "{" + << "return 0;" << endl + << "}"; os << "::CORBA::Object_var obj =" << endl << "this->container_->generate_reference (" << endl @@ -2505,7 +2373,8 @@ namespace << "_ptr exe," << endl << "::Components::CCMHome_ptr h," << endl << "::CIAO::Session_Container *c)" << endl - << " : our_base (exe, c)" << endl + << " : Servant_Impl_Base (c)," << endl + << " comp_svnt_base (exe, c)" << endl << "{" << "this->context_ = " << "new " << t.name () << "_Context (h, c, this);" << endl; @@ -2610,77 +2479,6 @@ namespace component_emitter.traverse (t); } - os << "// Operations for Navigation interface." << endl << endl; - - os << "CORBA::Object_ptr" << endl - << t.name () << "_Servant::provide_facet (" << endl - << "const char *name" << endl - << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "))" << endl - << "{" - << "if (name == 0)" << endl - << "{" - << "ACE_THROW_RETURN (" << endl - << "::CORBA::BAD_PARAM ()," << endl - << "::CORBA::Object::_nil ());" << endl - << "}"; - - // Generate an IF block for each facet inside provide_facet(). - { - Traversal::Component component_emitter; - - Traversal::Inherits inherits; - inherits.node_traverser (component_emitter); - - Traversal::Defines defines; - component_emitter.edge_traverser (defines); - component_emitter.edge_traverser (inherits); - - NavigationProvidesEmitter navigation_provides_emitter (ctx); - defines.node_traverser (navigation_provides_emitter); - - component_emitter.traverse (t); - } - - os << "ACE_THROW_RETURN (" << endl - << STRS[EXCP_IN] << " ()," << endl - << "::CORBA::Object::_nil ());" << endl - << "}"; - - os << "::Components::FacetDescriptions *" << endl - << t.name () << "_Servant::get_named_facets (" << endl - << "const " << STRS[COMP_NAMES] << endl - << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "))" << endl - << "{" - << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}"; - - os << "::Components::EmitterDescriptions *" << endl - << t.name () << "_Servant::get_all_emitters (" - << endl - << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_SNGL] << endl - << "{" - << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}"; - - os << "::Components::EmitterDescriptions *" << endl - << t.name () << "_Servant::get_named_emitters (" - << endl - << "const " << STRS[COMP_NAMES] << endl - << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "))" << endl - << "{" - << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}"; - // Generate subscribe_* and unsubscribe_* operations. { Traversal::Component component_emitter; @@ -2797,39 +2595,6 @@ namespace << "ACE_UNUSED_ARG (ck);" << endl << "}"; - os << "::Components::ConnectionDescriptions *" << endl - << t.name () << "_Servant::get_connections (" - << endl - << "const char * /* name */" << endl - << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "))" << endl - << "{" - << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}"; - - os << "::Components::ReceptacleDescriptions *" << endl - << t.name () << "_Servant::get_all_receptacles (" - << endl - << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_SNGL] << endl - << "{" - << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}"; - - os << "::Components::ReceptacleDescriptions *" << endl - << t.name () << "_Servant::get_named_receptacles (" - << endl - << "const " << STRS[COMP_NAMES] << endl - << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "))" << endl - << "{" - << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}"; - // Generate generic operations for receptacles. { Traversal::Component component_emitter; @@ -2847,43 +2612,6 @@ namespace component_emitter.traverse (t); } - os << STRS[COMP_ECB] << "_ptr" << endl - << t.name () << "_Servant::get_consumer (" << endl - << "const char *sink_name" << endl - << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "))" << endl - << "{" - << "if (sink_name == 0)" << endl - << "{" - << "ACE_THROW_RETURN (" << endl - << STRS[EXCP_IN] << " ()," << endl - << STRS[COMP_ECB] << "::_nil ());" << endl - << "}"; - - // Generate an IF block in for each consumer in get_consumer(). - { - Traversal::Component component_emitter; - - Traversal::Inherits inherits; - inherits.node_traverser (component_emitter); - - Traversal::Defines defines; - component_emitter.edge_traverser (defines); - component_emitter.edge_traverser (inherits); - - ConsumesGetEmitter consumes_emitter (ctx); - defines.node_traverser (consumes_emitter); - - component_emitter.traverse (t); - } - - os << "ACE_THROW_RETURN (" << endl - << STRS[EXCP_IN] << " ()," << endl - << STRS[COMP_ECB] << "::_nil ());" << endl - << "}"; - os << "void" << endl << t.name () << "_Servant::connect_consumer (" << endl @@ -2923,31 +2651,6 @@ namespace << STRS[EXCP_IN] << " ());" << endl << "}"; - os << STRS[COMP_ECB] << "_ptr" << endl - << t.name () << "_Servant::disconnect_consumer (" - << endl - << "const char * /* source_name */" << endl - << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "," << endl - << STRS[EXCP_NC] << "))" << endl - << "{" - << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}"; - - os << "::Components::ConsumerDescriptions *" << endl - << t.name () << "_Servant::get_named_consumers (" - << endl - << "const " << STRS[COMP_NAMES] << endl - << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "))" << endl - << "{" - << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}"; - os << STRS[COMP_CK] << " *" << endl << t.name () << "_Servant::subscribe (" << endl << "const char *publisher_name," << endl @@ -3029,30 +2732,6 @@ namespace << STRS[COMP_ECB] << "::_nil ());" << endl << "}"; - // @@ (diego) These are not implemented. Whenever they are, - // they'll require a treatment as all the other ports above. - - os << "::Components::PublisherDescriptions *" << endl - << t.name () << "_Servant::get_all_publishers (" - << endl - << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_SNGL] << endl - << "{" - << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}"; - - os << "::Components::PublisherDescriptions *" << endl - << t.name () << "_Servant::get_named_publishers (" - << endl - << "const " << STRS[COMP_NAMES] << endl - << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IN] << "))" << endl - << "{" - << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}"; - // Generate connect() and disconnect() for each emits declaration. { Traversal::Component component_emitter; @@ -3070,39 +2749,6 @@ namespace component_emitter.traverse (t); } - os << "// Operations for CCMObject interface." << endl << endl; - - os << "CORBA::IRObject_ptr" << endl - << t.name () << "_Servant::get_component_def (" << endl - << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_SNGL] << endl - << "{" - << "ACE_THROW_RETURN (" << endl - << "::CORBA::NO_IMPLEMENT ()," << endl - << "::CORBA::IRObject::_nil ());" << endl - << "}"; - - os << "void" << endl - << t.name () - << "_Servant::configuration_complete (" << endl - << STRS[ENV_SNGL_SRC_NOTUSED] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_ICF] << "))" << endl - << "{" - << "// CIAO to-do" << endl - << "}"; - - os << "void" << endl - << t.name () << "_Servant::remove (" << endl - << STRS[ENV_SNGL_SRC_NOTUSED] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_RF] << "))" << endl - << "{" - << "// CIAO to-do" << endl - << "}"; - os << "CORBA::Object_ptr" << endl << t.name () << "_Servant::get_facet_executor (const char *name" << endl @@ -3573,9 +3219,8 @@ namespace << t.scoped_name ().scope_name () << "::CCM_" << t.name () << "_ptr exe," << endl << "::CIAO::Session_Container *c)" << endl - << ": executor_ (" << t.scoped_name ().scope_name () << "::CCM_" - << t.name () << "::_duplicate (exe))," << endl - << "container_ (c)" << endl + << " : CIAO::Home_Servant_Impl_Base (c)," << endl + << " " << "home_svnt_base (exe, c)" << endl << "{" << "}"; @@ -3772,380 +3417,6 @@ namespace home_emitter.traverse (t); } - - os << "// Operations for keyless home interface." << endl << endl; - - os << "::Components::CCMObject_ptr" << endl - << t.name () << "_Servant::create_component (" << endl - << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << "::Components::CreateFailure))" << endl - << "{" - << "return this->create (" << STRS[ENV_SNGL_ARG] << ");" << endl - << "}"; - - os << "// Operations for implicit home interface." << endl << endl; - - { - TypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "_ptr" << endl - << t.name () << "_Servant::create (" << endl - << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << "::Components::CreateFailure))" << endl - << "{" - << "if (this->executor_.in () == 0)" << endl - << "{" - << "ACE_THROW_RETURN (" << endl - << "::CORBA::INTERNAL ()," << endl; - - { - TypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "::_nil ());" << endl - << "}" - << STRS[COMP_EC] << "_var _ciao_ec =" << endl - << "this->executor_->create (" << STRS[ENV_SNGL_ARG] << ");" - << "ACE_CHECK_RETURN ("; - - { - TypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "::_nil ());" << endl; - - { - EnclosingTypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "::CCM_"; - - { - SimpleTypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "_var _ciao_comp =" << endl; - - { - EnclosingTypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "::CCM_"; - - { - SimpleTypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "::_narrow (" << endl - << "_ciao_ec.in ()" << endl - << STRS[ENV_ARG] << ");" - << "ACE_CHECK_RETURN ("; - - { - TypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "::_nil ());" << endl - << "return this->_ciao_activate_component (" << endl - << "_ciao_comp.in ()" << endl - << STRS[ENV_ARG] << ");" << endl - << "}"; - - os << "// Operations for CCMHome interface." << endl << endl; - - os << "::CORBA::IRObject_ptr" << endl - << t.name () << "_Servant::get_component_def (" << endl - << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_SNGL] << endl - << "{" - << "ACE_THROW_RETURN (" << endl - << "::CORBA::NO_IMPLEMENT ()," << endl - << "::CORBA::IRObject::_nil ());" << endl - << "}"; - - os << "::CORBA::IRObject_ptr" << endl - << t.name () << "_Servant::get_home_def (" << endl - << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_SNGL] << endl - << "{" - << "ACE_THROW_RETURN (" << endl - << "::CORBA::NO_IMPLEMENT ()," << endl - << "::CORBA::IRObject::_nil ());" << endl - << "}"; - - os << "void" << endl - << t.name () << "_Servant::remove_component (" << endl - << "::Components::CCMObject_ptr comp" << endl - << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_RF] << "))" << endl - << "{"; - - { - TypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "_var _ciao_comp =" << endl; - - { - TypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "::_narrow (" << endl - << "comp" << endl - << STRS[ENV_ARG] << ");" - << "ACE_CHECK;" << endl - << "if (CORBA::is_nil (_ciao_comp.in ()))" << endl - << "{" - << "ACE_THROW (CORBA::INTERNAL ());" << endl - << "}" - << "_ciao_comp->remove (" << STRS[ENV_SNGL_ARG] << ");" - << "ACE_CHECK;" << endl - << "this->_ciao_passivate_component (" << endl - << "_ciao_comp.in ()" << endl - << STRS[ENV_ARG] << ");" << endl - << "}"; - - os << "// CIAO-specific operations." << endl << endl; - - { - TypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "_ptr" << endl - << t.name () - << "_Servant::_ciao_activate_component (" << endl; - - { - EnclosingTypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "::CCM_"; - - { - SimpleTypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "_ptr exe" << endl - << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_SNGL] << endl - << "{" - << "::CORBA::Object_var hobj =" << endl - << "this->container_->get_objref (" << endl - << "this" << endl - << STRS[ENV_ARG] << ");" - << "ACE_CHECK_RETURN ("; - - { - TypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "::_nil ());" - << endl - << "::Components::CCMHome_var home =" << endl - << "::Components::CCMHome::_narrow (" << endl - << "hobj.in ()" << endl - << STRS[ENV_ARG] << ");" - << "ACE_CHECK_RETURN ("; - - { - TypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "::_nil ());" - << endl; - - { - SimpleTypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "_Servant *svt =" << endl - << "new "; - - { - SimpleTypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "_Servant (" - << endl - << "exe," << endl - << "home.in ()," << endl - << "this->container_);" << endl - << "PortableServer::ServantBase_var safe (svt);" - << "PortableServer::ObjectId_var oid;" << endl - << "CORBA::Object_var objref =" << endl - << "this->container_->install_component (" << endl - << "svt," << endl - << "oid.out ()" << endl - << STRS[ENV_ARG] << ");" - << "ACE_CHECK_RETURN ("; - - { - TypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "::_nil ());" - << endl; - - { - TypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "_var ho =" << endl; - - { - TypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "::_narrow (" << endl - << "objref.in ()" << endl - << STRS[ENV_ARG] << ");" - << "ACE_CHECK_RETURN ("; - - { - TypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "::_nil ());" - << endl - << "if (this->component_map_.bind (oid.in (), svt) == 0)" << endl - << "{" - << "safe._retn ();" << endl - << "}" - << "return ho._retn ();" << endl - << "}"; - - os << "void" << endl - << t.name () - << "_Servant::_ciao_passivate_component (" << endl; - - { - TypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "_ptr comp" << endl - << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_SNGL] << endl - << "{" - << "PortableServer::ObjectId_var oid;" << endl - << "this->container_->uninstall_component (" << endl - << "comp," << endl - << "oid.out ()" << endl - << STRS[ENV_ARG] << ");" - << "ACE_CHECK;" << endl; - - { - SimpleTypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (t, manages_); - } - - os << "_Servant *servant = 0;" - << endl - << "if (this->component_map_.unbind (oid.in (), servant) == 0)" - << endl - << "{" - << "PortableServer::ServantBase_var safe (servant);" << endl - << "servant->_ciao_passivate (" << STRS[ENV_SNGL_ARG] << ");" - << "ACE_CHECK;" << endl - << "}" - << "}"; } virtual void diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index ad10aa47f84..38f312f9c25 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,66 @@ +Tue Sep 14 15:02:24 2004 Jeff Parsons <j.parsons@vanderbilt.edu> + + * DAnCE/ciao/Context_Impl_Base.cpp: + * DAnCE/ciao/Context_Impl_Base.h: + * DAnCE/ciao/Context_Impl_T.cpp: + * DAnCE/ciao/Context_Impl_T.h: + * DAnCE/ciao/Home_Servant_Impl_Base.cpp: + * DAnCE/ciao/Home_Servant_Impl_Base.h: + * DAnCE/ciao/Home_Servant_Impl_T.cpp: + * DAnCE/ciao/Home_Servant_Impl_T.h: + * ciao/Context_Impl_Base.cpp: + * ciao/Context_Impl_Base.h: + * ciao/Context_Impl_T.cpp: + * ciao/Context_Impl_T.h: + * ciao/Home_Servant_Impl_Base.cpp: + * ciao/Home_Servant_Impl_Base.h: + * ciao/Home_Servant_Impl_T.cpp: + * ciao/Home_Servant_Impl_T.h: + + New files, duplicated in CIAO/ciao and + CIAO/DAnCE/ciao, containing base classes + for the CIDL-compiler-generated context + and home servant classes. A template class + sits in the hierarchy between the generated + class and its skeleton base class (in the + case of the home servant) or its executor + base (in the case of the context). The + template class also inherits from a + non-template class which is used to hold + members and operations not using any template + parameters. + + * CIDLC/ServantHeaderGenerator.cpp: + * CIDLC/ServantSourceGenerator.cpp: + * DAnCE/ciao/CCM_Core.mpc: + * DAnCE/ciao/Servant_Impl_Base.cpp: + * DAnCE/ciao/Servant_Impl_Base.h: + * DAnCE/ciao/Servant_Impl_T.cpp: + * DAnCE/ciao/Servant_Impl_T.h: + * ciao/CCM_Core.mpc: + * ciao/Servant_Impl_Base.cpp: + * ciao/Servant_Impl_Base.h: + * ciao/Servant_Impl_T.cpp: + * ciao/Servant_Impl_T.h: + + Modified existing files to correspond with the + new files described above and: + + - Added implementations for the component servant + operations provide_facet(), get_named_facets(), + get_consumer() and get_named_consumers(). + + - Added inheritance of CCMObject to the non-template + base class, to enable operations in the template + base class, which used no template parameters but + which were there only to be in the inheritance + hierarchy from skeleton to generated servant, to + be moved to the non-template base class, and + thus not be reinstantiated with every new type. + + - Moved operations from generated code to one of + the two base classes. + Mon Sep 13 13:18:33 2004 Gan Deng <gan.deng@vanderbilt.edu> * RepositoryManager/Update_Plan.h diff --git a/TAO/CIAO/DAnCE/ciao/CCM_Core.mpc b/TAO/CIAO/DAnCE/ciao/CCM_Core.mpc index 6e775812619..8384d770c0a 100644 --- a/TAO/CIAO/DAnCE/ciao/CCM_Core.mpc +++ b/TAO/CIAO/DAnCE/ciao/CCM_Core.mpc @@ -130,8 +130,10 @@ project (CIAO_DnC_Server) : orbsvcslib, portableserver, valuetype, ifr_client, u Source_Files { Container_Base.cpp NodeApplication_Impl.cpp - Server_init.cpp + Context_Impl_Base.cpp + Home_Servant_Impl_Base.cpp Servant_Impl_Base.cpp + Server_init.cpp Servant_Activator.cpp Port_Activator.cpp StandardConfigurator_Impl.cpp @@ -140,11 +142,13 @@ project (CIAO_DnC_Server) : orbsvcslib, portableserver, valuetype, ifr_client, u Header_Files { CIAO_Server_Export.h CIAO_common.h - StandardConfigurator_Impl.h } Template_Files { + Context_Impl_T.cpp + Home_Servant_Impl_T.cpp Servant_Impl_T.cpp + Servant_Activator_T.cpp } } diff --git a/TAO/CIAO/DAnCE/ciao/Context_Impl_Base.cpp b/TAO/CIAO/DAnCE/ciao/Context_Impl_Base.cpp new file mode 100644 index 00000000000..22de08b1401 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Context_Impl_Base.cpp @@ -0,0 +1,88 @@ +// $Id$ + +#include "Context_Impl_Base.h" + +namespace CIAO +{ + Context_Impl_Base::Context_Impl_Base (Components::CCMHome_ptr home, + Session_Container * c) + : home_ (Components::CCMHome::_duplicate (home)), + container_ (c) + { + } + + Context_Impl_Base::~Context_Impl_Base (void) + { + } + + // Operations from ::Components::CCMContext. + + Components::Principal_ptr + Context_Impl_Base::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 + Context_Impl_Base::get_CCM_home ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return Components::CCMHome::_duplicate (this->home_.in ()); + } + + CORBA::Boolean + Context_Impl_Base::get_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), FALSE); + } + + Components::Transaction::UserTransaction_ptr + Context_Impl_Base::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 + Context_Impl_Base::is_caller_in_role ( + const char * /* role */ + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), FALSE); + } + + void + Context_Impl_Base::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // CIAO-specific. + + CIAO::Session_Container * + Context_Impl_Base::_ciao_the_Container (void) const + { + return this->container_; + } +} + diff --git a/TAO/CIAO/DAnCE/ciao/Context_Impl_Base.h b/TAO/CIAO/DAnCE/ciao/Context_Impl_Base.h new file mode 100644 index 00000000000..f42c0306c31 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Context_Impl_Base.h @@ -0,0 +1,105 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Context_Impl_Base.h + * + * $Id$ + * + * This file contains the non-template declaration of a base class for + * the template mixin for the generated context class. + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_CONTEXT_IMPL_BASE_H +#define CIAO_CONTEXT_IMPL_BASE_H + +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_Server_Export.h" +#include "ciao/CCM_ContainerC.h" +#include "tao/Objref_VarOut_T.h" + +namespace Components +{ + class CCMHome; + typedef CCMHome *CCMHome_ptr; + + typedef + TAO_Objref_Var_T< + CCMHome + > + CCMHome_var; +} + +namespace CIAO +{ + class Session_Container; + + /** + * @class Context_Impl_Base + * + * @brief Non-template base class for Context_Impl. + * + * Holds the non-template parts of its child class + * Context_Impl. + */ + class CIAO_SERVER_Export Context_Impl_Base + : public virtual Components::CCMContext + { + public: + Context_Impl_Base (Components::CCMHome_ptr home, + Session_Container * c); + + virtual ~Context_Impl_Base (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_WITH_DEFAULTS) + 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)); + + // CIAO-specific. + + CIAO::Session_Container *_ciao_the_Container (void) const; + + protected: + Components::CCMHome_var home_; + Session_Container *container_; + }; +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_CONTEXT_IMPL_BASE_H */ diff --git a/TAO/CIAO/DAnCE/ciao/Context_Impl_T.cpp b/TAO/CIAO/DAnCE/ciao/Context_Impl_T.cpp new file mode 100644 index 00000000000..da166b8d174 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Context_Impl_T.cpp @@ -0,0 +1,66 @@ +// $Id$ + +#ifndef CIAO_CONTEXT_IMPL_T_C +#define CIAO_CONTEXT_IMPL_T_C + +#include "Context_Impl_T.h" + +namespace CIAO +{ + template <typename BASE_CTX, + typename SVNT, + typename COMP, + typename COMP_VAR> + Context_Impl<BASE_CTX, SVNT, COMP, COMP_VAR>::Context_Impl ( + Components::CCMHome_ptr home, + Session_Container *c, + SVNT *sv) + : Context_Impl_Base (home, c), + servant_ (sv) + { + } + + template <typename BASE_CTX, + typename SVNT, + typename COMP, + typename COMP_VAR> + Context_Impl<BASE_CTX, SVNT, COMP, COMP_VAR>::~Context_Impl (void) + { + } + + // Operations from ::Components::SessionContext. + + template <typename BASE_CTX, + typename SVNT, + typename COMP, + typename COMP_VAR> + CORBA::Object_ptr + Context_Impl<BASE_CTX, SVNT, COMP, COMP_VAR>::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_ = COMP::_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 COMP::_duplicate (this->component_.in ()); + } +} + +#endif /* CIAO_CONTEXT_IMPL_T_C */ diff --git a/TAO/CIAO/DAnCE/ciao/Context_Impl_T.h b/TAO/CIAO/DAnCE/ciao/Context_Impl_T.h new file mode 100644 index 00000000000..2cc2895e23f --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Context_Impl_T.h @@ -0,0 +1,103 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Context_Impl_T.h + * + * $Id$ + * + * This file contains the declaration of a mixin base class for + * the generated context class. + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_CONTEXT_IMPL_T_H +#define CIAO_CONTEXT_IMPL_T_H + +#include /**/ "ace/pre.h" + +#include "Context_Impl_Base.h" +#include "tao/LocalObject.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CORBA +{ + class SystemException; +} + +namespace SecurityLevel2 +{ + class Credentials; +} + +namespace Components +{ + typedef SecurityLevel2::Credentials Principal; + typedef Principal *Principal_ptr; + + class IllegalState; + + namespace Transaction + { + class UserTransaction; + typedef UserTransaction *UserTransaction_ptr; + } +} + +namespace CIAO +{ + class Session_Container; + + /** + * @class Context_Impl + * + * @brief Mixin base class for generated context. + * + * This class implements operations and contains parameterized + * members common to all generated servants. + */ + template <typename BASE_CTX, + typename SVNT, + typename COMP, + typename COMP_VAR> + class Context_Impl : public virtual BASE_CTX, + public virtual Context_Impl_Base, + public virtual TAO_Local_RefCounted_Object + { + public: + Context_Impl (Components::CCMHome_ptr home, + Session_Container *c, + SVNT *sv); + + virtual ~Context_Impl (void); + + // Operations from ::Components::SessionContext. + + virtual CORBA::Object_ptr + get_CCM_object (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + protected: + SVNT *servant_; + COMP_VAR component_; + }; +} + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Context_Impl_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Context_Impl_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* CIAO_CONTEXT_IMPL_T_H */ diff --git a/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.cpp b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.cpp new file mode 100644 index 00000000000..fcc6d814161 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.cpp @@ -0,0 +1,39 @@ +// $Id$ + +#include "Home_Servant_Impl_Base.h" + +namespace CIAO +{ + Home_Servant_Impl_Base::Home_Servant_Impl_Base (Session_Container * c) + : container_ (c) + { + } + + Home_Servant_Impl_Base::~Home_Servant_Impl_Base (void) + { + } + + // Operations for CCMHome interface. + + CORBA::IRObject_ptr + Home_Servant_Impl_Base::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 + Home_Servant_Impl_Base::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), + CORBA::IRObject::_nil ()); + } + +} + diff --git a/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.h b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.h new file mode 100644 index 00000000000..91a41a32226 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_Base.h @@ -0,0 +1,68 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Home_Servant_Impl_Base.h + * + * $Id$ + * + * This file contains the non-template declaration of a base class for + * the template mixin for the generated home servant class. + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_HOME_SERVANT_IMPL_BASE_H +#define CIAO_HOME_SERVANT_IMPL_BASE_H + +#include /**/ "ace/pre.h" + +#include "CCM_ComponentS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_Server_Export.h" + +namespace CIAO +{ + class Session_Container; + + /** + * @class Home_Servant_Impl_Base + * + * @brief Non-template base class for Home_Servant_Impl. + * + * Holds the non-template parts of its child class + * Home_Servant_Impl. + */ + class CIAO_SERVER_Export Home_Servant_Impl_Base + : public virtual POA_Components::CCMHome + { + public: + Home_Servant_Impl_Base (Session_Container * c); + + virtual ~Home_Servant_Impl_Base (void); + + // 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)); + + protected: + Session_Container *container_; + }; +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_HOME_SERVANT_IMPL_BASE_H */ + diff --git a/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.cpp b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.cpp new file mode 100644 index 00000000000..e12d589655d --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.cpp @@ -0,0 +1,266 @@ +// $Id$ + +#ifndef CIAO_HOME_SERVANT_IMPL_T_C +#define CIAO_HOME_SERVANT_IMPL_T_C + +#include "Home_Servant_Impl_T.h" + +namespace CIAO +{ + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename COMP, + typename COMP_VAR, + typename COMP_EXEC, + typename COMP_EXEC_VAR, + typename COMP_SVNT> + Home_Servant_Impl<BASE_SKEL, + EXEC, + EXEC_VAR, + COMP, + COMP_VAR, + COMP_EXEC, + COMP_EXEC_VAR, + COMP_SVNT>::Home_Servant_Impl ( + EXEC * exe, + Session_Container * c + ) + : Home_Servant_Impl_Base (c), + executor_ (EXEC::_duplicate (exe)) + { + } + + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename COMP, + typename COMP_VAR, + typename COMP_EXEC, + typename COMP_EXEC_VAR, + typename COMP_SVNT> + Home_Servant_Impl<BASE_SKEL, + EXEC, + EXEC_VAR, + COMP, + COMP_VAR, + COMP_EXEC, + COMP_EXEC_VAR, + COMP_SVNT>::~Home_Servant_Impl (void) + { + } + + // Operations for CCMHome interface. + + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename COMP, + typename COMP_VAR, + typename COMP_EXEC, + typename COMP_EXEC_VAR, + typename COMP_SVNT> + void + Home_Servant_Impl<BASE_SKEL, + EXEC, + EXEC_VAR, + COMP, + COMP_VAR, + COMP_EXEC, + COMP_EXEC_VAR, + COMP_SVNT>::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) + { + COMP_VAR _ciao_comp = COMP::_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); + } + + // Operations for keyless home interface. + + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename COMP, + typename COMP_VAR, + typename COMP_EXEC, + typename COMP_EXEC_VAR, + typename COMP_SVNT> + Components::CCMObject_ptr + Home_Servant_Impl<BASE_SKEL, + EXEC, + EXEC_VAR, + COMP, + COMP_VAR, + COMP_EXEC, + COMP_EXEC_VAR, + COMP_SVNT>::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. + + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename COMP, + typename COMP_VAR, + typename COMP_EXEC, + typename COMP_EXEC_VAR, + typename COMP_SVNT> + COMP * + Home_Servant_Impl<BASE_SKEL, + EXEC, + EXEC_VAR, + COMP, + COMP_VAR, + COMP_EXEC, + COMP_EXEC_VAR, + COMP_SVNT>::create ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN (CORBA::INTERNAL (), + COMP::_nil ()); + } + + ::Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (COMP::_nil ()); + + COMP_EXEC_VAR _ciao_comp = + COMP_EXEC::_narrow (_ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (COMP::_nil ()); + + return this->_ciao_activate_component (_ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // CIAO-specific operations. + + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename COMP, + typename COMP_VAR, + typename COMP_EXEC, + typename COMP_EXEC_VAR, + typename COMP_SVNT> + COMP * + Home_Servant_Impl<BASE_SKEL, + EXEC, + EXEC_VAR, + COMP, + COMP_VAR, + COMP_EXEC, + COMP_EXEC_VAR, + COMP_SVNT>::_ciao_activate_component ( + COMP_EXEC *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 (COMP::_nil ()); + + Components::CCMHome_var home = + Components::CCMHome::_narrow (hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (COMP::_nil ()); + + COMP_SVNT *svt = 0; + ACE_NEW_RETURN (svt, + COMP_SVNT (exe, + home.in (), + this->container_), + COMP::_nil ()); + + 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 (COMP::_nil ()); + + COMP_VAR ho = COMP::_narrow (objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (COMP::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename COMP, + typename COMP_VAR, + typename COMP_EXEC, + typename COMP_EXEC_VAR, + typename COMP_SVNT> + void + Home_Servant_Impl<BASE_SKEL, + EXEC, + EXEC_VAR, + COMP, + COMP_VAR, + COMP_EXEC, + COMP_EXEC_VAR, + COMP_SVNT>::_ciao_passivate_component ( + COMP *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; + + COMP_SVNT *servant = 0; + + if (this->component_map_.unbind (oid.in (), servant) == 0) + { + PortableServer::ServantBase_var safe (servant); + + servant->_ciao_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + } +} + +#endif /* CIAO_HOME_SERVANT_IMPL_T_C */ diff --git a/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.h b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.h new file mode 100644 index 00000000000..8ff3e858990 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/Home_Servant_Impl_T.h @@ -0,0 +1,120 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Home_Servant_Impl_T.h + * + * $Id$ + * + * This file contains the declaration of a mixin base class for + * the generated home servant class. + * + * @authors Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_HOME_SERVANT_IMPL_T_H +#define CIAO_HOME_SERVANT_IMPL_T_H + +#include /**/ "ace/pre.h" + +#include "Home_Servant_Impl_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Hash_Map_Manager_T.h" + +namespace CIAO +{ + class Session_Container; + + /** + * @class Home_Servant_Impl + * + * @brief Mixin base class for generated home servant. + * + * This class implements operations + * common to all generated home servants. + */ + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename COMP, + typename COMP_VAR, + typename COMP_EXEC, + typename COMP_EXEC_VAR, + typename COMP_SVNT> + class Home_Servant_Impl + : public virtual BASE_SKEL, + public virtual Home_Servant_Impl_Base, + public virtual PortableServer::RefCountServantBase + { + public: + Home_Servant_Impl (EXEC * exe, + Session_Container * c); + + virtual ~Home_Servant_Impl (void); + + // Operations for CCMHome interface. + + virtual void + remove_component (Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + // 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 COMP * + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + protected: + // CIAO-specific operations. + + COMP * + _ciao_activate_component (COMP_EXEC *exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component (COMP *comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + EXEC_VAR executor_; + + ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId, + COMP_SVNT *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; +} + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Home_Servant_Impl_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Home_Servant_Impl_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* CIAO_HOME_SERVANT_IMPL_T_H */ + diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.cpp b/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.cpp index 38976b397a3..fccbf855572 100644 --- a/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.cpp +++ b/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.cpp @@ -1,7 +1,5 @@ // $Id$ - - #include "Servant_Impl_Base.h" #include "StandardConfigurator_Impl.h" #include "Container_Base.h" @@ -17,6 +15,347 @@ namespace CIAO { } + // Operations for CCMObject interface. + + ::Components::PrimaryKeyBase * + Servant_Impl_Base::get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoKeyAvailable)) + { + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); + + return 0; + } + + CORBA::IRObject_ptr + Servant_Impl_Base::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), + CORBA::IRObject::_nil ()); + } + + void + Servant_Impl_Base::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + Servant_Impl_Base::remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) + { + // CIAO to-do + } + + ::Components::ConnectionDescriptions * + Servant_Impl_Base::get_connections ( + const char * /* name */ + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ComponentPortDescription * + Servant_Impl_Base::get_all_ports ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + OBV_Components::ComponentPortDescription *cps = 0; + ACE_NEW_RETURN (cps, + OBV_Components::ComponentPortDescription, + 0); + ::Components::ComponentPortDescription_var retv = cps; + + ::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 + Servant_Impl_Base::provide_facet ( + const char *name + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) + { + if (name == 0) + { + ACE_THROW_RETURN (Components::InvalidName (), + CORBA::Object::_nil ()); + } + + CORBA::Object_ptr retval = this->lookup_facet (name); + + if (CORBA::is_nil (retval)) + { + ACE_THROW_RETURN (Components::InvalidName (), + CORBA::Object::_nil ()); + } + + return retval; + } + + Components::FacetDescriptions * + Servant_Impl_Base::get_named_facets ( + const ::Components::NameList & names + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) + { + Components::FacetDescriptions *retval = 0; + ACE_NEW_RETURN (retval, + ::Components::FacetDescriptions, + 0); + Components::FacetDescriptions_var safe_retval = retval; + CORBA::ULong len = names.length (); + safe_retval->length (len); + ::Components::FacetDescription *tmp = 0; + + for (CORBA::ULong i = 0; i < len; ++i) + { + tmp = this->lookup_facet_description (names[i].in ()); + + if (tmp == 0) + { + ACE_THROW_RETURN (Components::InvalidName (), + 0); + } + + safe_retval[i] = tmp; + } + + return safe_retval._retn (); + } + + ::Components::FacetDescriptions * + Servant_Impl_Base::get_all_facets ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::FacetDescriptions *tmp = 0; + ACE_NEW_RETURN (tmp, + ::Components::FacetDescriptions, + 0); + + ::Components::FacetDescriptions_var retval = tmp; + + retval->length (this->facet_table_.current_size ()); + CORBA::ULong i = 0; + + for (FacetTable::iterator iter = this->facet_table_.begin (); + iter != this->facet_table_.end (); + ++iter, ++i) + { + FacetTable::ENTRY & entry = *iter; + retval[i] = entry.int_id_; + } + + return retval._retn (); + } + + ::Components::ConsumerDescriptions * + Servant_Impl_Base::get_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::ConsumerDescriptions *tmp = 0; + ACE_NEW_RETURN (tmp, + ::Components::ConsumerDescriptions, + 0); + + ::Components::ConsumerDescriptions_var retval = tmp; + + retval->length (this->consumer_table_.current_size ()); + CORBA::ULong i = 0; + + for (ConsumerTable::iterator iter = this->consumer_table_.begin (); + iter != this->consumer_table_.end (); + ++iter, ++i) + { + ConsumerTable::ENTRY & entry = *iter; + retval[i] = entry.int_id_; + } + + return retval._retn (); + } + + ::Components::EventConsumerBase_ptr + Servant_Impl_Base::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 ()); + } + + Components::EventConsumerBase_ptr retval = + this->lookup_consumer (sink_name); + + if (CORBA::is_nil (retval)) + { + ACE_THROW_RETURN (Components::InvalidName (), + Components::EventConsumerBase::_nil ()); + } + + return retval; + } + + ::Components::EventConsumerBase_ptr + Servant_Impl_Base::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 * + Servant_Impl_Base::get_named_consumers ( + const ::Components::NameList & names + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) + { + Components::ConsumerDescriptions *retval = 0; + ACE_NEW_RETURN (retval, + ::Components::ConsumerDescriptions, + 0); + Components::ConsumerDescriptions_var safe_retval = retval; + CORBA::ULong len = names.length (); + safe_retval->length (len); + ::Components::ConsumerDescription *tmp = 0; + + for (CORBA::ULong i = 0; i < len; ++i) + { + tmp = this->lookup_consumer_description (names[i].in ()); + + if (tmp == 0) + { + ACE_THROW_RETURN (Components::InvalidName (), + 0); + } + + safe_retval[i] = tmp; + } + + return safe_retval._retn (); + } + + ::Components::EmitterDescriptions * + Servant_Impl_Base::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + Servant_Impl_Base::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::ReceptacleDescriptions * + Servant_Impl_Base::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + Servant_Impl_Base::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::PublisherDescriptions * + Servant_Impl_Base::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + Servant_Impl_Base::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); + } + + /// Protected operations. + void Servant_Impl_Base::add_facet (const char *port_name, CORBA::Object_ptr port_ref) @@ -35,7 +374,7 @@ namespace CIAO safe._retn (); } } - + CORBA::Object_ptr Servant_Impl_Base::lookup_facet (const char *port_name) { @@ -48,6 +387,19 @@ namespace CIAO return CORBA::Object::_duplicate (fd.in ()->facet_ref ()); } + + ::Components::FacetDescription * + Servant_Impl_Base::lookup_facet_description (const char *port_name) + { + ::Components::FacetDescription_var fd; + + if (this->facet_table_.find (port_name, fd) != 0) + { + return 0; + } + + return fd._retn (); + } void Servant_Impl_Base::add_consumer ( @@ -84,11 +436,26 @@ namespace CIAO ::Components::EventConsumerBase::_duplicate (cd.in ()->consumer ()); } + ::Components::ConsumerDescription * + Servant_Impl_Base::lookup_consumer_description ( + const char *port_name + ) + { + ::Components::ConsumerDescription_var cd; + + if (this->consumer_table_.find (port_name, cd) != 0) + { + return 0; + } + + return cd._retn (); + } + Components::StandardConfigurator* Servant_Impl_Base::get_standard_configurator ( ACE_ENV_SINGLE_ARG_DECL) { - //create the configurator servant + // Create the configurator servant. StandardConfigurator_Impl *config_impl = 0; ACE_NEW_THROW_EX (config_impl, @@ -103,12 +470,10 @@ namespace CIAO return configurator._retn (); } - PortableServer::POA_ptr Servant_Impl_Base::_default_POA ( ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { - return PortableServer::POA::_duplicate (container_->the_POA ()); } diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.h b/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.h index f3b5a693d17..e153d865769 100644 --- a/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.h +++ b/TAO/CIAO/DAnCE/ciao/Servant_Impl_Base.h @@ -48,16 +48,116 @@ namespace CIAO virtual ~Servant_Impl_Base (void); + /// Operations for CCMObject interface. + + virtual ::Components::PrimaryKeyBase * + get_primary_key (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::NoKeyAvailable)); + + virtual CORBA::IRObject_ptr + get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + configuration_complete (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)); + + virtual void + remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + virtual ::Components::ConnectionDescriptions * + get_connections (const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::ComponentPortDescription * + get_all_ports (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Object_ptr + provide_facet (const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::FacetDescriptions * + get_named_facets (const ::Components::NameList & names + ACE_ENV_ARG_DECL) + 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::ConsumerDescriptions * + get_all_consumers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + 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::EventConsumerBase_ptr + disconnect_consumer (const char *source_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::NoConnection)); + + virtual ::Components::ConsumerDescriptions * + get_named_consumers (const ::Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::EmitterDescriptions * + get_all_emitters (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::EmitterDescriptions * + get_named_emitters (const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::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)); + + 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)); + /// Operation to set attributes on the component. virtual void set_attributes (const Components::ConfigValues &descr ACE_ENV_ARG_DECL) = 0; - //Creates and returns the StandardConfigurator for the component + // Creates and returns the StandardConfigurator for the component. virtual Components::StandardConfigurator *get_standard_configurator ( ACE_ENV_SINGLE_ARG_DECL ); - /// Override that returns the (passed-in) default POA of our member + /// Override that returns the (passed-in) default POA of our member /// component's container, to ensure that we get registered /// to that POA when _this() is called. virtual PortableServer::POA_ptr _default_POA ( @@ -69,6 +169,10 @@ namespace CIAO CORBA::Object_ptr port_ref); CORBA::Object_ptr lookup_facet (const char *port_name); + + ::Components::FacetDescription *lookup_facet_description ( + const char *port_name + ); void add_consumer (const char *port_name, ::Components::EventConsumerBase_ptr port_ref); @@ -76,6 +180,10 @@ namespace CIAO ::Components::EventConsumerBase_ptr lookup_consumer ( const char *port_name ); + + ::Components::ConsumerDescription *lookup_consumer_description ( + const char *port_name + ); protected: typedef ACE_Hash_Map_Manager_Ex<const char *, diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.cpp b/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.cpp index 7bee9698885..4e39010461f 100644 --- a/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.cpp +++ b/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.cpp @@ -48,67 +48,7 @@ namespace CIAO this->context_->_remove_ref (); } - template <typename BASE_SKEL, - typename EXEC, - typename EXEC_VAR, - typename CONTEXT> - ::Components::FacetDescriptions * - Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::get_all_facets ( - ACE_ENV_SINGLE_ARG_DECL_NOT_USED - ) - ACE_THROW_SPEC ((CORBA::SystemException)) - { - ::Components::FacetDescriptions *tmp = 0; - ACE_NEW_RETURN (tmp, - ::Components::FacetDescriptions, - 0); - - ::Components::FacetDescriptions_var retval = tmp; - - retval->length (this->facet_table_.current_size ()); - CORBA::ULong i = 0; - - for (FacetTable::iterator iter = this->facet_table_.begin (); - iter != this->facet_table_.end (); - ++iter, ++i) - { - FacetTable::ENTRY & entry = *iter; - retval[i] = entry.int_id_; - } - - return retval._retn (); - } - - template <typename BASE_SKEL, - typename EXEC, - typename EXEC_VAR, - typename CONTEXT> - ::Components::ConsumerDescriptions * - Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::get_all_consumers ( - ACE_ENV_SINGLE_ARG_DECL_NOT_USED - ) - ACE_THROW_SPEC ((CORBA::SystemException)) - { - ::Components::ConsumerDescriptions *tmp = 0; - ACE_NEW_RETURN (tmp, - ::Components::ConsumerDescriptions, - 0); - - ::Components::ConsumerDescriptions_var retval = tmp; - - retval->length (this->consumer_table_.current_size ()); - CORBA::ULong i = 0; - - for (ConsumerTable::iterator iter = this->consumer_table_.begin (); - iter != this->consumer_table_.end (); - ++iter, ++i) - { - ConsumerTable::ENTRY & entry = *iter; - retval[i] = entry.int_id_; - } - - return retval._retn (); - } + // Operations for CCMObject interface. template <typename BASE_SKEL, typename EXEC, @@ -155,67 +95,6 @@ namespace CIAO typename EXEC, typename EXEC_VAR, typename CONTEXT> - ::Components::PrimaryKeyBase * - Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::get_primary_key ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException, - ::Components::NoKeyAvailable)) - { - ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); - - return 0; - } - - template <typename BASE_SKEL, - typename EXEC, - typename EXEC_VAR, - typename CONTEXT> - ::Components::ComponentPortDescription * - Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::get_all_ports ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException)) - { - OBV_Components::ComponentPortDescription *cps = 0; - ACE_NEW_RETURN (cps, - OBV_Components::ComponentPortDescription, - 0); - ::Components::ComponentPortDescription_var retv = cps; - - ::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 (); - } - - template <typename BASE_SKEL, - typename EXEC, - typename EXEC_VAR, - typename CONTEXT> CORBA::Object_ptr Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::_get_component ( ACE_ENV_SINGLE_ARG_DECL @@ -250,7 +129,7 @@ namespace CIAO ::CORBA::Object::_nil ()); } - // CIAO-specific operations. + // CIAO-specific operations. template <typename BASE_SKEL, typename EXEC, diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.h b/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.h index 48af7435c3c..067366f003d 100644 --- a/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.h +++ b/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.h @@ -48,16 +48,11 @@ namespace CIAO public: Servant_Impl (EXEC * exe, Session_Container * c); + virtual ~Servant_Impl (void); - virtual ::Components::FacetDescriptions * - get_all_facets (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual ::Components::ConsumerDescriptions * - get_all_consumers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - + // Operations for CCMObject interface. + virtual CORBA::Boolean same_component (CORBA::Object_ptr object_ref ACE_ENV_ARG_DECL_WITH_DEFAULTS) @@ -67,20 +62,11 @@ namespace CIAO 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 ::Components::ComponentPortDescription * - get_all_ports (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - virtual CORBA::Object_ptr _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - // CIAO-specific operations. + // CIAO-specific operations. void ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) diff --git a/TAO/CIAO/ciao/CCM_Core.mpc b/TAO/CIAO/ciao/CCM_Core.mpc index 78ddc0ca40e..afb0a3458dc 100644 --- a/TAO/CIAO/ciao/CCM_Core.mpc +++ b/TAO/CIAO/ciao/CCM_Core.mpc @@ -72,7 +72,6 @@ project (CIAO_Server) : orbsvcslib, portableserver, valuetype, ifr_client, secur IDL_Files { CCM_Deployment.idl CIAO_Servers.idl -// HomeRegistrar.idl } Source_Files { @@ -84,6 +83,8 @@ project (CIAO_Server) : orbsvcslib, portableserver, valuetype, ifr_client, secur ComponentServer_Impl.cpp Container_Base.cpp Container_Impl.cpp + Context_Impl_Base.cpp + Home_Servant_Impl_Base.cpp Servant_Impl_Base.cpp Servant_Activator.cpp Port_Activator.cpp @@ -98,6 +99,8 @@ project (CIAO_Server) : orbsvcslib, portableserver, valuetype, ifr_client, secur } Template_Files { + Context_Impl_T.cpp + Home_Servant_Impl_T.cpp Object_Set_T.cpp Servant_Impl_T.cpp Servant_Activator_T.cpp diff --git a/TAO/CIAO/ciao/Context_Impl_Base.cpp b/TAO/CIAO/ciao/Context_Impl_Base.cpp new file mode 100644 index 00000000000..22de08b1401 --- /dev/null +++ b/TAO/CIAO/ciao/Context_Impl_Base.cpp @@ -0,0 +1,88 @@ +// $Id$ + +#include "Context_Impl_Base.h" + +namespace CIAO +{ + Context_Impl_Base::Context_Impl_Base (Components::CCMHome_ptr home, + Session_Container * c) + : home_ (Components::CCMHome::_duplicate (home)), + container_ (c) + { + } + + Context_Impl_Base::~Context_Impl_Base (void) + { + } + + // Operations from ::Components::CCMContext. + + Components::Principal_ptr + Context_Impl_Base::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 + Context_Impl_Base::get_CCM_home ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return Components::CCMHome::_duplicate (this->home_.in ()); + } + + CORBA::Boolean + Context_Impl_Base::get_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), FALSE); + } + + Components::Transaction::UserTransaction_ptr + Context_Impl_Base::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 + Context_Impl_Base::is_caller_in_role ( + const char * /* role */ + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), FALSE); + } + + void + Context_Impl_Base::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // CIAO-specific. + + CIAO::Session_Container * + Context_Impl_Base::_ciao_the_Container (void) const + { + return this->container_; + } +} + diff --git a/TAO/CIAO/ciao/Context_Impl_Base.h b/TAO/CIAO/ciao/Context_Impl_Base.h new file mode 100644 index 00000000000..f42c0306c31 --- /dev/null +++ b/TAO/CIAO/ciao/Context_Impl_Base.h @@ -0,0 +1,105 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Context_Impl_Base.h + * + * $Id$ + * + * This file contains the non-template declaration of a base class for + * the template mixin for the generated context class. + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_CONTEXT_IMPL_BASE_H +#define CIAO_CONTEXT_IMPL_BASE_H + +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_Server_Export.h" +#include "ciao/CCM_ContainerC.h" +#include "tao/Objref_VarOut_T.h" + +namespace Components +{ + class CCMHome; + typedef CCMHome *CCMHome_ptr; + + typedef + TAO_Objref_Var_T< + CCMHome + > + CCMHome_var; +} + +namespace CIAO +{ + class Session_Container; + + /** + * @class Context_Impl_Base + * + * @brief Non-template base class for Context_Impl. + * + * Holds the non-template parts of its child class + * Context_Impl. + */ + class CIAO_SERVER_Export Context_Impl_Base + : public virtual Components::CCMContext + { + public: + Context_Impl_Base (Components::CCMHome_ptr home, + Session_Container * c); + + virtual ~Context_Impl_Base (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_WITH_DEFAULTS) + 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)); + + // CIAO-specific. + + CIAO::Session_Container *_ciao_the_Container (void) const; + + protected: + Components::CCMHome_var home_; + Session_Container *container_; + }; +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_CONTEXT_IMPL_BASE_H */ diff --git a/TAO/CIAO/ciao/Context_Impl_T.cpp b/TAO/CIAO/ciao/Context_Impl_T.cpp new file mode 100644 index 00000000000..da166b8d174 --- /dev/null +++ b/TAO/CIAO/ciao/Context_Impl_T.cpp @@ -0,0 +1,66 @@ +// $Id$ + +#ifndef CIAO_CONTEXT_IMPL_T_C +#define CIAO_CONTEXT_IMPL_T_C + +#include "Context_Impl_T.h" + +namespace CIAO +{ + template <typename BASE_CTX, + typename SVNT, + typename COMP, + typename COMP_VAR> + Context_Impl<BASE_CTX, SVNT, COMP, COMP_VAR>::Context_Impl ( + Components::CCMHome_ptr home, + Session_Container *c, + SVNT *sv) + : Context_Impl_Base (home, c), + servant_ (sv) + { + } + + template <typename BASE_CTX, + typename SVNT, + typename COMP, + typename COMP_VAR> + Context_Impl<BASE_CTX, SVNT, COMP, COMP_VAR>::~Context_Impl (void) + { + } + + // Operations from ::Components::SessionContext. + + template <typename BASE_CTX, + typename SVNT, + typename COMP, + typename COMP_VAR> + CORBA::Object_ptr + Context_Impl<BASE_CTX, SVNT, COMP, COMP_VAR>::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_ = COMP::_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 COMP::_duplicate (this->component_.in ()); + } +} + +#endif /* CIAO_CONTEXT_IMPL_T_C */ diff --git a/TAO/CIAO/ciao/Context_Impl_T.h b/TAO/CIAO/ciao/Context_Impl_T.h new file mode 100644 index 00000000000..2cc2895e23f --- /dev/null +++ b/TAO/CIAO/ciao/Context_Impl_T.h @@ -0,0 +1,103 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Context_Impl_T.h + * + * $Id$ + * + * This file contains the declaration of a mixin base class for + * the generated context class. + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_CONTEXT_IMPL_T_H +#define CIAO_CONTEXT_IMPL_T_H + +#include /**/ "ace/pre.h" + +#include "Context_Impl_Base.h" +#include "tao/LocalObject.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CORBA +{ + class SystemException; +} + +namespace SecurityLevel2 +{ + class Credentials; +} + +namespace Components +{ + typedef SecurityLevel2::Credentials Principal; + typedef Principal *Principal_ptr; + + class IllegalState; + + namespace Transaction + { + class UserTransaction; + typedef UserTransaction *UserTransaction_ptr; + } +} + +namespace CIAO +{ + class Session_Container; + + /** + * @class Context_Impl + * + * @brief Mixin base class for generated context. + * + * This class implements operations and contains parameterized + * members common to all generated servants. + */ + template <typename BASE_CTX, + typename SVNT, + typename COMP, + typename COMP_VAR> + class Context_Impl : public virtual BASE_CTX, + public virtual Context_Impl_Base, + public virtual TAO_Local_RefCounted_Object + { + public: + Context_Impl (Components::CCMHome_ptr home, + Session_Container *c, + SVNT *sv); + + virtual ~Context_Impl (void); + + // Operations from ::Components::SessionContext. + + virtual CORBA::Object_ptr + get_CCM_object (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + protected: + SVNT *servant_; + COMP_VAR component_; + }; +} + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Context_Impl_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Context_Impl_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* CIAO_CONTEXT_IMPL_T_H */ diff --git a/TAO/CIAO/ciao/Home_Servant_Impl_Base.cpp b/TAO/CIAO/ciao/Home_Servant_Impl_Base.cpp new file mode 100644 index 00000000000..fcc6d814161 --- /dev/null +++ b/TAO/CIAO/ciao/Home_Servant_Impl_Base.cpp @@ -0,0 +1,39 @@ +// $Id$ + +#include "Home_Servant_Impl_Base.h" + +namespace CIAO +{ + Home_Servant_Impl_Base::Home_Servant_Impl_Base (Session_Container * c) + : container_ (c) + { + } + + Home_Servant_Impl_Base::~Home_Servant_Impl_Base (void) + { + } + + // Operations for CCMHome interface. + + CORBA::IRObject_ptr + Home_Servant_Impl_Base::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 + Home_Servant_Impl_Base::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), + CORBA::IRObject::_nil ()); + } + +} + diff --git a/TAO/CIAO/ciao/Home_Servant_Impl_Base.h b/TAO/CIAO/ciao/Home_Servant_Impl_Base.h new file mode 100644 index 00000000000..91a41a32226 --- /dev/null +++ b/TAO/CIAO/ciao/Home_Servant_Impl_Base.h @@ -0,0 +1,68 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Home_Servant_Impl_Base.h + * + * $Id$ + * + * This file contains the non-template declaration of a base class for + * the template mixin for the generated home servant class. + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_HOME_SERVANT_IMPL_BASE_H +#define CIAO_HOME_SERVANT_IMPL_BASE_H + +#include /**/ "ace/pre.h" + +#include "CCM_ComponentS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_Server_Export.h" + +namespace CIAO +{ + class Session_Container; + + /** + * @class Home_Servant_Impl_Base + * + * @brief Non-template base class for Home_Servant_Impl. + * + * Holds the non-template parts of its child class + * Home_Servant_Impl. + */ + class CIAO_SERVER_Export Home_Servant_Impl_Base + : public virtual POA_Components::CCMHome + { + public: + Home_Servant_Impl_Base (Session_Container * c); + + virtual ~Home_Servant_Impl_Base (void); + + // 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)); + + protected: + Session_Container *container_; + }; +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_HOME_SERVANT_IMPL_BASE_H */ + diff --git a/TAO/CIAO/ciao/Home_Servant_Impl_T.cpp b/TAO/CIAO/ciao/Home_Servant_Impl_T.cpp new file mode 100644 index 00000000000..e12d589655d --- /dev/null +++ b/TAO/CIAO/ciao/Home_Servant_Impl_T.cpp @@ -0,0 +1,266 @@ +// $Id$ + +#ifndef CIAO_HOME_SERVANT_IMPL_T_C +#define CIAO_HOME_SERVANT_IMPL_T_C + +#include "Home_Servant_Impl_T.h" + +namespace CIAO +{ + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename COMP, + typename COMP_VAR, + typename COMP_EXEC, + typename COMP_EXEC_VAR, + typename COMP_SVNT> + Home_Servant_Impl<BASE_SKEL, + EXEC, + EXEC_VAR, + COMP, + COMP_VAR, + COMP_EXEC, + COMP_EXEC_VAR, + COMP_SVNT>::Home_Servant_Impl ( + EXEC * exe, + Session_Container * c + ) + : Home_Servant_Impl_Base (c), + executor_ (EXEC::_duplicate (exe)) + { + } + + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename COMP, + typename COMP_VAR, + typename COMP_EXEC, + typename COMP_EXEC_VAR, + typename COMP_SVNT> + Home_Servant_Impl<BASE_SKEL, + EXEC, + EXEC_VAR, + COMP, + COMP_VAR, + COMP_EXEC, + COMP_EXEC_VAR, + COMP_SVNT>::~Home_Servant_Impl (void) + { + } + + // Operations for CCMHome interface. + + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename COMP, + typename COMP_VAR, + typename COMP_EXEC, + typename COMP_EXEC_VAR, + typename COMP_SVNT> + void + Home_Servant_Impl<BASE_SKEL, + EXEC, + EXEC_VAR, + COMP, + COMP_VAR, + COMP_EXEC, + COMP_EXEC_VAR, + COMP_SVNT>::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) + { + COMP_VAR _ciao_comp = COMP::_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); + } + + // Operations for keyless home interface. + + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename COMP, + typename COMP_VAR, + typename COMP_EXEC, + typename COMP_EXEC_VAR, + typename COMP_SVNT> + Components::CCMObject_ptr + Home_Servant_Impl<BASE_SKEL, + EXEC, + EXEC_VAR, + COMP, + COMP_VAR, + COMP_EXEC, + COMP_EXEC_VAR, + COMP_SVNT>::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. + + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename COMP, + typename COMP_VAR, + typename COMP_EXEC, + typename COMP_EXEC_VAR, + typename COMP_SVNT> + COMP * + Home_Servant_Impl<BASE_SKEL, + EXEC, + EXEC_VAR, + COMP, + COMP_VAR, + COMP_EXEC, + COMP_EXEC_VAR, + COMP_SVNT>::create ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN (CORBA::INTERNAL (), + COMP::_nil ()); + } + + ::Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (COMP::_nil ()); + + COMP_EXEC_VAR _ciao_comp = + COMP_EXEC::_narrow (_ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (COMP::_nil ()); + + return this->_ciao_activate_component (_ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // CIAO-specific operations. + + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename COMP, + typename COMP_VAR, + typename COMP_EXEC, + typename COMP_EXEC_VAR, + typename COMP_SVNT> + COMP * + Home_Servant_Impl<BASE_SKEL, + EXEC, + EXEC_VAR, + COMP, + COMP_VAR, + COMP_EXEC, + COMP_EXEC_VAR, + COMP_SVNT>::_ciao_activate_component ( + COMP_EXEC *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 (COMP::_nil ()); + + Components::CCMHome_var home = + Components::CCMHome::_narrow (hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (COMP::_nil ()); + + COMP_SVNT *svt = 0; + ACE_NEW_RETURN (svt, + COMP_SVNT (exe, + home.in (), + this->container_), + COMP::_nil ()); + + 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 (COMP::_nil ()); + + COMP_VAR ho = COMP::_narrow (objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (COMP::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename COMP, + typename COMP_VAR, + typename COMP_EXEC, + typename COMP_EXEC_VAR, + typename COMP_SVNT> + void + Home_Servant_Impl<BASE_SKEL, + EXEC, + EXEC_VAR, + COMP, + COMP_VAR, + COMP_EXEC, + COMP_EXEC_VAR, + COMP_SVNT>::_ciao_passivate_component ( + COMP *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; + + COMP_SVNT *servant = 0; + + if (this->component_map_.unbind (oid.in (), servant) == 0) + { + PortableServer::ServantBase_var safe (servant); + + servant->_ciao_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + } +} + +#endif /* CIAO_HOME_SERVANT_IMPL_T_C */ diff --git a/TAO/CIAO/ciao/Home_Servant_Impl_T.h b/TAO/CIAO/ciao/Home_Servant_Impl_T.h new file mode 100644 index 00000000000..8ff3e858990 --- /dev/null +++ b/TAO/CIAO/ciao/Home_Servant_Impl_T.h @@ -0,0 +1,120 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Home_Servant_Impl_T.h + * + * $Id$ + * + * This file contains the declaration of a mixin base class for + * the generated home servant class. + * + * @authors Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + + +#ifndef CIAO_HOME_SERVANT_IMPL_T_H +#define CIAO_HOME_SERVANT_IMPL_T_H + +#include /**/ "ace/pre.h" + +#include "Home_Servant_Impl_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Hash_Map_Manager_T.h" + +namespace CIAO +{ + class Session_Container; + + /** + * @class Home_Servant_Impl + * + * @brief Mixin base class for generated home servant. + * + * This class implements operations + * common to all generated home servants. + */ + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename COMP, + typename COMP_VAR, + typename COMP_EXEC, + typename COMP_EXEC_VAR, + typename COMP_SVNT> + class Home_Servant_Impl + : public virtual BASE_SKEL, + public virtual Home_Servant_Impl_Base, + public virtual PortableServer::RefCountServantBase + { + public: + Home_Servant_Impl (EXEC * exe, + Session_Container * c); + + virtual ~Home_Servant_Impl (void); + + // Operations for CCMHome interface. + + virtual void + remove_component (Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + // 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 COMP * + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + protected: + // CIAO-specific operations. + + COMP * + _ciao_activate_component (COMP_EXEC *exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component (COMP *comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + EXEC_VAR executor_; + + ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId, + COMP_SVNT *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; +} + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Home_Servant_Impl_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Home_Servant_Impl_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* CIAO_HOME_SERVANT_IMPL_T_H */ + diff --git a/TAO/CIAO/ciao/Servant_Impl_Base.cpp b/TAO/CIAO/ciao/Servant_Impl_Base.cpp index cf5ba965941..fccbf855572 100644 --- a/TAO/CIAO/ciao/Servant_Impl_Base.cpp +++ b/TAO/CIAO/ciao/Servant_Impl_Base.cpp @@ -1,7 +1,5 @@ // $Id$ - - #include "Servant_Impl_Base.h" #include "StandardConfigurator_Impl.h" #include "Container_Base.h" @@ -17,6 +15,347 @@ namespace CIAO { } + // Operations for CCMObject interface. + + ::Components::PrimaryKeyBase * + Servant_Impl_Base::get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoKeyAvailable)) + { + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); + + return 0; + } + + CORBA::IRObject_ptr + Servant_Impl_Base::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), + CORBA::IRObject::_nil ()); + } + + void + Servant_Impl_Base::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + Servant_Impl_Base::remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) + { + // CIAO to-do + } + + ::Components::ConnectionDescriptions * + Servant_Impl_Base::get_connections ( + const char * /* name */ + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ComponentPortDescription * + Servant_Impl_Base::get_all_ports ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + OBV_Components::ComponentPortDescription *cps = 0; + ACE_NEW_RETURN (cps, + OBV_Components::ComponentPortDescription, + 0); + ::Components::ComponentPortDescription_var retv = cps; + + ::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 + Servant_Impl_Base::provide_facet ( + const char *name + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) + { + if (name == 0) + { + ACE_THROW_RETURN (Components::InvalidName (), + CORBA::Object::_nil ()); + } + + CORBA::Object_ptr retval = this->lookup_facet (name); + + if (CORBA::is_nil (retval)) + { + ACE_THROW_RETURN (Components::InvalidName (), + CORBA::Object::_nil ()); + } + + return retval; + } + + Components::FacetDescriptions * + Servant_Impl_Base::get_named_facets ( + const ::Components::NameList & names + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) + { + Components::FacetDescriptions *retval = 0; + ACE_NEW_RETURN (retval, + ::Components::FacetDescriptions, + 0); + Components::FacetDescriptions_var safe_retval = retval; + CORBA::ULong len = names.length (); + safe_retval->length (len); + ::Components::FacetDescription *tmp = 0; + + for (CORBA::ULong i = 0; i < len; ++i) + { + tmp = this->lookup_facet_description (names[i].in ()); + + if (tmp == 0) + { + ACE_THROW_RETURN (Components::InvalidName (), + 0); + } + + safe_retval[i] = tmp; + } + + return safe_retval._retn (); + } + + ::Components::FacetDescriptions * + Servant_Impl_Base::get_all_facets ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::FacetDescriptions *tmp = 0; + ACE_NEW_RETURN (tmp, + ::Components::FacetDescriptions, + 0); + + ::Components::FacetDescriptions_var retval = tmp; + + retval->length (this->facet_table_.current_size ()); + CORBA::ULong i = 0; + + for (FacetTable::iterator iter = this->facet_table_.begin (); + iter != this->facet_table_.end (); + ++iter, ++i) + { + FacetTable::ENTRY & entry = *iter; + retval[i] = entry.int_id_; + } + + return retval._retn (); + } + + ::Components::ConsumerDescriptions * + Servant_Impl_Base::get_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::ConsumerDescriptions *tmp = 0; + ACE_NEW_RETURN (tmp, + ::Components::ConsumerDescriptions, + 0); + + ::Components::ConsumerDescriptions_var retval = tmp; + + retval->length (this->consumer_table_.current_size ()); + CORBA::ULong i = 0; + + for (ConsumerTable::iterator iter = this->consumer_table_.begin (); + iter != this->consumer_table_.end (); + ++iter, ++i) + { + ConsumerTable::ENTRY & entry = *iter; + retval[i] = entry.int_id_; + } + + return retval._retn (); + } + + ::Components::EventConsumerBase_ptr + Servant_Impl_Base::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 ()); + } + + Components::EventConsumerBase_ptr retval = + this->lookup_consumer (sink_name); + + if (CORBA::is_nil (retval)) + { + ACE_THROW_RETURN (Components::InvalidName (), + Components::EventConsumerBase::_nil ()); + } + + return retval; + } + + ::Components::EventConsumerBase_ptr + Servant_Impl_Base::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 * + Servant_Impl_Base::get_named_consumers ( + const ::Components::NameList & names + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) + { + Components::ConsumerDescriptions *retval = 0; + ACE_NEW_RETURN (retval, + ::Components::ConsumerDescriptions, + 0); + Components::ConsumerDescriptions_var safe_retval = retval; + CORBA::ULong len = names.length (); + safe_retval->length (len); + ::Components::ConsumerDescription *tmp = 0; + + for (CORBA::ULong i = 0; i < len; ++i) + { + tmp = this->lookup_consumer_description (names[i].in ()); + + if (tmp == 0) + { + ACE_THROW_RETURN (Components::InvalidName (), + 0); + } + + safe_retval[i] = tmp; + } + + return safe_retval._retn (); + } + + ::Components::EmitterDescriptions * + Servant_Impl_Base::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + Servant_Impl_Base::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::ReceptacleDescriptions * + Servant_Impl_Base::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + Servant_Impl_Base::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::PublisherDescriptions * + Servant_Impl_Base::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + Servant_Impl_Base::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); + } + + /// Protected operations. + void Servant_Impl_Base::add_facet (const char *port_name, CORBA::Object_ptr port_ref) @@ -48,6 +387,19 @@ namespace CIAO return CORBA::Object::_duplicate (fd.in ()->facet_ref ()); } + + ::Components::FacetDescription * + Servant_Impl_Base::lookup_facet_description (const char *port_name) + { + ::Components::FacetDescription_var fd; + + if (this->facet_table_.find (port_name, fd) != 0) + { + return 0; + } + + return fd._retn (); + } void Servant_Impl_Base::add_consumer ( @@ -84,11 +436,26 @@ namespace CIAO ::Components::EventConsumerBase::_duplicate (cd.in ()->consumer ()); } + ::Components::ConsumerDescription * + Servant_Impl_Base::lookup_consumer_description ( + const char *port_name + ) + { + ::Components::ConsumerDescription_var cd; + + if (this->consumer_table_.find (port_name, cd) != 0) + { + return 0; + } + + return cd._retn (); + } + Components::StandardConfigurator* Servant_Impl_Base::get_standard_configurator ( ACE_ENV_SINGLE_ARG_DECL) { - //create the configurator servant + // Create the configurator servant. StandardConfigurator_Impl *config_impl = 0; ACE_NEW_THROW_EX (config_impl, @@ -103,12 +470,10 @@ namespace CIAO return configurator._retn (); } - PortableServer::POA_ptr Servant_Impl_Base::_default_POA ( ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { - return PortableServer::POA::_duplicate (container_->the_POA ()); } diff --git a/TAO/CIAO/ciao/Servant_Impl_Base.h b/TAO/CIAO/ciao/Servant_Impl_Base.h index f3b5a693d17..272fa8f3d5a 100644 --- a/TAO/CIAO/ciao/Servant_Impl_Base.h +++ b/TAO/CIAO/ciao/Servant_Impl_Base.h @@ -42,22 +42,123 @@ namespace CIAO * Servant_Impl. */ class CIAO_SERVER_Export Servant_Impl_Base + : public virtual POA_Components::CCMObject { public: Servant_Impl_Base (Session_Container * c); virtual ~Servant_Impl_Base (void); + /// Operations for CCMObject interface. + + virtual ::Components::PrimaryKeyBase * + get_primary_key (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::NoKeyAvailable)); + + virtual CORBA::IRObject_ptr + get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + configuration_complete (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)); + + virtual void + remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + virtual ::Components::ConnectionDescriptions * + get_connections (const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::ComponentPortDescription * + get_all_ports (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Object_ptr + provide_facet (const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::FacetDescriptions * + get_named_facets (const ::Components::NameList & names + ACE_ENV_ARG_DECL) + 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::ConsumerDescriptions * + get_all_consumers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + 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::EventConsumerBase_ptr + disconnect_consumer (const char *source_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::NoConnection)); + + virtual ::Components::ConsumerDescriptions * + get_named_consumers (const ::Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::EmitterDescriptions * + get_all_emitters (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::EmitterDescriptions * + get_named_emitters (const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::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)); + + 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)); + /// Operation to set attributes on the component. virtual void set_attributes (const Components::ConfigValues &descr ACE_ENV_ARG_DECL) = 0; - //Creates and returns the StandardConfigurator for the component + // Creates and returns the StandardConfigurator for the component. virtual Components::StandardConfigurator *get_standard_configurator ( ACE_ENV_SINGLE_ARG_DECL ); - /// Override that returns the (passed-in) default POA of our member + /// Override that returns the (passed-in) default POA of our member /// component's container, to ensure that we get registered /// to that POA when _this() is called. virtual PortableServer::POA_ptr _default_POA ( @@ -69,6 +170,10 @@ namespace CIAO CORBA::Object_ptr port_ref); CORBA::Object_ptr lookup_facet (const char *port_name); + + ::Components::FacetDescription *lookup_facet_description ( + const char *port_name + ); void add_consumer (const char *port_name, ::Components::EventConsumerBase_ptr port_ref); @@ -76,6 +181,10 @@ namespace CIAO ::Components::EventConsumerBase_ptr lookup_consumer ( const char *port_name ); + + ::Components::ConsumerDescription *lookup_consumer_description ( + const char *port_name + ); protected: typedef ACE_Hash_Map_Manager_Ex<const char *, diff --git a/TAO/CIAO/ciao/Servant_Impl_T.cpp b/TAO/CIAO/ciao/Servant_Impl_T.cpp index 7bee9698885..4e39010461f 100644 --- a/TAO/CIAO/ciao/Servant_Impl_T.cpp +++ b/TAO/CIAO/ciao/Servant_Impl_T.cpp @@ -48,67 +48,7 @@ namespace CIAO this->context_->_remove_ref (); } - template <typename BASE_SKEL, - typename EXEC, - typename EXEC_VAR, - typename CONTEXT> - ::Components::FacetDescriptions * - Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::get_all_facets ( - ACE_ENV_SINGLE_ARG_DECL_NOT_USED - ) - ACE_THROW_SPEC ((CORBA::SystemException)) - { - ::Components::FacetDescriptions *tmp = 0; - ACE_NEW_RETURN (tmp, - ::Components::FacetDescriptions, - 0); - - ::Components::FacetDescriptions_var retval = tmp; - - retval->length (this->facet_table_.current_size ()); - CORBA::ULong i = 0; - - for (FacetTable::iterator iter = this->facet_table_.begin (); - iter != this->facet_table_.end (); - ++iter, ++i) - { - FacetTable::ENTRY & entry = *iter; - retval[i] = entry.int_id_; - } - - return retval._retn (); - } - - template <typename BASE_SKEL, - typename EXEC, - typename EXEC_VAR, - typename CONTEXT> - ::Components::ConsumerDescriptions * - Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::get_all_consumers ( - ACE_ENV_SINGLE_ARG_DECL_NOT_USED - ) - ACE_THROW_SPEC ((CORBA::SystemException)) - { - ::Components::ConsumerDescriptions *tmp = 0; - ACE_NEW_RETURN (tmp, - ::Components::ConsumerDescriptions, - 0); - - ::Components::ConsumerDescriptions_var retval = tmp; - - retval->length (this->consumer_table_.current_size ()); - CORBA::ULong i = 0; - - for (ConsumerTable::iterator iter = this->consumer_table_.begin (); - iter != this->consumer_table_.end (); - ++iter, ++i) - { - ConsumerTable::ENTRY & entry = *iter; - retval[i] = entry.int_id_; - } - - return retval._retn (); - } + // Operations for CCMObject interface. template <typename BASE_SKEL, typename EXEC, @@ -155,67 +95,6 @@ namespace CIAO typename EXEC, typename EXEC_VAR, typename CONTEXT> - ::Components::PrimaryKeyBase * - Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::get_primary_key ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException, - ::Components::NoKeyAvailable)) - { - ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); - - return 0; - } - - template <typename BASE_SKEL, - typename EXEC, - typename EXEC_VAR, - typename CONTEXT> - ::Components::ComponentPortDescription * - Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::get_all_ports ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException)) - { - OBV_Components::ComponentPortDescription *cps = 0; - ACE_NEW_RETURN (cps, - OBV_Components::ComponentPortDescription, - 0); - ::Components::ComponentPortDescription_var retv = cps; - - ::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 (); - } - - template <typename BASE_SKEL, - typename EXEC, - typename EXEC_VAR, - typename CONTEXT> CORBA::Object_ptr Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::_get_component ( ACE_ENV_SINGLE_ARG_DECL @@ -250,7 +129,7 @@ namespace CIAO ::CORBA::Object::_nil ()); } - // CIAO-specific operations. + // CIAO-specific operations. template <typename BASE_SKEL, typename EXEC, diff --git a/TAO/CIAO/ciao/Servant_Impl_T.h b/TAO/CIAO/ciao/Servant_Impl_T.h index 48af7435c3c..4bface2a5b8 100644 --- a/TAO/CIAO/ciao/Servant_Impl_T.h +++ b/TAO/CIAO/ciao/Servant_Impl_T.h @@ -43,21 +43,17 @@ namespace CIAO typename EXEC_VAR, typename CONTEXT> class Servant_Impl : public virtual BASE_SKEL, - public Servant_Impl_Base + public virtual Servant_Impl_Base, + public virtual PortableServer::RefCountServantBase { public: Servant_Impl (EXEC * exe, Session_Container * c); + virtual ~Servant_Impl (void); - virtual ::Components::FacetDescriptions * - get_all_facets (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual ::Components::ConsumerDescriptions * - get_all_consumers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - + // Operations for CCMObject interface. + virtual CORBA::Boolean same_component (CORBA::Object_ptr object_ref ACE_ENV_ARG_DECL_WITH_DEFAULTS) @@ -67,20 +63,11 @@ namespace CIAO 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 ::Components::ComponentPortDescription * - get_all_ports (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - virtual CORBA::Object_ptr _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - // CIAO-specific operations. + // CIAO-specific operations. void ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) |