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.

完 整 实 例Java:}};int main(int argc, char* const* argv) {try{// 初 始 化 ORB。CORBA::ORB_ptr orb = CORBA::ORB_init(argc, argv);// 取 得 根 POA 的 引 用CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");// 窄 转 换 POA 引 用 的 对 象 引 用PortableServer::POA_var rootPOA = PortableServer::POA::_narrow(obj);CORBA::PolicyList policies;policies.length(1);policies[(CORBA::ULong)0] = rootPOA->create_lifespan_policy(PortableServer::PERSISTENT);// 用 正 确 的 策 略 创 建 myPOAPortableServer::POAManager_var rootManager = rootPOA->the_POAManager();PortableServer::POA_var myPOA = rootPOA->create_POA("bank_agent_poa",rootManager, policies );// 创 建 服 务 对 象AccountManagerImpl managerServant;// 确 定 服 务 对 象 IDPortableServer::ObjectId_var managerId =PortableServer::string_to_ObjectId("BankManager");// 用 myPOA 上 的 ID 激 活 服 务 对 象myPOA->activate_object_with_id(managerId, &managerServant);// 激 活 POA 管 理 器rootPOA->the_POAManager()->activate();cout servant_to_reference(&managerServant)

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

Saved successfully!

Ooh no, something went wrong!