summaryrefslogtreecommitdiff
path: root/TAO/tao/DynamicInterface
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/tao/DynamicInterface
parentce934fb7587f5358967a7ec60ade56323447225a (diff)
downloadATCD-4f331b4880be2e3d5c86a57a90c44be55c1b9fdf.tar.gz
ChangeLogTag: Thu May 23 17:38:10 2002 Jeff Parsons <parsons@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/DynamicInterface')
-rw-r--r--TAO/tao/DynamicInterface/Dynamic_Implementation.cpp97
-rw-r--r--TAO/tao/DynamicInterface/Dynamic_Implementation.h19
2 files changed, 101 insertions, 15 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"