From 8b32ac334bb90ba9be35311e27049248c66ea967 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Thu, 19 Mar 2009 15:16:15 +0000 Subject: Thu Mar 19 15:16:22 UTC 2009 Johnny Willemsen * tao/MProfile.cpp: Const change * tao/Profile.cpp: Layout change * tao/ZIOP/ZIOP_ORBInitializer.cpp: * tao/ZIOP/ZIOP_Service_Context_Handler.cpp: * tao/ZIOP/ZIOP_Service_Context_Handler.h: Added a ZIOP sc handler that transfers the ZIOP enabled and idlevellist policy from the client to the server. These are transmitted through the Messaging Invocation Policies which aren't supported yet by TAO. We have to make some changes to the core and pluggable transports to make all reply and request service contexts available on all places. * tao/Makefile.am: Added new files --- TAO/ChangeLog | 27 +++++- TAO/tao/MProfile.cpp | 4 +- TAO/tao/Makefile.am | 2 + TAO/tao/Profile.cpp | 3 +- TAO/tao/ZIOP/ZIOP_ORBInitializer.cpp | 7 ++ TAO/tao/ZIOP/ZIOP_Service_Context_Handler.cpp | 123 ++++++++++++++++++++++++++ TAO/tao/ZIOP/ZIOP_Service_Context_Handler.h | 43 +++++++++ 7 files changed, 202 insertions(+), 7 deletions(-) create mode 100644 TAO/tao/ZIOP/ZIOP_Service_Context_Handler.cpp create mode 100644 TAO/tao/ZIOP/ZIOP_Service_Context_Handler.h diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 0ea970ea709..018d5ab553a 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,10 +1,31 @@ +Thu Mar 19 15:16:22 UTC 2009 Johnny Willemsen + + * tao/MProfile.cpp: + Const change + + * tao/Profile.cpp: + Layout change + + * tao/ZIOP/ZIOP_ORBInitializer.cpp: + * tao/ZIOP/ZIOP_Service_Context_Handler.cpp: + * tao/ZIOP/ZIOP_Service_Context_Handler.h: + Added a ZIOP sc handler that transfers the ZIOP enabled and + idlevellist policy from the client to the server. These + are transmitted through the Messaging Invocation Policies which + aren't supported yet by TAO. We have to make some changes to + the core and pluggable transports to make all reply and + request service contexts available on all places. + + * tao/Makefile.am: + Added new files + Thu Mar 19 13:49:23 UTC 2009 Phil Mesnier * configure.ac: * orbsvcs/tests/Notify/Makefile.am: Add new build to the automake files. - + * orbsvcs/tests/Notify/Validate_Client/Makefile.am: * orbsvcs/tests/Notify/Validate_Client/README: * orbsvcs/tests/Notify/Validate_Client/Validate_Client.mpc: @@ -16,7 +37,7 @@ Thu Mar 19 13:49:23 UTC 2009 Phil Mesnier should ensure that the validator feature will actually get a OBJECT_NOT_EXIST exception rather than time out trying to resolve an unknown hostname. - + The problem with this test was the original source persistence file contained proxy references that were unresolvable, and so on some hosts, it took longer than the timeout period to fail to @@ -25,7 +46,7 @@ Thu Mar 19 13:49:23 UTC 2009 Phil Mesnier busy. Thus the proxy would not be reaped, and the persistence file would end up with proxy references, causing the test to fail. - + * orbsvcs/tests/Notify/Validate_Client/persistency_copy: Removed this file, the source data file is generated now. diff --git a/TAO/tao/MProfile.cpp b/TAO/tao/MProfile.cpp index 352ffc47871..c4c763c7f6c 100644 --- a/TAO/tao/MProfile.cpp +++ b/TAO/tao/MProfile.cpp @@ -201,7 +201,7 @@ TAO_MProfile::add_profiles (TAO_MProfile *pfiles) { // this->size_ == total number of profiles we can hold // this->last_ == the index of the last profile - CORBA::ULong space = this->size_ - this->last_; + CORBA::ULong const space = this->size_ - this->last_; if (space < pfiles->last_) { @@ -364,7 +364,7 @@ TAO_MProfile::give_shared_profile (TAO_Profile *pfile) pfile->_decr_refcnt(); return i; } - return this->give_profile(pfile,0); + return this->give_profile(pfile, 0); } diff --git a/TAO/tao/Makefile.am b/TAO/tao/Makefile.am index 09e5a3f1074..dd2983c525e 100644 --- a/TAO/tao/Makefile.am +++ b/TAO/tao/Makefile.am @@ -6537,6 +6537,7 @@ libTAO_ZIOP_la_SOURCES = \ ZIOP/ZIOP_ORBInitializer.cpp \ ZIOP/ZIOP_PolicyFactory.cpp \ ZIOP/ZIOP_Policy_Validator.cpp \ + ZIOP/ZIOP_Service_Context_Handler.cpp \ ZIOP/ZIOP_Policy_i.cpp \ ZIOP/ZIOP_Stub.cpp \ ZIOP/ZIOP_Stub_Factory.cpp @@ -6562,6 +6563,7 @@ nobase_include_HEADERS += \ ZIOP/ZIOP_PolicyFactory.h \ ZIOP/ZIOP_Policy_Validator.h \ ZIOP/ZIOP_Policy_i.h \ + ZIOP/ZIOP_Service_Context_Handler.h \ ZIOP/ZIOP_Stub.h \ ZIOP/ZIOP_Stub_Factory.h \ ZIOP/ziop_export.h diff --git a/TAO/tao/Profile.cpp b/TAO/tao/Profile.cpp index 8fd26b564d3..7edcce46ee9 100644 --- a/TAO/tao/Profile.cpp +++ b/TAO/tao/Profile.cpp @@ -313,8 +313,7 @@ TAO_Profile::set_tagged_components (TAO_OutputCDR &out_cdr) IOP::TaggedComponent tagged_component; tagged_component.tag = TAO_TAG_ENDPOINTS; tagged_component.component_data.length (length); - CORBA::Octet *buf = - tagged_component.component_data.get_buffer (); + CORBA::Octet *buf = tagged_component.component_data.get_buffer (); for (const ACE_Message_Block *iterator = out_cdr.begin (); iterator != 0; diff --git a/TAO/tao/ZIOP/ZIOP_ORBInitializer.cpp b/TAO/tao/ZIOP/ZIOP_ORBInitializer.cpp index 0865acd51e3..10318cf9ab7 100644 --- a/TAO/tao/ZIOP/ZIOP_ORBInitializer.cpp +++ b/TAO/tao/ZIOP/ZIOP_ORBInitializer.cpp @@ -7,6 +7,7 @@ #include "tao/ZIOP/ZIOP.h" #include "tao/ZIOP/ZIOP_Stub_Factory.h" #include "tao/ZIOP/ZIOP_PolicyFactory.h" +#include "tao/ZIOP/ZIOP_Service_Context_Handler.h" #include "tao/ORB_Core.h" #include "tao/PI/ORBInitInfo.h" @@ -43,6 +44,12 @@ TAO_ZIOP_ORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr info) // Set the name of the stub factory to be ZIOP_Stub_Factory. tao_info->orb_core ()->orb_params ()->stub_factory_name ("ZIOP_Stub_Factory"); ACE_Service_Config::process_directive (ace_svc_desc_TAO_ZIOP_Stub_Factory); + + // Bind the service context handler for RTCORBA + TAO_ZIOP_Service_Context_Handler* h = 0; + ACE_NEW (h, + TAO_ZIOP_Service_Context_Handler()); + tao_info->orb_core ()->service_context_registry ().bind (IOP::INVOCATION_POLICIES, h); } void diff --git a/TAO/tao/ZIOP/ZIOP_Service_Context_Handler.cpp b/TAO/tao/ZIOP/ZIOP_Service_Context_Handler.cpp new file mode 100644 index 00000000000..558aad84071 --- /dev/null +++ b/TAO/tao/ZIOP/ZIOP_Service_Context_Handler.cpp @@ -0,0 +1,123 @@ +// $Id$ + +#include "tao/ZIOP/ZIOP_Service_Context_Handler.h" + +ACE_RCSID (ZIOP, + ZIOP_Service_Context_Handler, + "$Id$") + +#include "tao/CDR.h" +#include "tao/Transport.h" +#include "tao/ORB_Core.h" +#include "tao/GIOP_Message_Base.h" +#include "tao/operation_details.h" +#include "tao/Stub.h" +#include "tao/ZIOP/ZIOP_Policy_i.h" +#include "tao/Messaging_PolicyValueC.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +int +TAO_ZIOP_Service_Context_Handler::process_service_context ( + TAO_Transport&, + const IOP::ServiceContext &) +{ + return 0; +} + +int +TAO_ZIOP_Service_Context_Handler::generate_service_context ( + TAO_Stub *stub, + TAO_Transport&, + TAO_Operation_Details &opdetails, + TAO_Target_Specification &, + TAO_OutputCDR &) +{ + if (stub) + { + CORBA::Policy_var idpolicy = + stub->get_cached_policy (TAO_CACHED_COMPRESSION_ID_LEVEL_LIST_POLICY); + + CORBA::Policy_var enabledpolicy = + stub->get_cached_policy (TAO_CACHED_COMPRESSION_ENABLING_POLICY); + + ::ZIOP::CompressorIdLevelListPolicy_var idpolicyp = + ::ZIOP::CompressorIdLevelListPolicy::_narrow (idpolicy.in ()); + + ::ZIOP::CompressionEnablingPolicy_var enabledpolicyp = + ::ZIOP::CompressionEnablingPolicy::_narrow (enabledpolicy.in ()); + + Messaging::PolicyValueSeq policy_value_seq; + policy_value_seq.length (0); + TAO_OutputCDR out_CDR; + CORBA::ULong i = 0; + size_t length = 0; + + if (!CORBA::is_nil (idpolicyp.in ())) + { + policy_value_seq.length (i + 1); + policy_value_seq[i].ptype = idpolicyp->policy_type (); + + if (!(out_CDR << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))) + return 0; + + if (!(idpolicyp->_tao_encode (out_CDR))) + return 0; + + length = out_CDR.total_length (); + policy_value_seq[i].pvalue.length (static_cast (length)); + CORBA::Octet *buf = policy_value_seq[i].pvalue.get_buffer (); + + // Copy the CDR buffer data into the octet sequence buffer. + for (const ACE_Message_Block *iterator = out_CDR.begin (); + iterator != 0; + iterator = iterator->cont ()) + { + ACE_OS::memcpy (buf, iterator->rd_ptr (), iterator->length ()); + buf += iterator->length (); + } + ++i; + } + if (!CORBA::is_nil (enabledpolicyp.in ())) + { + policy_value_seq.length (i + 1); + policy_value_seq[i].ptype = enabledpolicyp->policy_type (); + + if (!(out_CDR << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))) + return 0; + + if (!(enabledpolicyp->_tao_encode (out_CDR))) + return 0; + + length = out_CDR.total_length (); + policy_value_seq[i].pvalue.length (static_cast (length)); + CORBA::Octet *buf = policy_value_seq[i].pvalue.get_buffer (); + + // Copy the CDR buffer data into the octet sequence buffer. + for (const ACE_Message_Block *iterator = out_CDR.begin (); + iterator != 0; + iterator = iterator->cont ()) + { + ACE_OS::memcpy (buf, iterator->rd_ptr (), iterator->length ()); + buf += iterator->length (); + } + ++i; + } + + if (policy_value_seq.length () > 0) + { + TAO_OutputCDR out_cdr; + if (!(out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))) + return 0; + + if (!(out_cdr << policy_value_seq)) + return 0; + + opdetails.request_service_context ().set_context (IOP::INVOCATION_POLICIES, out_cdr); + } + } + + return 0; +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/ZIOP/ZIOP_Service_Context_Handler.h b/TAO/tao/ZIOP/ZIOP_Service_Context_Handler.h new file mode 100644 index 00000000000..c7976263aa3 --- /dev/null +++ b/TAO/tao/ZIOP/ZIOP_Service_Context_Handler.h @@ -0,0 +1,43 @@ +// -*- C++ -*- + +// =================================================================== +/** + * @file ZIOP_Service_Context_Handler.h + * + * $Id$ + * + * @author Johnny Willemsen + */ +// =================================================================== + +#ifndef TAO_ZIOP_SERVICE_CONTEXT_HANDLER_H +#define TAO_ZIOP_SERVICE_CONTEXT_HANDLER_H +#include /**/ "ace/pre.h" +#include "tao/ZIOP/ziop_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/Service_Context_Handler.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +class TAO_ZIOP_Service_Context_Handler : + public TAO_Service_Context_Handler +{ +public: + virtual int process_service_context (TAO_Transport& transport, + const IOP::ServiceContext& context); + virtual int generate_service_context ( + TAO_Stub *stub, + TAO_Transport &transport, + TAO_Operation_Details &opdetails, + TAO_Target_Specification &spec, + TAO_OutputCDR &msg); +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* TAO_ZIOP_SERVICE_CONTEXT_HANDLER_H */ -- cgit v1.2.1