summaryrefslogtreecommitdiff
path: root/trunk/CIAO/tools/Config_Handlers/DP_PCD_Handler.cpp
blob: 2be43fb3b5bf27691e1a496ed7106256106e3eb1 (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
// $Id$

#include "DP_PCD_Handler.h"
#include "CEPE_Handler.h"
#include "PSPE_Handler.h"
#include "ERE_Handler.h"
#include "CRDD_Handler.h"
#include "PCD_Handler.h"
#include "Basic_Deployment_Data.hpp"
#include "cdp.hpp"
#include "DAnCE/Deployment/Deployment_DataC.h"
#include "ciao/CIAO_common.h"
namespace CIAO
{
  namespace Config_Handlers
  {
    void
    DP_PCD_Handler::plan_connection_descrs (
        const DeploymentPlan &src,
        Deployment::PlanConnectionDescriptions& dest)
    {
      CIAO_TRACE("DP_PCD_Handler::plan_connection_descrs");
      DeploymentPlan::connection_const_iterator cci_e =
        src.end_connection ();
      
      CORBA::ULong pos = 0;
      dest.length (src.count_connection ());
      for (DeploymentPlan::connection_const_iterator cci_b =
             src.begin_connection ();
           cci_b != cci_e;
           ++cci_b)
        {
          DP_PCD_Handler::plan_connection_descr (*(cci_b),
                                                 dest[pos++]);
        }
    }
    
    PlanConnectionDescription
    DP_PCD_Handler::plan_connection_descr (
	const Deployment::PlanConnectionDescription &src)
    {
      CIAO_TRACE("DP_PCD_Handler::plan_connection_descr");
      PlanConnectionDescription pcd = PCD_Handler::get_PlanConnectionDescription(src);
      return pcd;
    }

    void
    DP_PCD_Handler::plan_connection_descr (
        const PlanConnectionDescription &src,
        Deployment::PlanConnectionDescription &dest)
    {
      CIAO_TRACE("DP_PCD_Handler::plan_connection_descr - reverse");
      dest.name =
        src.name ().c_str ();

      if (src.source_p ())
        {
          // There will be only one as per the schema
          dest.source.length (1);
          dest.source[0] =
            src.source ().c_str ();
        }


      CEPE_Handler::external_port_endpoints (src,
                                             dest.externalEndpoint);
      ERE_Handler::external_ref_endpoints (src,
                                           dest.externalReference);

      PSPE_Handler::sub_component_port_endpoints (src,
                                                  dest.internalEndpoint);

#if 0
      // @@MAJO: Need to figure how to use this.
      if (desc.deployedResource_p ())
        {
          CRDD_Handler crddhandler;

          toconfig.deployedResource.length (
            toconfig.deployedResource.length () + 1);

          crddhandler.get_ConnectionResourceDeploymentDescription (
            toconfig.deployedResource[toconfig.deployedResource.length () - 1],
            desc.deployedResource ());
        }

      if (desc.deployRequirement_p ())
        {

          // @@ MAJO: Not sure how to use this
          //Create the handler for the requirements.
          Requirement_Handler reqhandler;

          //Increase the sequence length and delgate
          //the Requirement to the Req_Handler.
          toconfig.deployRequirement.length (
            toconfig.deployRequirement.length () + 1);
          reqhandler.get_Requirement (
            toconfig.deployRequirement[toconfig.deployRequirement.length () - 1],
            desc.deployRequirement ());


        }
#endif /*if 0*/
    }
  }
}