Public Member Functions | Private Attributes

TAO::Portable_Server::RequestProcessingStrategyDefaultServant Class Reference

#include <RequestProcessingStrategyDefaultServant.h>

Inheritance diagram for TAO::Portable_Server::RequestProcessingStrategyDefaultServant:
Inheritance graph
[legend]
Collaboration diagram for TAO::Portable_Server::RequestProcessingStrategyDefaultServant:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 RequestProcessingStrategyDefaultServant (void)
virtual void strategy_cleanup (void)
PortableServer::ServantManager_ptr get_servant_manager (void)
void set_servant_manager (PortableServer::ServantManager_ptr imgr)
PortableServer::Servant get_servant (void)
void set_servant (PortableServer::Servant servant)
virtual TAO_SERVANT_LOCATION locate_servant (const PortableServer::ObjectId &system_id, PortableServer::Servant &servant)
virtual PortableServer::Servant locate_servant (const char *operation, const PortableServer::ObjectId &system_id, TAO::Portable_Server::Servant_Upcall &servant_upcall, TAO::Portable_Server::POA_Current_Impl &poa_current_impl, bool &wait_occurred_restart_call)
virtual PortableServer::Servant system_id_to_servant (const PortableServer::ObjectId &system_id)
virtual PortableServer::Servant id_to_servant (const PortableServer::ObjectId &id)
virtual void cleanup_servant (PortableServer::Servant servant, const PortableServer::ObjectId &user_id)
virtual void etherealize_objects (CORBA::Boolean etherealize_objects)
virtual PortableServer::ObjectIdservant_to_id (PortableServer::Servant servant)
virtual void post_invoke_servant_cleanup (const PortableServer::ObjectId &system_id, const TAO::Portable_Server::Servant_Upcall &servant_upcall)
virtual
::PortableServer::RequestProcessingPolicyValue 
type () const

Private Attributes

PortableServer::ServantBase_var default_servant_

Detailed Description

Definition at line 38 of file RequestProcessingStrategyDefaultServant.h.


Constructor & Destructor Documentation

TAO::Portable_Server::RequestProcessingStrategyDefaultServant::RequestProcessingStrategyDefaultServant ( void   ) 

Definition at line 26 of file RequestProcessingStrategyDefaultServant.cpp.

      : default_servant_ (0)
    {
    }


Member Function Documentation

void TAO::Portable_Server::RequestProcessingStrategyDefaultServant::cleanup_servant ( PortableServer::Servant  servant,
const PortableServer::ObjectId user_id 
) [virtual]

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 181 of file RequestProcessingStrategyDefaultServant.cpp.

    {
      if (servant)
        {
          // ATTENTION: Trick locking here, see class header for details
          Non_Servant_Upcall non_servant_upcall (*this->poa_);
          ACE_UNUSED_ARG (non_servant_upcall);

          servant->_remove_ref ();
        }

      // This operation causes the association of the Object Id specified
      // by the oid parameter and its servant to be removed from the
      // Active Object Map.
      if (this->poa_->unbind_using_user_id (user_id) != 0)
        {
          throw ::CORBA::OBJ_ADAPTER ();
        }
    }

void TAO::Portable_Server::RequestProcessingStrategyDefaultServant::etherealize_objects ( CORBA::Boolean  etherealize_objects  )  [virtual]
PortableServer::Servant TAO::Portable_Server::RequestProcessingStrategyDefaultServant::get_servant ( void   )  [virtual]

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 51 of file RequestProcessingStrategyDefaultServant.cpp.

    {
      // This operation returns the default servant associated with the
      // POA.
      return this->default_servant_.in ();
    }

PortableServer::ServantManager_ptr TAO::Portable_Server::RequestProcessingStrategyDefaultServant::get_servant_manager ( void   )  [virtual]

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 38 of file RequestProcessingStrategyDefaultServant.cpp.

    {
      throw PortableServer::POA::WrongPolicy ();
    }

PortableServer::Servant TAO::Portable_Server::RequestProcessingStrategyDefaultServant::id_to_servant ( const PortableServer::ObjectId id  )  [virtual]

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 162 of file RequestProcessingStrategyDefaultServant.cpp.

    {
      PortableServer::Servant servant = this->default_servant_.in ();

      if (servant == 0)
        {
          /*
           * If using default servant request processing strategy but
           * no default servant is available, we will raise the
           * ObjectNotActive system exception.
           */
          throw PortableServer::POA::ObjectNotActive ();
        }

      return servant;
    }

TAO_SERVANT_LOCATION TAO::Portable_Server::RequestProcessingStrategyDefaultServant::locate_servant ( const PortableServer::ObjectId system_id,
PortableServer::Servant servant 
) [virtual]

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 89 of file RequestProcessingStrategyDefaultServant.cpp.

    {
      TAO_SERVANT_LOCATION location = TAO_SERVANT_NOT_FOUND;

      location = this->poa_->servant_present (system_id, servant);

      if (location == TAO_SERVANT_NOT_FOUND)
        {
          if (this->default_servant_.in () != 0)
            {
              location = TAO_DEFAULT_SERVANT;
            }
        }

      return location;
    }

