summaryrefslogtreecommitdiff
path: root/TAO/CIAO/ciao/ComponentServer_Impl.inl
blob: 275516e8db17094fa477df4352538f8fe02e30f4 (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
/* -*- C++ -*- */
// $Id$

ACE_INLINE
CIAO::ComponentServer_Impl::ComponentServer_Impl (CORBA::ORB_ptr o,
                                                  PortableServer::POA_ptr p,
                                                  int static_config_flag,
                                                  const Static_Config_EntryPoints_Maps* static_entrypts_maps)
  : orb_ (CORBA::ORB::_duplicate (o)),
    poa_ (PortableServer::POA::_duplicate (p)),
    static_config_flag_ (static_config_flag),
    static_entrypts_maps_ (static_entrypts_maps)
{
}

ACE_INLINE void
CIAO::ComponentServer_Impl::set_objref (Components::Deployment::ServerActivator_ptr act,
                                        const Components::ConfigValues &config,
                                        Components::Deployment::ComponentServer_ptr cs
                                        ACE_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  if (!CORBA::is_nil (this->activator_.in ()) || !CORBA::is_nil (this->objref_.in ()))
    ACE_THROW (CORBA::BAD_INV_ORDER ());

  this->config_ = new Components::ConfigValues (config);
  this->activator_ = Components::Deployment::ServerActivator::_duplicate (act);
  this->objref_ = Components::Deployment::ComponentServer::_duplicate (cs);
}

ACE_INLINE Components::Deployment::ComponentServer_ptr
CIAO::ComponentServer_Impl::get_objref (ACE_ENV_SINGLE_ARG_DECL)
{
  if (CORBA::is_nil (this->objref_.in ()))
    {
      this->objref_ = this->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
      ACE_CHECK_RETURN (0);
    }

  return this->objref_.in ();
}

ACE_INLINE Components::Deployment::ComponentInstallation_ptr
CIAO::ComponentServer_Impl::get_component_installation (ACE_ENV_SINGLE_ARG_DECL)
{
  if (CORBA::is_nil (this->installation_.in ()))
    {
      if (this->static_config_flag_ == 1)
        return 0;

      ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0);

      CORBA::Object_var tmp = this->orb_->resolve_initial_references ("ComponentInstallation"
                                                                      ACE_ENV_ARG_PARAMETER);
      ACE_CHECK_RETURN (0);

      this->installation_ =
        Components::Deployment::ComponentInstallation::_narrow (tmp.in ()
                                                                ACE_ENV_ARG_PARAMETER);
      ACE_CHECK_RETURN (0);

      if (CORBA::is_nil (this->installation_.in ()))
        ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
    }

  return this->installation_.in ();
}