diff options
author | gokhale <asgokhale@users.noreply.github.com> | 1998-05-08 21:56:45 +0000 |
---|---|---|
committer | gokhale <asgokhale@users.noreply.github.com> | 1998-05-08 21:56:45 +0000 |
commit | f148fc1a571e937c9c91b8b43ceba5558234b54d (patch) | |
tree | 4939dd9df46dc3d86af5868160328a2a70bc7728 /TAO | |
parent | 3e526db466c97cd92167d6f44456a798d83c9acf (diff) | |
download | ATCD-f148fc1a571e937c9c91b8b43ceba5558234b54d.tar.gz |
*** empty log message ***
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/ChangeLog-98c | 57 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_exception.cpp | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_exception.cpp | 1 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface.cpp | 4 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_operation.cpp | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/Naming_Service/Naming_Service.cpp | 8 | ||||
-rw-r--r-- | TAO/tao/Connect.cpp | 103 | ||||
-rw-r--r-- | TAO/tao/POAC.h | 10 | ||||
-rw-r--r-- | TAO/tao/PolicyC.h | 2 | ||||
-rw-r--r-- | TAO/tao/Servant_Base.cpp | 8 | ||||
-rw-r--r-- | TAO/tao/Servant_Base.h | 3 | ||||
-rw-r--r-- | TAO/tao/Server_Request.cpp | 99 | ||||
-rw-r--r-- | TAO/tao/Server_Request.h | 31 |
13 files changed, 191 insertions, 139 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c index 22b299400ba..f5ea605d6c4 100644 --- a/TAO/ChangeLog-98c +++ b/TAO/ChangeLog-98c @@ -1,3 +1,58 @@ +Fri May 8 16:32:55 1998 Aniruddha Gokhale <gokhale@mambo.cs.wustl.edu> + + * TAO_IDL/be/be_exception.cpp: In the typecode generation, we were + incorrectly generating the byte order flag as 0 meaning big + endian. This is now changed to TAO_ENCAP_BYTE_ORDER. + + * TAO_IDL/be/be_visitor_exception.cpp: A spurious "return 0;" + statement in the middle of the code led to generation of empty + code for exception constructors. + + * TAO_IDL/be/be_visitor_interface.cpp: Added the "ACE_CORBA_1" + macro to the generated code so that MSVC++4.2 will be able to + parse the generated code. + + * orbsvcs/orbsvcs/Naming_Service/Naming_Service.cpp: We were + passing a variable of type ORB_var to a method expecting an + ORB_ptr. g++ was not too happy with this. So now we use the in () + method on the _var variable. + + * tao/Connect.cpp: Removed a large segment of commented-out code + which I had kept to remind me to use it to handle the DSI + case. See the log entry for Server_Request.{h,cpp}. + + * tao/{POAC, PolicyC}.h: Used the ACE_CORBA_1 macro when the + classes inherit from CORBA::Object. MSVC++4.2 was not too happy + with CORBA::Object. It needed CORBA_Object. + + * tao/ServantBase.h: Removed the Environment parameter from the + invoke method of TAO_DynamicImplementation class. This was + suggested by Irfan. + + * tao/Servant_Base.cpp: (invoke): Added code after the invoke to + the DSI implementation is made. This code creates a REPLY message + and then uses the dsi_marshal method (described below) to marshal + outgoing parameters. These methods are called only if the request + was 2 way. + + * tao/Server_Request.{h, cpp}: Several changes made + + Added a data member that indicates if the request was oneway or + twoway. This is used by the DSI when it has to decide if a reply + message must be constructed or not. + + Changed the is_user_exception_ data member to + exception_type_. This now explicitly tells us if it was a + GIOP_USER_EXCEPTION or a GIOP_SYSTEM_EXCEPTION or + GIOP_NO_EXCEPTION. This change was required because we faced a + situation in which we not only needed to know if the exception was + a user or a system exception but we wnated to know if there was an + exception itself or not. So a boolean variable was not sufficient + for this. + + Added a new method called "dsi_marshal". This is used by the DSI + to marshal the outgoing parameters. + Thu May 07 19:14:16 1998 Douglas C. Schmidt <schmidt@cs.wustl.edu> * TAO version 0.1.19 released. @@ -6,7 +61,7 @@ Thu May 07 17:55:07 1998 Nanbor Wang <nanbor@cs.wustl.edu> * TAO/orbsvcs/orbsvcs/orbsvcs.dsp: * TAO/orbsvcs/tests/Logger/server.dsp: Updated. Thanks to Carlos' - instruction on how to make the change. + instruction on how to make the change. Thu May 7 16:11:00 1998 Robert Eric Thornton <ret1@cec.wustl.edu> diff --git a/TAO/TAO_IDL/be/be_exception.cpp b/TAO/TAO_IDL/be/be_exception.cpp index b8eb55018d1..e47b3401b6f 100644 --- a/TAO/TAO_IDL/be/be_exception.cpp +++ b/TAO/TAO_IDL/be/be_exception.cpp @@ -447,7 +447,7 @@ be_exception::gen_encapsulation (void) // XXXASG - byte order must be based on what m/c we are generating code - // TODO - *cs << "0, // byte order" << nl; + *cs << "TAO_ENCAP_BYTE_ORDER, // byte order" << nl; // generate repoID *cs << (ACE_OS::strlen (this->repoID ())+1) << ", "; (void)this->tc_name2long (this->repoID (), arr, arrlen); diff --git a/TAO/TAO_IDL/be/be_visitor_exception.cpp b/TAO/TAO_IDL/be/be_visitor_exception.cpp index 81d83deaba4..068632562c2 100644 --- a/TAO/TAO_IDL/be/be_visitor_exception.cpp +++ b/TAO/TAO_IDL/be/be_visitor_exception.cpp @@ -924,7 +924,6 @@ int be_visitor_exception_ctor_assign::visit_predefined_type (be_predefined_type be_decl *bd = this->ctx_->node (); os->indent (); - return 0; // check if the type is an any if (node->pt () == AST_PredefinedType::PT_any) { diff --git a/TAO/TAO_IDL/be/be_visitor_interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface.cpp index 110ded0cf10..c87706de243 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface.cpp @@ -676,7 +676,9 @@ be_visitor_interface_ch::visit_interface (be_interface *node) { // we do not inherit from anybody, hence we do so from the base // CORBA::Object class - *os << " : public virtual CORBA::Object" << be_nl; + // Generate code that uses the macro. This is required to deal with + // the MSVC++ insanity + *os << " : public virtual ACE_CORBA_1 (Object)" << be_nl; } // generate the body diff --git a/TAO/TAO_IDL/be/be_visitor_operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation.cpp index 3f0d5b556af..74cf3242159 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation.cpp @@ -1009,7 +1009,7 @@ be_visitor_operation_ss::visit_operation (be_operation *node) // check if we are oneway in which case, we are done if (node->flags () == AST_Operation::OP_oneway) { - // we are done. Nothing else to do, except closing the funciton body. + // we are done. Nothing else to do, except closing the function body. os->decr_indent (); *os << "}\n\n"; return 0; diff --git a/TAO/orbsvcs/Naming_Service/Naming_Service.cpp b/TAO/orbsvcs/Naming_Service/Naming_Service.cpp index f6f4fac0982..57180f6502d 100644 --- a/TAO/orbsvcs/Naming_Service/Naming_Service.cpp +++ b/TAO/orbsvcs/Naming_Service/Naming_Service.cpp @@ -87,11 +87,11 @@ Naming_Service::init (int argc, "child_poa", TAO_TRY_ENV); TAO_CHECK_ENV; - + orb = this->orb_manager_.orb (); child_poa = this->orb_manager_.child_poa (); - - result = this->my_naming_server_.init (orb, + + result = this->my_naming_server_.init (orb.in (), child_poa, argc, argv); @@ -112,7 +112,7 @@ Naming_Service::init (int argc, if (result < 0) return result; - if (this->ior_output_file_ != 0) + if (this->ior_output_file_ != 0) { CORBA::String_var str = this->my_naming_server_.naming_service_ior (); diff --git a/TAO/tao/Connect.cpp b/TAO/tao/Connect.cpp index dfd1024f90d..9369988d89b 100644 --- a/TAO/tao/Connect.cpp +++ b/TAO/tao/Connect.cpp @@ -275,109 +275,6 @@ TAO_Server_Connection_Handler::handle_request (const TAO_GIOP_RequestHeader &hdr svr_req, 0, // this is SunSoft IIOP residue env); - -#if 0 - // @@ (ASG) - this commented out code must remain here since the DSI will use - // it. Please keep it here until I have figured out the best way out 03/22/98. - - // If no reply is necessary (i.e., oneway), then return! - if (hdr.response_expected == 0) - return; - - // Otherwise check for correct parameter handling, and reply as - // appropriate. - // - // NOTE: if "env" is set, it takes precedence over exceptions - // reported using the mechanism of the ServerRequest. Only system - // exceptions are reported that way ... - // - // XXX Exception reporting is ambiguous; it can be cleaner than - // this. With both language-mapped and dynamic/explicit reporting - // mechanisms, one of must be tested "first" ... so an exception - // reported using the other mechanism could be "lost". Perhaps only - // the language mapped one should be used for system exceptions. - - TAO_GIOP::start_message (TAO_GIOP_Reply, response); - TAO_GIOP_ServiceContextList resp_ctx; - resp_ctx.length (0); - response.encode (TC_ServiceContextList, - &resp_ctx, - 0, - env); - response.write_ulong (hdr.request_id); - - CORBA::TypeCode_ptr tc; - const void *value; - - if (!svr_req.params_ && env.exception () == 0) - { - dmsg ("DSI user error, didn't supply params"); - env.exception (new CORBA::BAD_INV_ORDER (CORBA::COMPLETED_NO)); - } - - // Standard exceptions only. - if (env.exception () != 0) - { - CORBA::Environment env2; - CORBA::Exception *x = env.exception (); - CORBA::TypeCode_ptr except_tc = x->type (); - - response.write_ulong (TAO_GIOP_SYSTEM_EXCEPTION); - (void) response.encode (except_tc, x, 0, env2); - } - - // Any exception at all. - else if (svr_req.exception_) - { - CORBA::Exception *x; - CORBA::TypeCode_ptr except_tc; - - x = (CORBA::Exception *) svr_req.exception_->value (); - except_tc = svr_req.exception_->type (); - - // Finish the GIOP Reply header, then marshal the exception. - // - // XXX x->type () someday ... - if (svr_req.ex_type_ == CORBA::SYSTEM_EXCEPTION) - response.write_ulong (TAO_GIOP_SYSTEM_EXCEPTION); - else - response.write_ulong (TAO_GIOP_USER_EXCEPTION); - - (void) response.encode (except_tc, x, 0, env); - } - - // Normal reply. - else - { - // First finish the GIOP header ... - response.write_ulong (TAO_GIOP_NO_EXCEPTION); - - // ... then send any return value ... - if (svr_req.retval_) - { - tc = svr_req.retval_->type (); - value = svr_req.retval_->value (); - (void) response.encode (tc, value, 0, env); - } - - // ... Followed by "inout" and "out" parameters, left to right - for (u_int i = 0; - i < svr_req.params_->count (); - i++) - { - CORBA::NamedValue_ptr nv = svr_req.params_->item (i, env); - CORBA::Any_ptr any; - - if (!(nv->flags () & (CORBA::ARG_INOUT|CORBA::ARG_OUT))) - continue; - - any = nv->value (); - tc = any->type (); - value = any->value (); - (void) response.encode (tc, value, 0, env); - } - } -#endif /* 0 */ } void diff --git a/TAO/tao/POAC.h b/TAO/tao/POAC.h index 95ff6546480..f5377abd7b8 100644 --- a/TAO/tao/POAC.h +++ b/TAO/tao/POAC.h @@ -112,7 +112,7 @@ class CurrentBase; #if !defined (_PORTABLESERVER_CURRENTBASE_CH_) #define _PORTABLESERVER_CURRENTBASE_CH_ - class TAO_Export CurrentBase: public virtual CORBA::Object + class TAO_Export CurrentBase: public virtual ACE_CORBA_1 (Object) { public: // the static operations @@ -1132,7 +1132,7 @@ class POAManager; #if !defined (_PORTABLESERVER_POAMANAGER_CH_) #define _PORTABLESERVER_POAMANAGER_CH_ - class TAO_Export POAManager: public virtual CORBA::Object + class TAO_Export POAManager: public virtual ACE_CORBA_1 (Object) { public: // the static operations @@ -1260,7 +1260,7 @@ class AdapterActivator; #if !defined (_PORTABLESERVER_ADAPTERACTIVATOR_CH_) #define _PORTABLESERVER_ADAPTERACTIVATOR_CH_ - class TAO_Export AdapterActivator: public virtual CORBA::Object + class TAO_Export AdapterActivator: public virtual ACE_CORBA_1 (Object) { public: // the static operations @@ -1358,7 +1358,7 @@ class ServantManager; #if !defined (_PORTABLESERVER_SERVANTMANAGER_CH_) #define _PORTABLESERVER_SERVANTMANAGER_CH_ - class TAO_Export ServantManager: public virtual CORBA::Object + class TAO_Export ServantManager: public virtual ACE_CORBA_1 (Object) { public: // the static operations @@ -1656,7 +1656,7 @@ class POA; #if !defined (_PORTABLESERVER_POA_CH_) #define _PORTABLESERVER_POA_CH_ - class TAO_Export POA: public virtual CORBA::Object + class TAO_Export POA: public virtual ACE_CORBA_1 (Object) { public: // the static operations diff --git a/TAO/tao/PolicyC.h b/TAO/tao/PolicyC.h index 5f90e1eb6b2..071ed15e07f 100644 --- a/TAO/tao/PolicyC.h +++ b/TAO/tao/PolicyC.h @@ -80,7 +80,7 @@ private: #if !defined (_CORBA_POLICY_CH_) #define _CORBA_POLICY_CH_ -class TAO_Export CORBA_Policy : public virtual CORBA::Object +class TAO_Export CORBA_Policy : public virtual ACE_CORBA_1 (Object) { public: // the static operations diff --git a/TAO/tao/Servant_Base.cpp b/TAO/tao/Servant_Base.cpp index a6a2cdeb36c..e39ae637907 100644 --- a/TAO/tao/Servant_Base.cpp +++ b/TAO/tao/Servant_Base.cpp @@ -196,5 +196,11 @@ TAO_DynamicImplementation::_dispatch (CORBA::ServerRequest &request, ACE_UNUSED_ARG (context); // Delegate to user - this->invoke (&request, env); + this->invoke (&request); + if (request.response_expected ()) + { + CORBA::Environment env2; + this->init_reply (env2); + this->dsi_marshal (env2); + } } diff --git a/TAO/tao/Servant_Base.h b/TAO/tao/Servant_Base.h index 96553236382..362f1828c88 100644 --- a/TAO/tao/Servant_Base.h +++ b/TAO/tao/Servant_Base.h @@ -103,8 +103,7 @@ class TAO_Export TAO_DynamicImplementation : public virtual TAO_ServantBase // circumstances may lead to unpredictable results. { public: - virtual void invoke (CORBA::ServerRequest_ptr request, - CORBA::Environment &env) = 0; + virtual void invoke (CORBA::ServerRequest_ptr request) = 0; // The invoke() method receives requests issued to any CORBA object // incarnated by the DSI servant and performs the processing // necessary to execute the request. diff --git a/TAO/tao/Server_Request.cpp b/TAO/tao/Server_Request.cpp index 2ba7d6c08e6..fd65f63952a 100644 --- a/TAO/tao/Server_Request.cpp +++ b/TAO/tao/Server_Request.cpp @@ -42,9 +42,11 @@ IIOP_ServerRequest::IIOP_ServerRequest (const TAO_GIOP_RequestHeader &hdr, incoming_ (req), outgoing_ (resp), reqid_ (hdr.request_id), + response_expected_ (hdr.response_expected), params_ (0), retval_ (0), exception_ (0), + exception_type_ (TAO_GIOP_NO_EXCEPTION), refcount_ (1), orb_ (the_orb), poa_ (the_poa) @@ -227,9 +229,9 @@ IIOP_ServerRequest::set_exception (const CORBA::Any &value, // and <<= operators for base exceptions (yet). CORBA_Exception* x = (CORBA_Exception*)value.value (); if (CORBA_UserException::_narrow (x) != 0) - this->is_user_exception_ = 1; + this->exception_type_ = TAO_GIOP_USER_EXCEPTION; else - this->is_user_exception_ = 0; + this->exception_type_ = TAO_GIOP_SYSTEM_EXCEPTION; } } @@ -281,21 +283,31 @@ IIOP_ServerRequest::marshal (CORBA::Environment &env, // exception reporting const TAO_Call_Data_Skel *info, // call description ...) // ... any parameters { + // what is "env" and "env2"? + // "env" holds the exception that got raised during the dispatch process and + // inside the operation implementation (upcall) + // + // "env2" is a local variable used here to identify any exceptions that get + // raised doing the marshaling CORBA::Environment env2; // check if we are inside with an exception. This may have happened // since the upcall could have set some exception if (env.exception ()) { - CORBA::Any any (env.exception ()->_type (), env.exception ()); // don't - // own it + // don't own it because ultimately it will be owned by the Server_Request + // via a call to "set_exception" + CORBA::Any any (env.exception ()->_type (), env.exception ()); this->set_exception (any, env2); } - // Setup a Reply message. + // Setup a Reply message so that we can marshal all the outgoing parameters + // into it. If an exception was set, then that gets marshaled into the reply + // message and we don't do anything after that this->init_reply (env2); - if (env2.exception () || env.exception ()) // exception, nothing to do + // exception? nothing to do after this + if (env2.exception () || env.exception ()) return; // Now, put all "in" and "inout" parameters into the NVList. @@ -326,13 +338,18 @@ IIOP_ServerRequest::marshal (CORBA::Environment &env, // exception reporting } if (pdp->mode == CORBA::ARG_OUT) - // don't add any value. + // don't add any value. The skeletons generated by the TAO IDL compiler + // make sure that the Any does not own the data (void) this->params_->item (j, env)->value ()->replace (pdp->tc, ptr, pdp->own, env); j++; } va_end (param_vector); + // in the following we are guaranteed that the any->value () returns a void* + // and not an ACE_Message_Block since the generated skeletons make sure that + // these Anys don't own the data. + // Normal reply. if (!env.exception ()) { @@ -399,11 +416,9 @@ IIOP_ServerRequest::init_reply (CORBA::Environment &env) // Finish the GIOP Reply header, then marshal the exception. // XXX x->type () someday ... - if (this->is_user_exception_) - this->outgoing_->write_ulong (TAO_GIOP_USER_EXCEPTION); - else - this->outgoing_->write_ulong (TAO_GIOP_SYSTEM_EXCEPTION); + this->outgoing_->write_ulong (this->exception_type_); + // we know that the value () will return the ACE_Message_Block TAO_InputCDR cdr ((ACE_Message_Block*)this->exception_->value ()); (void) this->outgoing_->append (except_tc, &cdr, env); } @@ -411,3 +426,65 @@ IIOP_ServerRequest::init_reply (CORBA::Environment &env) // First finish the GIOP header ... this->outgoing_->write_ulong (TAO_GIOP_NO_EXCEPTION); } + +// this method will be utilized by the DSI servant to marshal outgoing +// parameters + +void +IIOP_ServerRequest::dsi_marshal (CORBA::Environment &env) +{ + // NOTE: if "env" is set, it takes precedence over exceptions + // reported using the mechanism of the ServerRequest. Only system + // exceptions are reported that way ... + // + // XXX Exception reporting is ambiguous; it can be cleaner than + // this. With both language-mapped and dynamic/explicit reporting + // mechanisms, one of must be tested "first" ... so an exception + // reported using the other mechanism could be "lost". Perhaps only + // the language mapped one should be used for system exceptions. + + + CORBA::TypeCode_ptr tc; + const void *value; + + // only if there wasn't any exception, we proceed + if (this->exception_type_ == TAO_GIOP_NO_EXCEPTION) + { + // ... then send any return value ... + if (svr_req.retval_) + { + tc = svr_req.retval_->type (); + value = svr_req.retval_->value (); + if (svr_req.retval_->any_owns_data ()) + { + TAO_InputCDR cdr ((ACE_Message_Block *)value); + (void) this->outgoing_->append (tc, &cdr, env); + } + else + (void) this->outgoing_->encode (tc, value, 0, env); + } + + // ... Followed by "inout" and "out" parameters, left to right + for (u_int i = 0; + i < svr_req.params_->count (); + i++) + { + CORBA::NamedValue_ptr nv = svr_req.params_->item (i, env); + CORBA::Any_ptr any; + + if (!(nv->flags () & (CORBA::ARG_INOUT|CORBA::ARG_OUT))) + continue; + + any = nv->value (); + tc = any->type (); + value = any->value (); + if (any->any_owns_data ()) + { + TAO_InputCDR cdr ((ACE_Message_Block *)value); + (void) this->outgoing_->append (tc, &cdr, env); + } + else + (void) this->outgoing_->encode (tc, value, 0, env); + } + } +} diff --git a/TAO/tao/Server_Request.h b/TAO/tao/Server_Request.h index a6b8ca88be9..8cd45eeb841 100644 --- a/TAO/tao/Server_Request.h +++ b/TAO/tao/Server_Request.h @@ -210,17 +210,30 @@ public: // return the underlying ORB TAO_POA *oa (void); - // retturn the Object Adapter + // return the Object Adapter + + // + // = TAO extensions + // meant to be used internally. + // virtual void demarshal (CORBA::Environment &env, const TAO_Call_Data_Skel *info, ...); - // demarshal incoming parameters + // demarshal incoming parameters. Used by the SSI skeleton (i.e., the IDL + // compiler generated skeleton) virtual void marshal (CORBA::Environment &env, const TAO_Call_Data_Skel *info, ...); - // marshal outgoing parameters and return value + // marshal outgoing parameters and return value. This is used by the SSI + // i.e., by the IDL compiler generated skeletons. + + virtual void dsi_marshal (CORBA::Environment &env, + const TAO_Call_Data_Skel *info, + ...); + // does the marshaling of outgoing parameters and is used by the DSI based + // scheme virtual void init_reply (CORBA::Environment &env); // start a Reply message @@ -241,15 +254,18 @@ private: CORBA::String_var opname_; // Operation name. - TAO_InputCDR *incoming_; + TAO_InputCDR *incoming_; // Incoming stream. - TAO_OutputCDR *outgoing_; + TAO_OutputCDR *outgoing_; // Outgoing stream. CORBA::ULong reqid_; // request ID + CORBA::Boolean response_expected__; + // is it oneway or twoway + CORBA::NVList_ptr params_; // Incoming parameters. @@ -259,8 +275,9 @@ private: CORBA::Any_ptr exception_; // Any exception which might be raised. - int is_user_exception_; - // Flag to decide if the exception was a user exception or not. + // TAO_GIOP_ReplyStatusType exception_type_; + CORBA::ULong exception_type_; + // exception type (will be NO_EXCEPTION in the majority of the cases) u_int refcount_; // Number of things hold references to here. |