summaryrefslogtreecommitdiff
path: root/TAO/CIAO/DAnCE/Config_Handlers/ADD_Handler.cpp
blob: 49e106c815dc1ba9ac8f9723bf0bbc491fc47d16 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// $Id$
#include "ADD_Handler.h"
#include "Basic_Deployment_Data.hpp"
#include "ciao/Deployment_DataC.h"
#include "Property_Handler.h"
#include "Req_Handler.h"
#include "RDD_Handler.h"
#include "Singleton_IDREF_Map.h"

ACE_RCSID (DAnCE,
           ADD_Handler,
           "$Id$")

namespace CIAO
{
  namespace Config_Handlers
  {
    bool
    ADD_Handler::artifact_deployment_descr (
        const ArtifactDeploymentDescription &src,
        Deployment::ArtifactDeploymentDescription &dest,
        CORBA::ULong pos)
    {
      dest.name =
        CORBA::string_dup (src.name ().c_str ());

      dest.node =
        CORBA::string_dup (src.node ().c_str ());

      ArtifactDeploymentDescription::location_const_iterator end =
        src.end_location ();

      for (ArtifactDeploymentDescription::location_const_iterator
           start = src.begin_location ();
           start != end;
           ++start)
        {
          CORBA::ULong l =
            dest.location.length ();

          dest.location.length (l + 1);

          dest.location[l] = start->c_str ();
        }

      ArtifactDeploymentDescription::source_const_iterator sce =
        src.end_source ();

      for (ArtifactDeploymentDescription::source_const_iterator
           scb = src.begin_source ();
           scb != sce;
           ++scb)
        {
          CORBA::ULong l =
            dest.location.length ();

          dest.location.length (l + 1);

          dest.location[l] = scb->c_str ();
        }

      // @@TODO: See this loop is repeated
      ArtifactDeploymentDescription::execParameter_const_iterator adce =
        src.end_execParameter ();

      for (ArtifactDeploymentDescription::execParameter_const_iterator adcb =
             src.begin_execParameter ();
           adcb != adce;
           ++adcb)
        {
          CORBA::ULong len =
            dest.execParameter.length ();

          dest.execParameter.length (len + 1);

          Property_Handler::get_property ((*adcb),
                                          dest.execParameter[len]);
        }


      if (src.id_p ())
        {
          ACE_CString cstr (src.id ().c_str ());

          bool retval =
            Singleton_IDREF_Map::instance ()->bind_ref (cstr,
                                                        pos);
          if (!retval)
          {
            // @@ MAJO: Don't know how to handle this. Throw an exception?
          }
        }

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

      if (src.deployedResource_p ())
        {
          RDD_Handler handler;
          add.deployedResource.length (
            add.deployedResource.length () + 1);
          handler.get_ResourceDeploymentDescription (
            add.deployedResource[add.deployedResource.length () - 1],
            src.deployedResource ());
        }
#endif /* if 0*/

      return true;
    }

  }

}