PortableServer::Servant TAO::Portable_Server::RequestProcessingStrategyDefaultServant::locate_servant ( const char *  operation,
const PortableServer::ObjectId system_id,
TAO::Portable_Server::Servant_Upcall &  servant_upcall,
TAO::Portable_Server::POA_Current_Impl &  poa_current_impl,
bool &  wait_occurred_restart_call 
) [virtual]

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 110 of file RequestProcessingStrategyDefaultServant.cpp.

    {
      PortableServer::Servant servant = 0;

      servant = this->poa_->find_servant (system_id,
                                          servant_upcall,
                                          poa_current_impl);

      if (servant == 0)
        {
          // If the POA has the USE_DEFAULT_SERVANT policy, a default servant
          // has been associated with the POA so the POA will invoke the
          // appropriate method on that servant. If no servant has been
          // associated with the POA, the POA raises the OBJ_ADAPTER system
          // exception.
          PortableServer::Servant default_servant = this->default_servant_.in ();
          if (default_servant == 0)
            {
              throw ::CORBA::OBJ_ADAPTER (
                CORBA::OMGVMCID | 3,
                CORBA::COMPLETED_NO);
            }
          else
            {
              // Success
              servant = default_servant;
            }
        }

        return servant;
    }

void TAO::Portable_Server::RequestProcessingStrategyDefaultServant::post_invoke_servant_cleanup ( const PortableServer::ObjectId system_id,
const TAO::Portable_Server::Servant_Upcall &  servant_upcall 
) [virtual]
PortableServer::ObjectId * TAO::Portable_Server::RequestProcessingStrategyDefaultServant::servant_to_id ( PortableServer::Servant  servant  )  [virtual]

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 210 of file RequestProcessingStrategyDefaultServant.cpp.

    {
      PortableServer::Servant default_servant = this->default_servant_.in ();

      if (default_servant != 0 &&
          default_servant == servant)
        {
          // If they are the same servant, then check if we are in an
          // upcall.
          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 we are in an upcall on the default servant, return the
          // ObjectId associated with the current invocation.
          if (poa_current_impl != 0 &&
              servant == poa_current_impl->servant ())
            {
              return poa_current_impl->get_object_id ();
            }
        }

      return this->poa_->servant_to_user_id (servant);
    }

void TAO::Portable_Server::RequestProcessingStrategyDefaultServant::set_servant ( PortableServer::Servant  servant  )  [virtual]

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 59 of file RequestProcessingStrategyDefaultServant.cpp.

    {
      // This operation registers the specified servant with the POA as
      // the default servant. This servant will be used for all requests
      // for which no servant is found in the Active Object Map.
      this->default_servant_ = servant;

      // The implementation of set_servant will invoke _add_ref at least
      // once on the Servant argument before returning. When the POA no
      // longer needs the Servant, it will invoke _remove_ref on it the
      // same number of times.
      if (servant != 0)
        {
          // A recursive thread lock without using a recursive thread
          // lock.  Non_Servant_Upcall has a magic constructor and
          // destructor.  We unlock the Object_Adapter lock for the
          // duration of the servant activator upcalls; reacquiring once
          // the upcalls complete.  Even though we are releasing the lock,
          // other threads will not be able to make progress since
          // <Object_Adapter::non_servant_upcall_in_progress_> has been
          // set.
          Non_Servant_Upcall non_servant_upcall (*this->poa_);
          ACE_UNUSED_ARG (non_servant_upcall);

          servant->_add_ref ();
        }
    }

void TAO::Portable_Server::RequestProcessingStrategyDefaultServant::set_servant_manager ( PortableServer::ServantManager_ptr  imgr  )  [virtual]

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 44 of file RequestProcessingStrategyDefaultServant.cpp.

    {
      throw PortableServer::POA::WrongPolicy ();
    }

void TAO::Portable_Server::RequestProcessingStrategyDefaultServant::strategy_cleanup ( void   )  [virtual]
PortableServer::Servant TAO::Portable_Server::RequestProcessingStrategyDefaultServant::system_id_to_servant ( const PortableServer::ObjectId system_id  )  [virtual]

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 148 of file RequestProcessingStrategyDefaultServant.cpp.

    {
      PortableServer::Servant servant = this->default_servant_.in ();

      if (servant == 0)
        {
          servant = this->poa_->find_servant (system_id);
        }

      return servant;
    }

PortableServer::RequestProcessingPolicyValue TAO::Portable_Server::RequestProcessingStrategyDefaultServant::type ( void   )  const [virtual]

Implements TAO::Portable_Server::RequestProcessingStrategy.

Definition at line 243 of file RequestProcessingStrategyDefaultServant.cpp.

    {
      return ::PortableServer::USE_DEFAULT_SERVANT;
    }


Member Data Documentation

PortableServer::ServantBase_var TAO::Portable_Server::RequestProcessingStrategyDefaultServant::default_servant_ [private]

Definition at line 87 of file RequestProcessingStrategyDefaultServant.h.


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