Public Member Functions | Private Attributes

TAO_IORInterceptor_Adapter_Impl Class Reference

TAO_IORInterceptor_Adapter_Impl. More...

#include <IORInterceptor_Adapter_Impl.h>

Inheritance diagram for TAO_IORInterceptor_Adapter_Impl:
Inheritance graph
[legend]
Collaboration diagram for TAO_IORInterceptor_Adapter_Impl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~TAO_IORInterceptor_Adapter_Impl (void)
virtual void add_interceptor (PortableInterceptor::IORInterceptor_ptr interceptor)
virtual void add_interceptor (PortableInterceptor::IORInterceptor_ptr interceptor, const CORBA::PolicyList &policies)
virtual void destroy_interceptors (void)
virtual void establish_components (TAO_Root_POA *poa)
virtual void components_established (PortableInterceptor::IORInfo_ptr info)
virtual void adapter_state_changed (const TAO::ObjectReferenceTemplate_Array &array_obj_ref_template, PortableInterceptor::AdapterState state)
virtual void adapter_manager_state_changed (const char *id, PortableInterceptor::AdapterState state)

Private Attributes

TAO::IORInterceptor_List ior_interceptor_list_
 List of IOR interceptors maintained.

Detailed Description

TAO_IORInterceptor_Adapter_Impl.

Class that adapts various functions involving the PortableInterceptor interfaces IORInfo and IORInterceptor. This is the derived class that contains the actual implementations.

Definition at line 50 of file IORInterceptor_Adapter_Impl.h.


Constructor & Destructor Documentation

TAO_IORInterceptor_Adapter_Impl::~TAO_IORInterceptor_Adapter_Impl ( void   )  [virtual]

Definition at line 18 of file IORInterceptor_Adapter_Impl.cpp.

{
}


Member Function Documentation

void TAO_IORInterceptor_Adapter_Impl::adapter_manager_state_changed ( const char *  id,
PortableInterceptor::AdapterState  state 
) [virtual]

Whenever the POAManager state is changed, the adapter_manager_state_changed method is to be invoked on all the IOR Interceptors.

Implements TAO_IORInterceptor_Adapter.

Definition at line 187 of file IORInterceptor_Adapter_Impl.cpp.

{
  /// Whenever the POAManager state is changed, the
  /// adapter_manager_state_changed method is to be invoked on all the IOR
  ///  Interceptors.
  size_t const interceptor_count = this->ior_interceptor_list_.size ();

  if (interceptor_count == 0)
    return;

  for (size_t i = 0; i < interceptor_count; ++i)
    {
      PortableInterceptor::IORInterceptor_ptr ior_interceptor =
        this->ior_interceptor_list_.interceptor (i);

      PortableInterceptor::IORInterceptor_3_0_var ior_3_interceptor =
        PortableInterceptor::IORInterceptor_3_0::_narrow (ior_interceptor);
      if (!CORBA::is_nil (ior_3_interceptor.in ()))
        {
          ior_3_interceptor->adapter_manager_state_changed (id, state);
        }
    }
}

void TAO_IORInterceptor_Adapter_Impl::adapter_state_changed ( const TAO::ObjectReferenceTemplate_Array array_obj_ref_template,
PortableInterceptor::AdapterState  state 
) [virtual]

Implements TAO_IORInterceptor_Adapter.

Definition at line 148 of file IORInterceptor_Adapter_Impl.cpp.

{
  size_t const interceptor_count = this->ior_interceptor_list_.size ();

  if (interceptor_count == 0)
    return;

  PortableInterceptor::ObjectReferenceTemplateSeq seq_obj_ref_template;

  seq_obj_ref_template.length (
    static_cast <CORBA::ULong> (array_obj_ref_template.size()));

  for (size_t counter = 0; counter < array_obj_ref_template.size(); ++counter)
    {
      PortableInterceptor::ObjectReferenceTemplate *member =
        array_obj_ref_template[counter];

      CORBA::add_ref (member);

      seq_obj_ref_template[counter] = member;
    }

  for (size_t i = 0; i < interceptor_count; ++i)
    {
      PortableInterceptor::IORInterceptor_ptr ior_interceptor =
        this->ior_interceptor_list_.interceptor (i);

      PortableInterceptor::IORInterceptor_3_0_var ior_3_interceptor =
        PortableInterceptor::IORInterceptor_3_0::_narrow (ior_interceptor);
      if (!CORBA::is_nil (ior_3_interceptor.in ()))
        {
          ior_3_interceptor->adapter_state_changed (seq_obj_ref_template, state);
        }
    }
}

void TAO_IORInterceptor_Adapter_Impl::add_interceptor ( PortableInterceptor::IORInterceptor_ptr  interceptor,
const CORBA::PolicyList &  policies 
) [virtual]

