本文整理汇总了C++中portableserver::POAManager_var::in方法的典型用法代码示例。如果您正苦于以下问题:C++ POAManager_var::in方法的具体用法?C++ POAManager_var::in怎么用?C++ POAManager_var::in使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类portableserver::POAManager_var
的用法示例。
在下文中一共展示了POAManager_var::in方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
TAO_Notify_POA_Helper::create_i (
PortableServer::POA_ptr parent_poa,
const char* poa_name,
CORBA::PolicyList &policy_list)
{
PortableServer::POAManager_var manager =
parent_poa->the_POAManager ();
// Create the child POA.
this->poa_ = parent_poa->create_POA (poa_name, manager.in (), policy_list);
if (DEBUG_LEVEL > 0)
{
CORBA::String_var the_name = this->poa_->the_name ();
ORBSVCS_DEBUG ((LM_DEBUG, "Created POA : %C\n", the_name.in ()));
}
/*
// Destroy the policies
for (CORBA::ULong index = 0; index < policy_list.length (); ++index)
{
policy_list[index]->destroy ();
}
*/
}
示例2: create_persistent_poa
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
PortableServer::POA_var create_persistent_poa(PortableServer::POA_var root_poa,
PortableServer::POAManager_var mgr,
const char* name,
CORBA::PolicyList& policy_list)
{
PortableServer::POA_var result;
PortableServer::LifespanPolicy_var lifespan =
root_poa->create_lifespan_policy(PortableServer::PERSISTENT);
// create a USER_ID IdAssignmentPolicy object
PortableServer::IdAssignmentPolicy_var assign =
root_poa->create_id_assignment_policy(PortableServer::USER_ID);
// create PolicyList.
size_t orig_len = policy_list.length();
policy_list.length(orig_len+2);
policy_list[orig_len+0]=
PortableServer::LifespanPolicy::_duplicate(lifespan.in());
policy_list[orig_len+1]=
PortableServer::IdAssignmentPolicy::_duplicate(assign.in());
// create the child POA
result = root_poa->create_POA(name, mgr.in(), policy_list);
return result;
}
示例3:
PortableServer::POA_ptr
createPOA (PortableServer::POA_ptr root_poa,
bool share_mgr,
const char* poa_name)
{
PortableServer::LifespanPolicy_var life =
root_poa->create_lifespan_policy(PortableServer::PERSISTENT);
PortableServer::IdAssignmentPolicy_var assign =
root_poa->create_id_assignment_policy(PortableServer::USER_ID);
CORBA::PolicyList pols;
pols.length(2);
pols[0] = PortableServer::LifespanPolicy::_duplicate(life.in());
pols[1] = PortableServer::IdAssignmentPolicy::_duplicate(assign.in());
PortableServer::POAManager_var mgr = PortableServer::POAManager::_nil();
if (share_mgr)
{
mgr = root_poa->the_POAManager();
}
PortableServer::POA_var poa =
root_poa->create_POA(poa_name, mgr.in(), pols);
life->destroy();
assign->destroy();
return poa._retn();
}
示例4:
void
createPOAs(ACE_CString &base)
{
PortableServer::LifespanPolicy_var life =
root_poa->create_lifespan_policy(PortableServer::PERSISTENT);
PortableServer::IdAssignmentPolicy_var assign =
root_poa->create_id_assignment_policy(PortableServer::USER_ID);
CORBA::PolicyList pols;
pols.length(2);
pols[0] = PortableServer::LifespanPolicy::_duplicate(life.in());
pols[1] = PortableServer::IdAssignmentPolicy::_duplicate(assign.in());
PortableServer::POAManager_var mgr = PortableServer::POAManager::_nil();
ACE_CString poa_name = base + ACE_CString ("_a");
poa_a = root_poa->create_POA(poa_name.c_str(), mgr.in(), pols);
poa_name = base + ACE_CString ("_b");
poa_b = root_poa->create_POA(poa_name.c_str(), mgr.in(), pols);
}
示例5: policies
void
DAnCE_NodeManager_Module::create_poas (void)
{
DANCE_TRACE("DAnCE_NodeManager_Module::create_poas");
// Get reference to Root POA.
DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE,
(LM_TRACE, DLINFO
ACE_TEXT ("DAnCE_NodeManager_Module::create_poas - ")
ACE_TEXT ("Resolving root POA\n")));
CORBA::Object_var obj = this->orb_->resolve_initial_references ("RootPOA");
this->root_poa_ = PortableServer::POA::_narrow (obj.in ());
DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE,
(LM_TRACE, DLINFO
ACE_TEXT ("DAnCE_NodeManager_Module::create_poas - ")
ACE_TEXT ("Obtaining the POAManager\n")));
PortableServer::POAManager_var mgr = this->root_poa_->the_POAManager ();
TAO::Utils::PolicyList_Destroyer policies (2);
policies.length (2);
try
{
DANCE_TRACE_LOG (DANCE_LOG_TRACE,
(LM_TRACE, DLINFO
ACE_TEXT ("DAnCE_NodeManager_Module::create_poas - ")
ACE_TEXT ("DAnCE_NodeManager_Module::create_poas - ")
ACE_TEXT ("Creating the \"Managers\" POA.\n")));
policies[0] = this->root_poa_->create_id_assignment_policy (PortableServer::USER_ID);
policies[1] = this->root_poa_->create_lifespan_policy (PortableServer::PERSISTENT);
this->nm_poa_ = this->root_poa_->create_POA ("Managers",
mgr.in(),
policies);
}
catch (const PortableServer::POA::AdapterAlreadyExists &)
{
DANCE_TRACE_LOG (DANCE_LOG_TRACE,
(LM_INFO, DLINFO
ACE_TEXT ("DAnCE_NodeManager_Module::create_poas - ")
ACE_TEXT ("Using existing \"Managers\" POA\n")));
this->nm_poa_ = this->root_poa_->find_POA ("Managers", 0);
}
}
示例6: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
CORBA::ORB_var orb;
try
{
orb = CORBA::ORB_init (argc, argv);
CORBA::Object_var root_poa_o =
orb->resolve_initial_references ("RootPOA");
PortableServer::POA_var rootPOA =
PortableServer::POA::_narrow (root_poa_o.in ());
if (CORBA::is_nil (rootPOA.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
" (%P|%t) Panic: nil RootPOA\n"), 1);
}
PortableServer::POAManager_var poaMgr = rootPOA->the_POAManager ();
poaMgr->activate ();
CORBA::PolicyList policies;
policies.length (3);
policies[0] = rootPOA->create_id_assignment_policy (
PortableServer::SYSTEM_ID);
policies[1] = rootPOA->create_implicit_activation_policy (
PortableServer::NO_IMPLICIT_ACTIVATION);
policies[2] = rootPOA->create_lifespan_policy (
PortableServer::TRANSIENT);
PortableServer::POA_var fooPoa = rootPOA->create_POA (
"FOO_POA", poaMgr.in (), policies );
for (CORBA::ULong i = 0; i < policies.length (); ++i)
{
policies[i]->destroy ();
}
Foo_i servant;
PortableServer::ObjectId_var oid = fooPoa->activate_object( &servant );
CORBA::Object_var obj = fooPoa->id_to_reference (oid.in ());
foo_var client = foo::_narrow (obj.in());
client->check();
if (vc_check(client.in()))
{
orb->destroy();
return 1;
}
fooPoa->deactivate_object (oid.in () ); //servant is gone
if (vc_check(client.in(), false)) //exception expected
{
orb->destroy();
return 2;
}
}
catch(...)
{
return 3;
}
return 0;
}
示例7: self_manage
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try
{
// Initialize orb
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv);
// Get reference to Root POA.
CORBA::Object_var obj =
orb->resolve_initial_references ("RootPOA");
PortableServer::POA_var rootpoa =
PortableServer::POA::_narrow (obj.in ());
// Activate POA manager
PortableServer::POAManager_var mgr =
rootpoa->the_POAManager ();
mgr->activate ();
PortableServer::POA_var poa;
TAO::Utils::PolicyList_Destroyer PolicyList (3);
PolicyList.length (3);
PolicyList [0] =
rootpoa->create_lifespan_policy (PortableServer::PERSISTENT);
PolicyList [1] =
rootpoa->create_id_assignment_policy (PortableServer::USER_ID);
CORBA::Any CallbackPolicy;
CallbackPolicy <<= BiDirPolicy::BOTH;
const char* sServerPoaName = "TelemetryServer";
PolicyList [2] =
orb->create_policy (BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE,
CallbackPolicy);
poa = rootpoa->create_POA (sServerPoaName,
mgr.in(),
PolicyList);
PortableServer::ObjectId_var ServerId =
PortableServer::string_to_ObjectId ("TimeServer");
// Create an object
Time_impl *time_servant = new Time_impl;
PortableServer::ServantBase_var self_manage (time_servant);
poa->activate_object_with_id (ServerId.in (),
time_servant);
// Get a reference after activating the object
CORBA::Object_var object = poa->id_to_reference (ServerId.in ());
TimeModule::Time_var tm = TimeModule::Time::_narrow (object.in ());
// Get reference to initial naming context
CORBA::Object_var name_obj =
orb->resolve_initial_references ("NameService");
CosNaming::NamingContext_var inc =
CosNaming::NamingContext::_narrow (name_obj.in ());
if (CORBA::is_nil (inc.in ()))
{
ACE_ERROR ((LM_ERROR,
"(%P|%t) Error fetching naming context\n"));
}
CosNaming::Name service_name;
service_name.length(1);
service_name[0].id =
CORBA::string_dup ("Time");
inc->rebind (service_name,
tm.in ());
// Run the event loop for fun
ACE_Time_Value tv (3, 0);
// Accept requests
orb->run (&tv);
rootpoa->destroy (0 , 0);
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Caught an exception\n");
return -1;
}
return 0;
//.........这里部分代码省略.........
示例8: policies
int
main( int argc, char *argv[] )
{
try {
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
// Destringify ior
CORBA::Object_var obj = orb->string_to_object( "file://IOR" );
if( CORBA::is_nil( obj.in() ) ) {
cerr << "Nil reference" << endl;
throw 0;
}
// Narrow
CallbackServer_var cb_server = CallbackServer::_narrow( obj.in() );
if( CORBA::is_nil( cb_server.in() ) ) {
cerr << "Argument is not a CallbackServer reference" << endl;
throw 0;
}
//Get reference to Root POA
obj = orb->resolve_initial_references( "RootPOA" );
PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() );
// Policies for the childPOA to be created.
CORBA::PolicyList policies (4);
policies.length (4);
CORBA::Any pol;
pol <<= BiDirPolicy::BOTH;
policies[0] =
orb->create_policy (BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE,
pol);
policies[1] =
poa->create_id_assignment_policy(PortableServer::SYSTEM_ID);
policies[2] =
poa->create_implicit_activation_policy( PortableServer::IMPLICIT_ACTIVATION );
policies[3] =
poa->create_lifespan_policy(PortableServer::TRANSIENT);
PortableServer::POAManager_var mgr = poa->the_POAManager();
// Create POA as child of RootPOA with the above policies. This POA
// will receive request in the same connection in which it sent
// the request
PortableServer::POA_var child_poa =
poa->create_POA ("childPOA",
mgr.in(),
policies);
// Creation of childPOA is over. Destroy the Policy objects.
for (CORBA::ULong i = 0;
i < policies.length ();
++i)
{
policies[i]->destroy ();
}
// Activate POA Manager
mgr->activate();
// Create an object
ClientCallback_i servant;
// Register the servant with the RootPOA, obtain its object
// reference, stringify it, and write it to a file.
obj = child_poa->servant_to_reference( &servant );
//ClientCallback_var ccb = ClientCallback::_narrow( obj.in() );
cb_server->callback_hello( ClientCallback::_narrow( obj.in() ),
CORBA::string_dup( "Greetings earthling" ));
}
catch( const CORBA::Exception &ex ) {
cerr << "Uncaught CORBA exception: " << ex << endl;
return 1;
}
}
示例9: main
int main(int argc, char* argv[]){
char aux1[1000];
try{
//
// Inicializacion del ORB
//
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "");
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
PortableServer::POAManager_var manager = root_poa->the_POAManager();
//
// Obtain NamincContext reference ...
//
CORBA::Object_var naming_context_object;
CosNaming::NamingContext_ptr naming_context;
try {
naming_context_object =
orb->string_to_object("corbaloc:iiop:[email protected]:2809/NameService");
naming_context =
CosNaming::NamingContext::_narrow (naming_context_object.in ());
} catch (...) {
cerr << "Error: cannot obtain naming service initial reference" << endl;
throw;
}
//
// Crea un POA para el supplier: PERSISTENT LifespanPolicy, USER_ID policy
//
PortableServer::LifespanPolicy_var lifespan =
root_poa->create_lifespan_policy(PortableServer::PERSISTENT);
PortableServer::IdAssignmentPolicy_var idAssignment =
root_poa->create_id_assignment_policy(PortableServer::USER_ID);
CORBA::PolicyList policies(2);
policies.length(2);
policies[0] = PortableServer::IdAssignmentPolicy::_duplicate(idAssignment);
policies[1] = PortableServer::LifespanPolicy::_duplicate(lifespan);
PortableServer::POA_var consumer_poa =
root_poa->create_POA("consumerPOA", manager.in(), policies);
PortableServer::POAManager_var consumer_poa_manager =
consumer_poa->the_POAManager();
idAssignment->destroy();
lifespan->destroy();
// Activa el POAManager
manager->activate();
//
// Crea y activa el servant del consumer
//
PortableServer::ObjectId_var oid =
PortableServer::string_to_ObjectId("MyConsumer");
MyConsumerImpl servant_consumer;
try{
consumer_poa->activate_object_with_id(oid.in(), &servant_consumer);
}
catch(...){
cerr << "[supplier] ERROR: activating servant_supplier " << endl;
}
CORBA::Object_var consumer_obj = consumer_poa->id_to_reference(oid.in());
CosEventComm::PushConsumer_var consumer =
CosEventComm::PushConsumer::_narrow(consumer_obj);
//
// Recoge la referencia al canal
//
// readChannelIOR();
// obj = orb->string_to_object(ChannelIOR);
CosNaming::NamingContext_var naming_context_notif = NULL;
CosNaming::Name name_notif(2);
name_notif.length (2);
name_notif[0].id = CORBA::string_dup ("MyNotif");
name_notif[0].kind = CORBA::string_dup ("");
name_notif[1].id = CORBA::string_dup ("channel");
name_notif[1].kind = CORBA::string_dup ("");
obj = naming_context->resolve(name_notif);
CosNotifyChannelAdmin::EventChannel_var channel;
channel = CosNotifyChannelAdmin::EventChannel::_narrow(obj);
if (CORBA::is_nil(channel)) {
cerr << "[consumer] ERROR: canal nulo " << endl;
return -1;
//.........这里部分代码省略.........
示例10: safe_servant
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
DANCE_DISABLE_TRACE ();
int retval = 0;
try
{
DAnCE::Logger_Service * dlf =
ACE_Dynamic_Service<DAnCE::Logger_Service>::instance ("DAnCE_Logger");
if (dlf)
{
dlf->init (argc, argv);
}
DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO
ACE_TEXT("PL_Daemon - initializing ORB\n")));
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO
ACE_TEXT("PL_Daemon - initializing module instance\n")));
TAO::Utils::ORB_Destroyer safe_orb (orb);
CORBA::Object_var poa_obj
= orb->resolve_initial_references ("RootPOA");
PortableServer::POA_var poa
= PortableServer::POA::_narrow (poa_obj.in ());
PortableServer::POAManager_var mgr = poa->the_POAManager ();
PortableServer::POA_var persistent_poa;
TAO::Utils::PolicyList_Destroyer policies (2);
policies.length (2);
try
{
DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO ACE_TEXT("PL_Daemon - ")
ACE_TEXT("before creating the \"Managers\" POA.\n")));
policies[0] = poa->create_id_assignment_policy (PortableServer::USER_ID);
policies[1] = poa->create_lifespan_policy (PortableServer::PERSISTENT);
persistent_poa = poa->create_POA ("Managers",
mgr.in(),
policies);
}
catch (const PortableServer::POA::AdapterAlreadyExists &)
{
persistent_poa = poa->find_POA ("Managers", 0);
}
DAnCE::Plan_Launcher_Daemon_i *pl_daemon (0);
ACE_NEW_RETURN (pl_daemon,
DAnCE::Plan_Launcher_Daemon_i (orb.in ()),
0);
PortableServer::ServantBase_var safe_servant (pl_daemon);
PortableServer::ObjectId_var oid =
PortableServer::string_to_ObjectId ("Plan_Launcher_Daemon");
persistent_poa->activate_object_with_id (oid, pl_daemon);
CORBA::Object_var pl_obj = persistent_poa->id_to_reference (oid.in ());
CORBA::String_var pl_ior = orb->object_to_string (pl_obj.in ());
DAnCE::Utility::write_IOR (ACE_TEXT ("PL_Daemon.ior"),
pl_ior.in ());
orb->run ();
DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO
ACE_TEXT("PL_Daemon - destroying ORB\n")));
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
DANCE_ERROR (DANCE_LOG_EMERGENCY,
(LM_EMERGENCY, DLINFO
"PL_Daemon - Error - CORBA Exception :%C\n",
ex._info ().c_str ()));
retval = -1;
}
catch (...)
{
DANCE_ERROR (DANCE_LOG_EMERGENCY,
(LM_ERROR, "PL_Daemon - Error: Unknown exception.\n"));
retval = -1;
}
return retval;
}
示例11: policies
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
try
{
// Initialize the ORB first.
CORBA::ORB_var orb =
CORBA::ORB_init (argc,
argv,
"POAManagerFactoryTest");
if (parse_args (argc, argv) != 0)
return 1;
// Obtain the RootPOA.
CORBA::Object_var obj =
orb->resolve_initial_references ("RootPOA");
// Narrow to POA.
PortableServer::POA_var root_poa =
PortableServer::POA::_narrow (obj.in ());
if (verbose)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("Obtain PoaManagerFactory reference: ")));
pretest = fail;
// Obtain the POAManagerFactory.
PortableServer::POAManagerFactory_var poa_manager_factory
= root_poa->the_POAManagerFactory ();
VERIFY_CONDITION (!CORBA::is_nil(poa_manager_factory.in()));
if (verbose)
ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("%s\n"),
(pretest == fail) ? ACE_TEXT ("passed") : ACE_TEXT ("failed")));
if (CORBA::is_nil(poa_manager_factory.in()))
return 1;
CORBA::PolicyList policies (0);
policies.length (0);
if (verbose)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("Create a POAManager: ")));
pretest = fail;
// Explicitly create a POAManager - "POAManager1" .
PortableServer::POAManager_var poa_manager_1
= poa_manager_factory->create_POAManager ("POAManager1",
policies);
VERIFY_CONDITION (!CORBA::is_nil(poa_manager_1.in()));
if (verbose)
ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("%s\n"),
(pretest == fail) ? ACE_TEXT ("passed") : ACE_TEXT ("failed")));
if (CORBA::is_nil(poa_manager_1.in()))
return 1;
// Creating a POAManager with an exiting POAManager name raises exception.
if (verbose)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("Prevent duplicated POAManagers: ")));
pretest = fail;
CORBA::Boolean got_expected_exception = false;
try
{
PortableServer::POAManager_var poa_manager
= poa_manager_factory->create_POAManager ("POAManager1",
policies);
}
catch (const PortableServer::POAManagerFactory::ManagerAlreadyExists& )
{
got_expected_exception = true;
}
VERIFY_CONDITION (got_expected_exception);
if (verbose)
ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("%s\n"),
(pretest == fail) ? ACE_TEXT ("passed") : ACE_TEXT ("failed")));
if (! got_expected_exception)
return 1;
{
if (verbose)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("Implicitly create a POAManagers: ")));
pretest = fail;
// Implicitly create a POAManager instance which has an automatically
// assigned name.
PortableServer::POA_var child_poa =
root_poa->create_POA ("childPOA2",
PortableServer::POAManager::_nil (),
policies);
PortableServer::POAManager_var poa_manager_2
= child_poa->the_POAManager ();
VERIFY_CONDITION (!CORBA::is_nil(poa_manager_2.in()));
//.........这里部分代码省略.........
示例12:
RtecEventChannelAdmin::EventChannel_ptr
FTEC_Gateway::activate(PortableServer::POA_ptr root_poa)
{
PortableServer::POA_var poa;
PortableServer::POAManager_var mgr;
if (impl_->local_orb) {
int argc = 0;
char** argv = 0;
impl_->orb = CORBA::ORB_init(argc, argv, "FTEC_GatewayORB");
Interceptor_Destoryer::execute(impl_->orb.in());
poa = resolve_init<PortableServer::POA>(impl_->orb.in(), "RootPOA");
mgr = poa->the_POAManager();
mgr->activate();
}
else {
poa = PortableServer::POA::_duplicate(root_poa);
mgr = poa->the_POAManager();
}
PortableServer::IdUniquenessPolicy_var id_uniqueness_policy =
poa->create_id_uniqueness_policy(PortableServer::MULTIPLE_ID);
PortableServer::LifespanPolicy_var lifespan =
poa->create_lifespan_policy(PortableServer::PERSISTENT);
// create a USER_ID IdAssignmentPolicy object
PortableServer::IdAssignmentPolicy_var assign =
poa->create_id_assignment_policy(PortableServer::USER_ID);
CORBA::PolicyList policy_list;
policy_list.length(3);
policy_list[0] = PortableServer::IdUniquenessPolicy::_duplicate(
id_uniqueness_policy.in());
policy_list[1]=
PortableServer::LifespanPolicy::_duplicate(lifespan.in());
policy_list[2]=
PortableServer::IdAssignmentPolicy::_duplicate(assign.in());
impl_->poa = poa->create_POA("gateway_poa", mgr.in(), policy_list);
id_uniqueness_policy->destroy();
lifespan->destroy();
assign->destroy();
FtRtecEventComm::ObjectId oid;
oid.length(16);
TAO_FtRt::UUID::create(oid.get_buffer());
RtecEventChannelAdmin::EventChannel_var gateway;
activate_object_with_id(gateway.out(), impl_->poa.in(), this, oid);
++oid[9];
activate_object_with_id(impl_->consumer_admin.out(),
impl_->poa.in(),
&impl_->consumer_admin_servant,
oid);
++oid[9];
activate_object_with_id(impl_->supplier_admin.out(),
impl_->poa.in(),
&impl_->supplier_admin_servant,
oid);
return gateway._retn();
}
示例13: while
//-----------------------------------------------------------------------------
ORBHelper::ORBHelper() :
threadManager_mp(0),
orbRunYet_m(false)
{
//create a new ACE thread manager
threadManager_mp = ACE_Thread_Manager::instance();
//CORBA naming service corbaloc
ACE_CString nameService;
//get NameService Reference
nameService += acscommon::NAMING_SERVICE_NAME;
nameService +="=corbaloc::";
nameService += ACSPorts::getIP();
nameService += ":";
nameService += ACSPorts::getNamingServicePort().c_str();
nameService += "/";
nameService += acscommon::NAMING_SERVICE_NAME;
// initialize ORB
int argc = 5;
char* argv[] = { "",
"-ORBInitRef",
(char *)nameService.c_str(),
"-ORBDottedDecimalAddresses",
"1"};
//initialize the ORB
orb_mp = CORBA::ORB_init(argc, argv, "");
//ensure it's a real reference
ACE_ASSERT(!CORBA::is_nil(orb_mp));
//get the Root POA
CORBA::Object_var poaObject = orb_mp->resolve_initial_references("RootPOA");
//ensure it's a real reference
ACE_ASSERT(!CORBA::is_nil(poaObject.in()));
//narrow the Root POA
PortableServer::POA_var rootPOA = PortableServer::POA::_narrow(poaObject.in());
//ensure it's a real reference
ACE_ASSERT(!CORBA::is_nil(rootPOA.in()));
//get the POA manager
PortableServer::POAManager_var poaManager = rootPOA->the_POAManager();
//ensure it's a real reference
ACE_ASSERT(!CORBA::is_nil(poaManager.in()));
//finally activate the POA manager to start processing incoming and
//outgoing calls
poaManager->activate();
//spawn a separate thread to start the ORB in
ACE_ASSERT(threadManager_mp!=0);
threadManager_mp->spawn(ACE_THR_FUNC(ORBHelper::runOrbThread), static_cast<void *>(this));
//block until the ORB thread has really started!
while(orbRunYet_m==false)
{
ACE_OS::sleep(1);
}
ACE_OS::sleep(1);
}
示例14: ACE_TEXT
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
DANCE_DISABLE_TRACE ();
int retval = 0;
try
{
DAnCE::Logger_Service * dlf =
ACE_Dynamic_Service<DAnCE::Logger_Service>::instance ("DAnCE_Logger");
if (dlf)
{
dlf->init (argc, argv);
}
DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, (LM_TRACE, DLINFO
ACE_TEXT("SHS_Deamon - initializing ORB\n")));
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, (LM_TRACE, DLINFO
ACE_TEXT("SHS_Deamon - initializing module instance\n")));
TAO::Utils::ORB_Destroyer safe_orb (orb);
CORBA::Object_var tmp = orb->resolve_initial_references ("NameService");
CosNaming::NamingContext_var domain_nc =
CosNaming::NamingContext::_narrow (tmp);
if (CORBA::is_nil (domain_nc.in ()))
{
ACE_ERROR ((LM_EMERGENCY,
"SHS_Daemon - Unable to register with the"\
" CORBA Naming Service\n"));
return -1;
}
CORBA::Object_var poa_obj
= orb->resolve_initial_references ("RootPOA");
PortableServer::POA_var poa
= PortableServer::POA::_narrow (poa_obj.in ());
PortableServer::POAManager_var mgr = poa->the_POAManager ();
PortableServer::POA_var persistent_poa;
TAO::Utils::PolicyList_Destroyer policies (2);
policies.length (2);
try
{
DANCE_DEBUG (DANCE_LOG_TRACE, (LM_TRACE,
DLINFO ACE_TEXT("SHS_Deamon - ")
ACE_TEXT("before creating the \"SHS\" POA.\n")));
policies[0] = poa->create_id_assignment_policy (
PortableServer::USER_ID);
policies[1] = poa->create_lifespan_policy (
PortableServer::PERSISTENT);
persistent_poa = poa->create_POA ("SHS",
mgr.in(),
policies);
}
catch (const PortableServer::POA::AdapterAlreadyExists &)
{
persistent_poa = poa->find_POA ("Managers", 0);
}
DAnCE::SHS_Daemon_i *shs_daemon (0);
ACE_NEW_RETURN (shs_daemon,
DAnCE::SHS_Daemon_i (orb.in ()),
0);
PortableServer::ServantBase_var safe_servant (shs_daemon);
PortableServer::ObjectId_var oid =
PortableServer::string_to_ObjectId ("SHS_Daemon");
persistent_poa->activate_object_with_id (oid, shs_daemon);
CORBA::Object_var shs_obj = persistent_poa->id_to_reference (oid.in ());
CORBA::String_var shs_ior = orb->object_to_string (shs_obj.in ());
DAnCE::Utility::write_IOR (ACE_TEXT ("SHS_Daemon.ior"),
shs_ior.in ());
CosNaming::Name name (1);
name.length (1);
name[0].id = "DAnCE.SystemHealthDaemon";
domain_nc->rebind (name, shs_obj.in ());
mgr->activate ();
orb->run ();
DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, (LM_TRACE, DLINFO
ACE_TEXT("SHS_Daemon - destroying ORB\n")));
orb->destroy ();
//.........这里部分代码省略.........