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
|
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE- 2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<!-- generateKeywords macro -->
<META name="description" content="Apache Tuscany">
<META name="keywords" content="apache, apache tuscany, tuscany, service, services, fabric, soa, service oriented architecture, sca, service component architecture, das, sdo, csa, ruby, opensource">
<!-- generateKeywords macro end -->
<LINK type="text/css" rel="stylesheet" href="http://tuscany.apache.org/stylesheets/default.css">
<LINK rel="SHORTCUT ICON" href="https://cwiki.apache.org/confluence/display/TUSCANY/$images/favicon.ico">
<TITLE>Apache Tuscany : Java SCA Runtime Component Hierarchy</TITLE>
<META http-equiv="Content-Type" content="text/html;charset=UTF-8"></HEAD>
<BODY onload="init()">
<!-- topNav macro -->
<TABLE valign="top" border="0" cellspacing="0" cellpadding="0" width="100%" background="http://tuscany.apache.org/images/TuscanyLogoNEW_Text_120px_bg.jpg">
<TR>
<TD valing="top" align="left">
<A href="https://cwiki.apache.org/confluence/pages/viewpage.action?spaceKey=TUSCANY&title=$siteroot"><IMG src="http://tuscany.apache.org/images/TuscanyLogoNEW_Text_120px_bg.jpg" height="91" width="25" border="0"></A>
</TD>
<TD>
<A href="http://tuscany.apache.org/"><IMG src="http://tuscany.apache.org/images/TuscanyLogo.jpg" border="0"></A>
</TD>
<TD width="100%">
</TD>
<!-- Adds the edit page link to the top banner-->
<TD valign="bottom">
<DIV style="padding: 2px 10px; margin: 0px;">
<A href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=52196">
<IMG src="http://tuscany.apache.org/images/notep_16.gif" height="16" width="16" border="0" align="absmiddle" title="Edit Page"></A>
</DIV>
</TD>
</TR>
</TABLE>
<!-- topNav macro end -->
<!-- breadCrumbs macro -->
<TABLE border="0" cellpadding="2" cellspacing="0" width="100%">
<TR class="topBar">
<TD align="left" valign="middle" class="topBarDiv" nowrap="true" width="100%">
<A href="home.html" title="Apache Tuscany">Apache Tuscany</A> > <A href="home.html" title="Home">Home</A> > <A href="menus.html" title="Menus">Menus</A> > <A href="general.html" title="General">General</A> > <A href="sca-general-menu.html" title="SCA General Menu">SCA General Menu</A> > <A href="java-sca-menu.html" title="Java SCA Menu">Java SCA Menu</A> > <A href="delete-java-sca-architecture-overview.html" title="DELETE- Java SCA Architecture Overview">DELETE- Java SCA Architecture Overview</A> > <A href="" title="Java SCA Runtime Component Hierarchy">Java SCA Runtime Component Hierarchy</A>
</TD>
<TD align="right" valign="middle" class="topBarDiv" align="left" nowrap="true">
<A href="http://mail-archives.apache.org/mod_mbox/tuscany-user">User List</A> | <A href="http://mail-archives.apache.org/mod_mbox/tuscany-dev">Dev List</A> | <A href="http://issues.apache.org/jira/browse/Tuscany">Issue Tracker</A>
</TD>
</TR>
</TABLE>
<!-- breadCrumbs macro end -->
<TABLE border="0" cellpadding="0" width="100%" bgcolor="#FFFFFF">
<TR>
<TD align="left" valign="top">
<!-- pageContent macro -->
<DIV id="PageContent">
<DIV class="pagecontent">
<DIV class="wiki-content">
<H2><A name="JavaSCARuntimeComponentHierarchy-Theassmeblydiagram"></A>The assmebly diagram</H2>
<P><SPAN class="image-wrap" style=""><IMG src="java-sca-runtime-component-hierarchy.data/recursive_composite.jpg" style="border: 0px solid black"></SPAN></P>
<DIV class="code panel" style="background-color: #ffffff;border-color: #6699ff;border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #6699ff;background-color: #D5EFFF;"><B>Composite1</B></DIV><DIV class="codeContent panelContent" style="background-color: #ffffff;">
<PRE class="code-java">
<composite xmlns=<SPAN class="code-quote">"http:<SPAN class="code-comment">//www.osoa.org/xmlns/sca/1.0"</SPAN>
</SPAN> targetNamespace=<SPAN class="code-quote">"http:<SPAN class="code-comment">//sample"</SPAN>
</SPAN> xmlns:sample=<SPAN class="code-quote">"http:<SPAN class="code-comment">//sample"</SPAN>
</SPAN> name=<SPAN class="code-quote">"Composite1"</SPAN>>
<component name=<SPAN class="code-quote">"ComponentA"</SPAN>>
<implementation.java class=<SPAN class="code-quote">"sample.ComponentAImpl"</SPAN>/>
</component>
<component name=<SPAN class="code-quote">"ComponentB"</SPAN>>
<!-- Implemented by Composite3 -->
<implementation.composite name=<SPAN class="code-quote">"sample:Composite3"</SPAN>/>
<!-- Wired to ComponentA -->
<reference name=<SPAN class="code-quote">"Reference1"</SPAN> target=<SPAN class="code-quote">"ComponentA"</SPAN>/>
<property name=<SPAN class="code-quote">"Property1"</SPAN>>ABC</property>
</component>
<!-- ComponentB.Service1 is promoted -->
<service name=<SPAN class="code-quote">"Service1"</SPAN> promote=<SPAN class="code-quote">"ComponentB/Service1"</SPAN> />
</composite>
</PRE>
</DIV></DIV>
<DIV class="code panel" style="background-color: #ffffff;border-color: #6699ff;border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #6699ff;background-color: #D5EFFF;"><B>Composite2</B></DIV><DIV class="codeContent panelContent" style="background-color: #ffffff;">
<PRE class="code-java">
<composite xmlns=<SPAN class="code-quote">"http:<SPAN class="code-comment">//www.osoa.org/xmlns/sca/1.0"</SPAN> targetNamespace=<SPAN class="code-quote">"http://sample"</SPAN> xmlns:sample=<SPAN class="code-quote">"http://sample"</SPAN>
</SPAN> name=<SPAN class="code-quote">"Composite2"</SPAN>>
<component name=<SPAN class="code-quote">"ComponentC"</SPAN>>
<implementation.java class=<SPAN class="code-quote">"sample.ComponentAImpl"</SPAN> />
<!-- Wired to ComponentD.Service1 -->
<reference name=<SPAN class="code-quote">"Reference1"</SPAN> target=<SPAN class="code-quote">"ComponentD/Service1"</SPAN> />
</component>
<component name=<SPAN class="code-quote">"ComponentD"</SPAN>>
<!-- Implemented by Composite3 -->
<implementation.composite name=<SPAN class="code-quote">"sample:Composite3"</SPAN> />
<!-- The property value is <SPAN class="code-quote">"XYZ"</SPAN> -->
<property name=<SPAN class="code-quote">"Property1"</SPAN>>XYZ</property>
</component>
<!-- ComponentD.Reference1 is promoted -->
<reference name=<SPAN class="code-quote">"Reference1"</SPAN> promote=<SPAN class="code-quote">"ComponentD/Reference1"</SPAN> />
</composite>
</PRE>
</DIV></DIV>
<DIV class="code panel" style="background-color: #ffffff;border-color: #6699ff;border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #6699ff;background-color: #D5EFFF;"><B>Composite3</B></DIV><DIV class="codeContent panelContent" style="background-color: #ffffff;">
<PRE class="code-java">
<composite xmlns=<SPAN class="code-quote">"http:<SPAN class="code-comment">//www.osoa.org/xmlns/sca/1.0"</SPAN> targetNamespace=<SPAN class="code-quote">"http://sample"</SPAN> xmlns:sample=<SPAN class="code-quote">"http://sample"</SPAN>
</SPAN> xmlns:xsd=<SPAN class="code-quote">"http:<SPAN class="code-comment">//www.w3.org/2001/XMLSchema"</SPAN> name=<SPAN class="code-quote">"Composite3"</SPAN>>
</SPAN>
<component name=<SPAN class="code-quote">"ComponentE"</SPAN>>
<implementation.java class=<SPAN class="code-quote">"sample.ComponentEImpl"</SPAN> />
<reference name=<SPAN class="code-quote">"Reference1"</SPAN> target=<SPAN class="code-quote">"ComponentF/Service1"</SPAN> />
<!-- The property is from the composite Property1 -->
<property name=<SPAN class="code-quote">"Property1"</SPAN> source=<SPAN class="code-quote">"$Property1"</SPAN> />
</component>
<component name=<SPAN class="code-quote">"ComponentF"</SPAN>>
<implementation.java class=<SPAN class="code-quote">"sample.ComponentFImpl"</SPAN> />
</component>
<service name=<SPAN class="code-quote">"Service1"</SPAN> promote=<SPAN class="code-quote">"ComponentE/Service1"</SPAN> />
<reference name=<SPAN class="code-quote">"Reference1"</SPAN> promote=<SPAN class="code-quote">"ComponentF/Reference1"</SPAN>>
<binding.sca />
</reference>
<property name=<SPAN class="code-quote">"Property1"</SPAN> type=<SPAN class="code-quote">"xsd:string"</SPAN>>123</property>
</composite>
</PRE>
</DIV></DIV>
<P>1) Two components are implemented by the same composite<BR>
<BR>
Path a: Composite1.ComponentB is implemented by Composite3<BR>
Path b: Composite2.ComponentD is implemented by Composite3<BR>
<BR>
The service/reference can be promoted to different things:<BR>
<BR>
a: the final target for the ComponentF.Reference1 is Composite1.ComponentA<BR>
b: the final target for the ComponentF.Reference1 is Composite1.Reference1 (pointing to an external service)<BR>
<BR>
The property can be set to different value following different composition path:<BR>
<BR>
a: Composite3.ComponentE.Property1 is overrided by Composite1.ComponentB.Property1 (say value="ABC")<BR>
b: Composite3.ComponentE.Property1 is overrided by Composite2.ComponentD.Property1 (say value="XYZ")<BR>
<BR>
To represent the fully-configured components, we need to clone the model for Composite3 for Path a and b so that it can be used to hold different resolved values.</P>
<DIV class="panel" style="background-color: #ffffff;border-color: #6699ff;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #6699ff;background-color: #D5EFFF;"><B>Runtime Wires</B></DIV><DIV class="panelContent" style="background-color: #ffffff;">
<P>Hi,</P>
<P>I'm trying to indentify all the paths of SCA component interactions which <BR>
require to have runtime wires/invocation chains.</P>
<P>By the SCA spec, there are three cases for the wiring:</P>
<P>1) Component.Reference (A.ref1) -<DEL>is wired to</DEL>-> Component.Service (B.svc1)<BR>
--------------------------------------------------------------------------------------------------<BR>
1.1) If both the service and reference are defined by non-composite <BR>
components, then the runtime wire is as simple as A.ref1-->B.svc1.</P>
<P>1.2) If the service is defined on a composite component, then it can be <BR>
further resolved to the orginal atomic component service following the <BR>
service promotion chain.</P>
<P>For example, A.ref1 --> B.svc1 (B is implemented by another composite and <BR>
B.svc1 promotes C.svc1), then the runtime wire will be: A.ref1 --> C.svc1</P>
<P>1.3) If the reference is defined on a composite component, then it can be <BR>
further resolved to the orginal atomic component reference following the <BR>
reference promotion chain.</P>
<P>For example, A.ref1 --> B.svc1 (A is implemented by another composite and <BR>
A.ref1 promotes C.ref1), then the runtime wire will be: C.ref1 --> B.svc1</P>
<P>2) Composite.Reference (Composite1.ref1) -<DEL>promotes</DEL>-> Component.Reference <BR>
(B.ref1)<BR>
-----------------------------------------------------------------------------------------------------------------<BR>
If Composite1 is the top-level composite, and the B is a non-composite <BR>
component, then the runtime wire will be: B.ref1 --> Composite1.ref1</P>
<P>If Composite1 is used to implement a component A in Composite2, then we need <BR>
to futher check if A.ref1 is promoted or wired until we hit the end of the <BR>
promotion chain. The final target will be either a composite reference or a <BR>
component service that the out-most reference is wired to. For example, if <BR>
A.ref1 is wired to D.svc1 in Composite2, then the runtime wire is B.ref1 --> <BR>
D.svc1. If A.ref1 is promoted by Composite2.ref1, then the runtime wire is <BR>
B.ref1 --> Composite2.ref1.</P>
<P>If B is a composite component, then we need to find out the final component <BR>
reference that B.ref1 promotes. For example, it promotes D.ref1, then the <BR>
runtime wire is D.ref1 --> C.ref1</P>
<P>3) Composite.Service (Composite1.svc1) -<DEL>promotes</DEL>-> Component.Service <BR>
(A.svc1)<BR>
-----------------------------------------------------------------------------------------------------------<BR>
The source will be the outmost service on the promotion chain. For example, <BR>
if Composite2.svc1 promotes B.svc1 and B is implemented by Composite1, then <BR>
it is Composite2.svc1.</P>
<P>The target will be the innermost service on the promotion chain. For <BR>
example, if A is implemented by Composite3 and Composite3.svc1 promotes <BR>
C.svc1, then it is C.svc1.</P>
<UL>
<LI>Please note, due to the spec limitation, the composite service cannot<BR>
promote a composite reference directly.</LI>
</UL>
<P>Based on the above scenarios, it seems that we can create runtime wires <BR>
using the following algorithm (assuming multiplicity = 1..1). The key is to <BR>
get a final list of targets and selected bindings.</P>
<P>1) Runtime wire for references: For each of the references (r1) on <BR>
non-composite components, find the outmost reference (r0) on the reference <BR>
promotion chain. Then get the targets and selected bindings from r0. If SCA <BR>
binding is used for a target, it can be further optimized to use the <BR>
orginally promoted component service. The runtime wire should be created <BR>
between the r1 and a target (either a component service with SCA binding or <BR>
a reference binding) from r0.</P>
<P>2) Runtime wire for service promotions: For each of the service1 (s1) on <BR>
non-composite components, find the outmost service (s0, can be the same as <BR>
s1) on the service promotion chain. Create a runtime wire between the <BR>
selected binding of s0 and the component that defines s1. (Can we assume <BR>
that s1 is always local to s0?)</P>
<P>The service/reference promotions make the picture complicated. I hope my <BR>
thought makes sense.</P>
<P>Thanks,<BR>
Raymond</P>
</DIV></DIV>
<DIV class="code panel" style="background-color: #ffffff;border-color: #6699ff;border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #6699ff;background-color: #D5EFFF;"><B>Runtime Context Interfaces</B></DIV><DIV class="codeContent panelContent" style="background-color: #ffffff;">
<PRE class="code-java">
<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> RuntimeContext<M> <SPAN class="code-keyword">extends</SPAN> Lifecycle {
/**
* Create an intercetor <SPAN class="code-keyword">for</SPAN> the model in the invocation chain. For a reference binding,
* the interceptor is responsible to make the outbound invocation over the binding protocol.
* For a service binding, the interceptor is responsible to dispatch the incoming call to
* the target component service that the service promotes. For a component implementation,
* the interceptor will be responsible <SPAN class="code-keyword">for</SPAN> calling the implementation logic <SPAN class="code-keyword">for</SPAN> the given
* component.
*
* @param model The service that defines the binding
* @param operation The operation that the interceptor will handle
* @param isCallback A flag to tell <SPAN class="code-keyword">if</SPAN> the operation is <SPAN class="code-keyword">for</SPAN> the callback
* @<SPAN class="code-keyword">return</SPAN> An interceptor that handles the invocation logic, <SPAN class="code-keyword">null</SPAN> should be returned <SPAN class="code-keyword">if</SPAN> no
* interceptor is required
*/
Interceptor createInterceptor(M model, Operation operation, <SPAN class="code-object">boolean</SPAN> isCallback);
/**
* Get the effective <SPAN class="code-keyword">interface</SPAN> contract imposed by the binding or implementation. For
* example, it will be <SPAN class="code-keyword">interface</SPAN> contract introspected from the WSDL portType used by the
* endpoint <SPAN class="code-keyword">for</SPAN> a WebService binding.
* @param model The model object
*
* @<SPAN class="code-keyword">return</SPAN> The effective <SPAN class="code-keyword">interface</SPAN> contract
*/
InterfaceContract getEffectiveInterfaceContract(M model);
}
<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> ReferenceBindingContext <SPAN class="code-keyword">extends</SPAN> RuntimeContext<Reference> {
/**
* @param wire
*/
void setRuntimeWire(RuntimeWire wire);
/**
* @<SPAN class="code-keyword">return</SPAN>
*/
RuntimeWire getWire();
}
<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> ServiceBindingContext <SPAN class="code-keyword">extends</SPAN> RuntimeContext<Service> {
/**
* @param wire
*/
void setRuntimeWire(RuntimeWire wire);
/**
* @<SPAN class="code-keyword">return</SPAN>
*/
RuntimeWire getWire();
}
<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> ImplementationContext <SPAN class="code-keyword">extends</SPAN> RuntimeContext<Component> {
}
</PRE>
</DIV></DIV>
</DIV>
</DIV>
</DIV>
<!-- pageContent macro end -->
</TD>
</TR>
</TABLE>
<!-- footer macro -->
<SCRIPT src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</SCRIPT>
<SCRIPT type="text/javascript">
_uacct = "UA-1174707-5";
urchinTracker();
</SCRIPT>
<A href="http://www.statcounter.com/" target="_blank"><IMG src="http://c26.statcounter.com/counter.php?sc_project=2619156&java=0&security=94bd7e7d&invisible=0" alt="website stats" border="0"></A>
<DIV class="footer">
Copyright � 2003-2012, The Apache Software Foundation </BR>
Apache Tuscany and the Apache Tuscany project logo are trademarks of The Apache Software Foundation.
</DIV>
<!-- footer macro end -->
</BODY>
</HTML>
|