コード例 #1
0
ファイル: client.cpp プロジェクト: asdlei00/ACE
// This function does what TAO does in order to get a transport.
CORBA::Boolean
first_request_flag (CORBA::Object_ptr obj)
{
  TAO_Stub *const stub = obj->_stubobj ();
  if (0 == stub)
    {
      ACE_ERROR_RETURN ((LM_DEBUG,
                         "CORBA::Object has stub = 0\n"),
                        1);
    }

  TAO::Profile_Transport_Resolver resolver (obj, stub, true);

  resolver.resolve (0);

  TAO_Transport *transport = resolver.transport ();
  if (0 == transport)
    {
      ACE_ERROR_RETURN ((LM_DEBUG,
                         "Transport is 0\n"),
                        1);
    }

  return transport->first_request ();
}
コード例 #2
0
ファイル: TAO_Server_Request.cpp プロジェクト: OspreyHub/ATCD
// Constructor used in Thru-POA collocation code.
TAO_ServerRequest::TAO_ServerRequest (TAO_ORB_Core * orb_core,
                                      TAO_Operation_Details const & details,
                                      CORBA::Object_ptr target)
  : mesg_base_ (0),
    operation_ (details.opname ()),
    operation_len_ (details.opname_len ()),
    release_operation_ (false),
    is_forwarded_ (false),
    incoming_ (0),
    outgoing_ (0),
    response_expected_ (details.response_flags () == TAO_TWOWAY_RESPONSE_FLAG
                        || details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_SERVER)
                        || details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_TARGET)),
    deferred_reply_ (false),
    sync_with_server_ (details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_SERVER)),
    is_queued_ (false),
    is_dsi_ (false),
    reply_status_ (GIOP::NO_EXCEPTION),
    orb_core_ (orb_core),
    request_id_ (0),
    profile_ (orb_core),
    requesting_principal_ (0),
    dsi_nvlist_align_ (0),
    operation_details_ (&details),
    argument_flag_ (false)
#if TAO_HAS_INTERCEPTORS == 1
  , interceptor_count_ (0)
  , rs_pi_current_ (0)
  , caught_exception_ (0)
  , pi_reply_status_ (-1)
#endif  /* TAO_HAS_INTERCEPTORS == 1 */
  , transport_ (0)
{
  // Have to use a const_cast<>.  *sigh*
  this->profile_.object_key (
    const_cast<TAO::ObjectKey &> (target->_stubobj ()->object_key ()));

  // Shallow copy the request service context list. This way the operation
  // details and server request share the request context.
  IOP::ServiceContextList & dest_request_contexts =
    this->request_service_context_.service_info ();

  IOP::ServiceContextList & src_request_contexts =
    (const_cast <TAO_Operation_Details&> (details)).request_service_info ();

  dest_request_contexts.replace (src_request_contexts.maximum (),
                                 src_request_contexts.length (),
                                 src_request_contexts.get_buffer (),
                                 false /* Do not release. */);

  // Don't shallow copy the reply service context. It is probably empty,
  // when then during the request it is used, the buffer gets allocated and
  // then the operation details don't get the reply service context
}
コード例 #3
0
ファイル: Stub.cpp プロジェクト: OspreyHub/ATCD
// Expensive comparison of objref data, to see if two objrefs
// certainly point at the same object. (It's quite OK for this to
// return FALSE, and yet have the two objrefs really point to the same
// object.)
//
// NOTE that this must NOT go across the network!
// @@ Two object references are the same if any two profiles are the
//    same! This function is only test the profile in use!!!
CORBA::Boolean
TAO_Stub::is_equivalent (CORBA::Object_ptr other_obj)
{
  if (CORBA::is_nil (other_obj))
    return false;

  TAO_Profile * const other_profile = other_obj->_stubobj ()->profile_in_use_;
  TAO_Profile * const this_profile = this->profile_in_use_;

  if (other_profile == 0 || this_profile == 0)
    return false;

  // Compare the profiles
  return this_profile->is_equivalent (other_profile);
}
コード例 #4
0
PortableGroup::ObjectGroup_ptr
TAO::FT_PG_Object_Group_Storable::add_member_to_iogr (CORBA::Object_ptr member)
{
  // If this is the first member added to the group and it's type_id does
  // not match the member, then the object group should assume the same
  // type id as the first member.  We will need to replace the object
  // reference with an empty reference of the specified type id.

  if (CORBA::is_nil (member))
    {// A null object reference is not an acceptable member of the group.
      ORBSVCS_ERROR ((LM_ERROR,
                  ACE_TEXT ("(%P|%t) ERROR: Unable to add null member ")
                  ACE_TEXT ("to object group with id: %s\n"),
                  this->tagged_component_.object_group_id));
      return CORBA::Object::_nil ();
    }

  const char* member_type_id = member->_stubobj ()->type_id.in ();

  if ((this->members_.current_size () == 0) &&
      (ACE_OS::strcmp (this->type_id_, member_type_id) != 0) )
    {
      try {
        this->type_id_ = member_type_id;
        this->reference_ = manipulator_.create_object_group_using_id (
           this->type_id_,
           this->tagged_component_.group_domain_id,
           this->tagged_component_.object_group_id);
      }
      catch (const CORBA::Exception&)
        {
          ORBSVCS_ERROR ((LM_ERROR,
                      ACE_TEXT ("(%P|%t) ERROR: Unable to add member ")
                      ACE_TEXT ("to object group with id: %s for object ")
                      ACE_TEXT ("of type: %s\n"),
                      this->tagged_component_.object_group_id,
                      member_type_id));
          return CORBA::Object::_nil ();
        }
    }

  return PG_Object_Group::add_member_to_iogr (member);
}
コード例 #5
0
ファイル: PG_Object_Group.cpp プロジェクト: akostrikov/ATCD
void
TAO::PG_Object_Group::add_member (const PortableGroup::Location & the_location,
                                  CORBA::Object_ptr member)

