summaryrefslogtreecommitdiff
path: root/TAO/CIAO/DAnCE/Config_Handlers/MDD_Handler.cpp
blob: e2d3c269c0d06b302578e4feb681b95045b6ccc0 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// $Id$
#include "MDD_Handler.h"
#include "Basic_Deployment_Data.hpp"
#include "ciao/Deployment_DataC.h"
#include "ADD_Handler.h"
#include "Property_Handler.h"
#include "Req_Handler.h"
#include "Singleton_IDREF_Map.h"

namespace CIAO
{
  namespace Config_Handlers
  {
    void
    MDD_Handler::mono_deployment_description (
        const MonolithicDeploymentDescription& desc,
        Deployment::MonolithicDeploymentDescription& toconfig)
    {
      toconfig.name =
        CORBA::string_dup (desc.name ().c_str ());

      MonolithicDeploymentDescription::source_const_iterator me =
        desc.end_source ();

      for (MonolithicDeploymentDescription::source_const_iterator se =
             desc.begin_source ();
           se != me;
           ++se)
        {
          CORBA::ULong len =
            toconfig.source.length ();

          toconfig.source.length (len + 1);

          toconfig.source[len] =
            CORBA::string_dup ((*se).c_str ());
        }

      MonolithicDeploymentDescription::artifact_const_iterator ae =
        desc.end_artifact ();

      for (MonolithicDeploymentDescription::artifact_const_iterator
             ab = desc.begin_artifact ();
           ae != ab;
           ++ab)
        {
          CORBA::ULong tmp = 0;

          // @@ MAJO: What should be do
          bool r =
            Singleton_IDREF_Map::instance ()->find_ref (
              ab->id ().c_str (),
              tmp);

          if (!r)
            // @@MAJO: What should we do if find_ref fails?
            continue;

          CORBA::ULong len =
            toconfig.artifactRef.length ();

          toconfig.artifactRef.length (len + 1);

          toconfig.artifactRef[len] = tmp;
        }

      MonolithicDeploymentDescription::execParameter_const_iterator epce =
        desc.end_execParameter ();

      for (MonolithicDeploymentDescription::execParameter_const_iterator epcb =
             desc.begin_execParameter ();
           epcb != epce;
           ++epcb)
        {
          CORBA::ULong len =
            toconfig.execParameter.length ();

          toconfig.execParameter.length (len + 1);

          Property_Handler::get_property ((*epcb),
                                          toconfig.execParameter[len]);
        }

#if 0
      // @@ MAJO: Don't know how to handle this
      if (desc.deployRequirement_p ())
        {
                                  Req_Handler handler;
          toconfig.deployRequirement.length (
            toconfig.deployRequirement.length () + 1);
          handler.get_Requirement (
            toconfig.deployRequirement[toconfig.deployRequirement.length () - 1],
            desc.deployRequirement ());
        }
#endif /*if 0*/
    }

  }

}