当前位置: 首页>>代码示例>>C++>>正文


C++ portableserver::POA_var类代码示例

本文整理汇总了C++中portableserver::POA_var的典型用法代码示例。如果您正苦于以下问题:C++ POA_var类的具体用法?C++ POA_var怎么用?C++ POA_var使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了POA_var类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

TAO_Stub *
TAO_DynamicImplementation::_create_stub (void)
{
  // If DynamicImplementation::_this() is invoked outside of the
  // context of a request invocation on a target object being served
  // by the DSI servant, it raises the PortableServer::WrongPolicy
  // exception. See the CORBA C++ mapping, section 1.38.3.
  TAO::Portable_Server::POA_Current_Impl *poa_current_impl =
    static_cast <TAO::Portable_Server::POA_Current_Impl *>
                     (TAO_TSS_Resources::instance ()->poa_current_impl_);

  if (poa_current_impl == 0
      || this != poa_current_impl->servant ())
    {
      throw PortableServer::POA::WrongPolicy ();
    }

  PortableServer::POA_var poa =
    poa_current_impl->get_POA ();

  CORBA::PolicyList_var client_exposed_policies =
    poa_current_impl->poa ()->client_exposed_policies (
        poa_current_impl->priority ());

  CORBA::RepositoryId_var pinterface =
    this->_primary_interface (poa_current_impl->object_id (), poa.in ());

  return
    poa_current_impl->poa ()->key_to_stub (poa_current_impl->object_key (),
                                           pinterface.in (),
                                           poa_current_impl->priority ());
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:32,代码来源:Dynamic_Implementation.cpp

示例2: catch

// Shutdown.
void
AccountManager_i::close (Bank::Account_ptr account)
{
  try
    {
      CORBA::String_var name = account->name ();

      ACE_DEBUG((LM_DEBUG,
                 ACE_TEXT ("[SERVER] Process/Thread Id : (%P/%t) Closing Account for %C\n"),
                 name.in ()));

      Account_i_var account;
      if (hash_map_.unbind (name.in (), account) == -1)
        {
          if (TAO_debug_level > 0)
            ACE_DEBUG((LM_DEBUG,
                       ACE_TEXT ("Unable to close account\n")));
        }

      if (!account.is_nil ())
        {
          PortableServer::POA_var poa = account->_default_POA ();

          PortableServer::ObjectId_var id = poa->servant_to_id (account.in ());

          poa->deactivate_object (id.in ());
        }
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Unable to close Account\n");
    }
}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:34,代码来源:AccountManager_i.cpp

示例3: 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;
}
开发者ID:binary42,项目名称:OCI,代码行数:29,代码来源:create_persistent_poa.cpp

示例4: catch

TAO_Trader<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>::~TAO_Trader (void)
{
  // Remove Trading Components from POA


  for (int i = LOOKUP_IF; i <= LINK_IF; i++)
    {
      if (this->ifs_[i] != 0)
        {
          try
            {
              PortableServer::POA_var poa =
                this->ifs_[i]->_default_POA ();

              PortableServer::ObjectId_var id =
                poa->servant_to_id (this->ifs_[i]);

              poa->deactivate_object (id.in ());
            }
          catch (const CORBA::Exception&)
            {
              // Don't let exceptions propagate out of this call since
              // it's the destructor!
            }
        }
    }
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:27,代码来源:Trader_T.cpp

示例5: main

int main(int argc, char* argv[])
{
  CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "");

  CORBA::Object_var poa_obj = orb->resolve_initial_references ("RootPOA");
  PortableServer::POA_var poa = PortableServer::POA::_narrow (poa_obj);
  PortableServer::POAManager_var poa_manager = poa->the_POAManager();
  
  return_allprimitives_impl return_allprimitives(orb);

  PortableServer::ObjectId_var oid = poa->activate_object (&return_allprimitives);

  CORBA::Object_var ref = poa->id_to_reference (oid.in());
  CORBA::String_var str = orb->object_to_string (ref.in());
  if(argc > 1)
  {
    std::ofstream ofs(argv[1]);
    ofs << str.in() << std::endl;
  }
  else
    std::cout << str.in() << std::endl;

  std::cout << "Running" << std::endl;

  poa_manager->activate();
  orb->run();

  assert(return_allprimitives.foo7_ && return_allprimitives.foo6_ && return_allprimitives.foo5_
         && return_allprimitives.foo4_ && return_allprimitives.foo3_ && return_allprimitives.foo2_
         && return_allprimitives.foo1_);
}
开发者ID:amadeubarbosa,项目名称:mORBid,代码行数:31,代码来源:server.cpp

示例6: catch

