Go to the documentation of this file.00001 #include "tao/ObjRefTemplate/ObjectReferenceTemplate_i.h"
00002 #include "tao/PortableServer/Root_POA.h"
00003
00004 #include "tao/CORBA_String.h"
00005 #include "tao/ORB_Constants.h"
00006
00007 ACE_RCSID (ORT,
00008 ObjectReferenceTemplate_i,
00009 "$Id: ObjectReferenceTemplate_i.cpp 79992 2007-11-12 08:57:55Z johnnyw $")
00010
00011 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00012
00013 namespace TAO
00014 {
00015 ObjectReferenceTemplate::ObjectReferenceTemplate (
00016 const char *server_id,
00017 const char *orb_id,
00018 PortableInterceptor::AdapterName *adapter_name,
00019 PortableServer::POA_ptr poa)
00020 : server_id_ (server_id),
00021 orb_id_ (orb_id),
00022 adapter_name_ (adapter_name),
00023 poa_ (PortableServer::POA::_duplicate (poa))
00024 {
00025 }
00026
00027 ObjectReferenceTemplate::~ObjectReferenceTemplate (void)
00028 {
00029 }
00030
00031 char *
00032 ObjectReferenceTemplate::server_id (void)
00033 {
00034 return CORBA::string_dup (this->server_id_);
00035 }
00036
00037 char *
00038 ObjectReferenceTemplate::orb_id (void)
00039 {
00040 return CORBA::string_dup (this->orb_id_);
00041 }
00042
00043 PortableInterceptor::AdapterName *
00044 ObjectReferenceTemplate::adapter_name (void)
00045 {
00046 PortableInterceptor::AdapterName *adapter_name = 0;
00047
00048 ACE_NEW_THROW_EX (adapter_name,
00049 PortableInterceptor::AdapterName (
00050 *(this->adapter_name_)),
00051 CORBA::NO_MEMORY (
00052 CORBA::SystemException::_tao_minor_code (
00053 TAO::VMCID,
00054 ENOMEM),
00055 CORBA::COMPLETED_NO));
00056
00057 return adapter_name;
00058 }
00059
00060 CORBA::Object_ptr
00061 ObjectReferenceTemplate::make_object (
00062 const char *,
00063 const PortableInterceptor::ObjectId &)
00064 {
00065 if (CORBA::is_nil (this->poa_.in ()))
00066 throw ::CORBA::BAD_INV_ORDER ();
00067
00068 TAO_Root_POA* const tao_poa =
00069 dynamic_cast<TAO_Root_POA*> (this->poa_.in());
00070
00071 if (!tao_poa)
00072 throw ::CORBA::INTERNAL ();
00073
00074 return tao_poa->invoke_key_to_object ();
00075 }
00076 }
00077
00078 TAO_END_VERSIONED_NAMESPACE_DECL