summaryrefslogtreecommitdiff
path: root/TAO/tao
diff options
context:
space:
mode:
authorgokhale <asgokhale@users.noreply.github.com>1998-05-08 21:56:45 +0000
committergokhale <asgokhale@users.noreply.github.com>1998-05-08 21:56:45 +0000
commitf148fc1a571e937c9c91b8b43ceba5558234b54d (patch)
tree4939dd9df46dc3d86af5868160328a2a70bc7728 /TAO/tao
parent3e526db466c97cd92167d6f44456a798d83c9acf (diff)
downloadATCD-f148fc1a571e937c9c91b8b43ceba5558234b54d.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO/tao')
-rw-r--r--TAO/tao/Connect.cpp103
-rw-r--r--TAO/tao/POAC.h10
-rw-r--r--TAO/tao/PolicyC.h2
-rw-r--r--TAO/tao/Servant_Base.cpp8
-rw-r--r--TAO/tao/Servant_Base.h3
-rw-r--r--TAO/tao/Server_Request.cpp99
-rw-r--r--TAO/tao/Server_Request.h31
7 files changed, 126 insertions, 130 deletions
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.