summaryrefslogtreecommitdiffstats
path: root/site/trunk/site-publish/deployment.html
blob: 418cd9d8c60009f0445da1e4d4b983288f926fb7 (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
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
<!--

    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 : Deployment</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%">
					&nbsp;
				</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=43501">
						<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%">
					&nbsp;<A href="home.html" title="Apache Tuscany">Apache Tuscany</A>&nbsp;&gt;&nbsp;<A href="home.html" title="Home">Home</A>&nbsp;&gt;&nbsp;<A href="sca-overview.html" title="SCA Overview">SCA Overview</A>&nbsp;&gt;&nbsp;<A href="sca-java.html" title="SCA Java">SCA Java</A>&nbsp;&gt;&nbsp;<A href="sca-java-work-in-progress.html" title="SCA Java Work-In-Progress">SCA Java Work-In-Progress</A>&nbsp;&gt;&nbsp;<A href="" title="Deployment">Deployment</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>&nbsp;&nbsp;
				</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="Deployment-1%29Addacontribution%26nbsp%3BtotheSCAdomain"></A>1) Add a contribution&nbsp;to the SCA domain</H2>

<P><B>The contribution&nbsp;process is about adding Types to the domain (composites, classes, XSD&nbsp; complexTypes, etc).</B></P>

<P>1. An SCA application is developed and packaged as a jar or another archive format</P>

<P>2. The <B>ContributionService</B> is requested to add this jar as a contribution to the SCA domain. In effect, the SCA domain has a store to keep all the contributions.&nbsp; The ContributionService is an API that allows users to put contributions in the store. The contributions are identified by the URI. 3. Registered <B>ContributionProcessor</B>'s will be&nbsp;selected based on the contentType of the contribution. The ContributionProcessor is responsible to introspect the contribution which is a collection of artifacts. It may enlist other services to help, e.g the annotation processors for Java classes.We'd support a few well-known types in the core, primarily the ones used by the runtime like &quot;jar&quot; and &quot;java class&quot;.&nbsp;Others could be contributed as extensions,&nbsp;e.g &quot;rpm&quot; </P>
<DIV class="panelMacro"><TABLE class="infoMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD><B>Introspection of a contribution</B><BR>In general the result of that introspection would be invariant so it can be cached&nbsp;and replicated in many places.&nbsp;Introspection will be intensive and so we should do it as little as possible and&nbsp;caching the results is good.&nbsp;Of course, we'd need invalidation too.

<P>The caching is about storing the introspection results for&nbsp;&quot;production&quot; artifacts that are basically versioned and immutable.&nbsp;This is similar in concept to the way Maven caches artifacts locally&nbsp;and never needs to go back to an online repo once they have been&nbsp;downloaded. Given some introspections are likely to be expensive&nbsp;(e.g. scanning an EAR to look for EJBs and then processsing the class&nbsp;files for annotations) it would be good to avoid redoing that when&nbsp;its not necessary.</P></TD></TR></TABLE></DIV>

<P>3. The <B>ContributionProcessor</B> introspects the contribution to create a list of artifacts of interest for SCA. Each artifact is classified&nbsp;by ContentTypes.</P>

<P>4. The artifacts are parsed by the content type.&nbsp;&nbsp;we&nbsp;provide parsers for SCDL (StAXElementLoader)&nbsp;and we&nbsp;can reuse existing parsers for XSD and WSDL (XmlSchema, wsdl4j, woden). So the WSDL introspector would parse the document using, say, wsdl4j and then store the interesting things that it finds.</P>

<P>5.&nbsp;The interesting definitions are added to the contribution store&nbsp;and that is the end of the contribution operation.&nbsp;We keep the contribution and cache the introspection results. </P>

<P>The following diagram is created to illustrate the key players that interacts with the ContributionService.</P>

<P><SPAN class="image-wrap" style=""><IMG src="deployment.data/tuscany_contribution_service.jpg" style="border: 0px solid black"></SPAN></P>

