1 #include "LookupManager.h"
2 #include "ace/OS_NS_string.h"
7 TAO_Notify_Tests_LookupManager::TAO_Notify_Tests_LookupManager ()
9 , activation_manager_ (0)
10 , priority_mapping_ (0)
14 TAO_Notify_Tests_LookupManager::~TAO_Notify_Tests_LookupManager ()
19 TAO_Notify_Tests_LookupManager::init (CORBA::ORB_ptr orb
)
21 orb_
= CORBA::ORB::_duplicate (orb
);
23 this->resolve (this->root_poa_
, TAO_Notify_Tests_Name::root_poa
);
25 this->resolve (this->naming_
, TAO_Notify_Tests_Name::naming_service
);
29 TAO_Notify_Tests_LookupManager::_register (CORBA::Object_ptr obj
, const char* obj_name
)
31 CosNaming::Name_var name
=
32 this->naming_
->to_name (obj_name
);
33 //@@ Warning: this is rebind..
34 this->naming_
->rebind (name
.in (),
37 ACE_DEBUG ((LM_DEBUG
, "Registered %s with Naming Service\n", obj_name
));
41 TAO_Notify_Tests_LookupManager::_register (TAO_Notify_Tests_Driver_Base
* app
)
47 TAO_Notify_Tests_LookupManager::resolve (TAO_Notify_Tests_Driver_Base
*& app
)
53 TAO_Notify_Tests_LookupManager::_register (TAO_Notify_Tests_Activation_Manager
* activation_manager
)
55 this->activation_manager_
= activation_manager
;
59 TAO_Notify_Tests_LookupManager::resolve (TAO_Notify_Tests_Activation_Manager
*& activation_manager
)
61 activation_manager
= this->activation_manager_
;
65 TAO_Notify_Tests_LookupManager::_register (TAO_Notify_Tests_Priority_Mapping
* priority_mapping
)
67 this->priority_mapping_
= priority_mapping
;
71 TAO_Notify_Tests_LookupManager::resolve (TAO_Notify_Tests_Priority_Mapping
* &priority_mapping
)
73 priority_mapping
= this->priority_mapping_
;
77 TAO_Notify_Tests_LookupManager::resolve (CORBA::ORB_var
& orb
)
83 TAO_Notify_Tests_LookupManager::resolve (PortableServer::POA_var
& poa
)
85 poa
= this->root_poa_
;
89 TAO_Notify_Tests_LookupManager::resolve (CosNaming::NamingContextExt_var
& naming
)
91 naming
= this->naming_
;
95 TAO_Notify_Tests_LookupManager::resolve (PortableServer::POA_var
& poa
, const char *poa_name
)
97 if (ACE_OS::strcmp (poa_name
, TAO_Notify_Tests_Name::root_poa
) == 0)
99 CORBA::Object_ptr poa_object
=
100 this->orb_
->resolve_initial_references(TAO_Notify_Tests_Name::root_poa
);
102 if (CORBA::is_nil (poa_object
))
104 ACE_ERROR ((LM_ERROR
,
105 " (%P|%t) Unable to resolve the Root POA.\n"));
109 poa
= PortableServer::POA::_narrow (poa_object
);
111 this->root_poa_
= poa
;
115 poa
= root_poa_
->find_POA (poa_name
, 0);
120 TAO_Notify_Tests_LookupManager::resolve (CosNaming::NamingContextExt_var
& naming
, const char *naming_name
)
122 CORBA::Object_var naming_obj
=
123 this->orb_
->resolve_initial_references (naming_name
);
125 // Need to check return value for errors.
126 if (CORBA::is_nil (naming_obj
.in ()))
127 throw CORBA::UNKNOWN ();
129 this->naming_
= CosNaming::NamingContextExt::_narrow (naming_obj
.in ());
131 CosNaming::NamingContextExt::_duplicate (this->naming_
.in ());
133 naming
= this->naming_
;
137 TAO_Notify_Tests_LookupManager::resolve_object (const char* obj_name
)
139 CosNaming::Name
name (1);
141 name
[0].id
= CORBA::string_dup (obj_name
);
143 CORBA::Object_var obj
=
144 this->naming_
->resolve (name
);
150 TAO_Notify_Tests_LookupManager::resolve (CosNotifyChannelAdmin::EventChannelFactory_var
& ecf
, const char * factory_name
)
152 CORBA::Object_var object
= this->resolve_object (factory_name
);
154 ecf
= CosNotifyChannelAdmin::EventChannelFactory::_narrow (object
.in());
158 TAO_Notify_Tests_LookupManager::resolve (CosNotifyChannelAdmin::EventChannel_var
& ec
, const char * channel_name
)
160 CORBA::Object_var object
= this->resolve_object (channel_name
);
162 ec
= CosNotifyChannelAdmin::EventChannel::_narrow (object
.in());
166 TAO_Notify_Tests_LookupManager::resolve (CosNotifyChannelAdmin::SupplierAdmin_var
& sa
, const char * admin_name
)
168 CORBA::Object_var object
= this->resolve_object (admin_name
);
170 sa
= CosNotifyChannelAdmin::SupplierAdmin::_narrow (object
.in());
174 TAO_Notify_Tests_LookupManager::resolve (CosNotifyChannelAdmin::ConsumerAdmin_var
& ca
, const char * admin_name
)
176 CORBA::Object_var object
= this->resolve_object (admin_name
);
178 ca
= CosNotifyChannelAdmin::ConsumerAdmin::_narrow (object
.in());
182 TAO_Notify_Tests_LookupManager::resolve (CosNotifyComm::StructuredPushSupplier_var
& supplier
, const char *supplier_name
)
184 CORBA::Object_var object
= this->resolve_object (supplier_name
);
186 supplier
= CosNotifyComm::StructuredPushSupplier::_narrow (object
.in());
190 TAO_Notify_Tests_LookupManager::resolve (CosNotifyComm::StructuredPushConsumer_var
& consumer
, const char * consumer_name
)
192 CORBA::Object_var object
= this->resolve_object (consumer_name
);
194 consumer
= CosNotifyComm::StructuredPushConsumer::_narrow (object
.in());
198 TAO_Notify_Tests_LookupManager::resolve (CosNotifyFilter::FilterFactory_var
& ff
, const char *filter_factory_name
)
200 CORBA::Object_var object
= this->resolve_object (filter_factory_name
);
202 ff
= CosNotifyFilter::FilterFactory::_narrow (object
.in());
206 TAO_Notify_Tests_LookupManager::resolve (CosNotifyFilter::Filter_var
& filter
, const char *filter_name
)
208 CORBA::Object_var object
= this->resolve_object (filter_name
);
210 filter
= CosNotifyFilter::Filter::_narrow (object
.in());
214 TAO_Notify_Tests_LookupManager::resolve (CosNotifyFilter::FilterAdmin_var
& filter_admin
, const char *filter_admin_name
)
216 CORBA::Object_var object
= this->resolve_object (filter_admin_name
);
218 filter_admin
= CosNotifyFilter::FilterAdmin::_narrow (object
.in());
221 ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton
, TAO_Notify_Tests_LookupManager
, TAO_SYNCH_MUTEX
);