00001
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 "RequestProcessingStrategyAOMOnly.cpp,v 1.5 2006/03/10 07:19:15 jtc Exp")
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)
00025
00026 PortableServer::ServantManager_ptr
00027 RequestProcessingStrategyAOMOnly::get_servant_manager (ACE_ENV_SINGLE_ARG_DECL)
00028 ACE_THROW_SPEC ((CORBA::SystemException,
00029 PortableServer::POA::WrongPolicy))
00030 {
00031 ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
00032 PortableServer::ServantManager::_nil ());
00033 }
00034
00035 void
00036 RequestProcessingStrategyAOMOnly::set_servant_manager (
00037 PortableServer::ServantManager_ptr
00038 ACE_ENV_ARG_DECL)
00039 ACE_THROW_SPEC ((CORBA::SystemException,
00040 PortableServer::POA::WrongPolicy))
00041 {
00042 ACE_THROW (PortableServer::POA::WrongPolicy ());
00043 }
00044
00045 void
00046 RequestProcessingStrategyAOMOnly::set_servant (
00047 PortableServer::Servant
00048 ACE_ENV_ARG_DECL)
00049 ACE_THROW_SPEC ((CORBA::SystemException,
00050 PortableServer::POA::WrongPolicy))
00051 {
00052 ACE_THROW (PortableServer::POA::WrongPolicy ());
00053 }
00054
00055 #endif
00056
00057 PortableServer::Servant
00058 RequestProcessingStrategyAOMOnly::get_servant (ACE_ENV_SINGLE_ARG_DECL)
00059 ACE_THROW_SPEC ((CORBA::SystemException,
00060 PortableServer::POA::WrongPolicy))
00061 {
00062 ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
00063 0);
00064 }
00065
00066 TAO_SERVANT_LOCATION
00067 RequestProcessingStrategyAOMOnly::locate_servant (
00068 const PortableServer::ObjectId & system_id,
00069 PortableServer::Servant & servant
00070 ACE_ENV_ARG_DECL)
00071 {
00072 return this->poa_->servant_present (system_id,
00073 servant
00074 ACE_ENV_ARG_PARAMETER);
00075 }
00076
00077 PortableServer::Servant
00078 RequestProcessingStrategyAOMOnly::locate_servant (
00079 const char * ,
00080 const PortableServer::ObjectId &system_id,
00081 TAO::Portable_Server::Servant_Upcall &servant_upcall,
00082 TAO::Portable_Server::POA_Current_Impl &poa_current_impl,
00083 int &
00084 ACE_ENV_ARG_DECL)
00085 {
00086 PortableServer::Servant servant = 0;
00087
00088 servant = this->poa_->find_servant (system_id,
00089 servant_upcall,
00090 poa_current_impl
00091 ACE_ENV_ARG_PARAMETER);
00092 ACE_CHECK_RETURN (0);
00093
00094 if (servant == 0)
00095 {
00096 ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (CORBA::OMGVMCID | 2,
00097 CORBA::COMPLETED_NO),
00098 0);
00099 }
00100
00101 return servant;
00102 }
00103
00104 PortableServer::Servant
00105 RequestProcessingStrategyAOMOnly::system_id_to_servant (
00106 const PortableServer::ObjectId &system_id
00107 ACE_ENV_ARG_DECL)
00108 {
00109 return this->poa_->find_servant (system_id
00110 ACE_ENV_ARG_PARAMETER);
00111 }
00112
00113 PortableServer::Servant
00114 RequestProcessingStrategyAOMOnly::id_to_servant (
00115 const PortableServer::ObjectId &id
00116 ACE_ENV_ARG_DECL)
00117 ACE_THROW_SPEC ((CORBA::SystemException,
00118 PortableServer::POA::ObjectNotActive,
00119 PortableServer::POA::WrongPolicy))
00120 {
00121 return this->poa_->user_id_to_servant_i (id
00122 ACE_ENV_ARG_PARAMETER);
00123 }
00124
00125 void
00126 RequestProcessingStrategyAOMOnly::cleanup_servant (
00127 PortableServer::Servant servant,
00128 const PortableServer::ObjectId &user_id
00129 ACE_ENV_ARG_DECL)
00130 {
00131 if (servant)
00132 {
00133
00134 Non_Servant_Upcall non_servant_upcall (*this->poa_);
00135 ACE_UNUSED_ARG (non_servant_upcall);
00136
00137 servant->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
00138 ACE_CHECK;
00139 }
00140
00141
00142
00143
00144 int result = this->poa_->unbind_using_user_id (user_id);
00145
00146 if (result != 0)
00147 {
00148 ACE_THROW (CORBA::OBJ_ADAPTER ());
00149 }
00150 }
00151
00152 void
00153 RequestProcessingStrategyAOMOnly::etherealize_objects (
00154 CORBA::Boolean )
00155 {
00156 }
00157
00158 PortableServer::ObjectId *
00159 RequestProcessingStrategyAOMOnly::servant_to_id (
00160 PortableServer::Servant servant
00161 ACE_ENV_ARG_DECL)
00162 ACE_THROW_SPEC ((CORBA::SystemException,
00163 PortableServer::POA::ServantNotActive,
00164 PortableServer::POA::WrongPolicy))
00165 {
00166 return this->poa_->servant_to_user_id (servant ACE_ENV_ARG_PARAMETER);
00167 }
00168
00169 void
00170 RequestProcessingStrategyAOMOnly::post_invoke_servant_cleanup(
00171 const PortableServer::ObjectId &,
00172 const TAO::Portable_Server::Servant_Upcall &)
00173 {
00174 }
00175
00176 ::PortableServer::RequestProcessingPolicyValue
00177 RequestProcessingStrategyAOMOnly::type() const
00178 {
00179 return ::PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY;
00180 }
00181
00182 }
00183 }
00184
00185 TAO_END_VERSIONED_NAMESPACE_DECL