summaryrefslogtreecommitdiff
path: root/TAO/CIAO/examples/Hello/step-by-step.html
blob: 24560995648472953e2b215d85cea5483a2acbf6 (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
<!--//$Id$  -->

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>Step-By-Step of How to build a CIAO application</title>
</head>

<body
 text = "#000000"
 link = "#000fff"
 vLink= "#ff0f0f"
 aLink = "#0000ff"
 bgColor = "#ffffff">

<hr>
<h2>Simple <a href="http://www.dre.vanderbilt.edu/CIAO">CIAO</a> tutorial</h2>
<hr>
<b>Note:</b>
<li><a href="http://www.dre.vanderbilt.edu/cosmic">CoSMIC</a> tools are not used in this tutorial.</li>
<li>This is only a <em>GENERAL</em> way of building up a CIAO application. The user could always change the process in his own way. For example: the IDL file content, the project structure etc.</li>
<li>To download the code please refer to the CVS repository at <code>$CIAO_ROOT/examples/Hello</code>.</li>
<li>If you just want to try the example you could jump to the <em>Make</em> then the <em>Run</em> section.</li>
<hr>

<h2>Example Description</h2>
This Hello example is contructed in the following ways:
<li>1. There are 2 components in the system: Sender and Receiver</li>
<li>2. The Sender will send out the timeout event to the Receiver.</li>
<li>3. Upon receiving the timeout event, the Receiver will go and fetch data from the Sender. </li>
<li>4. The user could deploy multiple instances of the Receiver without changing any C++/idl source code.</li>
<hr>

<h2>Step-By-Step</h2>
<hr>
<ul><h3>Hello_Base</h3>
<li>1. Write an IDL file (<code>Hello_Base.idl</code>) which contains all the interfaces and events common to all the components. The reason we do this is becuse the generated lib of this idl file will be linked in by all the components in the system. To reduce the size of the component lib we have to include only the necesary part. In this example, we have an eventtype <code>timeout</code> and an interface <code>ReadMessage</code>, which are used by both the Sender and the Receiver, so we put both of them in Hello.idl.</li>

<li>2. Look at the <code>Hello_Base.mpc</code> file to get an idea how the Hello_Base_stub and Hello_Base_svnt projects are organized. <a href="http://downloads.ociweb.com/MPC/MakeProjectCreator.pdf">MPC</a> is a utility we used to generate makefiles or VC project/solution files for all <a href="http://www.cs.wustl.edu/~schmidt/ACE.html">ACE</a>, <a href="http://www.cs.wustl.edu/~schmidt/TAO.html">TAO</a> and <a href="http://www.cs.wustl.edu/~schmidt/CIAO.html">CIAO</a> libraries.</li>
</ul>

<hr>

<ul><h3>For Every Components</h3>

<li>1. Use: <br>
<ul>
<code>$CIAO_ROOT/bin/generate_component_mpc.pl -p Hello_Base Sender <br>
      $$CIAO_ROOT/bin/generate_component_mpc.pl -p Hello_Base Receiver
</code><br></ul>
Note:
<ul>
<li>I have different directories for <code>"Hello_Base", "Sender", "Receiver"</code> respectively.</li>

<li>For every <code>_stub</code> project, add:<br>
  <code>"libs  += Hello_Base_stub"</code><br>

</ul>

<li>2. Use the export script to generate the export files. (3 files per component).</li>

<li>3. Write an idl file for every compoent. Here you can put the component specific IDL definitions in this file. In this example we have a interface <code>trigger</code> specific to the Sender. Please note that the Sender component <code>"supports"</code> (IDL keyword) this interface. </li>

<li>4. Write the CIDL file for every component.</li>

<li>5. Write <code>_exec.h</code> and <code>_exec.cpp</code> files which actually implement the component.</li>
<br>
<br>
Writing all those files could be troublesome to a new CCM user. The best way of learning this is to read the example source code. If you are familliar with CORBA programming, it should not take too much time before you can declare yourself as a CCM programmer.

<hr>

<h3>The Entry Point</h3>
After both components are implemented we still need a small program to initialize the process. In Sender.idl there is a Sender specific interface with a single method in it created for this purpose. Hence there is a CORBA client application called <code>starter</code>. The <code>starter</code> will make a invocation on a supported interface called <code>trigger</code> on the Sender component to get the whole distributed application started. The <code>starter</code> will first the Sender component object reference through the ior string. Please see the the last part of <code>Hello/Sender/Sender.mpc</code> file for details.

<hr>

<h3>Make</h3>
<li>Go to the directory <code>$CIAO_ROOT/examples/Hello</code> and do:<br>
    <code>$ACE_ROOT/bin/mwc.pl</code> (use -type option if you are using a compiler/IDE other than gnuace -which by default generates GNU makefiles)</li>
    <br>For example, using <code>$ACE_ROOT/bin/mwc.pl -type vc71</code> if you are using Visual C++ 7.1 IDE.</li>
<li>Look at the generated Makefile(*unx) , Solution/workspace files(Windows) and you got it.</li>

<hr>

<h3>Assemble</h3>
Now we can step forward to build the assembly. Here we are going to build the simplest case only, which is 1 Receiver and 1 Sender. If you are interested in CIAO you could try 1 Sender with multiple Receiver. However, you need to change the Sender.idl to make it <em>publishes</em> timeout event instead of <em>emits</em> event. 

<br>
<br>

<li>1. Make a new directory with name <em>descriptors</em> in your workspace</li>
<li>2. Construct the <em>CIAO_Installation_Data.ini</em> file. You can use <code>uuidgen</code> to generate the UUIDs</li>

<li>3. For every component generate the <em>.csd</em> and <em>.ssd</em> files. Follow the example carefully and make sure that you use the right UUIDs</li>

<li>4. Write the <em>.cad</em> file which describes the assembly. You can choose to use <a href="http://www.dre.vanderbilt.edu/~lu/CADML">CADML</a> to generate the file.
<br>
Note: Please pay attention to the inter-relationship among different files, especially the relationship between the <em>.cad</em> file and <em>idl</em> file.
</li>

<hr>
<h3>Run</h3>
Finally you are ready to test the application you have made.
<br><br>
1. Run the example with a single CIAO_Daemon
<ul>
In <code>./descriptors</code> directory: <code>./run_test_default.pl</code> dose the following for you.
<li>1. <code>${CIAO_ROOT}/tools/Daemon/CIAO_Daemon  -ORBEndpoint iiop://localhost:20000 -n ${CIAO_ROOT}/tools/ComponentServer/ComponentServer </code></li>
<li>2. <code>${CIAO_ROOT}/tools/Assembly_Deployer/Assembly_Manager -o ior -c test.dat</code></li>
<li>3. <code>${CIAO_ROOT}/tools/Assembly_Deployer/Assembly_Deployer -k file://ior  -a default.cad</code></li>
<li>4. <code>../Sender/starter</code>  Note: you can repeat this step.</li>

If you want to get debug information from the component server, please see run_test_debug.pl which adds debug flag while running the component server.
</ul>
<br>

2. Run the example with 2 CIAO_Daemons but on the same machine.
<ul>
 In <code>./descriptors</code> directory: <code>./run_test_remote.pl</code> dose the following for you.
 <li>1. <code>${CIAO_ROOT}/tools/Daemon/CIAO_Daemon  -ORBEndpoint iiop://localhost:20000 -n ${CIAO_ROOT}/tools/ComponentServer/ComponentServer </code></li>
 <li>2. <code>${CIAO_ROOT}/tools/Daemon/CIAO_Daemon  -ORBEndpoint iiop://localhost:12000 -n ${CIAO_ROOT}/tools/ComponentServer/ComponentServer </code></li>
 <li>3. <code>${CIAO_ROOT}/tools/Assembly_Deployer/Assembly_Manager -o ior -c test.dat</code></li>
 <li>4. <code>${CIAO_ROOT}/tools/Assembly_Deployer/Assembly_Deployer -k file://ior  -a remote.cad</code></li>
 <li>5. <code>../Sender/starter</code>  Note: you can repeat this step.</li>
</ul>


<br>

3. Run the example with 2 CIAO_Daemons on two different hosts.
<ul>
 In <code>./descriptors</code> directory:<br>
 Here you have to open the <em>remote.dat</em> and fill in the right URL for your hosts. You can change the port number as well, of course you will have to use the corresponding right address in your -ORBEndpoint option in the following step1 and 2.

 <li>1. On host "Default" <code>${CIAO_ROOT}/tools/Daemon/CIAO_Daemon  -ORBEndpoint iiop://URL:20000 -n ${CIAO_ROOT}/tools/ComponentServer/ComponentServer </code></li>
 <li>2. On host "Remote" <code>${CIAO_ROOT}/tools/Daemon/CIAO_Daemon  -ORBEndpoint iiop://URL:12000 -n ${CIAO_ROOT}/tools/ComponentServer/ComponentServer </code></li>
 For step 3 and step4 it doesn't matter where they are executed.
 <li>3. <code>${CIAO_ROOT}/tools/Assembly_Deployer/Assembly_Manager -o ior -c test.dat</code></li>
 <li>4. <code>${CIAO_ROOT}/tools/Assembly_Deployer/Assembly_Deployer -k file://ior  -a remote.cad</code></li>
 Step5 must be executed on the same host where the Sender is deployed. If you are using my <em>remote.cad</em> file then the host is the <code>Default</code> one.
 <li>5. <code>../Sender/starter</code>  Note: you can repeat this step.</li>
</ul>

<br>

4. Run the example with 2 receivers deployed on the same ComponentServer.
<ul>
    In <code>./descriptors</code> directory: <code>./run_test_multirecv.pl</code>
</ul>

<hr>
<b>Email: </b><a href="mailto:"</a<ADDRESS>ciao-users@cse.wustl.edu</ADDRESS>
</body>
</html>