summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-05-23 22:53:29 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-05-23 22:53:29 +0000
commit4f331b4880be2e3d5c86a57a90c44be55c1b9fdf (patch)
tree2bc3cd24135ec530d28619d6bc7e7ae1788d0928 /TAO
parentce934fb7587f5358967a7ec60ade56323447225a (diff)
downloadATCD-4f331b4880be2e3d5c86a57a90c44be55c1b9fdf.tar.gz
ChangeLogTag: Thu May 23 17:38:10 2002 Jeff Parsons <parsons@cs.wustl.edu>
Diffstat (limited to 'TAO')
-rw-r--r--TAO/tao/DynamicInterface/Dynamic_Implementation.cpp97
-rw-r--r--TAO/tao/DynamicInterface/Dynamic_Implementation.h19
-rw-r--r--TAO/tao/PortableServer/Servant_Base.cpp60
-rw-r--r--TAO/tao/PortableServer/Servant_Base.h17
4 files changed, 140 insertions, 53 deletions
diff --git a/TAO/tao/DynamicInterface/Dynamic_Implementation.cpp b/TAO/tao/DynamicInterface/Dynamic_Implementation.cpp
index 72c13e14d15..3516acbde30 100644
--- a/TAO/tao/DynamicInterface/Dynamic_Implementation.cpp
+++ b/TAO/tao/DynamicInterface/Dynamic_Implementation.cpp
@@ -7,9 +7,23 @@ ACE_RCSID(DynamicInterface, Dynamic_Implementation, "$Id$")
#include "Server_Request.h"
#include "tao/ORB_Core.h"
+#include "tao/IFR_Client_Adapter.h"
#include "tao/PortableServer/POA.h"
#include "tao/PortableServer/Collocated_Object.h"
+#include "ace/Dynamic_Service.h"
+
+CORBA::Boolean
+TAO_DynamicImplementation::_is_a (const char *logical_type_id
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::RepositoryId id =
+ this->get_id_from_primary_interface (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return ACE_OS::strcmp (logical_type_id, id) == 0;
+}
+
CORBA::Object_ptr
TAO_DynamicImplementation::_this (ACE_ENV_SINGLE_ARG_DECL)
{
@@ -31,6 +45,29 @@ TAO_DynamicImplementation::_this (ACE_ENV_SINGLE_ARG_DECL)
return retval;
}
+CORBA_InterfaceDef_ptr
+TAO_DynamicImplementation::_get_interface (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_IFR_Client_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
+ TAO_ORB_Core::ifr_client_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTF_REPOS (),
+ 0);
+ }
+
+ CORBA::RepositoryId id =
+ this->get_id_from_primary_interface (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return adapter->get_interface (TAO_ORB_Core_instance ()->orb (),
+ id
+ ACE_ENV_ARG_PARAMETER);
+}
+
const char *
TAO_DynamicImplementation::_interface_repository_id (void) const
{
@@ -53,10 +90,10 @@ TAO_DynamicImplementation::_create_stub (ACE_ENV_SINGLE_ARG_DECL)
// If DynamicImplementation::_this() is invoked outside of the
// context of a request invocation on a target object being served
// by the DSI servant, it raises the PortableServer::WrongPolicy
- // exception.
+ // exception. See the CORBA C++ mapping, section 1.38.3.
TAO_POA_Current_Impl *poa_current_impl =
- ACE_static_cast(TAO_POA_Current_Impl *,
- TAO_TSS_RESOURCES::instance ()->poa_current_impl_);
+ ACE_static_cast (TAO_POA_Current_Impl *,
+ TAO_TSS_RESOURCES::instance ()->poa_current_impl_);
if (poa_current_impl == 0
|| this != poa_current_impl->servant ())
@@ -65,7 +102,15 @@ TAO_DynamicImplementation::_create_stub (ACE_ENV_SINGLE_ARG_DECL)
0);
}
- PortableServer::POA_var poa = poa_current_impl->get_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
+ PortableServer::POA_var poa =
+ poa_current_impl->get_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::PolicyList_var client_exposed_policies =
+ poa_current_impl->poa ()->client_exposed_policies (
+ poa_current_impl->priority ()
+ ACE_ENV_ARG_PARAMETER
+ );
ACE_CHECK_RETURN (0);
CORBA::RepositoryId pinterface =
@@ -74,15 +119,11 @@ TAO_DynamicImplementation::_create_stub (ACE_ENV_SINGLE_ARG_DECL)
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
- CORBA::PolicyList_var client_exposed_policies =
- poa_current_impl->poa ()->client_exposed_policies
- (poa_current_impl->priority () ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- return poa_current_impl->poa ()->key_to_stub (poa_current_impl->object_key (),
- pinterface,
- poa_current_impl->priority ()
- ACE_ENV_ARG_PARAMETER);
+ return
+ poa_current_impl->poa ()->key_to_stub (poa_current_impl->object_key (),
+ pinterface,
+ poa_current_impl->priority ()
+ ACE_ENV_ARG_PARAMETER);
}
void
@@ -143,3 +184,33 @@ TAO_DynamicImplementation::_dispatch (TAO_ServerRequest &request,
CORBA::release (dsi_request);
}
+
+CORBA::RepositoryId
+TAO_DynamicImplementation::get_id_from_primary_interface (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+{
+ // If this method is called outside of the
+ // context of a request invocation on a target object being served
+ // by the DSI servant, it raises the PortableServer::WrongPolicy
+ // exception. See the CORBA C++ mapping, section 1.38.3.
+ TAO_POA_Current_Impl *poa_current_impl =
+ ACE_static_cast (TAO_POA_Current_Impl *,
+ TAO_TSS_RESOURCES::instance ()->poa_current_impl_);
+
+ if (poa_current_impl == 0
+ || this != poa_current_impl->servant ())
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
+ 0);
+ }
+
+ PortableServer::POA_var poa =
+ poa_current_impl->get_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return this->_primary_interface (poa_current_impl->object_id (),
+ poa.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
diff --git a/TAO/tao/DynamicInterface/Dynamic_Implementation.h b/TAO/tao/DynamicInterface/Dynamic_Implementation.h
index a9199f2e455..d454e52bb43 100644
--- a/TAO/tao/DynamicInterface/Dynamic_Implementation.h
+++ b/TAO/tao/DynamicInterface/Dynamic_Implementation.h
@@ -50,15 +50,24 @@ public:
virtual CORBA::RepositoryId _primary_interface (
const PortableServer::ObjectId &oid,
PortableServer::POA_ptr poa
- ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0;
-
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ ) = 0;
// The _primary_interface() method receives an ObjectId value and a
// POA_ptr as input parameters and returns a valid RepositoryId
// representing the most-derived interface for that oid.
+ virtual CORBA::Boolean _is_a (const char *logical_type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+ // Local implementation of the CORBA::Object::_is_a method.
+
CORBA::Object_ptr _this (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
// Returns a CORBA::Object_ptr for the target object.
+ virtual CORBA_InterfaceDef_ptr _get_interface (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+ // Query the Interface Repository for the interface definition.
+
protected:
virtual const char *_interface_repository_id (void) const;
@@ -74,6 +83,12 @@ protected:
void *context
ACE_ENV_ARG_DECL_WITH_DEFAULTS);
// Turns around and calls invoke.
+
+private:
+ CORBA::RepositoryId get_id_from_primary_interface (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+ // Encapsulates code common to _is_a(), _get_interface() and _create_stub().
};
#include "ace/post.h"
diff --git a/TAO/tao/PortableServer/Servant_Base.cpp b/TAO/tao/PortableServer/Servant_Base.cpp
index fdfb09c078d..f6a67111064 100644
--- a/TAO/tao/PortableServer/Servant_Base.cpp
+++ b/TAO/tao/PortableServer/Servant_Base.cpp
@@ -75,18 +75,13 @@ TAO_ServantBase::_default_POA (ACE_ENV_SINGLE_ARG_DECL)
}
CORBA::Boolean
-TAO_ServantBase::_is_a (const char* logical_type_id
+TAO_ServantBase::_is_a (const char *logical_type_id
ACE_ENV_ARG_DECL)
{
const char *id = CORBA::_tc_Object->id (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
- if (ACE_OS::strcmp (logical_type_id, id) == 0)
- {
- return 1;
- }
-
- return 0;
+ return ACE_OS::strcmp (logical_type_id, id) == 0;
}
CORBA::Boolean
@@ -100,8 +95,8 @@ TAO_ServantBase::_get_interface (ACE_ENV_SINGLE_ARG_DECL)
{
TAO_IFR_Client_Adapter *adapter =
ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
- TAO_ORB_Core::ifr_client_adapter_name ()
- );
+ TAO_ORB_Core::ifr_client_adapter_name ()
+ );
if (adapter == 0)
{
@@ -147,19 +142,23 @@ TAO_ServantBase::_create_stub (ACE_ENV_SINGLE_ARG_DECL)
servant_orb = poa_current_impl->orb_core ().orb () ;
- stub = poa_current_impl->poa ()->key_to_stub (
- poa_current_impl->object_key (),
- this->_interface_repository_id (),
- poa_current_impl->priority ()
- ACE_ENV_ARG_PARAMETER);
+ stub =
+ poa_current_impl->poa ()->key_to_stub (
+ poa_current_impl->object_key (),
+ this->_interface_repository_id (),
+ poa_current_impl->priority ()
+ ACE_ENV_ARG_PARAMETER
+ );
ACE_CHECK_RETURN (0);
}
else
{
- PortableServer::POA_var poa = this->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
+ PortableServer::POA_var poa =
+ this->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
- CORBA::Object_var object = poa->servant_to_reference (this ACE_ENV_ARG_PARAMETER);
+ CORBA::Object_var object =
+ poa->servant_to_reference (this ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
// Get the stub object
@@ -176,14 +175,10 @@ TAO_ServantBase::_create_stub (ACE_ENV_SINGLE_ARG_DECL)
return stub;
}
-void TAO_ServantBase::synchronous_upcall_dispatch (
- TAO_ServerRequest &req,
+void TAO_ServantBase::synchronous_upcall_dispatch (TAO_ServerRequest &req,
void *servant_upcall,
void *derived_this
- ACE_ENV_ARG_DECL
- )
- //CORBA::Environment &ACE_TRY_ENV
-
+ ACE_ENV_ARG_DECL)
{
TAO_Skeleton skel;
const char *opname = req.operation ();
@@ -223,7 +218,10 @@ void TAO_ServantBase::synchronous_upcall_dispatch (
// Invoke the skeleton, it will demarshal the arguments,
// invoke the right operation on the skeleton class
// (<derived_this>), and marshal any results.
- skel (req, derived_this, servant_upcall ACE_ENV_ARG_PARAMETER); //, ACE_TRY_ENV);
+ skel (req,
+ derived_this,
+ servant_upcall
+ ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
// It is our job to send the already marshaled reply, but only
@@ -262,13 +260,10 @@ void TAO_ServantBase::synchronous_upcall_dispatch (
return;
}
-void TAO_ServantBase::asynchronous_upcall_dispatch (
- TAO_ServerRequest &req,
+void TAO_ServantBase::asynchronous_upcall_dispatch (TAO_ServerRequest &req,
void *servant_upcall,
void *derived_this
- ACE_ENV_ARG_DECL
- // CORBA::Environment &ACE_TRY_ENV
- )
+ ACE_ENV_ARG_DECL)
{
TAO_Skeleton skel;
const char *opname = req.operation ();
@@ -306,7 +301,10 @@ void TAO_ServantBase::asynchronous_upcall_dispatch (
// Invoke the skeleton, it will demarshal the arguments,
// invoke the right operation on the skeleton class
// (<derived_this>), and marshal any results.
- skel (req, derived_this, servant_upcall ACE_ENV_ARG_PARAMETER);
+ skel (req,
+ derived_this,
+ servant_upcall
+ ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
// It is our job to send the already marshaled reply, but only
@@ -372,7 +370,9 @@ TAO_RefCountServantBase::TAO_RefCountServantBase (void)
{
}
-TAO_RefCountServantBase::TAO_RefCountServantBase (const TAO_RefCountServantBase &)
+TAO_RefCountServantBase::TAO_RefCountServantBase (
+ const TAO_RefCountServantBase &
+ )
: ref_count_ (1)
{
}
diff --git a/TAO/tao/PortableServer/Servant_Base.h b/TAO/tao/PortableServer/Servant_Base.h
index 4dcc688c811..5af4946e6d7 100644
--- a/TAO/tao/PortableServer/Servant_Base.h
+++ b/TAO/tao/PortableServer/Servant_Base.h
@@ -47,20 +47,23 @@ public:
// Destructor.
virtual PortableServer::POA_ptr _default_POA (
- ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
-
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
// Returns the default POA for this servant.
- virtual CORBA::Boolean _is_a (const char* logical_type_id
+ virtual CORBA::Boolean _is_a (const char *logical_type_id
ACE_ENV_ARG_DECL_WITH_DEFAULTS);
// Local implementation of the CORBA::Object::_is_a method.
- virtual CORBA::Boolean _non_existent (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+ virtual CORBA::Boolean _non_existent (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
// Default <_non_existent>: always returns false.
virtual CORBA_InterfaceDef_ptr _get_interface (
- ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
-
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+ // Query the Interface Repository for the interface definition.
virtual void *_downcast (const char *repository_id) = 0;
// Get the correct vtable.
@@ -92,14 +95,12 @@ protected:
virtual void synchronous_upcall_dispatch (TAO_ServerRequest &req,
void *servant_upcall,
void *derived_this
- // CORBA::Environment &ACE_TRY_ENV);
ACE_ENV_ARG_DECL);
virtual void asynchronous_upcall_dispatch (TAO_ServerRequest &req,
void *servant_upcall,
void *derived_this
ACE_ENV_ARG_DECL);
- //CORBA::Environment &ACE_TRY_ENV);
virtual int _find (const char *opname,
TAO_Skeleton &skelfunc,