Implements TAO_IORInterceptor_Adapter.

Definition at line 30 of file IORInterceptor_Adapter_Impl.cpp.

{
  this->ior_interceptor_list_.add_interceptor (i, policies);
}

void TAO_IORInterceptor_Adapter_Impl::add_interceptor ( PortableInterceptor::IORInterceptor_ptr  interceptor  )  [virtual]
void TAO_IORInterceptor_Adapter_Impl::components_established ( PortableInterceptor::IORInfo_ptr  info  )  [virtual]

Call the IORInterceptor::components_established() method on all registered IORInterceptors.

Implements TAO_IORInterceptor_Adapter.

Definition at line 114 of file IORInterceptor_Adapter_Impl.cpp.

{
  // Iterate over the registered IOR interceptors so that they may be
  // given the opportunity to add tagged components to the profiles
  // for this servant.
  size_t const interceptor_count = this->ior_interceptor_list_.size ();

  // All the establish_components() interception points have been
  // invoked. Now call the components_established() interception point
  // on all the IORInterceptors.
  for (size_t j = 0; j < interceptor_count; ++j)
    {
      try
        {
          PortableInterceptor::IORInterceptor_ptr ior_interceptor =
            this->ior_interceptor_list_.interceptor (j);

          PortableInterceptor::IORInterceptor_3_0_var ior_3_interceptor =
            PortableInterceptor::IORInterceptor_3_0::_narrow (ior_interceptor);
          if (!CORBA::is_nil (ior_3_interceptor.in ()))
            {
              ior_3_interceptor->components_established (info);
            }
        }
      catch (const ::CORBA::Exception&)
        {
          throw ::CORBA::OBJ_ADAPTER (CORBA::OMGVMCID | 6,
                                      CORBA::COMPLETED_NO);
        }
    }
}

void TAO_IORInterceptor_Adapter_Impl::destroy_interceptors ( void   )  [virtual]

Implements TAO_IORInterceptor_Adapter.

Definition at line 38 of file IORInterceptor_Adapter_Impl.cpp.

{
  this->ior_interceptor_list_.destroy_interceptors ();

  delete this;
}

void TAO_IORInterceptor_Adapter_Impl::establish_components ( TAO_Root_POA poa  )  [virtual]

Call the IORInterceptor::establish_components() method on all registered IORInterceptors. This method calls IORInterceptor::establish_components() method on all registered IORInterceptors, and IORInterceptor::components_established() once the former is completed.

Implements TAO_IORInterceptor_Adapter.

Definition at line 46 of file IORInterceptor_Adapter_Impl.cpp.

{
  size_t const interceptor_count = this->ior_interceptor_list_.size ();

  if (interceptor_count == 0)
    return;

  TAO_IORInfo *tao_info = 0;
  ACE_NEW_THROW_EX (tao_info,
                    TAO_IORInfo (poa),
                    CORBA::NO_MEMORY (
                       CORBA::SystemException::_tao_minor_code (
                          TAO::VMCID,
                          ENOMEM),
                       CORBA::COMPLETED_NO));

  PortableInterceptor::IORInfo_var info = tao_info;

  // Release the POA during IORInterceptor calls to avoid potential
  // deadlocks.
  TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (*poa);
  ACE_UNUSED_ARG (non_servant_upcall);

  for (size_t i = 0; i < interceptor_count; ++i)
    {
      try
        {
          this->ior_interceptor_list_.interceptor (i)->establish_components (
            info.in ());
        }
      catch (const ::CORBA::Exception& ex)
        {
          // According to the Portable Interceptors specification,
          // IORInterceptor::establish_components() must not throw an
          // exception.  If it does, then the ORB is supposed to
          // ignore it and continue processing the remaining
          // IORInterceptors.
          if (TAO_debug_level > 1)
            {
              CORBA::String_var name =
                this->ior_interceptor_list_.interceptor (i)->name ();
              // @@ What do we do if we get an exception here?

              if (name.in () != 0)
                {
                  ACE_DEBUG ((LM_WARNING,
                              "(%P|%t) Exception thrown while processing "
                              "IORInterceptor \"%C\">\n",
                              name.in ()));
                }

              ex._tao_print_exception (
                "Ignoring exception in "
                "IORInterceptor::establish_components");
            }
        }
    }

  tao_info->components_established ();

  this->components_established (info.in ());

  // The IORInfo instance is no longer valid.  Invalidate it to
  // prevent the user from peforming "illegal" operations.
  tao_info->invalidate ();
}


Member Data Documentation

List of IOR interceptors maintained.

Definition at line 81 of file IORInterceptor_Adapter_Impl.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines