summaryrefslogtreecommitdiff
path: root/TAO/CIAO/docs/tutorials/CoSMIC/02.html
blob: 6c8cee01aa2b10c8eb31877cc998daa2652e53eb (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
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
  <title>Building a Stock Quoter with TAO - A Tutorial</title>
<!-- $Id$ -->
</head>
<body style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"
 link="#000fff" vlink="#ff0f0f">
<h3>Building Stock Quoter system in PICML<br>
</h3>
Now we can start modelling the Quoter system using PICML. If there's
anything that confuses you as we go through each step, <a
 href="Model/Quoter.xme">here</a> is a pre-built Quoter model for your
reference.
It has everything that we will be achieving in this section.
<blockquote>
  <hr><strong>Note:</strong>
In case you don't know, to importa a XML file, just select <span
 style="font-weight: bold;">File-&gt;Import XML..</span> from
GME and choose your XML model <br>
  <hr></blockquote>
The paradigm of PICML is designed keeping in mind the <a
 href="http://www.omg.org/cgi-bin/doc?ptc/2003-07-08">OMG Deployment
&amp; Configuration (D&amp;C) specification (ptc/2003-07-08)</a>, so
the modeling process is straightforwrd if you are familar
with the specification. Please go to <a
 href="http://www.cs.wustl.edu/%7Eschmidt/ACE_wrappers/TAO/CIAO/docs/releasenotes/dance.html">DAnCE
project</a> for more information. <br>
<br>
<hr>
<h3>Table of Contents</h3>
<ul>
  <li><a href="#1">ImplementationArtifacts</a></li>
  <li><a href="#2">ComponentImplementations</a></li>
  <li><a href="#3">ComponentPackages</a></li>
  <li><a href="#4">PackageConfiguration</a></li>
  <li><a href="#5">TopLevelPackage</a></li>
  <li><a href="#6">Targets</a></li>
  <li><a href="#7">DeploymentPlan</a></li>
</ul>
<hr>
The complete PICML Quoter model consists of modeling elements
distributed in various folders.. <span style="font-style: italic;">idl_to_picml</span>
has created
all these folders and some of the modeling entities for us, as you
might have seen. In
the rest of the section, we will explain the purpose of each folder as
well as the modeling entities contained in these folders. We will also
show how to model some of the folders that have to be done by hand.
Before we start, it is worth reminding you that, please don't forget to
check the constraints when you are done with your model. In particular,
whenever you are about to generate something from your model, check the
constraint first by choosing <br>
<span style="font-weight: bold;">File-&gt;Check-&gt;Check All</span> in
GME. This will help you find a lot of logic error in your model.<br>
<a name="1">
<h3>ImplementationArtifacts<br>
</h3>
</a>This folder contains implementation artifacts associated with
components. <span style="font-style: italic;">idl_to_picml</span> has
created these artifacts for us, with their dependency relationships
correctly captured. Figure 4 shows the Implementation Artifacts for <span
 style="font-style: italic;">Broker</span>.
<div style="text-align: center;"><img alt="" src="Images/fig4.jpg"
 style="border: 1px solid ; width: 891px; height: 552px;"><a name="1"><br>
Figure 4.<br>
</a><br>
<div style="text-align: left;"><a name="1"></a>
<hr><a name="2">
<h3>ComponentImplementation<br>
</h3>
</a>This folder contains models that describes the implementations of
component interfaces. In the Quoter example, we will have two
monolithic component implementations; respectively <span
 style="font-style: italic;">StockDistributorImplementation </span><span
 style="font-style: italic;">StockBroker</span>Implementation, and an
assembly
component implementation: <span style="font-style: italic;">StockQuoter</span>,
which is an assembly of <span style="font-style: italic;">StockDistributorImplementation
</span>and <span style="font-style: italic;">StockBrokerImplementaion</span>.
<span style="font-style: italic;">idl_to_picml</span> has created the
monolithic component implementations for us, as shown in figure 5 for
example, but we have to put them together by hand in order to construct
a Quoter system. <br>
<br>
<br>
<div style="text-align: center;"><img alt="" src="Images/fig5.jpg"
 style="border: 1px solid ; width: 922px; height: 639px;"><br>
Figure 5<br>
<div style="text-align: left;"><br>
Assembly component is a recursive concept. It provides a boundary for
the composition of monolithic components.Assembly component does not
provide real implementation for any interface, i.e., it is a virtual
component. Modeling an assembly component is different from modeling a
monolithic component: you don't need to worry about the
artifacts.Instead, you need to create connections between monolithic
components so that they can talk via ports. Let's try to assemble the <span
 style="font-style: italic;">StockQuoter</span>.<br>
<ol>
  <li>Right click folder <span style="font-style: italic;">ComponentImplementations</span>,
choose <span style="font-weight: bold;">Insert
Model-&gt;ComponentImplementationContainer</span>, rename it
as "StockQuoterImplementation" in the Attribute Panel. Double click to
open it.<br>
  </li>
  <li> From the Part Browser, drag a &lt;&lt;ComponentAssembly&gt;&gt;
to the modeling window,
name it "StockQuoter". Double click to open it.<br>
  </li>
  <li> Now we will create two instances for interfaces<span
 style="font-style: italic;"> StockBroker </span>and <span
 style="font-style: italic;">StockDistributor</span>. To do
that, expand the folder <code><span style="font-style: italic;">InterfaceDefinitions</span></code>,
then expand the <code><span style="font-style: italic;">InterfaceDefinitions/</span></code><span
 style="font-style: italic;">Broker</span>, then <code><span
 style="font-style: italic;">InterfaceDefinitions/</span></code><span
 style="font-style: italic;">Broker/</span><span
 style="font-style: italic;">Stock</span> until the interface
definition of <span style="font-style: italic;">StockBroker </span>shows.
While expanding the tree, always keep
the "StockQuoter" &lt;&lt;ComponentAssembly&gt;&gt; window open.
Then drag <code style="font-style: italic;">MyQuoter/InterfaceDefinitions/Broker/Stock/StockBroker</code>
in the
browser to the "StockQuoter" &lt;&lt;ComponentAssembly&gt;&gt; window
while pressing ALT key. Repeat the
same steps for <span style="font-style: italic;">My</span><code
 style="font-style: italic;">Quoter/InterfaceDefinitions/Distributor/Stock/StockDistributor</code>,
and you will see two instances of component interfaces have been
created as shown in Figure 6 (the black line in the figure only
indicates .mapping)<br>
  </li>
</ol>
<br>
<div style="text-align: center;"><img alt="" src="Images/fig6.jpg"
 style="width: 972px; height: 714px;"><br>
<br>
Figure 6
<br>
<ol style="text-align: left;">
  <li value="4"> Create an &lt;&lt;PublishConnector&gt;&gt;.<br>
  </li>
  <li> Now assemble the components together according to <a
 href="Images/fig1.jpg">Figure 1</a>(make sure you change to connect
mode <img alt="" src="Icons/AddConnMode.gif"
 style="width: 20px; height: 17px;"> ) and
the resulting assembly model should look like Figure 7. Note that to
create connections between
StockDistributor.notify_out and StockBroker.notify_in, you will need
the intermediate connector &lt;&lt;PublishConnector&gt;&gt;. <br>
  </li>
</ol>
<img alt="" src="Images/fig7.jpg" style="width: 724px; height: 402px;"><br>
<br>
Figure 7<br>
</div>
<hr>
<a name="3"></a>
<h3>ComponentPackage<br>
</h3>
This folder contains deployable component packages. Every instance in
an assembly should have a corresponding monolithic implementation and
packaged in a ComponentPackagebe To create a package for <em>StockBroker</em>.instance<br>
<ol>
  <li> Right click folder <span style="font-style: italic;">ComponentPackage</span>s
,
insert a &lt;&lt;PackageContainer&gt;&gt;, name it "Broker"; Double
click to open it.<br>
  </li>
  <li> From the PartBrowser, add the following:<br>
    <ul>
      <li>a &lt;&lt;ComponentPackage&gt;&gt; named "Broker";</li>
      <li>a &lt;&lt;ComponentImplementationReference&gt;&gt; named
"Broker";</li>
      <li>a &lt;&lt;ComponentRef&gt;&gt; named "Broker";</li>
    </ul>
  </li>
  <li> Refer the &lt;&lt;ComponentImplementationReference&gt;&gt; <em>Broker</em>
to <code>MyQuoter/ComponentImplementations/StockBroker</code>Implementation/StockBrokerMonolithicImpl.
Refer the
&lt;&lt;ComponentRef&gt;&gt; <em>Broker</em> to <code>MyQuoter/InterfaceDefinitions/Broker/Stock/StockBroker.
To do a refering in GME, simply drage the tree node in the Browser
"into" the reference model. For example, you should drage the tree node
    </code><code>MyQuoter/ComponentImplementations/StockBroker</code>Implementation/StockBrokerMonolithicImpl
into &lt;&lt;ComponentImplementationReference&gt;&gt; <em>Broker. </em><code>Check
GME manual(tutorials) for more information.</code> </li>
  <li> Switch to Connect Mode and create two connections according to
the following relationship.<br>
    <ul>
      <li> &lt;&lt;ComponentImplementationReference&gt;&gt; <em>Broker</em>
implements &lt;&lt;ComponentPackage&gt;&gt; <em>Broker</em>; </li>
      <li> &lt;&lt;ComponentPackage&gt;&gt; <em>Broker </em>realizes
&lt;&lt;ComponentRef&gt;&gt; <em>Broker</em>. </li>
    </ul>
    <br>
    <br>
&nbsp;&nbsp;&nbsp;&nbsp; The model you built should resemble Figure 8. <br>
    <br>
    <div style="text-align: center;"><img alt="" src="Images/fig8.jpg"
 style="width: 675px; height: 497px;"><br>
    <br>
Figure 8<br>
    <br>
    <div style="text-align: left;">Now create a
ComponentPackage/StockDistributor following the same steps.</div>
    </div>
  </li>
  <br>
  <div style="text-align: center;">
  <div style="text-align: left;">We will also need to create a package
for the assembly component
StockQuoter. Remember assembly component is a virtual component, it
does not "realize" a certain interface, so different from the Broker
and Distributor packages, the
StockQuoter does not need a &lt;&lt;ComponentRef&gt;&gt;. To create
this model: </div>
  </div>
  <div style="text-align: center;">
  <div style="text-align: left;">
  <ol>
    <il>1. Insert a &lt;&lt;ComponentPackage&gt;&gt; named "StockQuoter"<br>
    </il><il><il>2. Add a
&lt;&lt;ComponentImplementationReference&gt;&gt; named "StockQuoter",
refer it to MyQuoter<span style="font-family: monospace;">/ComponentImplementations/StockQuoter/StockQuoter</span></il></il>
  </ol>
  <ol>
    <il><il>3. Switch to connect mode and connect
&lt;&lt;ComponentImplementationReference&gt;&gt; StockQuoter with
&lt;&lt;ComponentPackage&gt;&gt; StockQuoter, as in Figure 9.<br>
    </il></il>
  </ol>
  <ol>
    <ul>
    </ul>
  </ol>
  </div>
  </div>
  <div style="text-align: center;">
  <div style="text-align: left;"> <br>
  <br>
  </div>
  <div style="text-align: center;"><img alt="" src="Images/fig9.jpg"
 style="width: 549px; height: 354px;"><br>
  <br>
Figure 9<br>
  <br>
  </div>
  </div>
</ol>
<hr>
<div style="text-align: left;"> <a name="4"></a>
<h3>PackageConfiguration<br>
</h3>
This folder contains just one model capturing specific configuration of
Component packages. <br>
<ol>
  <li> In the folder <span style="font-style: italic;">PackageConfiguratio</span>n,
and create a
&lt;&lt;PackageConfigurationContainer&gt;&gt;, name it "Default", click
to
open it.<br>
  </li>
  <li> Add a &lt;&lt;PackageConfiguration&gt;&gt; named "default" and a
&lt;&lt;ComponentPackageReference&gt;&gt;, name it "StockQuoter",
connect "Default" to "StockQuoter"<br>
  </li>
  <li> Refer &lt;&lt;ComponentPackageReference&gt;&gt; StockQuoter to
&lt;&lt;ComponentPackage&gt;&gt; <code>MyQuoter/ComponentPackage/StockQuoter/StockQuoter
    <br>
(Not &lt;&lt;ComponentImplementationReference&gt;&gt; </code><code>MyQuoter/ComponentPackage/StockQuoter/StockQuoter!)&nbsp;</code>
  </li>
</ol>
<br>
<hr>
<a name="5"></a>
<h3>ToplevelPackage<br>
</h3>
This folder contains one model capturing information about the
top-level element that will be fed to
the application. <br>
<ol>
  <li>In the folder <span style="font-style: italic;">ToplevelPackage</span>,
and create a
&lt;&lt;ToplevelPackageContainer&gt;&gt;, name it "Default", double
click to open it.<br>
  </li>
  <li> Add a &lt;&lt;ToplevelPackage&gt;&gt; named "ToplevelPackage"
and a &lt;&lt;PackageConfigurationReference&gt;&gt;, name it "Default",
connect "ToplevelPackage" to "Default" <br>
  </li>
  <li> Refer "Default" to My<code>Quoter/PackageConfiguration/Default/Default</code><br>
  </li>
</ol>
<br>
<hr>
<a name="6"></a>
<h3>Targets<br>
</h3>
This folder contains domain-specific models capturing information about
the target
environment in which component-based application will be deployed. In
this Quoter example, we can either deploy the two components into ONE
host, or into TWO different host. We will deploy the Quoter into two
different host. <br>
<ol>
  <li> In the folder <span style="font-style: italic;">Targets</span>,
insert a new &lt;&lt;Domain&gt;&gt; named "Domain"; double click to
open it.<br>
  </li>
  <li> From the Part Browser, add two &lt;&lt;Node&gt;&gt; named
"Broker" and "Distributor" respectively.<br>
  </li>
</ol>
<br>
Now we are ready to deploy our Components to the actual physical
environment.<br>
<hr>
<a name="7"></a>
<h3>DeploymentPlan<br>
</h3>
This folder contains a plan model that captures information about the
assignment of component to nodes. <br>
<ol>
  <li> In the folder <span style="font-style: italic;">DeploymentPlan</span>,
insert a model
&lt;&lt;DeploymentPlan&gt;&gt;; name it "Plan", click to open it<br>
  </li>
  <li> From the PartBrowser, add the following:<br>
    <ul>
      <li>Two &lt;&lt;CollocationGroup&gt;&gt;</li>
      <li>Two &lt;&lt;NodeReference&gt;&gt; named "Node_Broker" and
"Node_Distributor" respectively, refering to <code>MyQuoter/Targets/Domain/Broker</code>
and <code>MyQuoter/Targets/Domain/Distributor<code> respectively</code></code></li>
      <li>Two &lt;&lt;ComponentRef&gt;&gt; named "StockBroker" and
"StockDistributor" respectively, refering to <code>MyQuoter/ComponentImplementations/StockQuoterImplementation/StockQuoter/StockBroker</code>
and <code>MyQuoter/ComponentImplementations/StockQuoterImplementation/StockQuoter/StockDistributor</code>
respectively. Note that the &lt;&lt;ComponentRef&gt;&gt; in
DeploymentPlan is not refering to the interface, but rather, the actual
instance of the implementation.</li>
    </ul>
  </li>
  <li> Switch to Connect Mode, connect one
&lt;&lt;CollocationGroup&gt;&gt; to &lt;&lt;NodeReference&gt;&gt; <em>Node_Broker</em>,
connect another
&lt;&lt;CollocationGroup&gt;&gt; to &lt;&lt;NodeReference&gt;&gt; <span
 style="font-style: italic;">Node_</span><em>Distributor</em>.
Now the model looks like the following.<br>
    <br>
    <div style="text-align: center;"><img alt="" src="Images/fig10.jpg"
 style="width: 752px; height: 530px;"><br>
    <br>
Figure 10.<br>
    <br>
    </div>
  </li>
  <li> Now we need to associate &lt;&lt;ComponentRef&gt;&gt;
StockBroker to the
&lt;&lt;CollocationGroup&gt;&gt; running on the
&lt;&lt;NodeReference&gt;&gt; Broker, and &lt;&lt;ComponentRef&gt;&gt;
StockDistributor to the &lt;&lt;CollocationGroup&gt;&gt; running on the
&lt;&lt;NodeReference&gt;&gt; Distributor. To do that, switch the Edit
Mode Bar to Set Mode (<img alt="" src="Icons/SetMode.gif"
 style="width: 20px; height: 17px;">), and move
the cursor to the &lt;&lt;CollocationGroup&gt;&gt; running on
&lt;&lt;NodeReference&gt;&gt; Distributor, right-click on it. You will
find the cursor is changed to set mode cursor, and only the
&lt;&lt;CollocationGroup&gt;&gt; you clicked in is highlighted, as
shown
in Figure 11.<br>
    <br>
  </li>
</ol>
</div>
<div style="text-align: center;"><img alt="" src="Images/fig11.jpg"
 style="width: 672px; height: 505px;"><br>
<br>
Figure 11<br>
<br>
</div>
<div style="text-align: left;">&nbsp;Now move your cursor to
&lt;&lt;ComponentRef&gt;&gt;&nbsp; StockDistributor, and left-click it,
so that it looks like Figure 12.<br>
</div>
<br>
<div style="text-align: center;"><img alt="" src="Images/fig12.jpg"
 style="width: 672px; height: 505px;"><br>
<br>
Figure 12<br>
<br>
</div>
<div style="text-align: left;">&nbsp;&nbsp; This operation
associates <em>StockDistributor</em> component to the
&lt;&lt;CollocationGroup&gt;&gt; running on <em>Distributor</em> node.
To do the same with
Broker, just right-click on another &lt;&lt;CollocationGroup&gt;&gt;,
and left-click on StockBroker &lt;&lt;CollocationGroup&gt;&gt; which is
highlighted. <br>
<br>
<hr>
<a name="8"></a></div>
<br>
Up to this point, we are basiclly done with the modeling part. Before
we generate anything from this model though, please <span
 style="font-weight: bold;">DO </span>remember to check the
constraints of the model as we mentioned earlier.<br>
<br>
After we are done with the modeling, the flattened_deploymentplan
interpreter that comes along with PICML will help us to generate a
flattened_deploymentplan.cdp file. Please make sure you generate this
file to MyQuoter/descriptors.
<address><span style="font-style: italic;"></span><br>
<span style="font-style: italic;"></span><br>
<br>
<a href="mailto:ming.xiong@vanderbilt.edu">Ming Xiong<br>
</a></address>
<!-- Created: Sat Nov 27 15:25:06 CST 1999 --><!-- hhmts start -->
Last modified:<!-- hhmts end -->
</div>
</div>
</div>
</div>
</body>
</html>