RequestProcessingStrategyAOMOnly.cpp

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 #include "tao/ORB_Constants.h"
00004 #include "tao/PortableServer/RequestProcessingStrategyAOMOnly.h"
00005 #include "tao/PortableServer/ServantManagerC.h"
00006 #include "tao/PortableServer/Non_Servant_Upcall.h"
00007 #include "tao/PortableServer/Servant_Base.h"
00008 #include "tao/PortableServer/Root_POA.h"
00009 
00010 ACE_RCSID (PortableServer,
00011            Request_Processing,
00012            "$Id: RequestProcessingStrategyAOMOnly.cpp 80572 2008-02-05 20:02:46Z johnnyw $")
00013 
00014 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00015 
00016 namespace TAO
00017 {
00018   namespace Portable_Server
00019   {
00020     RequestProcessingStrategyAOMOnly::RequestProcessingStrategyAOMOnly()
00021     {
00022     }
00023 
00024 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00025 
00026     PortableServer::ServantManager_ptr
00027     RequestProcessingStrategyAOMOnly::get_servant_manager (void)
00028     {
00029       throw PortableServer::POA::WrongPolicy ();
00030     }
00031 
00032     void
00033     RequestProcessingStrategyAOMOnly::set_servant_manager (
00034       PortableServer::ServantManager_ptr /*imgr*/)
00035     {
00036       throw PortableServer::POA::WrongPolicy ();
00037     }
00038 
00039     void
00040     RequestProcessingStrategyAOMOnly::set_servant (
00041       PortableServer::Servant /*servant*/)
00042     {
00043       throw PortableServer::POA::WrongPolicy ();
00044     }
00045 
00046     PortableServer::Servant
00047     RequestProcessingStrategyAOMOnly::get_servant (void)
00048     {
00049       throw PortableServer::POA::WrongPolicy ();
00050     }
00051 
00052 #endif /* TAO_HAS_MINIMUM_POA == 0 !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) */
00053 
00054     TAO_SERVANT_LOCATION
00055     RequestProcessingStrategyAOMOnly::locate_servant (
00056       const PortableServer::ObjectId & system_id,
00057       PortableServer::Servant & servant)
00058     {
00059       return this->poa_->servant_present (system_id, servant);
00060     }
00061 
00062     PortableServer::Servant
00063     RequestProcessingStrategyAOMOnly::locate_servant (
00064       const char * /*operation*/,
00065       const PortableServer::ObjectId &system_id,
00066       TAO::Portable_Server::Servant_Upcall &servant_upcall,
00067       TAO::Portable_Server::POA_Current_Impl &poa_current_impl,
00068       bool & /*wait_occurred_restart_call*/)
00069     {
00070       PortableServer::Servant servant = 0;
00071 
00072       servant = this->poa_->find_servant (system_id,
00073                                           servant_upcall,
00074                                           poa_current_impl);
00075 
00076       if (servant == 0)
00077         {
00078           throw ::CORBA::OBJECT_NOT_EXIST (
00079             CORBA::OMGVMCID | 2,
00080             CORBA::COMPLETED_NO);
00081         }
00082 
00083       return servant;
00084     }
00085 
00086     PortableServer::Servant
00087     RequestProcessingStrategyAOMOnly::system_id_to_servant (
00088       const PortableServer::ObjectId &system_id)
00089     {
00090       return this->poa_->find_servant (system_id);
00091     }
00092 
00093     PortableServer::Servant
00094     RequestProcessingStrategyAOMOnly::id_to_servant (
00095       const PortableServer::ObjectId &id)
00096     {
00097       return this->poa_->user_id_to_servant_i (id);
00098     }
00099 
00100     void
00101     RequestProcessingStrategyAOMOnly::cleanup_servant (
00102       PortableServer::Servant servant,
00103       const PortableServer::ObjectId &user_id)
00104     {
00105       if (servant)
00106         {
00107           // ATTENTION: Trick locking here, see class header for details
00108           Non_Servant_Upcall non_servant_upcall (*this->poa_);
00109           ACE_UNUSED_ARG (non_servant_upcall);
00110 
00111           servant->_remove_ref ();
00112         }
00113 
00114       // This operation causes the association of the Object Id specified
00115       // by the oid parameter and its servant to be removed from the
00116       // Active Object Map.
00117       if (this->poa_->unbind_using_user_id (user_id) != 0)
00118         {
00119           throw ::CORBA::OBJ_ADAPTER ();
00120         }
00121     }
00122 
00123     void
00124     RequestProcessingStrategyAOMOnly::etherealize_objects (
00125       CORBA::Boolean /*etherealize_objects*/)
00126     {
00127     }
00128 
00129     PortableServer::ObjectId *
00130     RequestProcessingStrategyAOMOnly::servant_to_id (
00131       PortableServer::Servant servant)
00132     {
00133       return this->poa_->servant_to_user_id (servant);
00134     }
00135 
00136     void
00137     RequestProcessingStrategyAOMOnly::post_invoke_servant_cleanup(
00138       const PortableServer::ObjectId &/*system_id*/,
00139       const TAO::Portable_Server::Servant_Upcall &/*servant_upcall*/)
00140     {
00141     }
00142 
00143     ::PortableServer::RequestProcessingPolicyValue
00144     RequestProcessingStrategyAOMOnly::type() const
00145     {
00146       return ::PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY;
00147     }
00148 
00149   }
00150 }
00151 
00152 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:40:54 2010 for TAO_PortableServer by  doxygen 1.4.7