summaryrefslogtreecommitdiff
path: root/CIAO/connectors/ami4ccm/tutorials/Hello/Tutorial/05_compilation.html
blob: 9c444ec2da324854ec48dc560231135e646c7026 (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
<!--//$Id$  -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
	<TITLE>AMI4CCM Tutorial Hello - Compilation and deployment</TITLE>
</HEAD>
<BODY>
  <TABLE WIDTH="100%" BORDER=0 CELLPADDING=2 CELLSPACING=2 STYLE="PAGE-BREAK-BEFORE: always">
    <TR>
      <TD ALIGN=left><A href="04_ami4ccm.html">Previous</A></TD>
      <TD ALIGN=center><IMG border=0 align=bottom src="images/images.png" width="4%" height="5%" ></TD>
      <TD></TD>
    </TR>
  </TABLE>
  <HR>
  <H1>Compilation and deployment</H1>
  <H2 STYLE="PAGE-BREAK-AFTER: avoid">Compilation</H2>
  <P>Once all the code has been 
  written, compilation of the code would be the next step.<br>MPC is used in order to 
  create the Makefiles and projects files. All MPC files that are needed for this 
  tutorial are in the same directory as the accompanying IDL or executor files.<br>In 
  order to make the GNU make files or the Visual Studio project files, the 
  following steps should be performed :
  <UL>
    <LI>Start a command shell and navigate to :<br> <CODE>%CIAO_ROOT%/connectors/ami4ccm/tutorials/Hello/Hello_asm</CODE> 
    <LI>Run<br>
       <ul>
	 <LI><CODE>perl %ACE_ROOT%/bin/mwc.pl -type vc9</CODE> to create Visual Studio 2008 project files.</LI>
	<LI><CODE>perl  %ACE_ROOT%/bin/mwc.pl -type gnuace</CODE> to create the GNU make files.</LI> 
      </ul>
    <LI>Now compile the code like you're used to.</li>
  </UL>
  <P>If all went well, all libraries are in the Hello_asm/lib directory.</P>

  <H2>Deployment</H2>
  <P>Once all binaries are compiled, they're ready to be deployed.<br> In this tutorial we are using DAnCE to 
deploy our system. DAnCE starts a system in two phases : </P>
  <OL>
    <LI>configuration_complete</li>
    <LI>ccm_activate </LI>
  </OL>
  DAnCE shuts down a system again in two phases :
  <OL>
    <LI>passivate</LI>
    <LI>ccm_remove</LI>
  </OL>
  <P>Each component should have 
these four methods implemented. The business logic implemented in each step 
depends on you implementation. There're several processes taking care of the 
total deployment process. See the DAnCE documentation for more information about 
which processes there are and what their responsibilities are. DAnCE will start 
and shutdown a system with the aid of a deployment plan. A deployment plan 
describes which artifacts must run on which nodes and which components are 
connected to eachother via which interface (more on this later). All connections 
between components are made before 'configuration_complete' is called. </P>
<P>The deployment plan will be 
generated by the modelling tools but we take a brief look at the most important 
items of a deployment plan. A deployment plan is a XML based file which is 
devided into the following (main) sections: </P>
  <UL>
    <LI>Implementations</LI>
    <LI>Entry points </LI>
    <LI>Instances </LI>
    <LI>Connections </LI>
    <LI>Artifacts</LI>
  </UL>
<P ><I><B>All deployment code fragments mentioned in the rest of this 
tutorial are *NO* exports of any modelling tool.</B></I></P>

<H3 STYLE="PAGE-BREAK-AFTER: avoid">Implementations and Entry Points</H3>
<P>This defines which executor and servant
artifacts (binaries) should be used. Implementations also defines
which entry points in the binaries should be used. In this example
there are neeede 3 implementation sections, for the Sender Receiver
and AMI connector. <A href="Code/Deployment/descriptors/implementation.cdp">This</A> file 
shows the implementation section of the AMI connector. Beware that artifacts and 
entry points are exact otherwise deployment will fail.</P>

<H3STYLE="PAGE-BREAK-AFTER: avoid">Instances</H3>
<P>Instances define which artifacts run on
which node. Every fysical artifact in the system results in one
instance. The &lt;node&gt; section refers to the fysical node on
which this instance will be deployed. An instance always refers to an
implementation. It's possible that more than one instance refers to
the same implementation. The instance section also provide the
initial values of all attributes defined on the component. <A href="Code/Deployment/descriptors/instance.cdp">This</A>
file shows the instance section of the Sender, Receiver and AMI
connector.<U><B>The instance of the AMI connector 
uses the same node as the Sender! </B></U></P>

<H3 STYLE="PAGE-BREAK-AFTER: avoid">Connections</H3>
<P>A connection section defines 
which components are connected together. The connection is 'local' since a 
connector and a component are always running in the same process. Now that we 
have got all the data we need to know to make a connection for the asynchronous 
methods between the Sender and AMI connector (1) and between the AMI connector 
and the receiver (2). For the synchronous methods we need a connection between 
the Sender and the receiver. (3)</P>

<H4>(1) </H4>
<P>&lt;connection&gt;<br>
<font color="grey">//unique name of the connection</FONT><BR>
&nbsp;&nbsp;&lt;name&gt;run_asynch_foo_connection&lt;/name&gt;<BR>
&nbsp;&nbsp;&lt;deployRequirement&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;edu.dre.vanderbilt.DAnCE.ConnectionType&lt;/name&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;resourceType&gt;Local_Interface&lt;/resourceType&gt;<BR>
&nbsp;&nbsp;&lt;/deployRequirement&gt;<BR>
&nbsp;&nbsp;&lt;internalEndpoint&gt;<FONT COLOR="grey">//First endpoint (the Sender component)</FONT><br>
<FONT COLOR="grey">// PortName is defined as “sendc_” + name of port defined in Hello_Sender_comp.idl</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;portName&gt;sendc_run_my_foo&lt;/portName&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;provider&gt;false&lt;/provider&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;kind&gt;SimplexReceptacle&lt;/kind&gt;<BR>
&nbsp;&nbsp;&nbsp;&lt;instance xmi:idref="Hello.ComponentImplementations.HelloImplementation.Hello.Sender" 
/&gt;&nbsp;<FONT COLOR="grey">//The reference to the sender instance.</FONT><BR>
&nbsp;&nbsp;&lt;/internalEndpoint&gt;<BR>
&nbsp;&nbsp;&lt;internalEndpoint&gt;<FONT COLOR="grey">//Second endpoint (the AMI connector component);<BR></FONT>
&nbsp;&nbsp;&nbsp;&nbsp;</FONT>&lt;portName&gt;ami4ccm_port_ami4ccm_provides&lt;/portName&gt;
<FONT COLOR="grey">//PortName alsways the same&nbsp;<BR></FONT>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;provider&gt;true&lt;/provider&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;kind&gt;Facet&lt;/kind&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;instance xmi:idref="Hello.ComponentImplementations.HelloImplementation.Hello.AMI" 
/&gt;&nbsp;<FONT color="grey">//The reference to the connector instance<BR></FONT>
&nbsp;&nbsp;&lt;/internalEndpoint&gt;<BR>
&lt;/connection&gt;
</P>

<H4>(2) </H4>
<P>&lt;connection&gt;<BR>
&nbsp;&nbsp;&lt;name&gt;do_foo_connection&lt;/name&gt;<font color="grey">//unique name of the connection</FONT><BR>
&nbsp;&nbsp;&lt;internalEndpoint&gt;<FONT color="grey">//First endpoint (the Receiver component)</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;portName&gt;do_my_foo&lt;/portName&gt;<FONT color="grey>// PortName is defined as name of port 
defined in Hello_Receiver_comp.idl</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;provider&gt;true&lt;/provider&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;kind&gt;Facet&lt;/kind&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;instance xmi:idref="Hello.ComponentImplementations.HelloImplementation.Hello.Receiver" /&gt;<BR>
&nbsp;&nbsp;&lt;/internalEndpoint&gt;<BR>
&nbsp;&nbsp;&lt;internalEndpoint&gt;<FONT color="grey">//Second endpoint (the AMI component)</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;portName&gt;ami4ccm_port_ami4ccm_uses&lt;/portName&gt;<FONT color="grey">// PortName alsways the same&nbsp;</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;provider&gt;false&lt;/provider&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;kind&gt;SimplexReceptacle&lt;/kind&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;instance xmi:idref="Hello.ComponentImplementations.HelloImplementation.Hello.AMI" /&gt;<BR>
&nbsp;&nbsp;&lt;/internalEndpoint&gt;<BR>
&lt;/connection&gt;
</P>

<H4>(3)</H4>
<P>&lt;connection&gt;<BR>
&nbsp;&nbsp;&lt;name&gt;synch_foo_connection&lt;/name&gt;<BR>
&nbsp;&nbsp;&lt;internalEndpoint&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;portName&gt;do_my_foo&lt;/portName&gt;<FONT color="grey">// PortName is defined as name of port 
defined in Hello_Receiver_comp.idl</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;provider&gt;true&lt;/provider&gt;<FONT color=""grey">// The receiver provides this port</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;kind&gt;Facet&lt;/kind&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;instance xmi:idref="Hello.ComponentImplementations.HelloImplementation.Hello.Receiver" /&gt;<BR>
&nbsp;&nbsp;&lt;/internalEndpoint&gt;<BR>
&nbsp;&nbsp;&lt;internalEndpoint&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;portName&gt;run_my_foo&lt;/portName&gt;<FONT color="grey">// PortName is defined as name of port 
defined in Hello_Sender_comp.idl</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;provider&gt;false&lt;/provider&gt;<FONT color="grey">// The sender uses this port</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;kind&gt;SimplexReceptacle&lt;/kind&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;instance xmi:idref="Hello.ComponentImplementations.HelloImplementation.Hello.Sender" /&gt;<BR>
&nbsp;&nbsp;&lt;/internalEndpoint&gt;<BR>
&lt;/connection&gt;
</P>

<P>Take a look at <A href="Code/Deployment/descriptors/connections.cdp">this</A> file to 
see which connection should be made by DAnCE in order to run the Hello tutorial 
properly.</P>

<P>When the deployment tools (in this case DAnCE) deploys this 
system, it'll connect all defined connectors before the system is started (i.e. 
before configuration_complete is called on a component).</P>

