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


C++ corba::Policy_var类代码示例

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


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

示例1:

void
TAO_POA_Policy_Set::validate_policies (TAO_Policy_Validator &validator,
                                       TAO_ORB_Core &orb_core)
{
  // Just give a last chance for all the unloaded validators in other
  // libraries to be registered
  orb_core.load_policy_validators (validator);

  // Validate that all of the specified policies make sense.
  validator.validate (this->impl_ );

  // Verify that all policies are legal for the currently loaded
  // POA extensions.
  for (CORBA::ULong i = 0;
       i < this->impl_.num_policies ();
       i++)
    {
      CORBA::Policy_var policy = this->impl_.get_policy_by_index (i);

      CORBA::PolicyType type = policy->policy_type ();

      if (!(validator.legal_policy (type)))
        {
#if !defined (CORBA_E_MICRO)
          // An invalid policy was specified.  Let the user know about
          // it.
          throw PortableServer::POA::InvalidPolicy ();
#else
          TAOLIB_ERROR ((LM_ERROR, "Invalid policy\n"));
#endif
        }
    }
}
开发者ID:asdlei00,项目名称:ACE,代码行数:33,代码来源:POA_Policy_Set.cpp

示例2: policy

void
IORInterceptor::establish_components (
    PortableInterceptor::IORInfo_ptr info)
{
  try
    {
      PortableInterceptor::ObjectReferenceTemplate_var t =
        info->adapter_template ();

      PortableInterceptor::AdapterName_var a =
        t->adapter_name ();

      // Only execute if POA is not RootPOA.  The RootPOA will not
      // have our custom policy, but the child POA we created will.
      if (a->length () > 1)
        {
          CORBA::Policy_var policy (
            info->get_effective_policy (Test::POLICY_TYPE));

          Test::Policy_var test_policy (Test::Policy::_narrow (
            policy.in ()));

          this->success_ = true;
        }
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception (
        "EXCEPTION: ""IORInterceptor::establish_components:");

      ACE_ASSERT (false);
    }
}
开发者ID:asdlei00,项目名称:ACE,代码行数:33,代码来源:IORInterceptor.cpp

示例3: policy_list