<DIV class="panelMacro"><TABLE class="noteMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>We could merge the ContributionProcessor and ArtifactProcessor concepts into one. If so, the processor for the jar will be called first, it scans the files in the jar and delegate the processors which can handle the content types, for example, WSDLProcessor to load WSDLs, XSDProcessor to load XSDs, JavaAnnotationProcessor to introspect java classes and SCDL loaders to load SCDL files.</TD></TR></TABLE></DIV>


<H1><A name="Deployment-ContributionServicesImplementation"></A>Contribution Services Implementation</H1>

<P>The contribution services is available in multiple modules at java/sca/runtime/services</P>

<H4><A name="Deployment-ContributionModules"></A>Contribution Modules</H4>

<P><SPAN class="image-wrap" style=""><IMG src="deployment.data/Contribution%20Diagram.GIF" style="border: 0px solid black"></SPAN></P>
<DIV class="panelMacro"><TABLE class="noteMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>Note that the Contribution Services Implementation have dependencies on the Kernel SPI <BR>
   -&gt; LooaderRegistry<BR>
   -&gt; SCA Model objects

<P>The Kernel will have dependency on Contribution-Framework once things get integrated</P></TD></TR></TABLE></DIV>

<H4><A name="Deployment-TheContributionServiceinterface"></A>The ContributionService interface</H4>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">

/**
 * Service <SPAN class="code-keyword">interface</SPAN> that manages artifacts contributed to a Tuscany runtime.
 *
 * @version $Rev: 523009 $ $Date: 2007-03-27 10:38:24 -0700 (Tue, 27 Mar 2007) $
 */