int
TAO_IFR_Server::init_with_orb (int argc,
                               ACE_TCHAR *argv [],
                               CORBA::ORB_ptr orb,
                               int use_multicast_server)
{
  try
    {
      // Get the POA from the ORB.
      CORBA::Object_var poa_object =
        orb->resolve_initial_references ("RootPOA");

      if (CORBA::is_nil (poa_object.in ()))
        {
          ORBSVCS_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("(%P|%t) IFR_Service::init_with_orb ")
                             ACE_TEXT ("Unable to initialize the POA.\n")),
                            -1);
        }
      PortableServer::POA_var rp =
        PortableServer::POA::_narrow (poa_object.in ());
      return this->init_with_poa (argc, argv, orb, rp.in(), use_multicast_server);
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("IFR_Service::init_with_orb");

      throw;
    }
  return 0;
}
开发者ID:esohns,项目名称:ATCD,代码行数:31,代码来源:IFR_Service_Utils.cpp

示例7: catch

int
Consumer_Handler::init (int argc,
                        ACE_TCHAR *argv[],
                        ShutdownCallback *_shutdowncallback)
{
  const char *filtering_criteria = "";

   // First see if we have any environment variables.
  filtering_criteria =
    ACE_OS::getenv ("FILTERING_CRITERIA");

   // Then override these variables with command-line arguments if
   // necessary.
  filtering_criteria = argc > 1 ? ACE_TEXT_ALWAYS_CHAR(argv[1]) : "";

  try
    {
      // Retrieve the ORB.
      this->orb_ = CORBA::ORB_init (argc, argv);

      CORBA::Object_var poa_object  =
        this->orb_->resolve_initial_references ("RootPOA");

      PortableServer::POA_var poa =
        PortableServer::POA::_narrow (poa_object.in ());

      PortableServer::POAManager_var poa_manager =
        poa->the_POAManager ();

      poa_manager->activate ();

      // Save the Shutdown callback.
      this->shutdowncallback = _shutdowncallback;
      // Set the ShutdownCallback callback object
      // in the Consumer object implementation.
      this->receiver_i_.set (_shutdowncallback);

      // Start the servant.
      this->receiver_ =
        this->receiver_i_._this ();


      if (this->get_notifier () == -1)
        ACE_ERROR_RETURN ((LM_ERROR,
                           " (%P|%t) Unable to get the notifier "
                           "the TAO_Naming_Client.\n"),
                          -1);

      // Subscribe ourselves with the notifier's broker.
      this->notifier_->subscribe (this->receiver_.in (),
                                  filtering_criteria);
    }
  catch (const CORBA::Exception& ex)
   {
     ex._tao_print_exception ("Consumer_Handler::init\n");
     return -1;
   }

  return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:60,代码来源:Consumer_Handler.cpp

示例8: activate

void
TAO_ECG_UDP_Sender::new_connect (const RtecEventChannelAdmin::ConsumerQOS& sub)
{
  // Activate with poa.
  RtecEventComm::PushConsumer_var consumer_ref;
  PortableServer::POA_var poa = this->_default_POA ();

  TAO_EC_Object_Deactivator deactivator;
  activate (consumer_ref,
            poa.in (),
            this,
            deactivator);

  // Connect as a consumer to the local EC.
  RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin =
    this->lcl_ec_->for_consumers ();

  RtecEventChannelAdmin::ProxyPushSupplier_var proxy =
    consumer_admin->obtain_push_supplier ();
  ECG_Sender_Auto_Proxy_Disconnect new_proxy_disconnect (proxy.in ());

  proxy->connect_push_consumer (consumer_ref.in (),
                                sub);

  // Update resource managers.
  this->supplier_proxy_ = proxy._retn ();
  this->auto_proxy_disconnect_.set_command (new_proxy_disconnect);
  this->set_deactivator (deactivator);
}
开发者ID:asdlei00,项目名称:ACE,代码行数:29,代码来源:ECG_UDP_Sender.cpp

示例9: guard

  void
  StructuredPushSupplier::disconnect() 
  {
    DBG(cout << "Disconnecting StructuredPushSupplier." << endl);

    Guard guard(connectedMutex_);
    if (connected_) {
      proxyConsumer_->disconnect_structured_push_consumer();
      supplierAdmin_->destroy();

      // Get reference to Root POA.
      PortableServer::POA_var poa = _default_POA();

      // Deactivate.
      PortableServer::ObjectId_var oid =
	poa->reference_to_id (objref_);

      CORBA::release(objref_);
    
      // deactivate from the poa.
      poa->deactivate_object (oid.in ());

      connected_ = false;
    }
  }
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:25,代码来源:StructuredPushSupplier.cpp

示例10: policies

PortableServer::POA_ptr
ServerApp::create_poa(CORBA::ORB_ptr orb,
                      const char* poa_name)
{
  // Get the Root POA.
  PortableServer::POA_var root_poa
    = RefHelper<PortableServer::POA>::resolve_initial_ref(orb,
                                                          "RootPOA");

  // Get the POAManager from the Root POA.
  PortableServer::POAManager_var poa_manager
    = root_poa->the_POAManager();

  // Create the child POA Policies.
  CORBA::PolicyList policies(0);
  policies.length(0);

  // Create the child POA
  PortableServer::POA_var poa = AppHelper::create_poa(poa_name,
                                                      root_poa.in(),
                                                      poa_manager.in(),
                                                      policies);

  // Give away the child POA_ptr from the POA_var variable.
  return poa._retn();
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:26,代码来源:ServerApp.cpp

示例11: catch

void
Test_Supplier::disconnect (void)
{
  if (CORBA::is_nil (this->consumer_proxy_.in ()))
    return;

  try
    {
      this->consumer_proxy_->disconnect_push_consumer ();
    }
  catch (const CORBA::Exception&)
    {
      // The consumer may be gone already, so we
      // will ignore this exception
    }

  this->consumer_proxy_ =
    RtecEventChannelAdmin::ProxyPushConsumer::_nil ();

  // Deactivate the servant
  PortableServer::POA_var poa =
    this->supplier_._default_POA ();
  PortableServer::ObjectId_var id =
    poa->servant_to_id (&this->supplier_);
  poa->deactivate_object (id.in ());
}
开发者ID:CCJY,项目名称:ATCD,代码行数:26,代码来源:ECT_Supplier.cpp

示例12: OBJECT_NOT_EXIST

void
TAO_Hash_Naming_Context::destroy (void)
{
  // Check to make sure this object didn't have <destroy> method
  // invoked on it.
  if (this->destroyed_)
    throw CORBA::OBJECT_NOT_EXIST ();

  if (this->context_->current_size () != 0)
    throw CosNaming::NamingContext::NotEmpty();

  // Destroy is a no-op on a root context.
  if (root ())
    return;

  else
    {
      this->destroyed_ = 2;

      // Remove self from POA.  Because of reference counting, the POA
      // will automatically delete the servant when all pending requests
      // on this servant are complete.

      PortableServer::POA_var poa =
        this->_default_POA ();

      PortableServer::ObjectId_var id =
        PortableServer::string_to_ObjectId (poa_id_.fast_rep ());

      poa->deactivate_object (id.in ());
    }
}
开发者ID:binary42,项目名称:OCI,代码行数:32,代码来源:Hash_Naming_Context.cpp

示例13: main

int main(int argc, char *argv[])
{  
   cout << "Creating and initializing the ORB..." << endl;

   CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB4");

   CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
   PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
   poa->the_POAManager()->activate();

   EnvImpl* envImpl = new EnvImpl();
   poa->activate_object(envImpl);

   // Obtain a reference to the object, and register it in the naming service.
   obj = envImpl->_this();

   cout << orb->object_to_string(obj) << endl;
   cout << "Binding server implementations to registry..." << endl;
   bindObjectToName(orb, "Env", obj);
   envImpl->_remove_ref();

   cout << "Waiting for invocations from clients..." << endl;
   orb->run();

   return 0;
}
开发者ID:lihongyu19781114,项目名称:java,代码行数:26,代码来源:EnvServer.cpp

示例14: guard

  void
  StructuredPushConsumer::disconnect()
  {
    Guard guard(connectedMutex_);
    if (connected_ == 1) {
      MIRO_DBG(MIRO, LL_NOTICE, "Disconnecting StructuredPushConsumer.\n");
      connected_ = -1;
      try {
        proxySupplier_->disconnect_structured_push_supplier();

        // Get reference to Root POA.
        PortableServer::POA_var poa = _default_POA();

        // Deactivate.
        PortableServer::ObjectId_var oid =
          poa->reference_to_id(objref_);

        CORBA::release(objref_);

        // deactivate from the poa.
        poa->deactivate_object(oid.in());
      }
      catch (const CORBA::Exception & e) {
        MIRO_LOG_OSTR(LL_ERROR, "StructuredPushConsumer::disconnect() CORBA exception on: " << std::endl
                      << e << std::endl);
      }
    }
  }
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:28,代码来源:StructuredPushConsumer.cpp

示例15:

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();
}
开发者ID:asdlei00,项目名称:ACE,代码行数:29,代码来源:server.cpp


注:本文中的portableserver::POA_var类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。