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
|
<!-- $Id$ -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Getting Started</title>
<meta http-equiv="Content-Type" content=
"text/html; charset=us-ascii" />
<style type="text/css">
/*<![CDATA[*/
<!--
@font-face {
font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;
}
h3 {
font-size:13.5pt;
font-family:"Times New Roman";
font-weight:bold;
}
a:link, span.MsoHyperlink {
color:#000FFF;
text-decoration:underline;
text-underline:single;
}
a:visited, span.MsoHyperlinkFollowed {
color:#FF0F0F;
text-decoration:underline;
text-underline:single;
}
p {
font-size:12.0pt;
font-family:"Times New Roman";
}
address {
font-size:12.0pt;
font-family:"Times New Roman";
font-style:italic;
}
code {
font-family:"Courier New";
}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate {
font-size:8.0pt;
font-family:Tahoma;
}
div.Section1 {
page:Section1
}
-->
/*]]>*/
</style><!-- 01.html,v 1.3 2006/02/10 14:34:35 mxiong Exp -->
<style type="text/css">
/*<![CDATA[*/
body {
background-color: #FFFFFF;
}
:link { color: #000FFF }
:visited { color: #FF0F0F }
address.c50 {LINE-HEIGHT: 150%}
address.c49 {LINE-HEIGHT:150%}
div.c48 {LINE-HEIGHT: 150%; TEXT-ALIGN: center; text-align: center}
hr.c47 {text-align: center}
p.c46 {LINE-HEIGHT: 150%; TEXT-ALIGN: center; text-align: center}
p.c45 {LINE-HEIGHT:150%}
p.c44 {MARGIN-LEFT:1.75in;TEXT-INDENT:-0.75in;LINE-HEIGHT:150%;}
p.c43 {MARGIN-LEFT:0.5in;TEXT-INDENT:1.25in;LINE-HEIGHT:150%}
span.c42 {COLOR:black; FONT-FAMILY:'Courier New'}
span.c41 {LINE-HEIGHT:150%;FONT-FAMILY:'Times New Roman';}
p.c40 {LINE-HEIGHT: 150%; TEXT-INDENT: 0.5in; font-weight: bold}
p.c39 {MARGIN-LEFT: 1.25in; TEXT-INDENT: -0.25in; LINE-HEIGHT: 150%;}
span.c38 {COLOR: black; FONT-FAMILY: 'Courier New';}
span.c37 {FONT-SIZE: 10pt; COLOR: black; LINE-HEIGHT: 150%}
span.c36 {COLOR: black; FONT-FAMILY: Symbol;}
span.c35 {FONT: 7pt 'Times New Roman'}
p.c34 {MARGIN-LEFT:1.5in;LINE-HEIGHT:150%}
p.c33 {MARGIN-LEFT: 1.25in; LINE-HEIGHT: 150%}
span.c32 {COLOR: black;}
p.c31 {MARGIN-LEFT:1.25in;LINE-HEIGHT:150%}
span.c30 {font-family: Times New Roman}
span.c29 {font-family: Courier; font-size: 80%}
p.c28 {MARGIN-LEFT: 0.5in; TEXT-INDENT: 1.25in; LINE-HEIGHT: 150%}
span.c27 {COLOR: black; FONT-FAMILY: 'Courier New'}
p.c26 {MARGIN-LEFT:1.25in;TEXT-INDENT:-0.25in;LINE-HEIGHT:150%;}
span.c25 {FONT-SIZE: 10pt;COLOR: black;LINE-HEIGHT: 150%}
span.c24 {COLOR:black;LINE-HEIGHT:150%;FONT-FAMILY:'Times New Roman';}
span.c23 {FONT-SIZE:10pt; COLOR:black; LINE-HEIGHT:150%}
p.c22 {TEXT-INDENT:0.5in;LINE-HEIGHT:150%}
p.c21 {MARGIN-LEFT:0.75in;LINE-HEIGHT:150%}
span.c20 {COLOR:black;}
p.c19 {MARGIN-LEFT:0.5in;TEXT-INDENT:0.5in;LINE-HEIGHT:150%}
span.c18 {COLOR:black; FONT-FAMILY:'Courier New';}
p.c17 {MARGIN-LEFT:0.75in;TEXT-INDENT:-0.25in;LINE-HEIGHT:150%;}
span.c16 {FONT-SIZE:10pt;COLOR:black;LINE-HEIGHT:150%}
span.c15 {COLOR:black;FONT-FAMILY:Symbol;}
p.c14 {LINE-HEIGHT: 150%; font-weight: bold}
h3.c13 {MARGIN:0in 0in 0pt 1.5in; TEXT-INDENT:-0.25in; LINE-HEIGHT:150%;}
span.c12 {FONT-WEIGHT:normal; FONT-SIZE:12pt; COLOR:black; LINE-HEIGHT:150%;}
h3.c11 {MARGIN:0in 0in 0pt 0.75in; TEXT-INDENT:-0.25in; LINE-HEIGHT:150%;}
span.c10 {FONT-WEIGHT:normal; FONT-SIZE:12pt; COLOR:black; LINE-HEIGHT:150%; FONT-FAMILY:Symbol;}
h3.c9 {MARGIN:0in 0in 0pt; TEXT-INDENT:0.5in; LINE-HEIGHT:150%}
span.c8 {FONT-SIZE:12pt;COLOR:black;LINE-HEIGHT:150%}
p.c7 {MARGIN:0in 0in 0pt 0.75in; TEXT-INDENT:-0.25in; LINE-HEIGHT:150%;}
span.c6 {FONT-FAMILY:Symbol;}
span.c5 {FONT:7pt 'Times New Roman'}
span.c4 {FONT-WEIGHT:normal;FONT-SIZE:12pt;COLOR:black;LINE-HEIGHT:150%;}
h3.c3 {MARGIN:0in 0in 0pt; LINE-HEIGHT:150%}
h3.c2 {LINE-HEIGHT: 150%; MARGIN: 0in 0in 0pt; TEXT-ALIGN: center; text-align: center}
span.c1 {COLOR:black}
/*]]>*/
</style>
</head>
<body lang="EN-US" xml:lang="EN-US">
<h3 class="Section1 c2"><span class='c1'>Step 1: Define your
interfaces and component types</span></h3>
<h3 class="Section1 c2"><span class='c1'><img width="447" height=
"350" id="_x0000_i1025" src="images/step1.jpg" name=
"_x0000_i1025" /></span></h3>
<h3 class="Section1 c3"><span class='c1'> </span></h3>
<h3 class="Section1 c3"><span class='c4'>Please make sure to read
the following article to under the Stock Quoter system
architecture before delving further into the
tutorial:</span></h3>
<p class="Section1 c7"><span class='c6'>·<span class=
"c5"> </span></span> <a href=
"http://www.cuj.com/documents/s=9152/cujexp0404vinoski/">The
CORBA Component Model, Part 2: Defining Components with the IDL
3.x Types</a></p>
<h3 class="Section1 c3"><span class='c4'> </span></h3>
<h3 class="Section1 c3"><span class='c8'>Directory
Structure:</span></h3>
<h3 class="Section1 c3"><span class='c4'>The tutorial relies on
the following directory structure. Create Quoter and all its
subdirectories as shown below. We will describe the purpose of
these directories later in the tutorial.</span></h3>
<h3 class="Section1 c9"><span class='c4'>Quoter</span></h3>
<h3 class="Section1 c3"><span class=
'c4'>
|---- descriptors</span></h3>
<h3 class="Section1 c3"><span class=
'c4'>
|---- Stock_Base</span></h3>
<h3 class="Section1 c3"><span class=
'c4'>
|---- Distributor</span></h3>
<h3 class="Section1 c3"><span class=
'c4'>
|---- Broker</span></h3>
<h3 class="Section1 c3"><span class='c4'> </span></h3>
<h3 class="Section1 c3"><span class=
'c8'>Preliminaries:</span></h3>
<h3 class="Section1 c11"><span class='c10'>·<span class=
"c5"> </span></span>
<span class='c4'>We use the Make Project Creator (MPC) throughout
this tutorial. Understanding MPC will aid you in understanding
this tutorial. For more information on MPC please look at the
following:</span></h3>
<h3 class="Section1 c13"><span class='c12'>1.<span class=
"c5"> </span></span> <span class='c4'>MPC
<a href="../../../../../../MPC/docs/html/MakeProjectCreator.html">Chapter</a>.</span></h3>
<h3 class="Section1 c13"><span class='c12'>2.<span class=
"c5"> </span></span> <span class=
'c4'>$ACE_ROOT/MPC/<a href="../../../../../../MPC/docs/README">README</a></span></h3>
<p class='c14'><span class='c1'>Interface Design:</span></p>
<p class='c17'><span class='c15'>·<span class=
"c5"> </span></span>
<span class='c1'>In the <i>Quoter/Stock_Base</i> sub-directory,
place an idl file</span> <code><i><span class=
'c16'>Stock_Base.idl</span></i></code> <span class='c1'>that you
could copy from <a href="Stock_Base/Stock_Base.idl">here</a> .
This file defines the interfaces and events that will be used by
both StockDistributor and StockBroker components. We put together
the common interface definitions so the base library can be
shared by both components, reducing the footprint of "real"
components.</span></p>
<p class='c17'><span class='c15'>·<span class=
"c5"> </span></span>
<span class='c1'>Next, we need to create a Make Project Creator
(MPC) file to generate the make files for us. From the
<i>Quoter/Stock_Base</i> subdirectory, type the following
command:</span></p>
<p class='c19'><span class="c18">generate_component_mpc.pl
–n Stock_Base</span></p>
<p class='c21'><span class='c20'>The command above will generate
a <i>Stock_Base.mpc</i> file that contains two projects
<i>Stock_Base_stub</i> and <i>Stock_Base_skel</i> for the Stub
and Servant code respectively. The MPC file should look like
<a href="Stock_Base/Stock_Base.mpc">this</a>.<br/>
Mind that "libout" and "libpaths" are added. This is done to make
the compilation of this example easier and at runtime, all deliveralbes
are in one directory. Beware that you need to add this
directory to your system path when running the executables (see page 4).
</span></p>
<p class='c14'><span class='c1'>Component Design:</span></p>
<p class='c22'><b><span class=
'c1'>Distributor:</span></b><span class=
'c1'> </span></p>
<p class='c26'><span class='c15'>·<span class=
"c5"> </span></span>
<span class='c1'>In the</span> <code><i><span class=
'c23'>Quoter/Distributor</span></i></code> <code><span class=
"c24">sub-directory</span></code><span class='c1'>, place an idl
file</span> <code><i><span class=
'c25'>StockDistributor.idl</span></i></code> <span class=
'c1'>that looks like <a href=
"Distributor/StockDistributor.idl">this</a>. This file defines
the StockDistributor component interfaces.</span></p>
<p class='c26'><span class='c15'>·<span class=
"c5"> </span></span>
<span class='c1'>Next, we need to create a Make Project Creator
(MPC) file to generate the make files for us. From the
<i>Quoter/Distributor</i> <span> </span>sub-directory, type
the following command</span></p>
<p class="c28"><span class="c27">generate_component_mpc.pl -p
Stock_Base -c StockDistributorDriver StockDistributor</span></p>
<p class='c31'><span class='c20'>The command above takes a few
optional parameters. The -p option indicates that the <span class=
"c29">StockDistributor</span> component has a dependency on
<span class="c29">Stock_Base</span>, the -c option
causes the script to generate MPC files for a simple driver
program. In this tutorial, we use a simple driver program to
demonstrate how a non-CCM applications can interact with
component applications.</span></span></p>
<p class="c33"><span class="c32">The command above will generate
a <i>StockDistributor.mpc</i> file that contains several
projects that will build the Stub, Servant, and Executor code
respectively.
<p class="c39">·
<span class="c32">Next we write a simple driver program
(<code><i><span class=
"c37">StockDistributorDriver.cpp)</span></i></code> that will
control the <span class="c29">StockDistributor</span> component.
The simple driver program controls when the <span class=
"c29">StockDistributor</span> component publishes stock quotes,
the rates of publication, and when publication of stock quotes
stops. The simple driver program should look
like </span><span class="c32"><a href=
"Distributor/StockDistributorDriver.cpp">this</a>.</span></span></p>
<p class='c26'><span class='c15'>·<span class=
"c5"> </span></span>
<span class='c20'>The generated</span> <span class='c20'>MPC file
should look like <a href=
"Distributor/StockDistributor.mpc">this</a>. Both "libout" and "libpaths"
are added again.
</span></p>
<p class='c40'><span class='c1'>Broker:</span></p>
<p class='c26'><span class='c15'>·<span class=
"c5"> </span></span>
<span class='c1'>In the</span> <code><i><span class=
'c23'>Quoter/Broker</span></i></code> <span class=
'c1'><code><span class="c41">sub-directory,</span></code> place
an idl file</span> <code><i><span class=
'c16'>StockBroker.id</span></i></code><code><span class=
'c23'>l</span></code> <span class='c1'>that looks like <a href=
"Broker/StockBroker.idl">this</a>. This file defines the
StockBroker component interface.</span></p>
<p class='c26'><span class='c15'>·<span class=
"c5"> </span></span>
<span class='c1'>Next, we need to create a Make Project Creator
(MPC) file to generate the make files for us. From the
<i>Quoter/Broker</i> sub-directory, type the following
command:</span></p>
<p class='c43'><span class="c42"><span class=
"c27">generate_component_mpc.pl -p Stock_Base -c
StockBrokerDriver StockBroker</span></span></p>
<p class='c31'><span class='c20'><span class="c32">The command
above takes a few optional parameter. The -p option states that
the <span class="c29">StockBroker</span> component has a
dependency on <span class="c29">Stock_Base</span><span class="c32">, the
-c option causes the script to generates make files for a simple
driver program. In this tutorial, we use a simple driver program
to demonstrate how a non-CCM applications can interact with
Components.</span></span></span></span></p>
<p class="c33"><span class="c32"><span class="c32">The command
above will generate a <i>StockBroker.mpc</i> file that
contains several projects that will build the Stub, Servant,
and Executor code respectively.
<p class="c39"><span class="c36">·<span class=
"c35"> </span></span>
<span class="c32">Next we write a simple driver program
(<code><i><span class=
"c37">StockBrokerDriver.cpp)</span></i></code> that would control
the <span class="c29">StockBroker</span> component. The simple
driver program controls what stocks the <span class=
"c29">StockBroker</span> component subscribes to. The simple
driver program should look like </span><span class=
"c32"><a href="Broker/StockBrokerDriver.cpp">this</a>.</span></p>
<p class='c44'><span class='c15'>·<span class=
"c5"> </span></span>
<span class='c20'><span class="c32">The generated</span>
<span class="c32">MPC file should look like</span> <a href=
"Broker/StockBroker.mpc">this</a>. Both "libout" and "libpaths"
are added again.</span></p>
<p class='c45'><span class='c1'><br />
<b>Note:</b></span></p>
<p class='c45'><span class='c1'>To understand the meaning of
different parameters passed to</span> <span class=
"c42">generate_component_mpc.pl</span><span class='c20'>click
<a href="../../../generate_component_mpc.html">here</a> or type
the</span> <span class='c1'>following command:</span></p>
<p class='c45'><span class="c42">generate_component_mpc.pl
-h</span><span class='c1'><br />
<br /></span></p>
<p class='c46'><span class='c1'><a href=
"index.html">Previous</a>
<a href="02.html">Next</a></span></p>
<div class='c48'>
<hr class="c47" size="2" width="100%" />
</div>
<div class="Section1">
<address class='c49'>
<span class='c1'><a href=
"mailto:ming.xiong@vanderbilt.edu">Ming
Xiong<br /></a></span> <a href=
"mailto:abdullah.sowayan@lmco.com">Abdullah Sowayan</a>
</address>
<address class="c50">
</address>
<address class="c50">
$Id$
</address>
</div>
</body>
</html>
|