INS_Locator.cpp

Go to the documentation of this file.
00001 //=============================================================================
00002 /**
00003 *  @file   INS_Locator.cpp
00004 *
00005 *  INS_Locator.cpp,v 1.7 2006/03/16 15:53:35 sjiang Exp
00006 *
00007 *  @brief  Implementation of the ImR's INS Locator class
00008 *
00009 *  @author Darrell Brunsch <brunsch@cs.wustl.edu>
00010 */
00011 //=============================================================================
00012 
00013 #include "INS_Locator.h"
00014 #include "ImR_Locator_i.h"
00015 #include "tao/ORB_Constants.h"
00016 
00017 INS_Locator::INS_Locator (ImR_Locator_i& loc)
00018 : imr_locator_ (loc)
00019 {
00020 }
00021 
00022 char *
00023 INS_Locator::locate (const char* object_key ACE_ENV_ARG_DECL)
00024 ACE_THROW_SPEC ((CORBA::SystemException, IORTable::NotFound))
00025 {
00026   ACE_ASSERT (object_key != 0);
00027   ACE_TRY
00028     {
00029       ACE_CString key (object_key);
00030       ssize_t poaidx = key.find ('/');
00031       if (poaidx >= 0)
00032       {
00033         key = key.substring (0, poaidx);
00034       }
00035 
00036       if (imr_locator_.debug () > 1)
00037         ACE_DEBUG ((LM_DEBUG, "ImR: Activating server <%s>.\n", key.c_str ()));
00038 
00039       CORBA::String_var located =
00040         this->imr_locator_.activate_server_by_object (key.c_str () ACE_ENV_ARG_PARAMETER);
00041       ACE_TRY_CHECK;
00042 
00043       ACE_CString tmp = located.in ();
00044       tmp += object_key;
00045 
00046       if (imr_locator_.debug () > 0)
00047         ACE_DEBUG ((LM_DEBUG, "ImR: Forwarding invocation on <%s> to <%s>\n", key.c_str (), tmp.c_str()));
00048 
00049       return CORBA::string_dup (tmp.c_str ());
00050     }
00051   ACE_CATCH (ImplementationRepository::CannotActivate, ex)
00052     {
00053       ACE_TRY_THROW (CORBA::TRANSIENT (
00054         CORBA::SystemException::_tao_minor_code (TAO_IMPLREPO_MINOR_CODE, 0),
00055         CORBA::COMPLETED_NO));
00056     }
00057   ACE_CATCH (ImplementationRepository::NotFound, ex)
00058     {
00059       ACE_TRY_THROW (CORBA::TRANSIENT (
00060         CORBA::SystemException::_tao_minor_code (TAO_IMPLREPO_MINOR_CODE, 0),
00061         CORBA::COMPLETED_NO));
00062     }
00063   ACE_ENDTRY;
00064 }

Generated on Thu Nov 9 13:36:19 2006 for TAO_Implementation_Repository by doxygen 1.3.6