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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
// $Id$
#include "CPD_Handler.h"
#include "Basic_Deployment_Data.hpp"
#include "DAnCE/Deployment/Deployment_DataC.h"
#include "DAnCE/Logger/Log_Macros.h"
namespace CIAO
{
namespace Config_Handlers
{
void
CPD_Handler::handle_component_port_description (
const ComponentPortDescription& desc,
Deployment::ComponentPortDescription& toconfig)
{
DANCE_TRACE("CPD_Handler::component_port_description");
toconfig.name =
ACE_TEXT_ALWAYS_CHAR (desc.name ().c_str ());
if (desc.specificType_p ())
toconfig.specificType =
ACE_TEXT_ALWAYS_CHAR (desc.specificType ().c_str ());
toconfig.supportedType.length (desc.count_supportedType ());
std::for_each (desc.begin_supportedType (),
desc.end_supportedType (),
String_Seq_Functor (toconfig.supportedType));
switch (desc.kind ().integral ())
{
case CCMComponentPortKind::Facet_l:
toconfig.kind = Deployment::Facet;
break;
case CCMComponentPortKind::SimplexReceptacle_l:
toconfig.kind = Deployment::SimplexReceptacle;
break;
case CCMComponentPortKind::MultiplexReceptacle_l:
toconfig.kind = Deployment::MultiplexReceptacle;
break;
case CCMComponentPortKind::EventEmitter_l:
toconfig.kind = Deployment::EventEmitter;
break;
case CCMComponentPortKind::EventPublisher_l:
toconfig.kind = Deployment::EventPublisher;
break;
case CCMComponentPortKind::EventConsumer_l:
toconfig.kind = Deployment::EventConsumer;
break;
default:
ACE_ERROR ((LM_ERROR, "Invalid port type in connection %s\n",
desc.name ().c_str ()));
throw 1;
}
/* @@BUG: We need to consider how to handle booleans. */
toconfig.provider = desc.provider ();
toconfig.exclusiveProvider = desc.exclusiveProvider ();
toconfig.exclusiveUser = desc.exclusiveUser ();
toconfig.optional = desc.optional ();
}
ComponentPortDescription
CPD_Handler::component_port_description (
const Deployment::ComponentPortDescription& src)
{
DANCE_TRACE("CPD_Handler::component_port_description - reverse");
::XMLSchema::string< ACE_TCHAR > name (ACE_TEXT_CHAR_TO_TCHAR (src.name));
::XMLSchema::string< ACE_TCHAR > stype (ACE_TEXT_CHAR_TO_TCHAR (src.specificType));
::XMLSchema::string< ACE_TCHAR > tval (ACE_TEXT ("true"));
::XMLSchema::string< ACE_TCHAR > fval (ACE_TEXT ("false"));
XMLSchema::boolean provider;
XMLSchema::boolean exclusiveProvider;
XMLSchema::boolean exclusiveUser;
XMLSchema::boolean optional;
if (src.provider)
provider = true;
else
provider = false;
if (src.exclusiveUser)
exclusiveUser = true;
else
provider = false;
if (src.exclusiveProvider)
exclusiveProvider = true;
else
provider = false;
if (src.optional)
optional = true;
else
provider = false;
ComponentPortDescription cpd (name,
provider,
exclusiveProvider,
exclusiveUser,
optional,
CCMComponentPortKind::Facet);
switch (src.kind)
{
case ::Deployment::Facet:
cpd.kind (CCMComponentPortKind::Facet);
break;
case ::Deployment::SimplexReceptacle:
cpd.kind (CCMComponentPortKind::SimplexReceptacle);
break;
case ::Deployment::MultiplexReceptacle:
cpd.kind (CCMComponentPortKind::MultiplexReceptacle);
break;
case ::Deployment::EventEmitter:
cpd.kind (CCMComponentPortKind::EventEmitter);
break;
case ::Deployment::EventPublisher:
cpd.kind (CCMComponentPortKind::EventPublisher);
break;
case ::Deployment::EventConsumer:
cpd.kind (CCMComponentPortKind::EventConsumer);
break;
default:
ACE_ERROR ((LM_ERROR, ACE_TEXT("Invalid port kind in connection %C\n"),
name.c_str ()));
}
for (CORBA::ULong i = 0; i < src.supportedType.length (); ++i)
{
//cpd.add_supportedType (XMLSchema::string< ACE_TCHAR > ((src.supportedType[i])));
}
return cpd;
}
}
}
|