12.07.2015 Views

VisiBroker Edition

VisiBroker Edition

VisiBroker Edition

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

步 骤 4: 实 现 服 务 器// 初 始 化 ORB。CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);// 取 得 根 POA 的 引 用PortableServer::POA_var rootPOA = PortableServer::POA::_narrow(orb->resolve_initial_references("RootPOA"));CORBA::PolicyList policies;policies.length(1);policies[(CORBA::ULong)0] =rootPOA->create_lifespan_policy(PortableServer::PERSISTENT);// 得 到 POA 管 理 器PortableServer::POAManager_var poa_manager = rootPOA->the_POAManager();// 用 正 确 的 策 略 创 建 myPOAPortableServer::POA_var myPOA = rootPOA->create_POA("bank_agent_poa",poa_manager, policies);// 创 建 服 务 对 象AccountManagerImpl managerServant;// 确 定 服 务 对 象 IDPortableServer::ObjectId_var managerId =PortableServer::string_to_ObjectId("BankManager");// 用 myPOA 上 的 ID 激 活 服 务 对 象myPOA->activate_object_with_id(managerId, &managerServant);// 激 活 POA 管 理 器poa_manager->activate();cout servant_to_reference(&managerServant)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!