{
  ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_);

  if (CORBA::is_nil (member))
    {
      if (TAO_debug_level > 3)
        {
          ORBSVCS_ERROR ((LM_ERROR,
                      ACE_TEXT ("%T %n (%P|%t) - TAO::PG_Object_Group::add_member")
                      ACE_TEXT ("Can't add a null member to object group\n")
                      ));
        }
      throw PortableGroup::ObjectNotAdded ();
    }

  /////////////////////////////////////////
  // Convert the new member to a string IOR
  // This keeps a clean IOR (not an IOGR!)
  // while we add it to a group.  We need a
  // IORs, not IOGRs to send new IOGRs out
  // to replicas.

  // Verify that the member is not using V1.0 profiles
  // since IIOP V1.0 does not support tagged components
  const TAO_MProfile &member_profiles =
    member->_stubobj ()->base_profiles ();
  CORBA::ULong member_profile_count =
    member_profiles.profile_count ();
  if (member_profile_count > 0)
    {
      const TAO_GIOP_Message_Version & version =
        member_profiles.get_profile (0)->version ();
      if (version.major_version () == 1 &&
          version.minor_version () == 0)
        {
          if (TAO_debug_level > 3)
            {
              ORBSVCS_ERROR ((LM_ERROR,
                          ACE_TEXT ("%T %n (%P|%t) - ")
                          ACE_TEXT ("Can't add member because first profile ")
                          ACE_TEXT ("is IIOP version 1.0, which does not ")
                          ACE_TEXT ("support tagged components.\n")
                          ));
            }
          throw PortableGroup::ObjectNotAdded ();
        }
    }

  CORBA::String_var member_ior_string =
    orb_->object_to_string (member);

  PortableGroup::ObjectGroup_var new_reference;
  try {
    new_reference =
      this->add_member_to_iogr (member);
  }
  catch (const TAO_IOP::Duplicate&)
    {
      throw PortableGroup::MemberAlreadyPresent ();
    }
  catch (const TAO_IOP::Invalid_IOR&)
    {
      throw PortableGroup::ObjectNotAdded ();
    }
  catch (...)
    {
      throw;
    }

  if (CORBA::is_nil (new_reference.in ()))
    throw PortableGroup::ObjectNotAdded ();

  // Convert new member back to a (non group) ior.
  CORBA::Object_var member_ior =
    this->orb_->string_to_object (member_ior_string.in ());

  MemberInfo * info = 0;
  ACE_NEW_THROW_EX (info,
                    MemberInfo (member_ior.in (),
                                the_location),
                    CORBA::NO_MEMORY());

  if (this->members_.bind (the_location, info) != 0)
    {
      delete info;

      // @@ Dale why this is a NO MEMORY exception?
      throw CORBA::NO_MEMORY();
    }

  this->reference_ = new_reference; // note var-to-var assignment does
                                    // a duplicate

  if (this->increment_version ())
    {
      this->distribute_iogr ();
    }
  else
    { // Issue with incrementing the version

      if (TAO_debug_level > 6)
        {
          ORBSVCS_DEBUG ((LM_DEBUG,
                      ACE_TEXT ("PG (%P|%t) Issue incrementing the ")
                      ACE_TEXT ("version in Object_Group add_member\n")));
        }
      // Must unbind the new member and delete it.
      if (this->members_.unbind (the_location, info) == 0)
        delete info;
      throw PortableGroup::ObjectNotAdded ();
    }

  if (TAO_debug_level > 6)
  {
    ORBSVCS_DEBUG ((LM_DEBUG,
      ACE_TEXT("PG (%P|%t) exit Object_Group add_member\n")));
  }
}
コード例 #6
0
ファイル: Invocation_Adapter.cpp プロジェクト: CCJY/ATCD
  TAO::Collocation_Strategy
  Invocation_Adapter::collocation_strategy (CORBA::Object_ptr object)
  {
    TAO::Collocation_Strategy strategy = TAO::TAO_CS_REMOTE_STRATEGY;
    TAO_Stub *stub = object->_stubobj ();
    if (!CORBA::is_nil (stub->servant_orb_var ().in ()) &&
        stub->servant_orb_var ()->orb_core () != 0)
      {
        TAO_ORB_Core *orb_core = stub->servant_orb_var ()->orb_core ();

        if (orb_core->collocation_resolver ().is_collocated (object))
          {
            switch (orb_core->get_collocation_strategy ())
              {
              case TAO_ORB_Core::TAO_COLLOCATION_THRU_POA:
                {
                  // check opportunity
                  if (ACE_BIT_ENABLED (this->collocation_opportunity_,
                                      TAO::TAO_CO_THRU_POA_STRATEGY))
                    {
                      strategy = TAO::TAO_CS_THRU_POA_STRATEGY;
                    }
                  else
                    {
                      if (TAO_debug_level > 0)
                        {
                          TAOLIB_ERROR ((LM_ERROR,
                                      ACE_TEXT ("Invocation_Adapter::collocation_strategy, ")
                                      ACE_TEXT ("request for through poa collocation ")
                                      ACE_TEXT ("without needed collocation opportunity.\n")));
                        }
                      // collocation object, but no collocation_opportunity for Thru_poa
                      throw ::CORBA::INTERNAL (
                        CORBA::SystemException::_tao_minor_code (
                          TAO::VMCID,
                          EINVAL),
                        CORBA::COMPLETED_NO);
                    }
                  break;
                }
              case TAO_ORB_Core::TAO_COLLOCATION_DIRECT:
                {
                  if (ACE_BIT_ENABLED (this->collocation_opportunity_,
                                      TAO::TAO_CO_DIRECT_STRATEGY)
                                      && (object->_servant () != 0))
                    {
                      strategy = TAO::TAO_CS_DIRECT_STRATEGY;
                    }
                  else
                    {
                      if (TAO_debug_level > 0)
                        {
                          TAOLIB_ERROR ((LM_ERROR,
                                      ACE_TEXT ("Invocation_Adapter::collocation_strategy, ")
                                      ACE_TEXT ("request for direct collocation ")
                                      ACE_TEXT ("without needed collocation opportunity.\n")));
                        }
                      // collocation object, but no collocation_opportunity for Direct
                      // or servant() == 0
                      throw ::CORBA::INTERNAL (
                      CORBA::SystemException::_tao_minor_code (
                        TAO::VMCID,
                        EINVAL),
                      CORBA::COMPLETED_NO);
                    }
                  break;
                }
              case TAO_ORB_Core::TAO_COLLOCATION_BEST:
                {
                  if (ACE_BIT_ENABLED (this->collocation_opportunity_,
                                      TAO::TAO_CO_DIRECT_STRATEGY)
                      && (object->_servant () != 0))
                    {
                      strategy = TAO::TAO_CS_DIRECT_STRATEGY;
                    }
                  else if (ACE_BIT_ENABLED (this->collocation_opportunity_,
                                            TAO::TAO_CO_THRU_POA_STRATEGY))
                    {
                      strategy = TAO::TAO_CS_THRU_POA_STRATEGY;
                    }
                  else
                    {
                      strategy = TAO::TAO_CS_REMOTE_STRATEGY;
                    }
                  break;
                }
              }
          }
      }

    return strategy;
  }