<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> ContributionService {
    /**
     * Contribute an artifact to the SCA Domain. The type of the contribution is
     * determined by the Content-Type of the resource or, <SPAN class="code-keyword">if</SPAN> that is undefined,
     * by some implementation-specific means (such as mapping an extension in
     * the URL's path).
     * 
     * @param contributionURI The URI that is used as the contribution unique ID. 
     * @param sourceURL the location of the resource containing the artifact
     * @param storeInRepository flag that identifies <SPAN class="code-keyword">if</SPAN> you want to copy the
     *            contribution to the repository
     * @<SPAN class="code-keyword">throws</SPAN> DeploymentException <SPAN class="code-keyword">if</SPAN> there was a problem with the contribution
     * @<SPAN class="code-keyword">throws</SPAN> IOException <SPAN class="code-keyword">if</SPAN> there was a problem reading the resource
     */
    void contribute(URI contributionURI, URL sourceURL, <SPAN class="code-object">boolean</SPAN> storeInRepository) <SPAN class="code-keyword">throws</SPAN> ContributionException,
        IOException;

    /**
     * Contribute an artifact to the SCA Domain.
     * 
     * @param contributionURI The URI that is used as the contribution unique ID.
     * @param contributionContent a stream containing the resource being
     *            contributed; the stream will not be closed but the read
     *            position after the call is undefined
     * @<SPAN class="code-keyword">throws</SPAN> DeploymentException <SPAN class="code-keyword">if</SPAN> there was a problem with the contribution
     * @<SPAN class="code-keyword">throws</SPAN> IOException <SPAN class="code-keyword">if</SPAN> there was a problem reading the stream
     */
    void contribute(URI contributionURI, InputStream contributionContent)
        <SPAN class="code-keyword">throws</SPAN> ContributionException, IOException;

    /**
     * Get the model <SPAN class="code-keyword">for</SPAN> an installed contribution
     * 
     * @param contribution The URI of an installed contribution
     * @<SPAN class="code-keyword">return</SPAN> The model <SPAN class="code-keyword">for</SPAN> the contribution or <SPAN class="code-keyword">null</SPAN> <SPAN class="code-keyword">if</SPAN> there is no such
     *         contribution
     */
    Contribution getContribution(URI contribution);

    /**
     * Adds or updates a deployment composite using a supplied composite
     * (<SPAN class="code-quote">&quot;composite by value&quot;</SPAN> - a data structure, not an existing resource in the
     * domain) to the contribution identified by a supplied contribution URI.
     * The added or updated deployment composite is given a relative URI that
     * matches the <SPAN class="code-quote">&quot;name&quot;</SPAN> attribute of the composite, with a <SPAN class="code-quote">&quot;.composite&quot;</SPAN>
     * suffix.
     */
    void addDeploymentComposite(URI contribution, <SPAN class="code-object">Object</SPAN> composite);

    /**
     * Remove a contribution from the SCA domain
     * 
     * @param contribution The URI of the contribution
     * @<SPAN class="code-keyword">throws</SPAN> DeploymentException
     */
    void remove(URI contribution) <SPAN class="code-keyword">throws</SPAN> ContributionException;

    /**
     * Resolve an artifact by QName within the contribution
     * 
     * @param &lt;T&gt; The java type of the artifact such as javax.wsdl.Definition
     * @param contribution The URI of the contribution
     * @param definitionType The java type of the artifact
     * @param namespace The namespace of the artifact
     * @param name The name of the artifact
     * @<SPAN class="code-keyword">return</SPAN> The resolved artifact
     */
    &lt;T&gt; T resolve(URI contribution, <SPAN class="code-object">Class</SPAN>&lt;T&gt; definitionType, <SPAN class="code-object">String</SPAN> namespace, <SPAN class="code-object">String</SPAN> name);

    /**
     * Resolve the reference to an artifact by the location URI within the given
     * contribution. Some typical use cases are:
     * &lt;ul&gt;
     * &lt;li&gt;Reference a XML schema using
     * {http:<SPAN class="code-comment">//www.w3.org/2001/XMLSchema-instance}schemaLocation or
</SPAN>     * &lt;li&gt;Reference a list of WSDLs using
     * {http:<SPAN class="code-comment">//www.w3.org/2004/08/wsdl-instance}wsdlLocation
</SPAN>     * &lt;/ul&gt;
     * 
     * @param contribution The URI of the contribution
     * @param namespace The namespace of the artifact. This is <SPAN class="code-keyword">for</SPAN> validation
     *            purpose. If the namespace is <SPAN class="code-keyword">null</SPAN>, then no check will be
     *            performed.
     * @param uri The location URI
     * @param baseURI The URI of the base artifact where the reference is
     *            declared
     * @<SPAN class="code-keyword">return</SPAN> The URL of the resolved artifact
     */
    URL resolve(URI contribution, <SPAN class="code-object">String</SPAN> namespace, URI uri, URI baseURI);
}
</PRE>
</DIV></DIV>

<H4><A name="Deployment-ContributionServicesUMLDiagrams"></A>Contribution Services UML Diagrams</H4>

<P><B>Contribution Services</B></P>

<P><SPAN class="image-wrap" style=""><A class="confluence-thumbnail-link 1738x1275" href="deployment.data/Contribution%20Services.gif"><IMG src="deployment.data/Contribution%20Services.gif.jpeg" style="border: 0px solid black"></A></SPAN></P>

<P><B>Contribution Processors</B></P>

<P><SPAN class="image-wrap" style=""><A class="confluence-thumbnail-link 1325x1169" href="deployment.data/Contribution%20Processors.gif"><IMG src="deployment.data/Contribution%20Processors.gif.jpeg" style="border: 0px solid black"></A></SPAN></P>

<P><B>Artifact Resolver</B></P>

<P><SPAN class="image-wrap" style=""><A class="confluence-thumbnail-link 952x1413" href="deployment.data/Artifact%20Resolver.gif"><IMG src="deployment.data/Artifact%20Resolver.gif.jpeg" style="border: 0px solid black"></A></SPAN></P>


<H2><A name="Deployment-2%29ApplyChangestotheAssembly"></A>2) Apply Changes to the Assembly</H2>