<H3 >Coding connections</H3>
<P>Every component has got a context. The context is set by 
DAnCE and is the 'gateway' to all other component your component is connected 
to. The context caches all these connections so that the user doesn't need to 
cache those in his/her component.</P>
<P><B><U>Sender:</B></U><br>The following code retrieves the 
connection to the AMI connector interface from the context:<br>
<CODE>::Hello::AMI4CCM_MyFoo_obj_var asynch_foo = this-&gt;context_-&gt;get_connection_sendc_run_my_foo();</CODE>
<br><BR>
The following code retrieves the connection to the Receiver 
interface from the context:<br>
<CODE>::Hello::MyFoo_obj_var synch_foo = this-&gt;context_-&gt;get_connection_run_my_foo ();</CODE>
</p>
<P><B><U>Receiver: </B></U><br>
The Receiver provide one facet for the AMI connector and for the sender.<br>
<CODE>::Hello::CCM_MyFoo_obj_ptr<BR>
Receiver_exec_i::get_do_my_foo (void)<BR>
{<BR>&nbsp;&nbsp;return new MyFoo_exec_i ();<BR>
}</P>

<H3>Artifacts</H3>
<P>Artifacts sections contains the names of the binaries. See <A href="Code/Deployment/descriptors/artifacts.cdp">
this</A> files for an overview of all artifacts in the Hello tutorial.</P>

<H3>Complete plan</H3>
<P <A href="Code/Deployment/descriptors/Plan.cdp">This</A> file shows the complete deployment 
plan.</P>

<P STYLE="MARGIN-BOTTOM: 0cm"><BR></P>
<HR>
<P><BR><BR></P>
<TABLE WIDTH="100%" BORDER=0 CELLPADDING=2 CELLSPACING=2>
  <TR>
    <TD ALIGN=left>
      <A href="04_ami4ccm.html">Previous</A></TD>  
    <TD ALIGN=center>
      <IMG border=0 align=bottom src="images/images.png" width="4%" height="5%" ></TD>
    <TD></TD></TR></TABLE>
</BODY>
</HTML>