diff options
Diffstat (limited to 'TAO/orbsvcs/IFR_Service/Servant_Locator.cpp')
-rw-r--r-- | TAO/orbsvcs/IFR_Service/Servant_Locator.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/TAO/orbsvcs/IFR_Service/Servant_Locator.cpp b/TAO/orbsvcs/IFR_Service/Servant_Locator.cpp new file mode 100644 index 00000000000..f07dc101b08 --- /dev/null +++ b/TAO/orbsvcs/IFR_Service/Servant_Locator.cpp @@ -0,0 +1,65 @@ +// $Id$ + +#include "Servant_Locator.h" +#include "Servant_Factory.h" + +ACE_RCSID(IFR_Service, Servant_Locator, "$Id$") + +IFR_ServantLocator::IFR_ServantLocator (TAO_Repository_i *repo) + : repo_ (repo) +{ +} + +PortableServer::Servant +IFR_ServantLocator::preinvoke ( + const PortableServer::ObjectId &oid, + PortableServer::POA_ptr poa, + const char * /* operation */, + PortableServer::ServantLocator::Cookie &cookie + TAO_ENV_ARG_DECL + ) +{ + TAO_ENV_ARG_DEFN; + + CORBA::String_var s = + PortableServer::ObjectId_to_string (oid); + + ACE_TString full_name (s.in ()); + + ACE_Configuration_Section_Key servant_key; + + int status = + this->repo_->config ()->expand_path (this->repo_->root_key (), + full_name, + servant_key, + 0); + + if (status != 0) + { + // If we're here, destroy() has been called. + ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (), 0); + } + + PortableServer::Servant servant = + this->repo_->servant_factory ()->create_tie (servant_key, + poa, + ACE_TRY_ENV); + ACE_CHECK_RETURN (0); + + cookie = servant; + + return servant; +} + +void +IFR_ServantLocator::postinvoke ( + const PortableServer::ObjectId & /* oid */, + PortableServer::POA_ptr /* poa */, + const char * /* operation */, + PortableServer::ServantLocator::Cookie /* cookie */, + PortableServer::Servant servant + TAO_ENV_ARG_DECL_NOT_USED + ) +{ + delete servant; +} |