本文整理汇总了C++中portableserver::POA_var::set_servant_manager方法的典型用法代码示例。如果您正苦于以下问题:C++ POA_var::set_servant_manager方法的具体用法?C++ POA_var::set_servant_manager怎么用?C++ POA_var::set_servant_manager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类portableserver::POA_var
的用法示例。
在下文中一共展示了POA_var::set_servant_manager方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ServantLocator
int
Server_i::create_locator (PortableServer::POA_var second_poa)
{
try
{
// An Servant Locator object is created which will activate
// the servant on demand.
ServantLocator *temp_servant_locator = 0;
ACE_NEW_RETURN (temp_servant_locator,
ServantLocator (orb_.in (),
ACE_TEXT ("Generic_Servant"),
ACE_TEXT ("supply_servant"),
ACE_TEXT ("destroy_servant")),
0);
// Set ServantLocator object as the servant Manager of
// secondPOA.
this->servant_locator_ = temp_servant_locator;
second_poa->set_servant_manager (this->servant_locator_);
// For the code above, we're using the CORBA 3.0 servant manager
// semantics supported by TAO. For CORBA 2.x ORBs you'd need to
// use the following code in place of the previous lines:
//
// this->servant_locator_ = temp_servant_locator->_this ();
//
// Set ServantLocator object as the servant Manager of
// secondPOA.
// second_poa->set_servant_manager (this->servant_locator_.in ()
//);
// Try to create a reference with user created ID in second_poa
// which uses ServantLocator.
PortableServer::ObjectId_var second_test_oid =
PortableServer::string_to_ObjectId ("second test");
second_test_ =
second_poa->create_reference_with_id (second_test_oid.in (),
"IDL:test:1.0");
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Server_i:create_locator ()");
return 1;
}
return 0;
}
示例2: catch
int
Server_i::create_activator (PortableServer::POA_var first_poa)
{
try
{
// An Servant Activator object is created which will activate
// the servant on-demand.
ACE_NEW_RETURN (servant_activator_impl_,
ServantActivator_i (orb_.in ()),
0);
// Set ServantActivator_i object as the servant_manager of
// firstPOA.
first_poa->set_servant_manager (servant_activator_impl_);
// For the code above, we're using the CORBA 3.0 servant manager
// semantics supported by TAO. For CORBA 2.x ORBs you'd need to
// use the following code in place of the previous line:
//
// PortableServer::ServantManager_var servant_activator =
// servant_activator_impl_->_this ();
//
// first_poa->set_servant_manager (servant_activator.in (),
//);
// Create a reference with user created ID in firstPOA which
// uses the ServantActivator. The servant dll name as well as
// the factory function in the dll are used in creating the
// objectId.
PortableServer::ObjectId_var first_test_oid =
servant_activator_impl_->create_dll_object_id ("Generic_Servant",
"create_test_i");
first_test_ = first_poa->create_reference_with_id (first_test_oid.in (),
"IDL:test:1.0");
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Server_i:create_activator ()");
return 1;
}
return 0;
}
示例3: GCServantLocator
PortableServer::POA_ptr ossie::corba::createGCPOA(PortableServer::POA_ptr parent, const std::string& name)
{
CORBA::PolicyList policy_list;
policy_list.length(2);
policy_list[0] = parent->create_servant_retention_policy(PortableServer::NON_RETAIN);
policy_list[1] = parent->create_request_processing_policy(PortableServer::USE_SERVANT_MANAGER);
PortableServer::POAManager_var poa_mgr = parent->the_POAManager();
PortableServer::POA_var poa = parent->create_POA(name.c_str(), poa_mgr, policy_list);
for (size_t ii = 0; ii < policy_list.length(); ++ii) {
policy_list[ii]->destroy();
}
GCServantLocator* manager = new GCServantLocator();
PortableServer::ServantManager_var manager_ref = manager->_this();
poa->set_servant_manager(manager_ref);
manager->_remove_ref();
return poa._retn();
}
示例4: main
//.........这里部分代码省略.........
policies[3] = rootPOA->create_lifespan_policy(PortableServer::PERSISTENT);
PortableServer::POA_var namingContextsPOA =
rootPOA->create_POA("namingContextsPOA", manager, policies);
PortableServer::POAManager_var namingContextsManager =
namingContextsPOA->the_POAManager();
//
// BindingIterators POA creation
//
CORBA::PolicyList bindingIterators_policies;
bindingIterators_policies.length(2);
bindingIterators_policies[0] =
rootPOA->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL);
bindingIterators_policies[1] =
rootPOA->create_id_assignment_policy(PortableServer::USER_ID);
PortableServer::POA_var bindingIteratorsPOA =
namingContextsPOA->create_POA("bindingIteratorsPOA", namingContextsManager,
bindingIterators_policies);
//
// Creates and sets a new ServantManager
//
TIDNaming::ServantManagerNSImpl* servant_manager =
new TIDNaming::ServantManagerNSImpl(my_global_orb, bindingIteratorsPOA,
max_binding_iterators);
namingContextsPOA->set_servant_manager(servant_manager);
// Creates the reference to the "root.ctx". Dont create it
// This fragment of code is not needed anymore. It creates the
// initial reference to root naming context, now created from
// PersistenceManager class.
/*
PortableServer::ObjectId_var oid =
PortableServer::string_to_ObjectId("root.ctx"); // Change to "NameService"
CORBA::Object_var obj =
namingContextsPOA->create_reference_with_id(oid,"IDL:omg.org/CosNaming/NamingContextExt:1.0");
*/
// Manager activation (ORB/POA staff)
manager->activate();
namingContextsManager->activate();
//
// Check if has persistence
//
if (strcmp(persistence_dir, "") != 0) {
if (m_orb->trace != NULL){
TIDorb::util::StringBuffer msg;
msg << "Using '" << persistence_dir << "' as persistence directory";
m_orb->print_trace(TIDorb::util::TR_USER, msg.str().data());
}
//
// Recover the persistent data