summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/IFRService/IRObject_i.cpp
blob: 4add4020c6faaa4ddae45e4bb0e3e64720acefed (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// $Id$

#include "orbsvcs/IFRService/IRObject_i.h"
#include "orbsvcs/IFRService/Repository_i.h"
#include "orbsvcs/IFRService/IDLType_i.h"
#include "orbsvcs/IFRService/Contained_i.h"
#include "orbsvcs/IFRService/IFR_Service_Utils.h"

#include "tao/PortableServer/Root_POA.h"
#include "tao/PortableServer/POA_Current_Impl.h"
#include "tao/TSS_Resources.h"


ACE_RCSID (IFR_Service,
           IRObject_i,
           "$Id$")


TAO_BEGIN_VERSIONED_NAMESPACE_DECL

TAO_IRObject_i::TAO_IRObject_i (TAO_Repository_i *repo)
  : repo_ (repo)
{
}

TAO_IRObject_i::~TAO_IRObject_i (void)
{
}

CORBA::DefinitionKind
TAO_IRObject_i::def_kind (
  )
{
  // Will always be overridden by concrete classes.
  return CORBA::dk_none;
}

void
TAO_IRObject_i::section_key (ACE_Configuration_Section_Key &key)
{
  this->section_key_ = key;
}

void
TAO_IRObject_i::update_key (void)
{
  TAO::Portable_Server::POA_Current_Impl *pc_impl =
    static_cast <TAO::Portable_Server::POA_Current_Impl *>
                     (TAO_TSS_Resources::instance ()->poa_current_impl_);

  PortableServer::ObjectId object_id;
  int status = TAO_Root_POA::parse_ir_object_key (pc_impl->object_key (),
                                                  object_id);
  if (status != 0)
    {
      ACE_DEBUG ((LM_DEBUG,
                  "update_key - parse_ir_object_key failed\n"));
      return;
    }

  char *oid_string = TAO_IFR_Service_Utils::oid_to_string (object_id);

  if (oid_string[0U] == '\0')
    {
      this->section_key_ = this->repo_->root_key ();
      return;
    }

  ACE_TString path (oid_string,
                    0,
                    false);

  status =
    this->repo_->config ()->expand_path (this->repo_->root_key (),
                                         path,
                                         this->section_key_,
                                         0);

  if (status != 0)
    {
      // If we're here, destroy() has been called on us.
      throw CORBA::OBJECT_NOT_EXIST ();
    }
}

TAO_END_VERSIONED_NAMESPACE_DECL