summaryrefslogtreecommitdiff
path: root/CIAO/tools/Config_Handlers/XML_File_Intf.cpp
blob: 53e8ac1e801d74f1727eaa6186cc402338688f83 (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
// $Id$

#include "XML_File_Intf.h"
#include "Utils/XML_Helper.h"
#include "Deployment.hpp"
#include "DP_Handler.h"
#include "DAnCE/Deployment/Deployment_DataC.h"
#include "ciao/CIAO_common.h"


namespace CIAO
{
  namespace Config_Handlers
  {
    XML_File_Intf::XML_File_Intf (const char *file)
    {
      if (!this->read_process_file (file))
        throw;
    }

    bool
    XML_File_Intf::read_process_file (const char *file)
    {
      CIAO_TRACE("XML_File_Intf::read_process_file");

      XML_Helper helper;

      if (!helper.is_initialized ())
        return false;

      XERCES_CPP_NAMESPACE::DOMDocument *dom =
        helper.create_dom (file);

      if (!dom)
        return false;

      DeploymentPlan dp =
        deploymentPlan (dom);


      DP_Handler dp_handler (dp);

      this->idl_dp_.reset (dp_handler.plan ());

      if (this->idl_dp_.get ())
        return true;

      return false;
    }

    ::Deployment::DeploymentPlan const *
    XML_File_Intf::get_plan (void) const
    {
      CIAO_TRACE("get_plan");
      return this->idl_dp_.get ();
    }

    ::Deployment::DeploymentPlan *
    XML_File_Intf::get_plan (void)
    {
      CIAO_TRACE("XML_File_Intf::get_plan");
      return this->idl_dp_.release ();
    }
  }
}