summaryrefslogtreecommitdiff
path: root/TAO/CIAO/tools/Config_Handlers/STD_CPD_Handler.cpp
blob: e5d097750f152d2d72fd5dadf0b69e295e728f2d (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
// $Id$
#include "STD_CPD_Handler.h"
#include "STD_CID_Handler.h"
#include "Basic_Deployment_Data.hpp"
#include "ciao/Deployment_DataC.h"
#include "Deployment.hpp"

namespace CIAO
{
  namespace Config_Handlers
  {
    bool
    STD_CPD_Handler::component_package_descr (
                                              const ComponentPackageDescription &desc,
                                              ::Deployment::ComponentPackageDescription &toconfig)
    {
      toconfig.label =
        desc.label ().c_str ();

      toconfig.UUID =
        desc.UUID ().c_str ();

      PackagedComponentImplementation pci = desc.implementation ();
      Deployment::PackagedComponentImplementation idl_pci;
      idl_pci.name =
        pci.name ().c_str ();

      if (!this->xml_helper_->is_initialized ())
        return false;

      // parse the .cid (ComponentImplementationDescription) file
      // that <referencedImplementation> links to
      xercesc::DOMDocument* dom =
        this->xml_helper_->create_dom ((pci.referencedImplementation ()).href ().c_str ()); // here location indicates .pcd file

      if (!dom)
        return false;

      ComponentImplementationDescription cid =
        componentImplementationDescription (dom);

      Deployment::ComponentImplementationDescription idl_cid;

      STD_CID_Handler cid_handler (this->xml_helper_);

      cid_handler.component_impl_descr (cid,
                                        idl_cid);

      idl_pci.referencedImplementation = idl_cid;

      toconfig.implementation.length (1);
      toconfig.implementation [0] = idl_pci;

      return true;
    }
  }
}