int
insecure_invocation_test (CORBA::ORB_ptr orb,
                          CORBA::Object_ptr obj)
{
  // Disable protection for this insecure invocation test.

  Security::QOP qop = Security::SecQOPNoProtection;

  CORBA::Any no_protection;
  no_protection <<= qop;

  // Create the Security::QOPPolicy.
  CORBA::Policy_var policy =
    orb->create_policy (Security::SecQOPPolicy,
                        no_protection);

  CORBA::PolicyList policy_list (1);
  policy_list.length (1);
  policy_list[0] = CORBA::Policy::_duplicate (policy.in ());

  // Create an object reference that uses plain IIOP (i.e. no
  // protection).
  CORBA::Object_var object =
    obj->_set_policy_overrides (policy_list,
                                CORBA::SET_OVERRIDE);

  Foo::Bar_var server =
    Foo::Bar::_narrow (object.in ());

  if (CORBA::is_nil (server.in ()))
    {
      ACE_ERROR ((LM_ERROR,
                  "(%P|%t) ERROR: Object reference <%s> is "
                  "nil.\n",
                  ior));

      return 1;
    }

  try
    {
      // This invocation should result in a CORBA::NO_PERMISSION
      // exception.
      server->baz ();
    }
  catch (const CORBA::NO_PERMISSION&)
    {
      ACE_DEBUG ((LM_INFO,
                  "(%P|%t) Received CORBA::NO_PERMISSION from "
                  "server, as expected.\n"));

      return 0;
    }

  ACE_ERROR ((LM_ERROR,
              "(%P|%t) ERROR: CORBA::NO_PERMISSION was not thrown.\n"
              "(%P|%t) ERROR: It should have been thrown.\n"));

  return 1;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:60,代码来源:client.cpp

示例4: check_cp_policy

//Check if the policy of object is set to client declared
CORBA::Short check_cp_policy (Test_ptr server ACE_ENV_ARG_DECL)
{
	// Check that the object is configured with CLIENT_PROPAGATED
        // PriorityModelPolicy.
        CORBA::Policy_var policy =
            server->_get_policy (RTCORBA::PRIORITY_MODEL_POLICY_TYPE
                    ACE_ENV_ARG_PARAMETER);
        ACE_CHECK_RETURN (-1);

        RTCORBA::PriorityModelPolicy_var priority_policy =
            RTCORBA::PriorityModelPolicy::_narrow (policy.in () ACE_ENV_ARG_PARAMETER);
        ACE_CHECK_RETURN (-1);

        if (CORBA::is_nil (priority_policy.in ()))
            ACE_ERROR_RETURN ((LM_ERROR,
                        "ERROR: Priority Model Policy not exposed!\n"),
                    -1);

        RTCORBA::PriorityModel priority_model =
            priority_policy->priority_model (ACE_ENV_SINGLE_ARG_PARAMETER);
        ACE_CHECK_RETURN (-1);

        if (priority_model != RTCORBA::CLIENT_PROPAGATED)
            ACE_ERROR_RETURN ((LM_ERROR,
                        "ERROR: priority_model != "
                        "RTCORBA::CLIENT_PROPAGATED!\n"),
                    -1);
		    
	return priority_policy->server_priority (ACE_ENV_SINGLE_ARG_PARAMETER);
}
开发者ID:kraman,项目名称:RTZen,代码行数:31,代码来源:client1.cpp

示例5:

void
TAO_RT_POA::parse_rt_policies (TAO_POA_Policy_Set &policies)
{
  {
    CORBA::Policy_var policy =
      policies.get_cached_policy (TAO_CACHED_POLICY_PRIORITY_MODEL);

    RTCORBA::PriorityModelPolicy_var priority_model =
      RTCORBA::PriorityModelPolicy::_narrow (policy.in ());

    if (!CORBA::is_nil (priority_model.in ()))
      {
        RTCORBA::PriorityModel rt_priority_model =
          priority_model->priority_model ();

        this->cached_policies_.priority_model (
          TAO::Portable_Server::Cached_Policies::PriorityModel (rt_priority_model));

        RTCORBA::Priority priority =
          priority_model->server_priority ();

        this->cached_policies_.server_priority (priority);
      }
  }

  this->thread_pool_ =
    TAO_POA_RT_Policy_Validator::extract_thread_pool (this->orb_core_,
                                                      policies.policies ());
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:29,代码来源:RT_POA.cpp

示例6:

    void
    Cached_Policies::update (TAO_POA_Policy_Set &policy_set
                                     )
    {
      for (CORBA::ULong i = 0; i < policy_set.num_policies (); i++)
        {
          CORBA::Policy_var policy = policy_set.get_policy_by_index (i);

          this->update_policy (policy.in ()
                              );
        }
    }
开发者ID:CCJY,项目名称:ATCD,代码行数:12,代码来源:POA_Cached_Policies.cpp

示例7:

void
TAO_ZIOPPolicy_Validator::validate_impl (TAO_Policy_Set &policies)
{
  CORBA::Policy_var policy =
    policies.get_cached_policy (TAO_CACHED_COMPRESSION_ENABLING_POLICY);

  if (policy.in () == 0)
    return;

  ZIOP::CompressionEnablingPolicy_var srp =
    ZIOP::CompressionEnablingPolicy::_narrow (policy.in ());

  if (srp.in () == 0)
    return;
}
开发者ID:chenbk85,项目名称:ACE-Middleware,代码行数:15,代码来源:ZIOP_Policy_Validator.cpp

示例8:

CORBA::Policy_ptr
TAO_Stub::get_cached_policy (TAO_Cached_Policy_Type type)
{
  // No need to lock, the stub only changes its policies at
  // construction time...

  CORBA::Policy_var result;
  if (this->policies_ != 0)
    {
      result = this->policies_->get_cached_policy (type);
    }

  if (CORBA::is_nil (result.in ()))
    {
      result = this->orb_core_->get_cached_policy_including_current (type);
    }

  return result._retn ();
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:19,代码来源:Stub.cpp

示例9:

CORBA::Policy_ptr
TAO_IORInfo::get_effective_policy (CORBA::PolicyType type)
{
  this->check_validity ();

  CORBA::Policy_var policy =
    this->poa_->get_policy (type);

  if (!CORBA::is_nil (policy.in ()))
    {
      return policy._retn ();
    }

  // TODO: Now check the global ORB policies.
  // ........

  // No policy matching the given PolicyType was found.
  throw ::CORBA::INV_POLICY (CORBA::OMGVMCID | 3, CORBA::COMPLETED_NO);
}
开发者ID:asdlei00,项目名称:ACE,代码行数:19,代码来源:IORInfo.cpp

示例10: register_with_proxy

CORBA::Object_ptr register_with_proxy (CORBA::Object_ptr native)
{
	// Disable protection for this insecure invocation test.

	Security::QOP qop = Security::SecQOPNoProtection;

	CORBA::Any no_protection;
	no_protection <<= qop;

	// Create the Security::QOPPolicy.
	CORBA::Policy_var policy =
		orb->create_policy (Security::SecQOPPolicy,
				    no_protection);

	CORBA::PolicyList policy_list (1);
	policy_list.length (1);
	policy_list[0] = CORBA::Policy::_duplicate (policy.in ());

	// Create an object reference that uses plain IIOP (i.e. no
	// protection).
	CORBA::Object_var object =
		mapper->_set_policy_overrides (policy_list,
					       CORBA::SET_OVERRIDE);

	ACE_DEBUG ((LM_DEBUG,"Trying to narrow an insecure reference\n"));

	Lorica::ReferenceMapper_var open_mapper =
		Lorica::ReferenceMapper::_narrow(object.in());

	ACE_DEBUG ((LM_DEBUG,"Using open mapper for registering\n"));

	try
	{
		return open_mapper->as_server(native,"Hello",
					      Lorica::ServerAgent::_nil());
	}
	catch (CORBA::Exception &ex)
	{
		ACE_DEBUG ((LM_DEBUG,"open_mapper->as_server raised %s\n",ex._name()));
		return CORBA::Object::_nil();
	}
}
开发者ID:snaewe,项目名称:lorica,代码行数:42,代码来源:server.cpp

示例11:

CORBA::Short
Activity::get_server_priority (CORBA::Object_ptr server)
{
  // Get the Priority Model Policy from the stub.
  CORBA::Policy_var policy =
    server->_get_policy (RTCORBA::PRIORITY_MODEL_POLICY_TYPE);

  // Narrow down to correct type.
  RTCORBA::PriorityModelPolicy_var priority_policy =
    RTCORBA::PriorityModelPolicy::_narrow (policy.in ());

  // Make sure that we have the SERVER_DECLARED priority model.
  RTCORBA::PriorityModel priority_model =
    priority_policy->priority_model ();
  if (priority_model != RTCORBA::SERVER_DECLARED)
    return -1;

  // Return the server priority.
  return priority_policy->server_priority ();
}
开发者ID:INMarkus,项目名称:ATCD,代码行数:20,代码来源:Activity.cpp

示例12:

CORBA::Short
check_policy (Test_ptr server)
{
  CORBA::Policy_var policy =
    server->_get_policy (RTCORBA::PRIORITY_MODEL_POLICY_TYPE);

  RTCORBA::PriorityModelPolicy_var priority_policy =
    RTCORBA::PriorityModelPolicy::_narrow (policy.in ());

  if (check_for_nil (priority_policy.in (), "PriorityModelPolicy") == -1)
    return -1;

  RTCORBA::PriorityModel priority_model =
    priority_policy->priority_model ();
  if (priority_model != RTCORBA::SERVER_DECLARED)
    ACE_ERROR_RETURN ((LM_ERROR,
                       "ERROR: priority_model != "
                       "RTCORBA::SERVER_DECLARED!\n"),
                      -1);

  return priority_policy->server_priority ();
}
开发者ID:asdlei00,项目名称:ACE,代码行数:22,代码来源:client.cpp

示例13: INTERNAL

/* static */
TAO_Thread_Pool *
TAO_POA_RT_Policy_Validator::extract_thread_pool (TAO_ORB_Core &orb_core,
                                                  TAO_Policy_Set &policies)
{
  CORBA::Policy_var policy =
    policies.get_cached_policy (TAO_CACHED_POLICY_THREADPOOL);

  RTCORBA::ThreadpoolPolicy_var thread_pool_policy =
    RTCORBA::ThreadpoolPolicy::_narrow (policy.in ());

  if (CORBA::is_nil (thread_pool_policy.in ()))
    return 0;

  RTCORBA::ThreadpoolId thread_pool_id = thread_pool_policy->threadpool ();

  // Get the RTORB.
  CORBA::Object_var object = orb_core.resolve_rt_orb ();

  RTCORBA::RTORB_var rt_orb = RTCORBA::RTORB::_narrow (object.in ());

  TAO_RT_ORB * const tao_rt_orb =
    dynamic_cast <TAO_RT_ORB *> (rt_orb.in ());

  if (!tao_rt_orb)
    throw CORBA::INTERNAL ();

  TAO_Thread_Pool_Manager & tp_manager = tao_rt_orb->tp_manager ();

  TAO_Thread_Pool * const thread_pool =
    tp_manager.get_threadpool (thread_pool_id);

  if (thread_pool == 0)
    throw PortableServer::POA::InvalidPolicy ();

  return thread_pool;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:37,代码来源:RT_Policy_Validator.cpp

示例14: check_sd_policy

//Check if the policy of object is set to server declared
CORBA::Short check_sd_policy (Test_ptr server ACE_ENV_ARG_DECL)
{
    CORBA::Policy_var policy =
        server->_get_policy (RTCORBA::PRIORITY_MODEL_POLICY_TYPE
                ACE_ENV_ARG_PARAMETER);
    ACE_CHECK_RETURN (-1);

    RTCORBA::PriorityModelPolicy_var priority_policy =
        RTCORBA::PriorityModelPolicy::_narrow (policy.in () ACE_ENV_ARG_PARAMETER);
    ACE_CHECK_RETURN (-1);

    if (check_for_nil (priority_policy.in (), "PriorityModelPolicy") == -1)
        return -1;

    RTCORBA::PriorityModel priority_model =
        priority_policy->priority_model (ACE_ENV_SINGLE_ARG_PARAMETER);
    ACE_CHECK_RETURN (-1);
    if (priority_model != RTCORBA::SERVER_DECLARED)
        ACE_ERROR_RETURN ((LM_ERROR,
                    "ERROR: priority_model != "
                    "RTCORBA::SERVER_DECLARED!\n"),
                -1);
    return priority_policy->server_priority (ACE_ENV_SINGLE_ARG_PARAMETER);
}
开发者ID:kraman,项目名称:RTZen,代码行数:25,代码来源:client1.cpp

示例15: MARSHAL

int
TAO_DiffServ_Service_Context_Handler::generate_service_context (
  TAO_Stub *stub,
  TAO_Transport&,
  TAO_Operation_Details &opdetails,
  TAO_Target_Specification &,
  TAO_OutputCDR &)
{
  if (stub)
    {
      CORBA::Policy_var cnpp =
        stub->get_cached_policy (TAO_CACHED_POLICY_CLIENT_NETWORK_PRIORITY);

      TAO::NetworkPriorityPolicy_var cnp =
         TAO::NetworkPriorityPolicy::_narrow (cnpp.in ());

      if (!CORBA::is_nil (cnp.in ()))
        {
          TAO::DiffservCodepoint const reply_diffserv_codepoint =
            cnp->reply_diffserv_codepoint ();

          CORBA::Long const rep_dscp_codepoint = reply_diffserv_codepoint;

          TAO_OutputCDR cdr;
          if (!(cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))
            || !(cdr << rep_dscp_codepoint))
            {
              throw CORBA::MARSHAL ();
            }

          opdetails.request_service_context ().set_context (IOP::REP_NWPRIORITY, cdr);
        }
    }

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


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