summaryrefslogtreecommitdiff
path: root/trunk/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Util.cpp
blob: f84609e3eb3cc449c7a1cdada05763faab72e035 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "orbsvcs/SSLIOP/SSLIOP_Util.h"


ACE_RCSID (SSLIOP,
           SSLIOP_Util,
           "$Id$")


#include "orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h"
#include "orbsvcs/SSLIOP/SSLIOP_Current.h"

#include "tao/ORB_Core.h"
#include "tao/debug.h"


TAO_BEGIN_VERSIONED_NAMESPACE_DECL

TAO::SSLIOP::Current_ptr
TAO::SSLIOP::Util::current (TAO_ORB_Core *orb_core)
{
  try
    {
      // Go straight to the object_ref_table in the ORB Core to avoid
      // the ORB::resolve_initial_references() mechanism's complaints
      // about the fact that the ORB isn't fully initialized yet
      // (happens on the client side).
      CORBA::Object_var obj =
        orb_core->object_ref_table ().resolve_initial_reference (
          "SSLIOPCurrent");

      TAO::SSLIOP::Current_var tao_current =
        TAO::SSLIOP::Current::_narrow (obj.in ());

      if (CORBA::is_nil (tao_current.in ()))
        throw CORBA::INV_OBJREF ();

      return tao_current._retn ();
    }
  catch (const CORBA::Exception& ex)
    {
      if (TAO_debug_level > 0)
        ex._tao_print_exception (
          "Could not resolve \"SSLIOPCurrent\" object");

      return 0;
    }

  return 0;
}

TAO_END_VERSIONED_NAMESPACE_DECL