
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1640879 13f79535-47bb-0310-9956-ffa450edef68
356 lines
20 KiB
HTML
356 lines
20 KiB
HTML
|
||
<!--
|
||
|
||
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 <20> 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>
|