<P><B>The assembly is about creating/modifying/ removing instances of things (primarily components).</B></P>

<P>1. User calls &quot;addToDomainComosite&quot;&nbsp;or &quot;applyChanges&quot; aginst the <B>AssemblyService</B>.&nbsp;There is a changeSet which represents an atomic modification to the domain,&nbsp;for example, adding an &quot;include&quot; to the domain composite.</P>

<P>2. The assembly service applies this to the current logical assembly creating a new revision of the assembly.</P>

<P>3. The action in the changeSet will need to be expanded out, e.g.</P>
<UL>
	<LI>The &lt;include&gt; will need to be resolved to a composite.&nbsp;</LI>
	<LI>The content of the composite will need to be examined and result in new components being defined</LI>
	<LI>Those components will have implementations that need to be run and requirements on where&nbsp;and so forth</LI>
</UL>


<P>There is a resolution phase that is used to build a fully configured logical model where references (things like composite names, class names, etc) are resolved this is done using the contribution service&nbsp;to retrieve the target artifacts for the references. It calls back the contribution service to resolve the cross-references&nbsp;probably via&nbsp;a different api&nbsp;but it is going to the store.So now we have a fully resolved logical configuration model. Errors may be reported during the resolve phase&nbsp;such as:</P>
<UL>
	<LI>No such composite</LI>
	<LI>No such service</LI>
	<LI>WSDL portType cannot be resolved</LI>
</UL>


<P>But we also run a logical validation on the resulting model,&nbsp;e.g. checking that if wires connect.</P>

<P>4. Convert the new logical model to a set of physical models which involves allocating pieces of the model to physical runtimes&nbsp;so that they can be consumed by the runtime to activate the components. This is done by creating physical changeSets for each runtime.</P>

<P>5. The physical models are propagated to the given runtime by some means (via the FederatedDeployer suppor that Meeraj's working on) </P>
<DIV class="panelMacro"><TABLE class="infoMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD><B>Physical models for the runtime</B><BR>The changeSet for the physical runtime is meant to be very precise and&nbsp;the builder's role is to turn that into runnable code. So it's not SCDL stuff but much lower level. The&nbsp;idea is to keep the builder very simple (and hence quite testable) that means there is a bit more work in the conversion from logical to physical,&nbsp;bascially a &quot;portable&quot; builder.<BR>
The conversion will&nbsp;use the introspection results from the store to generate the builder configuration,&nbsp;for example,&nbsp;suppose introspection discovers a component has an @Init method,&nbsp;we store that in the introspection result. The ContributionProcessor&nbsp;might load the java classes to introspect the annotations. (It may not actually load the class using a class loader since it could parse bytecode e.g. with ASM).&nbsp;But the result is an extended implemenation description. We need a langauge neutral form for that&nbsp;so ideally it can be used on both a Java and Native platform. It's something that goes beyond the componentType&nbsp;and it's the PojoComponentType type of thing, but more.

<P>The idea of &quot;portable builders&quot; is about separating the node&nbsp; responsible for domain assembly from the nodes running component&nbsp; implementations. In a heterogeneous federation, it could be the&nbsp; assembly node(s) are running C+&#43; but the user wants to add a Java&nbsp; component that will actually run on a Java node. If the introspection&nbsp; results for the Java contribution are portable, it would be possible&nbsp; for the C+&#43; to set up the physical configuration for the Java&nbsp; builder; alternatively, it could delegate that to a service running&nbsp; in a native Java environment. Similarly, if the component was in some&nbsp; portable language (like Ruby or XSLT), then the configuration could&nbsp; be done on a Java node and passed to a C+&#43; runtime node.</P></TD></TR></TABLE></DIV>
<P>6. The next steps&nbsp;is the build/connect/run. </P>
							</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&nbsp;&nbsp;</BR>
                        Apache Tuscany and the Apache Tuscany project logo are trademarks of The Apache Software Foundation.
		</DIV>
		<!-- footer macro end -->

    </BODY>
</HTML>