diff options
author | iliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-03-07 20:46:41 +0000 |
---|---|---|
committer | iliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-03-07 20:46:41 +0000 |
commit | 272dd56bd10fa1615e354347871b06d6efe63e0a (patch) | |
tree | 8d65ae000be4cbfe9107509c972d016f21476e84 | |
parent | ba191e5916221d217401878e17062d64f0285212 (diff) | |
download | ATCD-272dd56bd10fa1615e354347871b06d6efe63e0a.tar.gz |
Merged revisions 80861-80862 via svnmerge from
https://svn.dre.vanderbilt.edu/DOC/Middleware/trunk/TAO
........
r80861 | johnnyw | 2008-03-07 07:48:34 -0600 (Fri, 07 Mar 2008) | 1 line
Fri Mar 7 13:47:30 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl>
........
r80862 | johnnyw | 2008-03-07 14:36:56 -0600 (Fri, 07 Mar 2008) | 1 line
........
24 files changed, 395 insertions, 124 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 82f823fcc45..011d178a9aa 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,43 @@ +Fri Mar 7 13:47:30 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl> + + * tao/BiDir_GIOP/BiDir_ORBInitializer.cpp: + * tao/BiDir_GIOP/BiDir_Service_Context_Handler.cpp: + * tao/BiDir_GIOP/BiDir_Service_Context_Handler.h: + * tao/BiDir_GIOP/BiDirPolicy_Validator.h: + * tao/GIOP_Message_Generator_Parser_12.cpp: + * tao/GIOP_Message_Generator_Parser_12.h: + * tao/Service_Context_Handler.cpp: + * tao/Service_Context_Handler.h: + * tao/Service_Context_Handler_Registry.cpp: + * tao/Service_Context_Handler_Registry.h: + * tao/tao.mpc: + Made the handling of service contexts pluggable. Previously + the core of TAO did know how to handle the IOP::BI_DIR_IIOP + service context. Introduced a new Service Context Handler + base class from which concrete handlers are derived, these + handlers are then registered with the service context handler + registry for a certain context id. This way the BiDIR + library handles the BiDIR service context. The future + compression support can now also be implemented without + that the core knows much about this. The next step is to + refactor the adding of the bidir service context to a message + in such a way that it is pluggable. + + * tao/GIOP_Message_Generator_Parser_10.cpp: + Check the return value of several streaming operators + + * tao/Object.{h,cpp}: + Disable the _request operation with CORBA/e + + * tao/LocalObject.{h,cpp}: + Disabled a few operations with CORBA/e + + * tao/Service_Callbacks.h: + * tao/Service_Context.cpp: + * tao/Service_Context.h: + * tao/Service_Context.inl: + Layout changes + Tue Mar 4 10:10:30 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl> * tao/ORB_Table.{h,cpp,inl}: @@ -6,6 +6,11 @@ PLANNED MAJOR CHANGES "SOMETIME IN THE FUTURE" (i.e., exact beta not known) USER VISIBLE CHANGES BETWEEN TAO-1.6.3 and TAO-1.6.4 ==================================================== +. Service Context Handling has been made pluggable + +. Improved CORBA/e support and as result the footprint decreased when + CORBA/e has been enabled + USER VISIBLE CHANGES BETWEEN TAO-1.6.2 and TAO-1.6.3 ==================================================== diff --git a/TAO/tao/BiDir_GIOP/BiDirPolicy_Validator.h b/TAO/tao/BiDir_GIOP/BiDirPolicy_Validator.h index d193638a75a..d156e161a51 100644 --- a/TAO/tao/BiDir_GIOP/BiDirPolicy_Validator.h +++ b/TAO/tao/BiDir_GIOP/BiDirPolicy_Validator.h @@ -39,7 +39,6 @@ class TAO_ORB_Core; class TAO_BiDirGIOP_Export TAO_BiDirPolicy_Validator : public TAO_Policy_Validator { public: - TAO_BiDirPolicy_Validator (TAO_ORB_Core &orb_core); virtual void validate_impl (TAO_Policy_Set &policies); diff --git a/TAO/tao/BiDir_GIOP/BiDir_ORBInitializer.cpp b/TAO/tao/BiDir_GIOP/BiDir_ORBInitializer.cpp index 572d93bfd6c..1ec6cfcbed0 100644 --- a/TAO/tao/BiDir_GIOP/BiDir_ORBInitializer.cpp +++ b/TAO/tao/BiDir_GIOP/BiDir_ORBInitializer.cpp @@ -3,8 +3,11 @@ #include "tao/BiDir_GIOP/BiDir_ORBInitializer.h" #include "tao/BiDir_GIOP/BiDir_PolicyFactory.h" #include "tao/BiDir_GIOP/BiDirGIOP.h" +#include "tao/BiDir_GIOP/BiDir_Service_Context_Handler.h" +#include "tao/PI/ORBInitInfo.h" #include "tao/ORB_Constants.h" +#include "tao/ORB_Core.h" #include "ace/CORBA_macros.h" @@ -15,9 +18,29 @@ ACE_RCSID (BiDir_GIOP, TAO_BEGIN_VERSIONED_NAMESPACE_DECL void -TAO_BiDir_ORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr) +TAO_BiDir_ORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr info) { - // + // Narrow to a TAO_ORBInitInfo object to get access to the + // orb_core() TAO extension. + TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info); + + if (CORBA::is_nil (tao_info.in ())) + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + "(%P|%t) TAO_Bidir_ORBInitializer::pre_init:\n" + "(%P|%t) Unable to narrow " + "\"PortableInterceptor::ORBInitInfo_ptr\" to\n" + "(%P|%t) \"TAO_ORBInitInfo *.\"\n")); + + throw ::CORBA::INTERNAL (); + } + + // Bind the service context handler for BiDIR GIOP + TAO_BiDIR_Service_Context_Handler* h = 0; + ACE_NEW (h, + TAO_BiDIR_Service_Context_Handler()); + tao_info->orb_core ()->service_context_registry ().bind (IOP::BI_DIR_IIOP, h); } void @@ -28,8 +51,7 @@ TAO_BiDir_ORBInitializer::post_init (PortableInterceptor::ORBInitInfo_ptr info) void TAO_BiDir_ORBInitializer::register_policy_factories ( - PortableInterceptor::ORBInitInfo_ptr info - ) + PortableInterceptor::ORBInitInfo_ptr info) { /// Register the BiDir policy factories. PortableInterceptor::PolicyFactory_ptr temp_factory = @@ -48,7 +70,6 @@ TAO_BiDir_ORBInitializer::register_policy_factories ( /// Bind the same policy factory to all BiDir related policy /// types since a single policy factory is used to create each of /// the different types of BiDir policies. - info->register_policy_factory (BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE, policy_factory.in ()); } diff --git a/TAO/tao/BiDir_GIOP/BiDir_Service_Context_Handler.cpp b/TAO/tao/BiDir_GIOP/BiDir_Service_Context_Handler.cpp new file mode 100644 index 00000000000..7f78d6da748 --- /dev/null +++ b/TAO/tao/BiDir_GIOP/BiDir_Service_Context_Handler.cpp @@ -0,0 +1,25 @@ +// $Id$ + +#include "tao/BiDir_GIOP/BiDir_Service_Context_Handler.h" + +ACE_RCSID (BiDir_GIOP, + BiDir_Service_Context_Handler, + "$Id$") + +#include "tao/CDR.h" +#include "tao/TAO_Server_Request.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +int +TAO_BiDIR_Service_Context_Handler::process_service_context ( + TAO_ServerRequest& server_request, + const IOP::ServiceContext& context) +{ + TAO_InputCDR cdr (reinterpret_cast<const char*> ( + context.context_data.get_buffer ()), + context.context_data.length ()); + return server_request.transport()->tear_listen_point_list (cdr); +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/BiDir_GIOP/BiDir_Service_Context_Handler.h b/TAO/tao/BiDir_GIOP/BiDir_Service_Context_Handler.h new file mode 100644 index 00000000000..04689ed4eb4 --- /dev/null +++ b/TAO/tao/BiDir_GIOP/BiDir_Service_Context_Handler.h @@ -0,0 +1,36 @@ +// -*- C++ -*- + +// =================================================================== +/** + * @file BiDir_Service_Context_Handler.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +// =================================================================== + +#ifndef TAO_BIDIR_SERVICE_CONTEXT_HANDLER_H +#define TAO_BIDIR_SERVICE_CONTEXT_HANDLER_H +#include /**/ "ace/pre.h" +#include "tao/BiDir_GIOP/bidirgiop_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_BiDIR_Service_Context_Handler : + public TAO_Service_Context_Handler +{ + virtual int process_service_context (TAO_ServerRequest& server_request, + const IOP::ServiceContext& context); +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* TAO_BIDIR_SERVICE_CONTEXT_HANDLER_H */ diff --git a/TAO/tao/GIOP_Message_Generator_Parser_10.cpp b/TAO/tao/GIOP_Message_Generator_Parser_10.cpp index 3d002815733..ceba1d9655c 100644 --- a/TAO/tao/GIOP_Message_Generator_Parser_10.cpp +++ b/TAO/tao/GIOP_Message_Generator_Parser_10.cpp @@ -26,10 +26,12 @@ TAO_GIOP_Message_Generator_Parser_10::write_request_header ( TAO_OutputCDR &msg) { // Write the service context list - msg << opdetails.request_service_info (); + if (!(msg << opdetails.request_service_info ())) + return false; // The request ID - msg << opdetails.request_id (); + if (!(msg << opdetails.request_id ())) + return false; CORBA::Octet const response_flags = opdetails.response_flags (); @@ -149,11 +151,13 @@ TAO_GIOP_Message_Generator_Parser_10::write_reply_header ( { // Write the service context list. #if (TAO_HAS_MINIMUM_CORBA == 1) - output << reply.service_context_notowned (); + if (!(output << reply.service_context_notowned ())) + return false; #else if (reply.is_dsi_ == false) { - output << reply.service_context_notowned (); + if (!(output << reply.service_context_notowned ())) + return false; } else { @@ -162,8 +166,7 @@ TAO_GIOP_Message_Generator_Parser_10::write_reply_header ( // force the appropriate padding. // But first we take it out any of them.. CORBA::ULong count = 0; - IOP::ServiceContextList &svc_ctx = - reply.service_context_notowned (); + IOP::ServiceContextList &svc_ctx = reply.service_context_notowned (); CORBA::ULong const l = svc_ctx.length (); CORBA::ULong i; @@ -181,7 +184,9 @@ TAO_GIOP_Message_Generator_Parser_10::write_reply_header ( ++count; // Now marshal the rest of the service context objects - output << count; + if (!(output << count)) + return false; + for (i = 0; i != l; ++i) { if (svc_ctx[i].context_id == TAO_SVC_CONTEXT_ALIGN) @@ -189,7 +194,8 @@ TAO_GIOP_Message_Generator_Parser_10::write_reply_header ( continue; } - output << svc_ctx[i]; + if (!(output << svc_ctx[i])) + return false; } } @@ -327,14 +333,12 @@ TAO_GIOP_Message_Generator_Parser_10::parse_request_header ( // Get the input CDR in the request class TAO_InputCDR & input = *request.incoming (); - IOP::ServiceContextList &service_info = - request.request_service_info (); + IOP::ServiceContextList &service_info = request.request_service_info (); - if ( ! (input >> service_info)) + if (!(input >> service_info)) return -1; - CORBA::Boolean hdr_status = - (CORBA::Boolean) input.good_bit (); + CORBA::Boolean hdr_status = (CORBA::Boolean) input.good_bit (); CORBA::ULong req_id = 0; @@ -400,8 +404,6 @@ TAO_GIOP_Message_Generator_Parser_10::parse_request_header ( return hdr_status ? 0 : -1; } - - int TAO_GIOP_Message_Generator_Parser_10::parse_locate_header ( TAO_GIOP_Locate_Request_Header &request) @@ -409,11 +411,9 @@ TAO_GIOP_Message_Generator_Parser_10::parse_locate_header ( // Get the stream TAO_InputCDR &msg = request.incoming_stream (); - CORBA::Boolean hdr_status = true; - // Get the request id CORBA::ULong req_id = 0; - hdr_status = msg.read_ulong (req_id); + CORBA::Boolean hdr_status = msg.read_ulong (req_id); // Store it in the Locate request classes request.request_id (req_id); @@ -424,15 +424,13 @@ TAO_GIOP_Message_Generator_Parser_10::parse_locate_header ( return hdr_status ? 0 : -1; } - - int TAO_GIOP_Message_Generator_Parser_10::parse_reply ( TAO_InputCDR &cdr, TAO_Pluggable_Reply_Params ¶ms) { // Read the service context list first - if ( ! (cdr >> params.svc_ctx_)) + if (!(cdr >> params.svc_ctx_)) { if (TAO_debug_level > 0) { @@ -444,8 +442,7 @@ TAO_GIOP_Message_Generator_Parser_10::parse_reply ( } // Call the base class for further processing - if (TAO_GIOP_Message_Generator_Parser::parse_reply (cdr, - params) == -1) + if (TAO_GIOP_Message_Generator_Parser::parse_reply (cdr, params) == -1) return -1; return 0; diff --git a/TAO/tao/GIOP_Message_Generator_Parser_12.cpp b/TAO/tao/GIOP_Message_Generator_Parser_12.cpp index 35b750b5ea1..1448ff7b111 100644 --- a/TAO/tao/GIOP_Message_Generator_Parser_12.cpp +++ b/TAO/tao/GIOP_Message_Generator_Parser_12.cpp @@ -30,7 +30,8 @@ TAO_GIOP_Message_Generator_Parser_12::write_request_header ( TAO_OutputCDR &msg) { // First the request id - msg << opdetails.request_id (); + if (!(msg << opdetails.request_id ())) + return false; CORBA::Octet const response_flags = opdetails.response_flags (); @@ -256,7 +257,6 @@ TAO_GIOP_Message_Generator_Parser_12::parse_request_header ( // Notice that there are no memory allocations involved // here! - request.operation (input.rd_ptr (), length - 1, 0 /* TAO_ServerRequest does NOT own string */); @@ -285,10 +285,10 @@ TAO_GIOP_Message_Generator_Parser_12::parse_request_header ( return -1; } - // Check an process if BiDir contexts are available - if (request.orb_core ()->bidir_giop_policy ()) + if (req_service_info.length() > 0) { - this->check_bidirectional_context (request); + request.orb_core ()->service_context_registry (). + process_service_contexts (request); } if (input.length () > 0) @@ -423,7 +423,7 @@ TAO_GIOP_Message_Generator_Parser_12::marshall_target_spec ( if (TAO_debug_level) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%N |%l) Unable to handle this request \n"))); + ACE_TEXT ("(%N |%l) Unable to handle this request\n"))); } return false; } @@ -432,7 +432,8 @@ TAO_GIOP_Message_Generator_Parser_12::marshall_target_spec ( case TAO_Target_Specification::Profile_Addr: { // As this is a union send in the discriminant first - msg << GIOP::ProfileAddr; + if (!(msg << GIOP::ProfileAddr)) + return false; // Get the profile const IOP::TaggedProfile *pfile = spec.profile (); @@ -440,7 +441,8 @@ TAO_GIOP_Message_Generator_Parser_12::marshall_target_spec ( if (pfile) { // Marshall in the object key - msg << *pfile; + if (!(msg << *pfile)) + return false; } else { @@ -478,7 +480,7 @@ TAO_GIOP_Message_Generator_Parser_12::marshall_target_spec ( if (TAO_debug_level) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%N |%l) Unable to handle this request \n"))); + ACE_TEXT ("(%N |%l) Unable to handle this request\n"))); } return false; } @@ -496,45 +498,6 @@ TAO_GIOP_Message_Generator_Parser_12::marshall_target_spec ( return true; } - -bool -TAO_GIOP_Message_Generator_Parser_12::check_bidirectional_context ( - TAO_ServerRequest &request) -{ - TAO_Service_Context &service_context = request.request_service_context (); - - // Check whether we have the BiDir service context info available in - // the ServiceContextList - if (service_context.is_service_id (IOP::BI_DIR_IIOP)) - { - return this->process_bidir_context (service_context, - request.transport ()); - } - - return false; -} - -bool -TAO_GIOP_Message_Generator_Parser_12::process_bidir_context ( - TAO_Service_Context &service_context, - TAO_Transport *transport) -{ - // Get the context info - IOP::ServiceContext context; - context.context_id = IOP::BI_DIR_IIOP; - - if (service_context.get_context (context) != 1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("(%P|%t) Context info not found \n")), - false); - - TAO_InputCDR cdr (reinterpret_cast<const char*> ( - context.context_data.get_buffer ()), - context.context_data.length ()); - - return transport->tear_listen_point_list (cdr); -} - size_t TAO_GIOP_Message_Generator_Parser_12::fragment_header_length (void) const { diff --git a/TAO/tao/GIOP_Message_Generator_Parser_12.h b/TAO/tao/GIOP_Message_Generator_Parser_12.h index 2ee3ab574f3..58b23b5046f 100644 --- a/TAO/tao/GIOP_Message_Generator_Parser_12.h +++ b/TAO/tao/GIOP_Message_Generator_Parser_12.h @@ -42,29 +42,24 @@ public: virtual bool write_request_header ( const TAO_Operation_Details &opdetails, TAO_Target_Specification &spec, - TAO_OutputCDR &msg - ); + TAO_OutputCDR &msg); /// Write the LocateRequest header virtual bool write_locate_request_header ( CORBA::ULong request_id, TAO_Target_Specification &spec, - TAO_OutputCDR &msg - ); + TAO_OutputCDR &msg); /// Write the reply header in to @a output virtual bool write_reply_header ( TAO_OutputCDR &output, - TAO_Pluggable_Reply_Params_Base &reply - - ); + TAO_Pluggable_Reply_Params_Base &reply); /// Writes the locate _reply message in to the @a output virtual bool write_locate_reply_mesg ( TAO_OutputCDR &output, CORBA::ULong request_id, - TAO_GIOP_Locate_Status_Msg &status - ); + TAO_GIOP_Locate_Status_Msg &status); virtual bool write_fragment_header (TAO_OutputCDR & cdr, CORBA::ULong request_id); @@ -75,9 +70,7 @@ public: /// Parse the LocateRequest Header from the incoming stream. This will do a /// version specific parsing of the incoming Request header - virtual int parse_locate_header ( - TAO_GIOP_Locate_Request_Header & - ); + virtual int parse_locate_header (TAO_GIOP_Locate_Request_Header &); /// Parse the reply message virtual int parse_reply (TAO_InputCDR &input, @@ -106,17 +99,6 @@ private: /// later than 1.2. We need to share this method bool marshall_target_spec (TAO_Target_Specification &spec, TAO_OutputCDR &msg); - - /// Check whether we have BiDirContext info available. If available - /// delegate the responsibility on to the TAO_Transport classes to - /// initiate action. - /// @note At somepoint this may be needed for future versions of - /// GIOP and we may have to share this - bool check_bidirectional_context (TAO_ServerRequest &request); - - /// Process the BiDirContext info that we have received. - bool process_bidir_context (TAO_Service_Context &, - TAO_Transport *transport); }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/LocalObject.cpp b/TAO/tao/LocalObject.cpp index 63f482cdba2..c481cb49907 100644 --- a/TAO/tao/LocalObject.cpp +++ b/TAO/tao/LocalObject.cpp @@ -90,6 +90,7 @@ CORBA::LocalObject::_non_existent (void) return false; } +#if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO) void CORBA::LocalObject::_create_request (CORBA::Context_ptr, const char *, @@ -126,7 +127,6 @@ CORBA::LocalObject::_repository_id (void) throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } -#if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO) CORBA::Object_ptr CORBA::LocalObject::_get_component (void) { diff --git a/TAO/tao/LocalObject.h b/TAO/tao/LocalObject.h index a3521486020..551e35a030d 100644 --- a/TAO/tao/LocalObject.h +++ b/TAO/tao/LocalObject.h @@ -76,7 +76,6 @@ namespace CORBA /// Throws NO_IMPLEMENT. virtual CORBA::Object_ptr _get_component (void); -#endif /// Get the repository id. virtual char * _repository_id (void); @@ -100,6 +99,7 @@ namespace CORBA /// Throws NO_IMPLEMENT. virtual CORBA::Request_ptr _request (const char * operation); +#endif #endif /* TAO_HAS_MINIMUM_CORBA */ #if (TAO_HAS_CORBA_MESSAGING == 1) diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index a801d5fea25..26ddf0edb83 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -36,6 +36,7 @@ #include "tao/Invocation_Utils.h" #include "tao/Adapter_Registry.h" #include "tao/ORB_Core_TSS_Resources.h" +#include "tao/Service_Context_Handler_Registry.h" #include "ace/Array_Map.h" #include "ace/Thread_Manager.h" @@ -200,6 +201,8 @@ public: /// yet TAO::ORBInitializer_Registry_Adapter *orbinitializer_registry (void); + TAO_Service_Context_Registry &service_context_registry (void); + /// Get the protocol factories TAO_ProtocolFactorySet *protocol_factories (void); @@ -1184,6 +1187,9 @@ protected: /// Registry containing all orb initializers TAO::ORBInitializer_Registry_Adapter *orbinitializer_registry_; + /// Registry containing all service context handlers + TAO_Service_Context_Registry service_context_registry_; + #if (TAO_HAS_INTERCEPTORS == 1) /// Cached pointer/reference to the PICurrent object. /** diff --git a/TAO/tao/ORB_Core.inl b/TAO/tao/ORB_Core.inl index 2f72d050c83..a06b2c6bff6 100644 --- a/TAO/tao/ORB_Core.inl +++ b/TAO/tao/ORB_Core.inl @@ -448,6 +448,12 @@ TAO_ORB_Core::orbinitializer_registry () return this->orbinitializer_registry_; } +ACE_INLINE TAO_Service_Context_Registry & +TAO_ORB_Core::service_context_registry (void) +{ + return this->service_context_registry_; +} + ACE_INLINE TAO::PolicyFactory_Registry_Adapter * TAO_ORB_Core::policy_factory_registry () { diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp index 90e7e73c7f9..9c434cfce12 100644 --- a/TAO/tao/Object.cpp +++ b/TAO/tao/Object.cpp @@ -444,6 +444,7 @@ CORBA::Object::_create_request (CORBA::Context_ptr ctx, } #endif +#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) CORBA::Request_ptr CORBA::Object::_request (const char *operation) { @@ -452,8 +453,7 @@ CORBA::Object::_request (const char *operation) { TAO_Dynamic_Adapter *dynamic_adapter = ACE_Dynamic_Service<TAO_Dynamic_Adapter>::instance ( - TAO_ORB_Core::dynamic_adapter_name () - ); + TAO_ORB_Core::dynamic_adapter_name ()); return dynamic_adapter->request ( this, @@ -465,6 +465,7 @@ CORBA::Object::_request (const char *operation) throw ::CORBA::NO_IMPLEMENT (); } } +#endif // NON_EXISTENT ... send a simple call to the object, which will // either elicit a false response or a OBJECT_NOT_EXIST exception. In diff --git a/TAO/tao/Object.h b/TAO/tao/Object.h index 4d4bc2be098..a68d22b866e 100644 --- a/TAO/tao/Object.h +++ b/TAO/tao/Object.h @@ -185,7 +185,6 @@ namespace CORBA CORBA::ContextList_ptr ctxtlist, CORBA::Request_ptr &request, CORBA::Flags req_flags); -#endif // The default implementation of this method uses the same simple, // multi-protocol remote invocation interface as is assumed by the @@ -194,6 +193,7 @@ namespace CORBA /// DII operation to create a request. virtual CORBA::Request_ptr _request (const char *operation); +#endif #endif /* TAO_HAS_MINIMUM_CORBA */ diff --git a/TAO/tao/Service_Callbacks.h b/TAO/tao/Service_Callbacks.h index 6f94f428b87..7fbc435152c 100644 --- a/TAO/tao/Service_Callbacks.h +++ b/TAO/tao/Service_Callbacks.h @@ -74,11 +74,11 @@ public: virtual ~TAO_Service_Callbacks (void); /// Select the profile from MProfile as the needs of the services - /// may be. Return the profile in <pfile> + /// may be. Return the profile in @a pfile virtual CORBA::Boolean select_profile (const TAO_MProfile &mprofile, TAO_Profile *&pfile); - /// Check whether <obj> is nil or not. + /// Check whether @a obj is nil or not. virtual CORBA::Boolean object_is_nil (CORBA::Object_ptr obj); @@ -90,25 +90,21 @@ public: virtual CORBA::ULong hash_ft (TAO_Profile *p, CORBA::ULong m); - // Verify if condition is given for LOCATION_FORWARD_PERM reply + /// Verify if condition is given for LOCATION_FORWARD_PERM reply virtual CORBA::Boolean is_permanent_forward_condition (const CORBA::Object_ptr obj, const TAO_Service_Context &service_context) const; - - /// Allow the service layer to decide whether the COMM_FAILURE /// exception should be thrown or a reinvocation is needed virtual TAO::Invocation_Status raise_comm_failure ( IOP::ServiceContextList &clist, - TAO_Profile *profile - ); + TAO_Profile *profile); /// Allow the service layer to decide whether the TRANSIENT /// exception should be thrown or a reinvocation is needed virtual TAO::Invocation_Status raise_transient_failure ( IOP::ServiceContextList &clist, - TAO_Profile *profile - ); + TAO_Profile *profile); }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Service_Context.cpp b/TAO/tao/Service_Context.cpp index a3b21b71162..6e9088a6f3b 100644 --- a/TAO/tao/Service_Context.cpp +++ b/TAO/tao/Service_Context.cpp @@ -212,7 +212,7 @@ TAO_Service_Context::encode (TAO_OutputCDR& cdr) const int TAO_Service_Context::decode (TAO_InputCDR& cdr) { - if ((cdr >> this->service_context_) == 0) + if (!(cdr >> this->service_context_)) { return 0; } diff --git a/TAO/tao/Service_Context.h b/TAO/tao/Service_Context.h index 0f9b90e458a..2185550a87a 100644 --- a/TAO/tao/Service_Context.h +++ b/TAO/tao/Service_Context.h @@ -122,9 +122,9 @@ public: /// Return the underlying service context list IOP::ServiceContextList &service_info (void); - // @note This method is only for backward comptiblity. We - // need to get this removed once RT folks have their service - // addition info done through this interface + /// @note This method is only for backward comptiblity. We + /// need to get this removed once RT folks have their service + /// addition info done through this interface const IOP::ServiceContextList &service_info (void) const; private: diff --git a/TAO/tao/Service_Context.inl b/TAO/tao/Service_Context.inl index 035925bb348..50dbc7c9559 100644 --- a/TAO/tao/Service_Context.inl +++ b/TAO/tao/Service_Context.inl @@ -22,20 +22,17 @@ TAO_Service_Context::service_info (void) const return this->service_context_; } - ACE_INLINE void TAO_Service_Context::set_context (IOP::ServiceId id, TAO_OutputCDR &cdr) { - this->set_context_i (id, - cdr); + this->set_context_i (id, cdr); } ACE_INLINE void TAO_Service_Context::set_context (IOP::ServiceContext &context, TAO_OutputCDR &cdr) { - this->set_context_i (context, - cdr); + this->set_context_i (context, cdr); } ACE_INLINE bool diff --git a/TAO/tao/Service_Context_Handler.cpp b/TAO/tao/Service_Context_Handler.cpp new file mode 100644 index 00000000000..90e30d2c306 --- /dev/null +++ b/TAO/tao/Service_Context_Handler.cpp @@ -0,0 +1,19 @@ +// $Id$ + +#include "tao/Service_Context_Handler.h" + +ACE_RCSID (tao, + Service_Context_Handler, + "$Id$") + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +TAO_Service_Context_Handler::TAO_Service_Context_Handler (void) +{ +} + +TAO_Service_Context_Handler::~TAO_Service_Context_Handler (void) +{ +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Service_Context_Handler.h b/TAO/tao/Service_Context_Handler.h new file mode 100644 index 00000000000..93adb979d94 --- /dev/null +++ b/TAO/tao/Service_Context_Handler.h @@ -0,0 +1,47 @@ +// -*- C++ -*- + +// =================================================================== +/** + * @file Service_Context_Handler.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +// =================================================================== + +#ifndef TAO_SERVICE_CONTEXT_HANDLER_H +#define TAO_SERVICE_CONTEXT_HANDLER_H + +#include /**/ "ace/pre.h" + +#include "tao/IOP_IORC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +class TAO_ServerRequest; + +/** + * This is the base of handler classes that each can process a certain + * service context. This way optional libraries can plugin handlers to the + * core of TAO. Each handler has to be registered in the Service Context + * Handler registry + */ +class TAO_Export TAO_Service_Context_Handler +{ + public: + TAO_Service_Context_Handler (void); + virtual int process_service_context (TAO_ServerRequest& server_request, + const IOP::ServiceContext& context) = 0; + virtual ~TAO_Service_Context_Handler (void); +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* TAO_SERVICE_CONTEXT_HANDLER_H */ diff --git a/TAO/tao/Service_Context_Handler_Registry.cpp b/TAO/tao/Service_Context_Handler_Registry.cpp new file mode 100644 index 00000000000..a39281416e6 --- /dev/null +++ b/TAO/tao/Service_Context_Handler_Registry.cpp @@ -0,0 +1,63 @@ +// $Id$ + +#include "tao/Service_Context_Handler_Registry.h" + +ACE_RCSID (tao, + Service_Context_Handler_Registry, + "$Id$") + +#include "tao/TAO_Server_Request.h" +#include "tao/Service_Context_Handler.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +int +TAO_Service_Context_Registry::process_service_contexts ( + TAO_ServerRequest& server_request) +{ + IOP::ServiceContextList &service_info = + server_request.request_service_context ().service_info (); + for (CORBA::ULong index = 0; + index != service_info.length (); + ++index) + { + IOP::ServiceContext const & context = service_info[index]; + TAO_Service_Context_Handler* const handler = registry_[context.context_id]; + if (handler) + { + return handler->process_service_context (server_request, context); + } + } + return 0; +} + +TAO_Service_Context_Registry::~TAO_Service_Context_Registry (void) +{ + for (Table::iterator x = this->registry_.begin (); + x != this->registry_.end (); + ++x) + { + delete (*x).second; + } +} + +int +TAO_Service_Context_Registry::bind ( + IOP::ServiceId id, + TAO_Service_Context_Handler* handler) +{ + value_type const value = + std::make_pair (key_type (id), data_type (handler)); + + std::pair<iterator, bool> result = this->registry_.insert (value); + + return (result.second ? 0 : 1); +} + +TAO_Service_Context_Handler* +TAO_Service_Context_Registry::operator[] (IOP::ServiceId id) +{ + return registry_[id]; +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Service_Context_Handler_Registry.h b/TAO/tao/Service_Context_Handler_Registry.h new file mode 100644 index 00000000000..f006a9801fa --- /dev/null +++ b/TAO/tao/Service_Context_Handler_Registry.h @@ -0,0 +1,66 @@ +// -*- C++ -*- + +// =================================================================== +/** + * @file Service_Context_Handler_Registry.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +// =================================================================== + +#ifndef TAO_SERVICE_CONTEXT_HANDLER_REGISTRY_H +#define TAO_SERVICE_CONTEXT_HANDLER_REGISTRY_H + +#include /**/ "ace/pre.h" + +#include "tao/IOP_IORC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Array_Map.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +class TAO_ServerRequest; +class TAO_Service_Context_Handler; + +class TAO_Export TAO_Service_Context_Registry +{ + public: + /// Destructor + + ~TAO_Service_Context_Registry (void); + + /** + * Bind a new entry in the registry + */ + int bind (IOP::ServiceId id, TAO_Service_Context_Handler* handler); + + /** + * Retrieve the entry related to @a id + */ + TAO_Service_Context_Handler* operator[] (IOP::ServiceId id); + + int process_service_contexts (TAO_ServerRequest& server_request); + + private: + typedef ACE_Array_Map<IOP::ServiceId, + TAO_Service_Context_Handler*> Table; + typedef Table::key_type key_type; + typedef Table::data_type data_type; + typedef Table::value_type value_type; + typedef Table::size_type size_type; + typedef value_type * iterator; + + Table registry_; +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* TAO_SERVICE_CONTEXT_HANDLER_REGISTRY_H */ diff --git a/TAO/tao/tao.mpc b/TAO/tao/tao.mpc index aa43ae596e0..303e2b2a4fa 100644 --- a/TAO/tao/tao.mpc +++ b/TAO/tao/tao.mpc @@ -192,6 +192,8 @@ project(TAO) : acelib, install, tao_output, taodefaults, pidl, extra_core, tao_v ServerRequestInterceptor_Adapter_Factory.cpp Service_Callbacks.cpp Service_Context.cpp + Service_Context_Handler.cpp + Service_Context_Handler_Registry.cpp Services_Activate.cpp ServicesC.cpp ShortSeqC.cpp @@ -422,7 +424,7 @@ project(TAO) : acelib, install, tao_output, taodefaults, pidl, extra_core, tao_v Object_T.h Object_Reference_Sequence_Element_T.h Object_Reference_Const_Sequence_Element_T.h - Objref_VarOut_T.h + Objref_VarOut_T.h Object_Reference_Traits_Base_T.h Object_Reference_Traits_T.h OctetSeqC.h |