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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
|
<!--
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 : place holder for the old user guide page</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=107029">
<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="sca-overview.html" title="SCA Overview">SCA Overview</A> > <A href="sca-java.html" title="SCA Java">SCA Java</A> > <A href="java-sca-documentation-menu.html" title="Java SCA Documentation Menu">Java SCA Documentation Menu</A> > <A href="sca-java-user-guide.html" title="SCA Java User Guide">SCA Java User Guide</A> > <A href="" title="place holder for the old user guide page">place holder for the old user guide page</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">
<P>this is a copy of what used to have for user guide while we are trying to clean this up. Some of the changes are shoing here already.</P>
<TABLE class="sectionMacroWithBorder" border="0" cellpadding="5" cellspacing="0" width="100%"><TBODY><TR>
<TD class="confluenceTd" valign="top" width="15%">
<DIV class="panel" style="background-color: #ECF4D1;border-color: #C3CDA1;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #C3CDA1;background-color: #C3CDA1;"><B>General</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="home.html" title="Home">Home</A><BR>
<A href="http://www.apache.org/licenses/LICENSE-2.0.html" class="external-link" rel="nofollow">License </A><BR>
<A href="sca-java-get-involved.html" title="SCA Java Get Involved">Get Involved</A><BR>
<A href="sca-java-found-a-bug.html" title="SCA Java Found A Bug">Found a Bug?</A></P>
</DIV></DIV>
<DIV class="panel" style="background-color: #ECF4D1;border-color: #b4b4b5;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #b4b4b5;background-color: #C3CDA1;"><B>SCA Java</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="sca-java.html" title="SCA Java">SCA Java Home</A><BR>
<A href="tuscany-dashboard.html" title="Tuscany Dashboard">SCA Dashboard</A><BR>
<A href="java-sca-tools.html" title="Java SCA Tools">Tools </A><BR>
<A href="tuscany-sca-java-faq.html" title="Tuscany SCA Java - FAQ">FAQ</A></P>
</DIV></DIV>
<DIV class="panel" style="background-color: #ECF4D1;border-color: #b4b4b5;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #b4b4b5;background-color: #C3CDA1;"><B>SCA Java 1.x</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="sca-java-releases.html" title="SCA Java Releases">Downloads</A><BR>
<A href="java-sca-documentation-menu.html" title="Java SCA Documentation Menu">Documentation</A><BR>
<A href="https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk/" class="external-link" rel="nofollow">1.x Source Code</A><BR>
<A href="http://tinyurl.com/8rlxd3" class="external-link" rel="nofollow">Roadmap</A></P>
</DIV></DIV>
<DIV class="panel" style="background-color: #ECF4D1;border-color: #b4b4b5;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #b4b4b5;background-color: #C3CDA1;"><B>SCA Java 2.x</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="sca-java-2x-releases.html" title="SCA Java 2.x Releases">Downloads</A><BR>
<A href="http://tuscany.apache.org/documentation-2x/" class="external-link" rel="nofollow">Documentation</A><BR>
<A href="https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/" class="external-link" rel="nofollow">2.x Source Code</A><BR>
<A href="http://tinyurl.com/8rlxd3" class="external-link" rel="nofollow">Roadmap</A></P>
</DIV></DIV>
<DIV class="panel" style="background-color: #ECF4D1;border-color: #b4b4b5;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #b4b4b5;background-color: #C3CDA1;"><B>Documentation</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="sca-java-user-guide.html" title="SCA Java User Guide">User Guide</A><BR>
<A href="sca-java-architecture-guide.html" title="SCA Java Architecture Guide">Architecture Guide</A><BR>
<A href="sca-java-development-guide.html" title="SCA Java Development Guide">Developer Guide</A><BR>
<A href="sca-java-extension-development-guide.html" title="SCA Java Extension Development Guide">Extension Developer Guide</A></P>
</DIV></DIV>
<DIV class="panel" style="background-color: #ECF4D1;border-color: #b4b4b5;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #b4b4b5;background-color: #C3CDA1;"><B>Resources</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="tuscany-sca-java-faq.html" title="Tuscany SCA Java - FAQ">FAQ</A><BR>
<A href="https://svn.apache.org/repos/asf/incubator/tuscany/java/sca" class="external-link" rel="nofollow">Source Code</A></P>
</DIV></DIV>
</TD>
<TD class="confluenceTd" valign="top" width="85%">
<P><BR class="atl-forced-newline"></P>
<DIV class="panel" style="background-color: #ECF4D1;border-color: #C3CDA1;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #C3CDA1;background-color: #C3CDA1;"><B>Apache Tuscany SCA User Guide</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<UL>
<LI><A href="http://cwiki.apache.org/confluence/display/TUSCANY/Quick%20Guide%20to%20SCA" class="external-link" rel="nofollow"><B>Introduction to SCA</B></A></LI>
<LI><A href="#placeholderfortheolduserguidepage-Intro"><B>About Tuscany User Guide</B></A></LI>
<LI><A href="#placeholderfortheolduserguidepage-CreateYourFirstApplication"><B>Create Your First Application</B></A>
<UL>
<LI>Single node, Tuscany standalone environment</LI>
</UL>
</LI>
<LI><A href="#placeholderfortheolduserguidepage-distributedapplication"><B>Create a Distributed Application</B></A>
<UL>
<LI>Multi node, Tuscany standalone environment</LI>
</UL>
</LI>
<LI><A href="#placeholderfortheolduserguidepage-CreateaStoreApplication"><B>Create a Store Application</B></A></LI>
<LI><A href="#placeholderfortheolduserguidepage-webapp">*Create a web application *</A></LI>
<LI><A href="#placeholderfortheolduserguidepage-HostEmbedded"><B>Host Embedded</B></A></LI>
<LI><A href="#placeholderfortheolduserguidepage-TuscanySCANodeImplementation"><B>Tuscany SCA Node Implementation</B></A></LI>
<LI><A href="#placeholderfortheolduserguidepage-HostingTuscanySCANodes"><B>Hosting Tuscany SCA Nodes</B></A></LI>
<LI><A href="#placeholderfortheolduserguidepage-TuscanySCADomain"><B>Tuscany SCA Domain</B></A></LI>
<LI><A href="#placeholderfortheolduserguidepage-TuscanyDomainManager"><B>Tuscany web based Domain Manager Tool</B></A></LI>
<LI><A href="http://tuscany.apache.org/sca-java-web-applications.html" class="external-link" rel="nofollow"><B>Deploying as Web Application</B></A></LI>
<LI><A href="#placeholderfortheolduserguidepage-Tuscanydependencies"><B>Understanding Tuscany's Depedencies</B></A> (To be done)</LI>
<LI><A href="#placeholderfortheolduserguidepage-TuscanySCAExtensions"><B>Tuscany SCA Extensions</B></A>
<UL>
<LI><A href="#placeholderfortheolduserguidepage-TheExtensibleRuntime">The Extensible Runtime</A></LI>
<LI><A href="#placeholderfortheolduserguidepage-UsingExtensions">Using Extensions</A></LI>
</UL>
</LI>
<LI><A href="#placeholderfortheolduserguidepage-TuscanySCAAndIDEs"><B>Tuscany SCA And IDEs</B></A>
<UL>
<LI><A href="#placeholderfortheolduserguidepage-UsingTheSamplesInAnIDEWithoutMaven">Using The Samples In An IDE Without Maven</A></LI>
<LI><A href="#placeholderfortheolduserguidepage-UsingTheSamplesInAnIDEIfYouHaveMaven">Using The Samples In An IDE If You Have Maven</A><BR class="atl-forced-newline">
</LI>
</UL>
</LI>
</UL>
</DIV></DIV>
<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><DIV class="" align="center">This page is undergoing complete re-write to be more like a user guide than it is today. You are welcome to help review and complete it. </DIV>
</TD></TR></TABLE></DIV>
<H2><A name="placeholderfortheolduserguidepage-"></A><A name="placeholderfortheolduserguidepage-Intro"></A><DIV class="" style="background-color: #C3CDA1;">About Tuscany User Guide</DIV>
</H2>
<P>It is assumed that by now you have browsed through the <A href="http://cwiki.apache.org/confluence/display/TUSCANY/Quick%20Guide%20to%20SCA" class="external-link" rel="nofollow">introduction to SCA</A><BR>
section or are familiar with SCA. This user guide helps you learn more about SCA through Tuscany. It starts with building a simple application and progresses into more advanced features through references to samples that reside in Tuscany. </P>
<P>Before we start, let's emphasise that it is Tuscany's goal to provide an implementaiton that avoids imposing rules and requirements on how you write your applications. In fact the goal is to let you write application code without being concerned about the technology you choose or the environment in which it will be used. You focus on your business logic and Tuscany infrastructure will handle the rest. </P>
<H2><A name="placeholderfortheolduserguidepage-"></A><A name="placeholderfortheolduserguidepage-CreateYourFirstApplication"></A><DIV class="" style="background-color: #C3CDA1;">Create Your First Application</DIV>
</H2>
<P>This simple exercise provides you with a hands-on experience for creating an SCA calculator application. Although this is a simple application, it will cover the following items:</P>
<UL>
<LI>Creating SCA POJO-based components</LI>
<LI>Composing an application</LI>
<LI>Deploying the application</LI>
<LI>Modifying the application to use a different binding</LI>
</UL>
<P>Give <A href="getting-started-with-tuscany-using-the-command-line.html" title="Getting Started with Tuscany ( using the Command Line)">create a calculator application</A> a try. </P>
<H2><A name="placeholderfortheolduserguidepage-"></A><A name="placeholderfortheolduserguidepage-CreateaStoreApplication"></A><DIV class="" style="background-color: #C3CDA1;">Create a Store Application</DIV>
</H2>
<P>Now that you have created a simple calculator application, let's move on to a more interesting application called store. This application is developed in Eclipse enviromment and uses more advanced features that are offered in Tuscany. You will notice that it is as simple to create this application as it was to create the calculator application.</P>
<P><A href="getting-started-with-tuscany.html" title="Getting Started with Tuscany">Getting Started with Tuscany using a Tuscany Distribution In Eclipse</A><BR>
This is a quick getting started guide that go trough the steps of building the store scenario using the Tuscany SCA distribution manually installed into Eclipse</P>
<P><A href="getting-started-with-tuscany-using-tuscany-eclipse-plugin.html" title="Getting Started with Tuscany (using Tuscany Eclipse Plugin)">Getting Started with Tuscany using the Tuscany Eclipse Plugin</A><BR>
This is a quick getting started guide that go trough the steps of building the store scenario using the Tuscany Eclipse plugin.</P>
<P><A href="build-your-first-web-services-with-tuscany.html" title="Build your first Web Services with Tuscany">First Steps - Building your first web services using Tuscany</A><BR>
This is a quick guide that go through the steps of exposing your pojo component as web services.</P>
<H2><A name="placeholderfortheolduserguidepage-"></A><A name="placeholderfortheolduserguidepage-distributed"></A><DIV class="" style="background-color: #C3CDA1;">Create a Distributed Application</DIV>
</H2>
<P>A Tuscany application can be run in a single or multi-node environment. Here we introduce SCA node and walk you through an example that demonstrates how the calculator example can be distributed. This exercise will cover the following:</P>
<UL>
<LI>What is a node?</LI>
<LI>How to create and configure a node?<BR>
Give <A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANY&title=distributed%20calculator&linkCreation=true&fromPageId=107029" class="createlink">distributed calculator</A> a try.<BR>
<A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANY&title=note&linkCreation=true&fromPageId=107029" class="createlink">note</A> the following sections need to go into a tutorial for distributed sample</LI>
</UL>
<H3><A name="placeholderfortheolduserguidepage-TuscanySCANode"></A>Tuscany SCA Node</H3>
<P>In order to run an SCA application Tuscany SCA Java provides a runtime that is wrapped up in a Node. The runtime itself is made up of many of the modules that are present in the modules directory of the Tuscany SCA Java distribution. As you might expect there are functions that read XML, create an in memory mode model of the SCA assembly, create the components and wire them together ready to process incoming messages. All of these functions are wrapped up in a Node. A node is configured using SCA contributions and will run a single composite. When running standalone the node also defines the scope of component services that references can target by name. SCA defines the term Domain to describe this scope. <SPAN class="error">Unable to render embedded object: File (calculator2.png) not found.</SPAN><BR>
A node runs within a single JVM. A JVM can run many Nodes.</P>
<H3><A name="placeholderfortheolduserguidepage-hostembedded"></A>host embedded</H3>
<P>For a long time in Tuscany we have had a modules called <A href="sca-java-hostembedded.html" title="SCA JAVA host.embedded">host.embedded</A> that contains the code required to get the runtime up and running in standalone configuration. This was developed before the distributed domain support was added but the main interface here is called an SCADomain. It's just a very small domain with only one node inside it. You can't see the node and you configure and access it via the SCADomain interface. The majority of samples and tests use this today. However the new SCA Node implementation can work in both standalone and distributed configuration so may be more appropriate in situations other than the simple Tuscany samples and tests. We will convert more samples ant tests to this approach over time to show the benefit of using the node implementation.</P>
<H3><A name="placeholderfortheolduserguidepage-TuscanySCANodeImplementation"></A>Tuscany SCA Node Implementation</H3>
<P>Available from release 1.2 there is a new domain/node implementation. The node part of this can be run either stand alone or as part of a distributed domain. Most of the sample and test code has not started using this implementation yet and there may be more changes to the API.</P>
<H4><A name="placeholderfortheolduserguidepage-CreatingandConfiguringNode"></A>Creating and Configuring Node</H4>
<P>Creating a node in code is straightforward. For example,</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
SCANode2 node = SCANode2Factory.newInstance().createSCANodeFromClassLoader(<SPAN class="code-quote">"calculator.composite"</SPAN>, <SPAN class="code-keyword">null</SPAN>);
</PRE>
</DIV></DIV>
<P>The node uses current classes classloader to located the named composite file. The location of the composite file is assumed to be the location if the SCA contribution. The assumption here is that only one contribution is required. </P>
<P>If more contributions must be loaded by the node the following interface can be used.</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
SCANode2 node = SCANode2Factory.newInstance().createSCANode(<SPAN class="code-quote">"file:/C:/CalculatorContribution1/Calculator.composite"</SPAN>,
<SPAN class="code-keyword">new</SPAN> SCAContribution(<SPAN class="code-quote">"CalculatorContribution1"</SPAN>,
<SPAN class="code-quote">"file:/C:/CalculatorContribution1"</SPAN>),
<SPAN class="code-keyword">new</SPAN> SCAContribution(<SPAN class="code-quote">"CalculatorContribution2"</SPAN>,
<SPAN class="code-quote">"file:/C:/CalculatorContribution2"</SPAN>));
</PRE>
</DIV></DIV>
<P>Where</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
<SPAN class="code-quote">"file:/C:/CalculatorContribution1/Calculator.composite"</SPAN>
</PRE>
</DIV></DIV>
<P>Is the explicit location of the composite file to be run and</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
<SPAN class="code-keyword">new</SPAN> SCAContribution(<SPAN class="code-quote">"CalculatorContribution1"</SPAN>,
<SPAN class="code-quote">"file:/C:/CalculatorContribution1"</SPAN>)
</PRE>
</DIV></DIV>
<P>Shows how to provide contribution details. Multiple contributions can be specified. You might have multiple contributions if, for example, you have chosen to separate common artifacts from those specific to this composite. The contribution containing common artifacts can then be used in other SCA applications without change.</P>
<H4><A name="placeholderfortheolduserguidepage-StartingaNode"></A>Starting a Node</H4>
<P>Once the node is created it is configured and ready for use. It can be started as follows.</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
node.start();
</PRE>
</DIV></DIV>
<H4><A name="placeholderfortheolduserguidepage-LocatingServices"></A>Locating Services</H4>
<P>A local service reference can be retrieved in the following way.</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
calculatorService = ((SCAClient)node).getService(CalculatorService.class, <SPAN class="code-quote">"CalculatorServiceComponent"</SPAN>);
</PRE>
</DIV></DIV>
<H4><A name="placeholderfortheolduserguidepage-StoppingaNode"></A>Stopping a Node</H4>
<P>If you are done with the node or need to stop is processing messages use the following.</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
node.stop();
</PRE>
</DIV></DIV>
<H4><A name="placeholderfortheolduserguidepage-"></A><A name="placeholderfortheolduserguidepage-HostingTuscanySCANodes"></A></H4>
<DIV class="" style="background-color: #C3CDA1;">Hosting Tuscany SCA Nodes</DIV>
<P>You can run SCA applications in many different ways but the same underlying runtime is used but packaged in slightly different ways as follows</P>
<H4><A name="placeholderfortheolduserguidepage-CommandLine"></A>Command Line</H4>
<P>Most of the samples that are shipped with the Tuscany SCA Java distribution run from the command line by driving the Node API or old SCADomain API programmatically.</P>
<P>There is a pre-packaed launcher that has a mainline for starting nodes. When run from the command line it expects to be running in the context of the binary distribution where "modules" and "lib" directories are present.</P>
<P>It loads all of the jars from</P>
<P>1) the directory where the launcher class is found.<BR>
2) the ../modules directory<BR>
3) the ../libs directory</P>
<P>It then repeats the process looking for ../modules and ../lib dirs based on the contents of a TUSCANY_HOME environment variable</P>
<P>With the final list it creates a URLClassLoader with the current classloader as the parent and enforces a parent first classloading strategy.</P>
<P><IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" height="16" width="16" align="absmiddle" alt="" border="0"> TODO - how does it find the composite file to run?</P>
<H3><A name="placeholderfortheolduserguidepage-WebApp"></A>WebApp</H3>
<P>Some of the samples that are shipped with the Tuscany SCA Java distribution run as web apps<BR>
<IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" height="16" width="16" align="absmiddle" alt="" border="0"> TODO</P>
<H4><A name="placeholderfortheolduserguidepage-Tomcat"></A>Tomcat</H4>
<P>Running a Tuscany SCA Java enabled webapp in Tomcat is as simple as copying the webapp to the Tomcat webapps directory.</P>
<H4><A name="placeholderfortheolduserguidepage-Geronimo"></A>Geronimo</H4>
<P><IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" height="16" width="16" align="absmiddle" alt="" border="0"> TODO</P>
<H4><A name="placeholderfortheolduserguidepage-WebSphere"></A>WebSphere</H4>
<P>Please see this blog entry to learn how to do this: <A href="http://jsdelfino.blogspot.com/2007/10/how-to-use-apache-tuscany-with.html" class="external-link" rel="nofollow">http://jsdelfino.blogspot.com/2007/10/how-to-use-apache-tuscany-with.html</A></P>
<H4><A name="placeholderfortheolduserguidepage-WebLogic"></A>WebLogic</H4>
<P>Please see this user's blog to learn how to do this: <A href="http://davesowerby.blogspot.com/2008/02/using-tuscany-with-weblogic.html" class="external-link" rel="nofollow">http://davesowerby.blogspot.com/2008/02/using-tuscany-with-weblogic.html</A></P>
<H3><A name="placeholderfortheolduserguidepage-Eclipse"></A>Eclipse</H3>
<P>There are two Getting Started documents that discuss this.</P>
<P><A href="getting-started-with-tuscany.html" title="Getting Started with Tuscany">Getting Started with Tuscany using a Tuscany Distribution In Eclipse</A><BR>
<A href="getting-started-with-tuscany-using-tuscany-eclipse-plugin.html" title="Getting Started with Tuscany (using Tuscany Eclipse Plugin)">Getting Started with Tuscany using the Tuscany Eclipse Plugin</A></P>
<H2><A name="placeholderfortheolduserguidepage-"></A><A name="placeholderfortheolduserguidepage-TuscanySCADomain"></A></H2>
<DIV class="" style="background-color: #C3CDA1;">Tuscany SCA Domain</DIV>
<P>SCA has the concept of a domain. Section 10 of the SCA Assembly specification describes an SCA Domain as defining "the boundary of visibility for all SCA mechanisms". SCA wires can be used to connect components within a single SCA Domain.</P>
<P>From the calculator sample you can see that the wires between the component references and services, formed by adding a target component name to a reference, are resolved inside an SCA domain. For example, this section of the calculator composite file shows how the CalcuatorServiceComponent targets the AddServiceComponent.</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
<component name=<SPAN class="code-quote">"CalculatorServiceComponent"</SPAN>>
<implementation.java class=<SPAN class="code-quote">"calculator.CalculatorServiceImpl"</SPAN>/>
<reference name=<SPAN class="code-quote">"addService"</SPAN> target=<SPAN class="code-quote">"AddServiceComponent"</SPAN> />
<reference name=<SPAN class="code-quote">"subtractService"</SPAN> target=<SPAN class="code-quote">"SubtractServiceComponent"</SPAN> />
<reference name=<SPAN class="code-quote">"multiplyService"</SPAN> target=<SPAN class="code-quote">"MultiplyServiceComponent"</SPAN> />
<reference name=<SPAN class="code-quote">"divideService"</SPAN> target=<SPAN class="code-quote">"DivideServiceComponent"</SPAN> />
</component>
<component name=<SPAN class="code-quote">"AddServiceComponent"</SPAN>>
<implementation.java class=<SPAN class="code-quote">"calculator.AddServiceImpl"</SPAN>/>
</component>
</PRE>
</DIV></DIV>
<P>The target="AddServiceComponent" of the CalculatorServiceComponent's addService reference refers to the AddServiceComponent defined later on in this composite. A domain can consist of more than one composite and wires can run between components defined in the composites. The SCA Domain describes the boundary within which target component services can be located.</P>
<P>To connect to services outside of the SCA Domain (whether they be services provided by SCA or by other means) you configure an explicit binding, for example, lets assume that the AddServiceComponent is a non-sca web service out there on the network somewhere. As this is outside the SCA domain we can use an explicit remote binding to talk to it.</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
<component name=<SPAN class="code-quote">"CalculatorServiceComponent"</SPAN>>
<implementation.java class=<SPAN class="code-quote">"calculator.CalculatorServiceImpl"</SPAN>/>
<reference name=<SPAN class="code-quote">"addService"</SPAN> >
<<SPAN class="code-keyword">interface</SPAN>.java <SPAN class="code-keyword">interface</SPAN>=<SPAN class="code-quote">"calculator.AddService"</SPAN> />
<binding.ws uri=<SPAN class="code-quote">"http:<SPAN class="code-comment">//localhost:8080/sample-calculator-ws-webapp/AddServiceComponent"</SPAN>/>
</SPAN> </reference>
<reference name=<SPAN class="code-quote">"subtractService"</SPAN> target=<SPAN class="code-quote">"SubtractServiceComponent"</SPAN>></reference>
<reference name=<SPAN class="code-quote">"multiplyService"</SPAN> target=<SPAN class="code-quote">"MultiplyServiceComponent"</SPAN>></reference>
<reference name=<SPAN class="code-quote">"divideService"</SPAN> target=<SPAN class="code-quote">"DivideServiceComponent"</SPAN>></reference>
</component>
</PRE>
</DIV></DIV>
<P>Tuscany SCA supports running an SCA Domain in a single Node or spread across multiple Nodes potentially on different machines. We have seen a domain with a single node before.<BR>
<SPAN class="error">Unable to render embedded object: File (calculator2.png) not found.</SPAN><BR>
A domain with multiple nodes allows wires to run between components running in the separate nodes which may be running on different JVMs on different machines. <BR>
<SPAN class="error">Unable to render embedded object: File (calculator3.png) not found.</SPAN><BR>
When reference and service are in different composites the domain manager is used to pre-process each composited prior to the composites being deployed to nodes for running. Contributions (containing the composites) are added to the domain manager. Configuration must be provided which tells the workspace where the nodes are that are going to run the composites and which composites they will run. Based on this information the domain manager makes an atom feed available for each composite that is deployed to a node. The node to which the composite is assigned must read the correct atom feed in order to configure itself by downloading the composite to run and the contributions required provide the artifacts required by the composite. There is a Node API that takes as input the URL of an atom feed exposed by the domain manager as follows. </P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
SCANode2 node = SCANode2Factory.newInstance().createSCANodeFromURL(<SPAN class="code-quote">"http:<SPAN class="code-comment">//localhost:9990/node-config/NodeA"</SPAN>);</SPAN>
</PRE>
</DIV></DIV>
<P>The URL <A href="http://localhost:9990/node-config/NodeA" class="external-link" rel="nofollow">http://localhost:9990/node-config/NodeA</A> is the URL of the atom feed that the domain manager provides.</P>
<P>The domain manager processes all the relationships between all composite components and provides a fully configured composite to each node, i.e. all of the binding URIs are filled out correctly so it's basically a pre-processing step. You can simulate the effect by manually adding the full uri to the reference binding.ws if you don't want to run with the domain manager</P>
<P>The calculator-distributed sample is a simple example of the use of the workspace. You can fire up the workspace and play with the gui or look at the 3 xml files in the top directory of that sample which the workspace relies on for configuration.</P>
<H3><A name="placeholderfortheolduserguidepage-StartingADomain"></A>Starting A Domain</H3>
<P>There is a launcher that has a mainline for starting the domain. For example, </P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">static</SPAN> void main(<SPAN class="code-object">String</SPAN>[] args) <SPAN class="code-keyword">throws</SPAN> Exception {
DomainManagerLauncher.main(args);
}
</PRE>
</DIV></DIV>
<P><IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" height="16" width="16" align="absmiddle" alt="" border="0"> TODO - how is this run without having to create your own mainline. </P>
<H3><A name="placeholderfortheolduserguidepage-ConfiguringADomainThroughTheWebInterface"></A>Configuring A Domain Through The Web Interface</H3>
<P>One the domain manager is running you can get to the web interface of the default domain point you browser at <A href="http://localhost:9990/ui" class="external-link" rel="nofollow">http://localhost:9990/ui</A>. This provides a number of different pages allowing you to </P>
<UL>
<LI>Add contributions to the domain</LI>
<LI>Add node configurations to the domain</LI>
<LI>Configure composites to run on specific nodes</LI>
<LI>Start local node instances to test the configuration</LI>
</UL>
<H3><A name="placeholderfortheolduserguidepage-ConfiguringaDomainThroughTheFileSystem"></A>Configuring a Domain Through The File System</H3>
<P>Behind the domain manager web application there are three files where the configuration information is stored. </P>
<P><B>workspace.xml</B> - stores the ID and location of each contribution that has been added to the domain.</P>
<P><B>domain.composite</B> - the virtual domain composite. This is an SCA composite that represents the virtual domain which includes all of the composites that will run in the domain. A URI is provided which indicates which contribution each composite comes from. Ultimately an SCANode2 instance will be started for each composite included in the virtual domain. Each SCANode2 instance can be running on separate/distributed processors. So the virtual domain is a consolidated description of you distributed SCA application</P>
<P><B>cloud.composite</B> - describes the compute cloud (the set of distributed SCANode2 instances) being used to run the SCA application. Each node is assigned a composite and also has details of the configuration of bindings when they run on that node, for example, the root URI is set. It's possibly slightly confusing that this file is in SCA composite format also but this is a convenience because firstly we didn't have to create a new file format and secondly there may be some benefit in the future of representing this network of nodes as a network of SCA services for management purposes although we don't do that yet.</P>
<P>These files are updated when you make changes to the domain through the domain manager interface but they have a fairly simple XML format and can be edited manually or new utilities could be constructed to edit them automatically.</P>
<P><A name="placeholderfortheolduserguidepage-TuscanyDomainManager"></A></P>
<H2><A name="placeholderfortheolduserguidepage-TuscanyWebbasedDomainManagerTool"></A>Tuscany Web-based Domain Manager Tool</H2>
<P>This <A href="http://www.ibm.com/developerworks/webservices/library/ws-sca-tuscany/index.html?S_TACT=105AGX04&S_CMP=EDU" class="external-link" rel="nofollow">article</A> that is hosted outside of Tuscany provides a step by step instruction for how to use the Tuscany web-based domain manager UI to administer an SCA domain and how to use the domain administrative UI to deploy an SOA solution comprised of SCA components.</P>
<H2><A name="placeholderfortheolduserguidepage-"></A><A name="placeholderfortheolduserguidepage-TuscanySCACoreFeatures"></A></H2>
<DIV class="" style="background-color: #C3CDA1;">Tuscany SCA Core Features</DIV>
<H3><A name="placeholderfortheolduserguidepage-"></A><A name="placeholderfortheolduserguidepage-Policy"></A></H3>
<DIV class="" style="background-color: #C3CDA1;">Policy</DIV>
<P><IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" height="16" width="16" align="absmiddle" alt="" border="0"> TODO</P>
<H2><A name="placeholderfortheolduserguidepage-"></A><A name="placeholderfortheolduserguidepage-TuscanySCAExtensions"></A></H2>
<DIV class="" style="background-color: #C3CDA1;">Tuscany SCA Extensions</DIV>
<H3><A name="placeholderfortheolduserguidepage-"></A><A name="placeholderfortheolduserguidepage-TheExtensibleRuntime"></A></H3>
<DIV class="" style="background-color: #C3CDA1;">The Extensible Runtime</DIV>
<P>The Tuscany SCA runtime comprises a small set of core software which deals with:</P>
<UL>
<LI>Managing extesions to the Tuscany SCA Runtime(<EM>core</EM>)</LI>
<LI>Building and in memory assembly model of SCA applications (<EM>assembly</EM>)</LI>
<LI>Processing SCA applcations that are contributed (<EM>contribution</EM>)</LI>
<LI>Supporting databindings (<EM>databinding</EM>)</LI>
<LI>Supporting Tuscany SCA when its embedded in other environments (<EM>embedded</EM>)</LI>
<LI>Supporting Tuscany SCA when its running in a servlet container (<EM>http</EM>)</LI>
</UL>
<P>The collections of interfaces that describe these features are referred to as the System Programming Interface (SPI). The <A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANY&title=SCA%20Java%20Developer%20Guide&linkCreation=true&fromPageId=107029" class="createlink">developer guide</A> discusses them in more detail but from a user perspective the important thing to realize is that the majority of interesting functionality in Tuscany SCA is provided by extensions which build upon this core SPI. These extensions provide Tuscany SCA with its ability to support a wide variety features.</P>
<UL>
<LI>Implementation types</LI>
<LI>Binding types</LI>
<LI>Databinding types</LI>
<LI>Interface description styles</LI>
<LI>Hosting environments</LI>
</UL>
<P>So to understand how to use the Tuscany SCA runtime is to understand how to use its extensions. The available extensions are described in the <A href="sca-java-user-reference.html" title="SCA Java User Reference">User Reference</A></P>
<H3><A name="placeholderfortheolduserguidepage-"></A><A name="placeholderfortheolduserguidepage-UsingExtensions"></A></H3>
<DIV class="" style="background-color: #C3CDA1;">Using Extensions</DIV>
<P>Extensions are loaded into the Tuscany SCA runtime using the Java service loading mechanism. Each extension is packaged as a jar and provides a file;</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
</PRE>
</DIV></DIV>
<P>Using this information the Tuscany SCA runtime will load each extensions present on the the Java CLASSPATH. So if you want to use a particular feature make sure that it's available on your classpath. Conversely if you don't want a particular feature to be active remove it from the classpath.</P>
<P>Writing a new extension is a subject in its own right and is described in the <A href="sca-java-extension-development-guide.html" title="SCA Java Extension Development Guide">extension guide</A></P>
<H2><A name="placeholderfortheolduserguidepage-"></A><A name="placeholderfortheolduserguidepage-TuscanySCAAndIDEs"></A></H2>
<DIV class="" style="background-color: #C3CDA1;">Tuscany SCA And IDEs</DIV>
<H3><A name="placeholderfortheolduserguidepage-"></A><A name="placeholderfortheolduserguidepage-UsingTheSamplesInAnIDEWithoutMaven"></A></H3>
<DIV class="" style="background-color: #C3CDA1;">Using The Samples In An IDE Without Maven</DIV>
<P>We don't provide any IDE project files with our disitributions so you will have to import the sample files into your IDE manually. Here's an example of how it can be done using Eclipse. Here the directory tuscany_sca_install_dir is the directory whch holds the Tuscany SCA Java binary installation after it's been extracted from its archive file, for example, for the 0.90 release this will be tuscany-sca-0.90-incubating.</P>
<P>In a new or existing workspace</P>
<UL>
<LI>Create a new java project to represent the sample you want to work on, e.g.
<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE>my working dir/calculator
</PRE>
</DIV></DIV></LI>
<LI>Import all of the sample code and resources into this project, e.g.
<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE>Use the File,Import menu and then select tuscany_sca_install_dir/samples/calculator from the filesystem
</PRE>
</DIV></DIV></LI>
<LI>Configure the source path to include
<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE>tuscany_sca_install_dir/samples/calculator/src/main/java
tuscany_sca_install_dir/samples/calculator/src/main/resources
</PRE>
</DIV></DIV></LI>
<LI>Configure the output folder to be
<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE>tuscany_sca_install_dir/samples/calculator/target
</PRE>
</DIV></DIV></LI>
<LI>Configure the build path to include all of the jars provided in
<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE>tuscany_sca_install_dir/lib
</PRE>
</DIV></DIV></LI>
<LI>If you select calculator.CalculatorClient.java and run as "Java Application" you should see
<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE>3 + 2=5.0
3 - 2=1.0
3 * 2=6.0
3 / 2=1.5
</PRE>
</DIV></DIV></LI>
</UL>
<P>The details of how to do this for other development environments will vary but the process will be similar.</P>
<H3><A name="placeholderfortheolduserguidepage-"></A><A name="placeholderfortheolduserguidepage-UsingTheSamplesInAnIDEIfYouHaveMaven"></A></H3>
<DIV class="" style="background-color: #C3CDA1;">Using The Samples In An IDE If You Have Maven</DIV>
<P>If you are a Maven user you can use it to generate all of the IDE project files for you automatically. This works best if you generate IDE projects for all of the Apache Tuscany modules. You can then include the ones you are interested in working with in you IDE.</P>
<P>To build IDE project files for all of the modules in Apache Tuscany SCA;</P>
<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE>cd sca
</PRE>
</DIV></DIV>
<P>If you are an Eclipse user do the following</P>
<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE>mvn -Peclipse eclipse:eclipse
</PRE>
</DIV></DIV>
<P>If you are an IDEA user do the following</P>
<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE>mvn idea:idea
</PRE>
</DIV></DIV>
<P>These commands generate project files for each module in Apache Tuscany SCA. The modules you are interested in can now be included in your IDE, for example, in Eclipse, if you create a new Java project and use the option to "create a new project from existing source" you can specify an SCA module directory, which includes the generated project files, and Eclipse will treat it like any other Java project.</P>
<P></P></TD></TR></TBODY></TABLE>
</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>
|