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
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<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">
<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/TUSCANYxDOCx2x/$images/favicon.ico">
<TITLE>2.0-beta-Samples documentation : Apache Tuscany</TITLE>
<META http-equiv="Content-Type" content="text/html;charset=UTF-8"></HEAD>
<STYLE>
.spacetree * ul {
padding-left:0px;
margin-left: 0px;
}
.spacetree * li {
margin-left: 5px;
padding-left:5px;
}
</STYLE>
<BODY onload="init()">
<!-- topNav -->
<TABLE border="0" cellpadding="2" cellspacing="0" width="100%">
<TR class="topBar">
<TD align="left" valign="middle" class="topBarDiv" align="left" nowrap="">
<A href="https://cwiki.apache.org/geronimo"> Home</A> > <A href="index.html" title="Apache Tuscany Docs 2.x">Apache Tuscany Docs 2.x</A> > <A href="index.html" title="Index">Index</A> > <A href="getting-started.html" title="Getting Started">Getting Started</A> > <A href="samples.html" title="Samples">Samples</A> > <A href="" title="2.0-beta-Samples documentation">2.0-beta-Samples documentation</A>
</TD>
<TD align="right" valign="middle" nowrap="">
<FORM name="search" action="http://www.google.com/search" method="get">
<INPUT type="hidden" name="ie" value="UTF-8">
<INPUT type="hidden" name="oe" value="UTF-8">
<INPUT type="hidden" name="domains" value="">
<INPUT type="hidden" name="sitesearch" value="">
<INPUT type="text" name="q" maxlength="255" value="">
<INPUT type="submit" name="btnG" value="Google Search">
</FORM>
</TD>
</TR>
</TABLE>
<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="index.html" title="Apache Tuscany Docs 2.x">Apache Tuscany Docs 2.x</A> > <A href="index.html" title="Index">Index</A> > <A href="getting-started.html" title="Getting Started">Getting Started</A> > <A href="samples.html" title="Samples">Samples</A> > <A href="" title="2.0-beta-Samples documentation">2.0-beta-Samples documentation</A>
</TD>
<TD align="right" valign="middle" class="topBarDiv" align="left" nowrap="true">
<A href="http://tuscany.apache.org/">Tuscany Home</A> | <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>
<TABLE border="0" cellpadding="0" width="100%" bgcolor="#FFFFFF">
<TR>
<TD valign="top" align="left" width="22%" bgcolor="#F9F9F9" class="noprint">
<DIV class="tabletitle">Table of Contents</DIV>
<DIV class="spacetree">
</DIV>
</TD>
<TD align="left" valign="top" width="78%">
<!-- pageContent -->
<DIV id="PageContent">
<DIV class="pageheader" style="padding: 6px 0px 0px 0px;">
<!-- We'll enable this once we figure out how to access (and save) the logo resource -->
<!--img src="http://geronimo.apache.org/images/confluence_logo.gif" style="float: left; margin: 4px 4px 4px 10px;" border="0"-->
<DIV style="margin: 0px 10px 0px 10px" class="smalltext">Apache Tuscany Docs 2.x</DIV>
<DIV style="margin: 0px 10px 8px 10px" class="pagetitle">2.0-beta-Samples documentation</DIV>
<DIV class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;">
<!-- -->
<A href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=23338770">
<IMG src="http://geronimo.apache.org/images/icons/notep_16.gif" height="16" width="16" border="0" align="absmiddle" title="Edit Page"></A>
<A href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=23338770">Edit Page</A>
<A href="https://cwiki.apache.org/confluence/pages/listpages.action?key=TUSCANYxDOCx2x">
<IMG src="http://geronimo.apache.org/images/icons/browse_space.gif" height="16" width="16" border="0" align="absmiddle" title="Browse Space"></A>
<A href="https://cwiki.apache.org/confluence/pages/listpages.action?key=TUSCANYxDOCx2x">Browse Space</A>
<A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANYxDOCx2x&fromPageId=23338770">
<IMG src="http://geronimo.apache.org/images/icons/add_page_16.gif" height="16" width="16" border="0" align="absmiddle" title="Add Page"></A>
<A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANYxDOCx2x&fromPageId=23338770">Add Page</A>
<A href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=TUSCANYxDOCx2x&fromPageId=23338770">
<IMG src="http://geronimo.apache.org/images/icons/add_blogentry_16.gif" height="16" width="16" border="0" align="absmiddle" title="Add News"></A>
<A href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=TUSCANYxDOCx2x&fromPageId=23338770">Add News</A>
<!-- -->
</DIV>
</DIV>
<DIV class="pagecontent">
<DIV class="wiki-content">
<H1><A name="2.0-beta-Samplesdocumentation-"></A><FONT color="#003366"><B>Tuscany 2.0-Beta1 Samples</B></FONT></H1>
<P>The Tuscany samples are shipped with Tuscany binary and source releases (see the /samples directory). If you are using Tuscany from a release distribution then make sure you are looking at the documentation that corresponds to the samples as they stood at the time of the release. </P>
<P>The contents of the <A href="samples.html" title="Samples">Samples</A> page contains links to the various different versions of samples documentation.</P>
<P>In a distribution, the samples source code is found in the samples directory, directly under the root directory. The following sections are laid out to match the structure of the samples directory and its subdirectories.</P>
<P>If you're new to Tuscany SCA start with the getting-started. Samples are generally presented in the form on an SCA contribution (look for directories ending in "-contribution") or as a webapp (look for directories ending in "-webapp"). The directories getting-started, learning-more and applications all contain sample SCA contributions of increasing complexity. The running-tuscany directory describes the various different ways you can start the Tuscany runtime and install contributions. The extending-tuscany directory contains some examples of how to build new binding and implementation extensions for using in Tuscany.</P>
<P>In the following text we use <some_text> to mean you have to replace it with whatever is appropriate in your environment. For example <tuscany_bin_distro> means the directory in which you install the Tuscany binary distribution.</P>
<P>Instructions are colour coded as follows:</P>
<DIV class="panel" style="background-color: pink;border-width: 1px;"><DIV class="panelContent" style="background-color: pink;">
<P>Instructions in pink boxes are for the Ant user</P>
</DIV></DIV>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>Instructions in silver boxes are for the Maven user</P>
</DIV></DIV>
<P>Note. As some of these samples create and use local network connections you may need to configure your firewall, if you are running one, to allow the test to run successfully. </P>
<DIV>
<UL>
<LI><SPAN class="TOCOutline">1</SPAN> <A href="#2.0-beta-Samplesdocumentation-gettingstarted">getting-started</A></LI>
<UL>
<LI><SPAN class="TOCOutline">1.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-helloworldcontribution">helloworld-contribution</A></LI>
<LI><SPAN class="TOCOutline">1.2</SPAN> <A href="#2.0-beta-Samplesdocumentation-helloworldwebapp">helloworld-webapp</A></LI>
<LI><SPAN class="TOCOutline">1.3</SPAN> <A href="#2.0-beta-Samplesdocumentation-callbackapi">callback-api</A></LI>
<LI><SPAN class="TOCOutline">1.4</SPAN> <A href="#2.0-beta-Samplesdocumentation-scascopes">sca-scopes</A></LI>
<LI><SPAN class="TOCOutline">1.5</SPAN> <A href="#2.0-beta-Samplesdocumentation-scaincludecontribution">sca-include-contribution</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2</SPAN> <A href="#2.0-beta-Samplesdocumentation-learningmore">learning-more</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-async">async</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.1.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-calculatorcontribution">calculator-contribution</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2.2</SPAN> <A href="#2.0-beta-Samplesdocumentation-bindingcomet">binding-comet</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.2.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-weatherwebapp">weather-webapp</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2.3</SPAN> <A href="#2.0-beta-Samplesdocumentation-bindingjms">binding-jms</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.3.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-helloworldwebapp">helloworld-webapp</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2.4</SPAN> <A href="#2.0-beta-Samplesdocumentation-bindingjsonrpc">binding-jsonrpc</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.4.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-calculatorcontribution">calculator-contribution</A></LI>
<LI><SPAN class="TOCOutline">2.4.2</SPAN> <A href="#2.0-beta-Samplesdocumentation-calculatorwebapp">calculator-webapp</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2.5</SPAN> <A href="#2.0-beta-Samplesdocumentation-bindingrmi">binding-rmi</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.5.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-calculatorservicecontribution">calculator-service-contribution</A></LI>
<LI><SPAN class="TOCOutline">2.5.2</SPAN> <A href="#2.0-beta-Samplesdocumentation-calculatorreferencecontribution">calculator-reference-contribution</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2.6</SPAN> <A href="#2.0-beta-Samplesdocumentation-bindingsca">binding-sca</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.6.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-calculatorcontribution">calculator-contribution</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2.7</SPAN> <A href="#2.0-beta-Samplesdocumentation-bindingws">binding-ws</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.7.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-calculatorcontribution">calculator-contribution</A></LI>
<LI><SPAN class="TOCOutline">2.7.2</SPAN> <A href="#2.0-beta-Samplesdocumentation-contributionhelloworldwssdo">contribution-helloworld-ws-sdo</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2.8</SPAN> <A href="#2.0-beta-Samplesdocumentation-distributedosgi">distributed-osgi</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.8.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-dosgidynamiccalculatoroperations">dosgi-dynamic-calculator-operations</A></LI>
<LI><SPAN class="TOCOutline">2.8.2</SPAN> <A href="#2.0-beta-Samplesdocumentation-dosgidynamiccalculator">dosgi-dynamic-calculator</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2.9</SPAN> <A href="#2.0-beta-Samplesdocumentation-implementationbpel">implementation-bpel</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.9.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-contributionhelloworldbpel">contribution-helloworld-bpel</A></LI>
<LI><SPAN class="TOCOutline">2.9.2</SPAN> <A href="#2.0-beta-Samplesdocumentation-helloworldbpelwebapp">helloworld-bpel-webapp</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2.10</SPAN> <A href="#2.0-beta-Samplesdocumentation-implementationcomposite">implementation-composite</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.10.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-helloworldrecursive">helloworld-recursive</A></LI>
<LI><SPAN class="TOCOutline">2.10.2</SPAN> <A href="#2.0-beta-Samplesdocumentation-helloworldrecursivews">helloworld-recursive-ws</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2.11</SPAN> <A href="#2.0-beta-Samplesdocumentation-implementationjava">implementation-java</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.11.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-contributioncalculator">contribution-calculator</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2.12</SPAN> <A href="#2.0-beta-Samplesdocumentation-implementation.osgi">implementation.osgi</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.12.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-dosgicalculator">dosgi-calculator</A></LI>
<LI><SPAN class="TOCOutline">2.12.2</SPAN> <A href="#2.0-beta-Samplesdocumentation-dosgicalculatoroperations">dosgi-calculator-operations</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2.13</SPAN> <A href="#2.0-beta-Samplesdocumentation-implementationscript">implementation-script</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.13.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-contributioncalculator">contribution-calculator</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2.14</SPAN> <A href="#2.0-beta-Samplesdocumentation-implementationspring">implementation-spring</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.14.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-contributionhelloworldspring">contribution-helloworld-spring</A></LI>
<LI><SPAN class="TOCOutline">2.14.2</SPAN> <A href="#2.0-beta-Samplesdocumentation-helloworldspringwebapp">helloworld-spring-webapp</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2.15</SPAN> <A href="#2.0-beta-Samplesdocumentation-implementationweb">implementation-web</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.15.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-helloworldjaxrswebapp">helloworld-jaxrs-webapp</A></LI>
<LI><SPAN class="TOCOutline">2.15.2</SPAN> <A href="#2.0-beta-Samplesdocumentation-helloworldjsclientwebapp">helloworld-js-client-webapp</A></LI>
<LI><SPAN class="TOCOutline">2.15.3</SPAN> <A href="#2.0-beta-Samplesdocumentation-helloworldjsfwebapp">helloworld-jsf-webapp</A></LI>
<LI><SPAN class="TOCOutline">2.15.4</SPAN> <A href="#2.0-beta-Samplesdocumentation-helloworldjspwebapp">helloworld-jsp-webapp</A></LI>
<LI><SPAN class="TOCOutline">2.15.5</SPAN> <A href="#2.0-beta-Samplesdocumentation-helloworldservletwebapp">helloworld-servlet-webapp</A></LI>
<LI><SPAN class="TOCOutline">2.15.6</SPAN> <A href="#2.0-beta-Samplesdocumentation-helloworldstripeswebapp">helloworld-stripes-webapp</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2.16</SPAN> <A href="#2.0-beta-Samplesdocumentation-loggingscribe">logging-scribe</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.16.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-GettingtherequiresApacheThriftlibrary">Getting the requires Apache Thrift library</A></LI>
<LI><SPAN class="TOCOutline">2.16.2</SPAN> <A href="#2.0-beta-Samplesdocumentation-StartingaScribeserver">Starting a Scribe server</A></LI>
<LI><SPAN class="TOCOutline">2.16.3</SPAN> <A href="#2.0-beta-Samplesdocumentation-RunningtheLoggingTestsampletestprogram">Running the LoggingTest sample test program</A></LI>
<LI><SPAN class="TOCOutline">2.16.4</SPAN> <A href="#2.0-beta-Samplesdocumentation-CheckingtheScribelogoutput">Checking the Scribe log output</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2.17</SPAN> <A href="#2.0-beta-Samplesdocumentation-mavenosgijunit">maven-osgi-junit</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.17.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-calculatorosgi">calculator-osgi</A></LI>
<LI><SPAN class="TOCOutline">2.17.2</SPAN> <A href="#2.0-beta-Samplesdocumentation-calculatorrestosgi">calculator-rest-osgi</A></LI>
</UL>
<LI><SPAN class="TOCOutline">2.18</SPAN> <A href="#2.0-beta-Samplesdocumentation-scaclient">sca-client</A></LI>
<UL>
<LI><SPAN class="TOCOutline">2.18.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-calculatorscaclient">calculator-scaclient</A></LI>
<LI><SPAN class="TOCOutline">2.18.2</SPAN> <A href="#2.0-beta-Samplesdocumentation-helloworldscaclient">helloworld-scaclient</A></LI>
</UL>
</UL>
<LI><SPAN class="TOCOutline">3</SPAN> <A href="#2.0-beta-Samplesdocumentation-runningtuscany">running-tuscany</A></LI>
<UL>
<LI><SPAN class="TOCOutline">3.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-commandline">command-line</A></LI>
<LI><SPAN class="TOCOutline">3.2</SPAN> <A href="#2.0-beta-Samplesdocumentation-eclipse">eclipse</A></LI>
<LI><SPAN class="TOCOutline">3.3</SPAN> <A href="#2.0-beta-Samplesdocumentation-embeddedjse">embedded-jse</A></LI>
<LI><SPAN class="TOCOutline">3.4</SPAN> <A href="#2.0-beta-Samplesdocumentation-embeddedosgi">embedded-osgi</A></LI>
<LI><SPAN class="TOCOutline">3.5</SPAN> <A href="#2.0-beta-Samplesdocumentation-maven">maven</A></LI>
<LI><SPAN class="TOCOutline">3.6</SPAN> <A href="#2.0-beta-Samplesdocumentation-mavenjunit">maven-junit</A></LI>
<LI><SPAN class="TOCOutline">3.7</SPAN> <A href="#2.0-beta-Samplesdocumentation-mavenjunitosgi">maven-junit-osgi</A></LI>
<LI><SPAN class="TOCOutline">3.8</SPAN> <A href="#2.0-beta-Samplesdocumentation-osgi">osgi</A></LI>
<LI><SPAN class="TOCOutline">3.9</SPAN> <A href="#2.0-beta-Samplesdocumentation-shell">shell</A></LI>
<LI><SPAN class="TOCOutline">3.10</SPAN> <A href="#2.0-beta-Samplesdocumentation-webapp">webapp</A></LI>
</UL>
<LI><SPAN class="TOCOutline">4</SPAN> <A href="#2.0-beta-Samplesdocumentation-extendingtuscany">extending-tuscany</A></LI>
<UL>
<LI><SPAN class="TOCOutline">4.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-bindingextension">binding-extension</A></LI>
<LI><SPAN class="TOCOutline">4.2</SPAN> <A href="#2.0-beta-Samplesdocumentation-implementationextension">implementation-extension</A></LI>
</UL>
<LI><SPAN class="TOCOutline">5</SPAN> <A href="#2.0-beta-Samplesdocumentation-applications">applications</A></LI>
<UL>
<LI><SPAN class="TOCOutline">5.1</SPAN> <A href="#2.0-beta-Samplesdocumentation-store">store</A></LI>
<LI><SPAN class="TOCOutline">5.2</SPAN> <A href="#2.0-beta-Samplesdocumentation-storewebapp">store-webapp</A></LI>
</UL>
</UL></DIV>
<H2><A name="2.0-beta-Samplesdocumentation-gettingstarted"></A>getting-started</H2>
<P>SCA defines a concept called a Contribution which is the way that SCA composite applications are packed for deployment. See <A href="sca-introduction.html" title="SCA Introduction">SCA Introduction</A> for more information on SCA concepts.</P>
<P>The getting-started samples consist of simple SCA contributions that you can build and run as your first step to getting up and running with the Tuscany SCA Java runtime.</P>
<P>You can build the sample contributions with either Maven or Ant and the running-tuscany directory contains information about the various ways you can start Tuscany and run these contributions.</P>
<H3><A name="2.0-beta-Samplesdocumentation-helloworldcontribution"></A>helloworld-contribution</H3>
<P>This is a simple SCA contribution. It describes a composite application with a single component, HelloWorldComponent, implemented in Java. The component's Java implementation provides service "business logic" for saying hello to a person whose name is supplied as input to the service. The component is described in a composite called helloworld.composite as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
<composite xmlns=<SPAN class="code-quote">"http:<SPAN class="code-comment">//docs.oasis-open.org/ns/opencsa/sca/200912"</SPAN>
</SPAN> xmlns:tuscany=<SPAN class="code-quote">"http:<SPAN class="code-comment">//tuscany.apache.org/xmlns/sca/1.1"</SPAN>
</SPAN> targetNamespace=<SPAN class="code-quote">"http:<SPAN class="code-comment">//sample"</SPAN>
</SPAN> name=<SPAN class="code-quote">"helloworld"</SPAN>>
<component name=<SPAN class="code-quote">"HelloworldComponent"</SPAN>>
<implementation.java class=<SPAN class="code-quote">"sample.HelloworldImpl"</SPAN>/>
</component>
</composite>
</PRE>
</DIV></DIV>
<P>The contribution also contains a composite called helloworldws.composite which describes a component, HelloworldWSComponent, that uses the same implementation but uses a web services binding:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
<composite xmlns=<SPAN class="code-quote">"http:<SPAN class="code-comment">//docs.oasis-open.org/ns/opencsa/sca/200912"</SPAN>
</SPAN> xmlns:tuscany=<SPAN class="code-quote">"http:<SPAN class="code-comment">//tuscany.apache.org/xmlns/sca/1.1"</SPAN>
</SPAN> targetNamespace=<SPAN class="code-quote">"http:<SPAN class="code-comment">//sample"</SPAN>
</SPAN> name=<SPAN class="code-quote">"helloworldws"</SPAN>>
<component name=<SPAN class="code-quote">"HelloworldWSComponent"</SPAN>>
<implementation.java class=<SPAN class="code-quote">"sample.HelloworldImpl"</SPAN>/>
<service name=<SPAN class="code-quote">"Helloworld"</SPAN>>
<binding.ws />
</service>
</component>
</composite>
</PRE>
</DIV></DIV>
<P>This gives us a number of options for interacting with the components in this application. </P>
<P>Firstly there is a JUnit test inside this project called HelloworldTestCase.java. This starts the Tuscany runtime and loads the contribution. It then talks to the HelloworldComponent over the default SCA binding (binding.sca) using a local Java proxy.</P>
<P>Secondly the HelloworldWSComponent exposes a service with a web services binding. You can talk to this component using your favourite web services client. You can retrieve the WSDL for the web service automatically (see later)</P>
<DIV class="panel" style="background-color: pink;border-width: 1px;"><DIV class="panelContent" style="background-color: pink;">
<P>To build this contribution using Ant do the following:</P>
<P>TODO</P>
</DIV></DIV>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>To build this contribution using Maven do the following:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd helloworld-contribution
mvn
</PRE>
</DIV></DIV>
</DIV></DIV>
<P>This will produce the contribution as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
helloworld-contribution/target/helloworld-contribution.jar
</PRE>
</DIV></DIV>
<P>As the JUnit test deploys and runs the contribution we can use it as a first simple example of a running SCA application. </P>
<DIV class="panel" style="background-color: pink;border-width: 1px;"><DIV class="panelContent" style="background-color: pink;">
<P>To run the JUnit test using Ant do the following:</P>
<P>TODO</P>
</DIV></DIV>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The contribution will be run automatically during the Maven build step and you will see the output from the JUnit test printed on the console in amongst the other output:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
Response from helloworld.sayHello(<SPAN class="code-quote">"Petra"</SPAN>) = Hello Petra
</PRE>
</DIV></DIV>
</DIV></DIV>
<P>To access the web service that the HelloworldWSComponent exposes we have to keep the runtime runntime running. </P>
<DIV class="panel" style="background-color: pink;border-width: 1px;"><DIV class="panelContent" style="background-color: pink;">
<P>To run the sample Ant so that you can access the web service do the following:</P>
<P>TODO</P>
</DIV></DIV>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>We have a Maven plugin that will run SCA contributions. You use it in Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd helloworld-contribution
mvn tuscany:run
</PRE>
</DIV></DIV>
<P>You will note that in the console output you can see a web service being exposed by the binding.ws JAXWS provider:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
Binding.ws JAXWS provider - Service URI: http:<SPAN class="code-comment">//localhost:8085/HelloworldWSComponent/Helloworld</SPAN>
</PRE>
</DIV></DIV>
<P>If you point you web browser at this address and add ?wsdl on the end:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
http:<SPAN class="code-comment">//localhost:8085/HelloworldWSComponent/Helloworld?wsdl</SPAN>
</PRE>
</DIV></DIV>
<P>You'll see the WSDL for the service returned. Using you're favourite web services client, for example, the Web Services Explorer in Eclipse, you can send messages to this web service. </P>
<P>When you're done use CTRL-C to stop the sample. </P>
</DIV></DIV>
<P>For more information on getting started with the Apache Tuscany SCA Java runtime see the <A href="getting-started.html" title="Getting Started">Getting Started</A> page.</P>
<H3><A name="2.0-beta-Samplesdocumentation-helloworldwebapp"></A>helloworld-webapp</H3>
<P>This sample is not a contribution in it's own right but demonstrates how to run the helloworld-contribution inside a web application. As it's the same contribution the same two components, HelloworldComponent and HelloworldWSComponnet, will be started. </P>
<DIV class="panel" style="background-color: pink;border-width: 1px;"><DIV class="panelContent" style="background-color: pink;">
<P>To build this contribution using Ant do the following:</P>
<P>TODO</P>
</DIV></DIV>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>To build this contribution using Maven do the following:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd helloworld-webapp
mvn
</PRE>
</DIV></DIV>
</DIV></DIV>
<P>This will produce a webapp as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
helloworld-webapp/target/helloworld.war
</PRE>
</DIV></DIV>
<P>You can run this webapp by deploying it to you're favourite webapp container. For example, you can deploy to Tomcat and run as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cp helloworld-webapp/target/helloworld.war my_tomcat_install/webapps
my_tomcat_install/bin/catalina run
</PRE>
</DIV></DIV>
<P>Once running point your web browser at:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
http:<SPAN class="code-comment">//localhost:8080/helloworld/hello.html</SPAN>
</PRE>
</DIV></DIV>
<P>You'll see a link there to the WSDL that's automatically generated for the web service binding of the HelloworldWSComponent. Again you can use your favourite web services client to send messages to the service. </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><B>TODO</B><BR>There is no example of accessing binding.sca from within the webapp. Do we want to include this?</TD></TR></TABLE></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><B>TODO</B><BR>For more information on creating webapps to run SCA contributions with Tuscany see - ?</TD></TR></TABLE></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-callbackapi"></A>callback-api</H3>
<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><B>TODO</B><BR><FONT color="#000000">This feels like a learning-more sample. I wouldn't focus on callbacks with the first time user</FONT></TD></TR></TABLE></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-scascopes"></A>sca-scopes</H3>
<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><B>TODO</B><BR><FONT color="#000000">This feels like a learning-more sample. I wouldn't focus on scopes with the first time user</FONT></TD></TR></TABLE></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-scaincludecontribution"></A>sca-include-contribution</H3>
<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><B>TODO</B><BR><FONT color="#000000">This feels like a learning-more sample. I wouldn't focus on inclusion with the first time user</FONT></TD></TR></TABLE></DIV>
<H2><A name="2.0-beta-Samplesdocumentation-learningmore"></A>learning-more</H2>
<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><B>TODO</B><BR>All of the run instructions here are subject to change. I just picked ones that works but ideally we'd use the command line consistently when that is operating correctly. Also Mike commented that it's unnatural and confusing to "cd running-tuscany/xyz" to run a sample. This should also be solved if we can go with the command line.</TD></TR></TABLE></DIV>
<P>The samples found in the contributions below illustrate more of SCA and Tuscany's features in action. The contributions here are primarily focused on demonstrating the various SCA extensions that the Tuscany runtime supports, for example, bindings and implementations. The directories are named to let you easily find a sample of the extension you're interested in.</P>
<P>You can identify contributions here as the name of the directory from which they are built ends with "-contribution". There are also webapp samples here. The names of these directories end with "-webapp".</P>
<H3><A name="2.0-beta-Samplesdocumentation-async"></A>async</H3>
<P>This sample demonstrates the SCA asynchronous progamming model in action as typified by services that are configured with the asyncInvocation intent. For example, from calculator-contribution</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
@Remotable
@AsyncInvocation
<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> CalculatorServiceAsync {
void calculateAsync(<SPAN class="code-object">Integer</SPAN> n1, ResponseDispatch<<SPAN class="code-object">String</SPAN>> response);
}
</PRE>
</DIV></DIV>
<P>A client component can access an asynchronous service either synchronously or asynchronously. Asynchronous reference interfaces also have a special form, again from calculator-contribution:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
@Remotable
<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> CalculateReferenceAsync {
<SPAN class="code-comment">// Sync
</SPAN> <SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">String</SPAN> calculate(<SPAN class="code-object">Integer</SPAN> i1);
<SPAN class="code-comment">// Aysnc Poll
</SPAN> <SPAN class="code-keyword">public</SPAN> Response<<SPAN class="code-object">String</SPAN>> calculateAsync(<SPAN class="code-object">Integer</SPAN> i1);
<SPAN class="code-comment">// Async Callback
</SPAN> <SPAN class="code-keyword">public</SPAN> Future<<SPAN class="code-object">String</SPAN>> calculateAsync(<SPAN class="code-object">Integer</SPAN> i1, AsyncHandler<<SPAN class="code-object">String</SPAN>> handler);
}
</PRE>
</DIV></DIV>
<H4><A name="2.0-beta-Samplesdocumentation-calculatorcontribution"></A>calculator-contribution</H4>
<P>This contribution defines synchronous and asynchronous component services and a client component which references both. During the test the client component exercise all three styles of reference interface operation against both the synchronous and asynchronous service.</P>
<DIV class="panel" style="background-color: pink;border-width: 1px;"><DIV class="panelContent" style="background-color: pink;">
<P>The contribution can be built using Ant as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/async/calculator-contribution
ant
</PRE>
</DIV></DIV>
<P>The contribution can be installed and the composite it contains run using Ant as follows</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd running-tuscany/embedded-jse
ant sample-implementation-java-calculator-async-contribution
</PRE>
</DIV></DIV>
</DIV></DIV>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The contribution can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/async/calculator-contribution
mvn
</PRE>
</DIV></DIV>
<P>The contribution can be installed and the composite it contains run using Maven as follows</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd running-tuscany/embedded-jse
mvn
</PRE>
</DIV></DIV>
<P>This will run several contributions including the sample-implementation-java-calculator-async-contribution.</P>
</DIV></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-bindingcomet"></A>binding-comet</H3>
<P>The Comet protocol allows a servlet to process IO asynchronously, receiving events when data is available for reading on the connection (rather than always using a blocking read), and writing data back on connections asynchronously (most likely responding to some event raised from some other source).</P>
<H4><A name="2.0-beta-Samplesdocumentation-weatherwebapp"></A>weather-webapp</H4>
<P>Executing the command "mvn" in this sample project creates a web archive suitable for deployment to Tomcat. It makes use of the tuscany comet binding.</P>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The webapp can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/binding-commet/weather-webapp
mvn
</PRE>
</DIV></DIV>
</DIV></DIV>
<P>The webapp can be installed and run as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/binding-commet/weather-webapp
cp target/sample-binding-comet-1.0.war <your_container_deployment-dir>
start the container as appropriate
</PRE>
</DIV></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-bindingjms"></A>binding-jms</H3>
<P>This binding supports message orient communication via the JMS API.</P>
<H4><A name="2.0-beta-Samplesdocumentation-helloworldwebapp"></A>helloworld-webapp</H4>
<P>This contribution packages an SCA application inside a webapp. The application has two components which exchange helloworld style messages over the JMS binding. </P>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The webapp can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/binding-jms/helloworld-webapp
mvn
</PRE>
</DIV></DIV>
</DIV></DIV>
<P>The webapp can be installed and run as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/binding-jms/helloworld-webapp
cp target/helloworld-jms.war <your_container_deployment-dir>
start the container as appropriate
</PRE>
</DIV></DIV>
<DIV class="panelMacro"><TABLE class="warningMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD><B>TODO</B><BR>By rights the webapp should be called sample-binding-jms-helloworld-webapp.war</TD></TR></TABLE></DIV>
<P>Once the webapp is deployed point your browser at:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
http:<SPAN class="code-comment">//localhost:8080/helloworld-jms/</SPAN>
</PRE>
</DIV></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-bindingjsonrpc"></A>binding-jsonrpc</H3>
<P>This binding supports communication over the JSON-RPC protocol.</P>
<H4><A name="2.0-beta-Samplesdocumentation-calculatorcontribution"></A>calculator-contribution</H4>
<P>This sample demonstrates using the simple calculator service component which makes use of four other services for add, subtract, multiply and divide functions. In this variant of the calculator sample the AddService is configured to be invoked using the JSON-RPC protocol. You can see the configuration by looking in the src/main/resources/Calculator.composite xml file.</P>
<DIV class="panel" style="background-color: pink;border-width: 1px;"><DIV class="panelContent" style="background-color: pink;">
<P>The contribution Jar can be built using Ant as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/binding-jsonrpc/calculator-contribution
ant
</PRE>
</DIV></DIV>
<P>The contribution can be installed and the composite it contains run using Ant as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd running-tuscany/embedded-jse
ant sample-implementation-java-calculator-async-contribution
</PRE>
</DIV></DIV>
</DIV></DIV>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The contribution Jar can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/binding-jsonrpc/calculator-contribution
mvn
</PRE>
</DIV></DIV>
<P>The contribution can be installed and the composite it contains run using Maven as follows</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd running-tuscany/embedded-jse
mvn
</PRE>
</DIV></DIV>
<P>This will run several contributions including the sample-implementation-java-calculator-async-contribution.</P>
</DIV></DIV>
<H4><A name="2.0-beta-Samplesdocumentation-calculatorwebapp"></A>calculator-webapp</H4>
<P>This contribution packages the same calculator-contribution inside a webapp. </P>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The webapp can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/binding-jsonrpc/calculator-webapp
mvn
</PRE>
</DIV></DIV>
</DIV></DIV>
<P>The webapp can be installed and run as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/binding-jsonrpc/calculator-webapp
cp target/sample-binding-jsonrpc-calculator-webapp.war <your_container_deployment-dir>
start the container as appropriate
</PRE>
</DIV></DIV>
<P>Once the webapp is deployed point your browser at:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
http:<SPAN class="code-comment">//localhost:8080/sample-binding-jsonrpc-calculator-webapp/</SPAN>
</PRE>
</DIV></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-bindingrmi"></A>binding-rmi</H3>
<P>In this example the calculator function is split over two contributions in order to demonstrate the remote method invocation binding (binding.rmi). The calculator-service-contribution contains a composite which defines a CalculatorServiceComponent which exposes a CalculatorService using binding.rmi. The calculator-reference-contribution contains a composite which also defines a CalculatorServiceComponent but which in this case calls the add, subtract, multiple and divide operations offered by the component in the calculator-service-contribution. The two contributions are run using separate Tuscany nodes and the resulting components communicate over RMI. Both contributions must be deployed and started for the sample to work;</P>
<DIV class="panel" style="background-color: pink;border-width: 1px;"><DIV class="panelContent" style="background-color: pink;">
<P>The contributions can be installed and the composite they contain run using Ant as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd running-tuscany/embedded-jse
ant sample-binding-rmi-calculator-contribution
</PRE>
</DIV></DIV>
</DIV></DIV>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The contributions can be installed and the composite they contain run using Ant as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd running-tuscany/embedded-jse
mvn
</PRE>
</DIV></DIV>
<P>This will run several contributions including the binding-rmi sample contributions</P>
</DIV></DIV>
<H4><A name="2.0-beta-Samplesdocumentation-calculatorservicecontribution"></A>calculator-service-contribution</H4>
<P>This contribution defines a CalculatorServiceComponent whose add, subtract, multiply and divide operations are available over RMI. </P>
<DIV class="panel" style="background-color: pink;border-width: 1px;"><DIV class="panelContent" style="background-color: pink;">
<P>The contribution Jar can be built using Ant as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/binding-rmi/calculator-service-contribution
ant
</PRE>
</DIV></DIV>
</DIV></DIV>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The contribution Jar can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/binding-rmi/calculator-service-contribution
mvn
</PRE>
</DIV></DIV>
</DIV></DIV>
<H4><A name="2.0-beta-Samplesdocumentation-calculatorreferencecontribution"></A>calculator-reference-contribution</H4>
<P>This sample extends the calculator sample by replacing the local wired connections with RMI bindings. Instead of local add, subtract, multiply and divide components, an RMI service implementation now provides the add, subtract, multiply and divide interfaces and is hosted as an RMI server. References specified in the .composite file include an RMI binding which targets<BR>
this RMI server.</P>
<DIV class="panel" style="background-color: pink;border-width: 1px;"><DIV class="panelContent" style="background-color: pink;">
<P>The contribution Jar can be built using Ant as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/binding-rmi/calculator-reference-contribution
ant
</PRE>
</DIV></DIV>
</DIV></DIV>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The contribution Jar can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/binding-rmi/calculator-reference-contribution
mvn
</PRE>
</DIV></DIV>
</DIV></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-bindingsca"></A>binding-sca</H3>
<P>This sample is the simplest sample other than that shown in the getting starting section. It uses the default SCA protocol for communicating between the various components of the caluclator application.</P>
<H4><A name="2.0-beta-Samplesdocumentation-calculatorcontribution"></A>calculator-contribution</H4>
<P>The service and reference definitions in the Calculator.composite and CalculatorClient.composite files have no binding attributes, thereby defaulting to the SCA binding for communication between the running instances of the components.</P>
<DIV class="panel" style="background-color: pink;border-width: 1px;"><DIV class="panelContent" style="background-color: pink;">
<P>The contribution Jar can be built using Ant as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/binding-sca/calculator-contribution
ant
</PRE>
</DIV></DIV>
<P>The contribution can be installed and the composite it contains run using Ant as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd running-tuscany/embedded-jse
ant sample-binding-sca-calculator-contribution
</PRE>
</DIV></DIV>
</DIV></DIV>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The contribution Jar can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/binding-sca/calculator-contribution
mvn
</PRE>
</DIV></DIV>
<P>The contribution can be installed and the composite it contains run using Maven as follows</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd running-tuscany/embedded-jse
mvn
</PRE>
</DIV></DIV>
<P>This will run several contributions including the sample-binding-sca-calculator-contribution.</P>
</DIV></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-bindingws"></A>binding-ws</H3>
<P>The web service binding allows components to expose and call services using SOAP formatted messages primarily over HTTP. </P>
<H4><A name="2.0-beta-Samplesdocumentation-calculatorcontribution"></A>calculator-contribution</H4>
<P>This contribution provides the four arithmetic operations in the calculator service, with the AddService being accessible as a web service via the URL <A href="http://localhost:8085/AddServiceComponent" class="external-link" rel="nofollow">http://localhost:8085/AddServiceComponent</A>, as configured in the Calculator.composite file.</P>
<DIV class="panel" style="background-color: pink;border-width: 1px;"><DIV class="panelContent" style="background-color: pink;">
<P>The contribution Jar can be built using Ant as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/binding-ws/calculator-contribution
ant
</PRE>
</DIV></DIV>
<P>The contribution can be installed and the composite it contains run using Ant as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd running-tuscany/embedded-jse
ant sample-binding-ws-calculator-contribution
</PRE>
</DIV></DIV>
</DIV></DIV>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The contribution Jar can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/binding-ws/calculator-contribution
mvn
</PRE>
</DIV></DIV>
<P>The contribution can be installed and the composite it contains run using Maven as follows</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd running-tuscany/embedded-jse
mvn
</PRE>
</DIV></DIV>
<P>This will run several contributions including the sample-binding-sca-calculator-contribution.</P>
</DIV></DIV>
<H4><A name="2.0-beta-Samplesdocumentation-contributionhelloworldwssdo"></A>contribution-helloworld-ws-sdo</H4>
<P>This sample demonstrates an SCA reference that uses a web service binding which works with SDO. Instead if using JAXB style Java beans in the service interface they are replaced with SDO object. </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><B>TODO</B><BR><FONT color="#000000">Sample not currently enabled - awaiting SDO support</FONT></TD></TR></TABLE></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-distributedosgi"></A>distributed-osgi</H3>
<P>These samples demonstrate the execution of Tuscany contributions in a OSGI environment. In particular the two bundle project in this directory define calculator objects that communicate with one another using the mechanisms defined in the OSGi remote services specifications. Here the Tuscany SCA runtime provides dynamic service discovery functionality. The calculator objects are registered as services directly with the OSGi bundle context by the bundle activator. Under the covers SCA provides the remote service disovery features that allow OSGi registered service to discover and communicate with one another across two JVMs. </P>
<P>To run the sample each bundle must be build using maven and then loaded into a separate OSGi environment into which the Tuscany SCA runtime has already been installed (See "osgi" under running-tuscany)</P>
<H4><A name="2.0-beta-Samplesdocumentation-dosgidynamiccalculatoroperations"></A>dosgi-dynamic-calculator-operations</H4>
<P>This bundle provides the calculator add, subtract, multiple, divide operations services.</P>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The bundle Jar can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/distributed-osgi/dosgi-dynamic-calculator-operations
mvn
</PRE>
</DIV></DIV>
</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><B>TODO</B><BR>projects should be called dosgi-dynamic-calculator-operations-bundle</TD></TR></TABLE></DIV>
<P>To run the bundle see "osgi" under running-tuscany. In short do the following:</P>
<P>On Windows, run</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
java -jar ..\..\..\..\modules\osgi-3.5.0-v20090520.jar -configuration ..\..\..\..\features\configuration -clean -console
</PRE>
</DIV></DIV>
<P>You should see the osgi console. You can run "ss" command under the osgi> to see the status of the bundles.</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
osgi> ss
</PRE>
</DIV></DIV>
<P>Then you can install and start the bundle that's just been built:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
osgi> install file:./target/sample-dosgi-dynamic-calculator-operations.jar
</PRE>
</DIV></DIV>
<H4><A name="2.0-beta-Samplesdocumentation-dosgidynamiccalculator"></A>dosgi-dynamic-calculator</H4>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The bundle Jar can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/distributed-osgi/dosgi-dynamic-calculator
mvn
</PRE>
</DIV></DIV>
</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><B>TODO</B><BR>projects should be called dosgi-dynamic-calculator-bundle</TD></TR></TABLE></DIV>
<P>To run the bundle see "osgi" under running-tuscany. In short do the following:</P>
<P>On Windows, run</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
java -jar ..\..\..\..\modules\osgi-3.5.0-v20090520.jar -configuration ..\..\..\..\features\configuration -clean -console
</PRE>
</DIV></DIV>
<P>You should see the osgi console. You can run "ss" command under the osgi> to see the status of the bundles.</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
osgi> ss
</PRE>
</DIV></DIV>
<P>Then you can install and start the bundle that's just been built:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
osgi> install file:./target/sample-dosgi-dynamic-calculator.jar
</PRE>
</DIV></DIV>
<P>You should see the calculator service start. </P>
<H3><A name="2.0-beta-Samplesdocumentation-implementationbpel"></A>implementation-bpel</H3>
<P>BPEL component implementations will be useful to those who wish to describe a sequence of calls that must be made to other component services. </P>
<H4><A name="2.0-beta-Samplesdocumentation-contributionhelloworldbpel"></A>contribution-helloworld-bpel</H4>
<DIV class="panel" style="background-color: pink;border-width: 1px;"><DIV class="panelContent" style="background-color: pink;">
<P>The contribution Jar can be built using Ant as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/implementation-bpel/helloworld-bpel-contribution
ant
</PRE>
</DIV></DIV>
<P>The contribution can be installed and the composite it contains run using Ant as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
????
</PRE>
</DIV></DIV>
</DIV></DIV>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The contribution Jar can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/implementation-bpel/helloworld-bpel-contribution
mvn
</PRE>
</DIV></DIV>
<P>The contribution can be installed and the composite it contains run using Maven as follows</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
????
</PRE>
</DIV></DIV>
</DIV></DIV>
<H4><A name="2.0-beta-Samplesdocumentation-helloworldbpelwebapp"></A>helloworld-bpel-webapp</H4>
<H3><A name="2.0-beta-Samplesdocumentation-implementationcomposite"></A>implementation-composite</H3>
<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><B>TODO</B><BR><FONT color="#000000">Understand and Document</FONT></TD></TR></TABLE></DIV>
<H4><A name="2.0-beta-Samplesdocumentation-helloworldrecursive"></A>helloworld-recursive</H4>
<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><B>TODO</B><BR>Understand and Document</TD></TR></TABLE></DIV>
<H4><A name="2.0-beta-Samplesdocumentation-helloworldrecursivews"></A>helloworld-recursive-ws</H4>
<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><B>TODO</B><BR><FONT color="#000000">Understand and Document</FONT></TD></TR></TABLE></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-implementationjava"></A>implementation-java</H3>
<P>The sample provides a single calculator service with a default SCA binding. The CalculatorClient exercises this interface by calling add, subtract, multiply and divide operations. This results in messages passing to the appropriate components in the composite across the local wires.</P>
<H4><A name="2.0-beta-Samplesdocumentation-contributioncalculator"></A>contribution-calculator</H4>
<DIV class="panel" style="background-color: pink;border-width: 1px;"><DIV class="panelContent" style="background-color: pink;">
<P>The contribution Jar can be built using Ant as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/implementation-java/calculator-contribution
ant
</PRE>
</DIV></DIV>
<P>The contribution can be installed and the composite it contains run using Ant as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd running-tuscany/embedded-jse
ant sample-implementation-java-calculator-contribution
</PRE>
</DIV></DIV>
</DIV></DIV>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The contribution Jar can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/implementation-java/calculator-contribution
mvn
</PRE>
</DIV></DIV>
<P>The contribution can be installed and the composite it contains run using Maven as follows</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd running-tuscany/embedded-jse
mvn
</PRE>
</DIV></DIV>
<P>This will run several contributions including the sample-implementation-java-calculator-contribution.</P>
</DIV></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-implementation.osgi"></A>implementation.osgi</H3>
<H4><A name="2.0-beta-Samplesdocumentation-dosgicalculator"></A>dosgi-calculator</H4>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The bundle Jar can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/implementation-osgi/dosgi-calculator
mvn
</PRE>
</DIV></DIV>
</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><B>TODO</B><BR>projects should be called dosgi-calculator-bundle</TD></TR></TABLE></DIV>
<P>To run the bundle see "osgi" under running-tuscany. In short do the following:</P>
<P>On Windows, run</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
java -jar ..\..\..\..\modules\osgi-3.5.0-v20090520.jar -configuration ..\..\..\..\features\configuration -clean -console
</PRE>
</DIV></DIV>
<P>You should see the osgi console. You can run "ss" command under the osgi> to see the status of the bundles.</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
osgi> ss
</PRE>
</DIV></DIV>
<P>Then you can install and start the bundle that's just been built:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
osgi> install file:./target/sample-dosgi-calculator.jar
</PRE>
</DIV></DIV>
<P>You should see the calculator service start. </P>
<H4><A name="2.0-beta-Samplesdocumentation-dosgicalculatoroperations"></A>dosgi-calculator-operations</H4>
<P>This bundle provides the calculator add, subtract, multiple, divide operations services.</P>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The bundle Jar can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/distributed-osgi/dosgi-calculator-operations
mvn
</PRE>
</DIV></DIV>
</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><B>TODO</B><BR>projects should be called dosgi-calculator-operations-bundle</TD></TR></TABLE></DIV>
<P>To run the bundle see "osgi" under running-tuscany. In short do the following:</P>
<P>On Windows, run</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
java -jar ..\..\..\..\modules\osgi-3.5.0-v20090520.jar -configuration ..\..\..\..\features\configuration -clean -console
</PRE>
</DIV></DIV>
<P>You should see the osgi console. You can run "ss" command under the osgi> to see the status of the bundles.</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
osgi> ss
</PRE>
</DIV></DIV>
<P>Then you can install and start the bundle that's just been built:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
osgi> install file:./target/sample-dosgi-calculator-operations.jar
</PRE>
</DIV></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-implementationscript"></A>implementation-script</H3>
<P>This sample provides a simple calculator service whose operations are implemented using four different script languages. </P>
<H4><A name="2.0-beta-Samplesdocumentation-contributioncalculator"></A>contribution-calculator</H4>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The bundle Jar can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/implementation-script/calculator-contribution
mvn
</PRE>
</DIV></DIV>
</DIV></DIV>
<DIV class="panel" style="background-color: pink;border-width: 1px;"><DIV class="panelContent" style="background-color: pink;">
<P>The contribution Jar can be built using Ant as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/implementation-script/calculator-contribution
ant
</PRE>
</DIV></DIV>
<P>The contribution can be installed and the composite it contains run using Ant as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
????
</PRE>
</DIV></DIV>
</DIV></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-implementationspring"></A>implementation-spring</H3>
<P>The Spring implementation sample contains a simple Hello World service and client using implementation.spring. </P>
<H4><A name="2.0-beta-Samplesdocumentation-contributionhelloworldspring"></A>contribution-helloworld-spring</H4>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The bundle Jar can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/implementation-spring/helloworld-spring-contribution
mvn
</PRE>
</DIV></DIV>
</DIV></DIV>
<H4><A name="2.0-beta-Samplesdocumentation-helloworldspringwebapp"></A>helloworld-spring-webapp</H4>
<P>The HelloWorld Spring WebApp sample contains a simple Hello World service implemented using Spring and wrapped in a webApp. </P>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>The bundle Jar can be built using Maven as follows:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd learning-more/implementation-spring/helloworld-spring-webapp
mvn
</PRE>
</DIV></DIV>
</DIV></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-implementationweb"></A>implementation-web</H3>
<P>The Web implementation samples contain examples of a HelloWorld service implemented using implementation.web and accessed with various different technologies. </P>
<H4><A name="2.0-beta-Samplesdocumentation-helloworldjaxrswebapp"></A>helloworld-jaxrs-webapp</H4>
<P>The HelloWorld JAX-RS WebApp sample uses implementation.web with JAX-RS to display a simple "Hello World" message from a webapp. </P>
<H4><A name="2.0-beta-Samplesdocumentation-helloworldjsclientwebapp"></A>helloworld-js-client-webapp</H4>
<P>The HelloWorld JavaScript client Webapp sample uses implementation.web and a javascript client to call a simple "Hello World" service and display the results. </P>
<H4><A name="2.0-beta-Samplesdocumentation-helloworldjsfwebapp"></A>helloworld-jsf-webapp</H4>
<P>The HelloWorld JSF WebApp sample shows a simple "Hello World" service implemented in a webapp and accessed using Java Server Faces. </P>
<H4><A name="2.0-beta-Samplesdocumentation-helloworldjspwebapp"></A>helloworld-jsp-webapp</H4>
<P>The HelloWorld JSP WebApp sample uses implementation.web and a JSP client to invoke a simple "Hello World" service and display the results. </P>
<H4><A name="2.0-beta-Samplesdocumentation-helloworldservletwebapp"></A>helloworld-servlet-webapp</H4>
<P>The HelloWorld Servlet WebApp sample uses implementation.web with a servlet to return a simple "Hello World" message in response to a request.</P>
<H4><A name="2.0-beta-Samplesdocumentation-helloworldstripeswebapp"></A>helloworld-stripes-webapp</H4>
<P>The HelloWorld Stripes WebApp sample uses implementation.web with Stripes to display a simple "Hello World" message from a webapp. </P>
<H3><A name="2.0-beta-Samplesdocumentation-loggingscribe"></A>logging-scribe</H3>
<P>This Tuscany sample shows how to implement and use a simple Logger component that logs string messages to a Scribe logging server. </P>
<P>Scribe is an open source server for aggregating streaming log data. It is designed to scale to a very large number of nodes and be robust to network and node failures.</P>
<P>See the Scribe Wiki <A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANYxDOCx2x&title=1&linkCreation=true&fromPageId=23338770" class="createlink">1</A> for more information on Scribe.</P>
<H4><A name="2.0-beta-Samplesdocumentation-GettingtherequiresApacheThriftlibrary"></A>Getting the requires Apache Thrift library</H4>
<P>This sample uses Apache Thrift's libthrift.jar to communicate with Scribe servers. Libthrift is not yet available in a Maven repository, so before building the sample with maven you need to download libthrift <A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANYxDOCx2x&title=2&linkCreation=true&fromPageId=23338770" class="createlink">2</A> and install it in your local maven repository like this:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
mvn install:install-file -DgroupId=org.apache.thrift -DartifactId=libthrift -Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=libthrift-r917130.jar
</PRE>
</DIV></DIV>
<H4><A name="2.0-beta-Samplesdocumentation-StartingaScribeserver"></A>Starting a Scribe server</H4>
<P>Before running the LoggingTest sample test program, you need to start a Scribe server for the sample program to connect to.</P>
<P>Steps to start a Scribe server are described in the Scribe examples README <A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANYxDOCx2x&title=3&linkCreation=true&fromPageId=23338770" class="createlink">3</A>. A simple scribe server configuration can be found in the Scribe examples <A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANYxDOCx2x&title=4&linkCreation=true&fromPageId=23338770" class="createlink">4</A>. </P>
<P>LoggingTest will try to connect to a Scribe server at localhost:1463. To use a Scribe server at a different host or port, configure the host and port properties in scribe.composite to match your server. </P>
<H4><A name="2.0-beta-Samplesdocumentation-RunningtheLoggingTestsampletestprogram"></A>Running the LoggingTest sample test program</H4>
<P>To run the LoggingTest sample test program, do this:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
mvn -Dtest=LoggingTest test
</PRE>
</DIV></DIV>
<H4><A name="2.0-beta-Samplesdocumentation-CheckingtheScribelogoutput"></A>Checking the Scribe log output</H4>
<P>After running LoggingTest, you should find the logged string "Hello There" in file sample/sample_current under your Scribe log store directory.</P>
<P>If you've used the example1.conf Scribe configuration from the Scribe examples <A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANYxDOCx2x&title=4&linkCreation=true&fromPageId=23338770" class="createlink">4</A>, you should find your log message in /tmp/scribetest/sample/sample_current.</P>
<P><A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANYxDOCx2x&title=1&linkCreation=true&fromPageId=23338770" class="createlink">1</A> <A href="http://wiki.github.com/facebook/scribe/" class="external-link" rel="nofollow">http://wiki.github.com/facebook/scribe/</A><BR>
<A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANYxDOCx2x&title=2&linkCreation=true&fromPageId=23338770" class="createlink">2</A> <A href="http://svn.apache.org/repos/asf/cassandra/trunk/lib/libthrift-r917130.jar" class="external-link" rel="nofollow">http://svn.apache.org/repos/asf/cassandra/trunk/lib/libthrift-r917130.jar</A><BR>
<A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANYxDOCx2x&title=3&linkCreation=true&fromPageId=23338770" class="createlink">3</A> <A href="http://github.com/facebook/scribe/blob/master/examples/README" class="external-link" rel="nofollow">http://github.com/facebook/scribe/blob/master/examples/README</A><BR>
<A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANYxDOCx2x&title=4&linkCreation=true&fromPageId=23338770" class="createlink">4</A> <A href="http://github.com/facebook/scribe/blob/master/examples/example1.conf" class="external-link" rel="nofollow">http://github.com/facebook/scribe/blob/master/examples/example1.conf</A></P>
<H3><A name="2.0-beta-Samplesdocumentation-mavenosgijunit"></A>maven-osgi-junit</H3>
<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><B>TODO</B><BR><FONT color="#000000">Understand and Document</FONT></TD></TR></TABLE></DIV>
<H4><A name="2.0-beta-Samplesdocumentation-calculatorosgi"></A>calculator-osgi</H4>
<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><B>TODO</B><BR><FONT color="#000000">Understand and Document</FONT></TD></TR></TABLE></DIV>
<H4><A name="2.0-beta-Samplesdocumentation-calculatorrestosgi"></A>calculator-rest-osgi</H4>
<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><B>TODO</B><BR><FONT color="#000000">Understand and Document</FONT></TD></TR></TABLE></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-scaclient"></A>sca-client</H3>
<P>Samples that demonstrate the OASIS defined SCA Client API being used in simple Java applications to access SCA components running in the domain.</P>
<H4><A name="2.0-beta-Samplesdocumentation-calculatorscaclient"></A>calculator-scaclient</H4>
<P>Disabled in this Beta1 release pending some up-coming changes in <BR>
the way that domains are addressed and accessed.</P>
<H4><A name="2.0-beta-Samplesdocumentation-helloworldscaclient"></A>helloworld-scaclient</H4>
<P>Disabled in this Beta1 release pending some up-coming changes in <BR>
the way that domains are addressed and accessed.</P>
<H2><A name="2.0-beta-Samplesdocumentation-runningtuscany"></A>running-tuscany</H2>
<P>Running something in Tuscany requires one or more contributions, and a method of launching the contributions to make the services they provide available. The sections below describes various means of launching contributions with the Tuscany SCA Java runtime. It's not important that you try all of these but they show you what's possible and hopefully show you how to use Tuscany in an environment that makes sense to you.</P>
<P>Some of the running-tuscany sub-directories just contain a README that gives you instructions. For example, maven just tells you how to configure and run contributions using the maven-tuscany-plugin. Others contain code. For example, embedded-jse contains simple Java launchers that show you how to start some of the sample contributions from a Java program.</P>
<P>The sample contributions in getting-started and learning-more should work regardless of which approach you adopt. However some approaches, like embedded-jse, don't have launchers for every single sample contribution.</P>
<H3><A name="2.0-beta-Samplesdocumentation-commandline"></A>command-line</H3>
<P>You can execute a sample contribution from the command line on Windows or Linux.</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><B>TODO</B><BR>Waiting for tuscany.bat to be reworked before correcting</TD></TR></TABLE></DIV>
<P>To execute a sample contribution from the command line</P>
<P>on Windows, from a command prompt in the samples directory, run the command ...</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
<tuscany_din_distro>\bin\tuscany.bat <SPAN class="code-quote">"contribution-name"</SPAN>
</PRE>
</DIV></DIV>
<P>for example</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd <tuscany_din_distro>\samples\learning-more\binding-sca\calculator-contribution
<tuscany_din_distro>\bin\tuscany.bat sample-binding-sca-calculator-contribution.jar
</PRE>
</DIV></DIV>
<P>or on *nix platforms, from a shell prompt in the samples directory, run the command ...</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd <tuscany_din_distro>/samples/learning-more/binding-sca/calculator-contribution
<tuscany_din_distro>/bin/tuscany.sh sample-binding-sca-calculator-contribution.jar
</PRE>
</DIV></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-eclipse"></A>eclipse</H3>
<P>To import sample contributions into Eclipse you first need to import the Tuscany runtime. You then need to import the sample contribution into Eclipse as a project. Instructions for doing both of these things can be found here</P>
<P><A href="http://tuscany.apache.org/import-existing-tuscany-sca-projects-into-eclipse.html" class="external-link" rel="nofollow">http://tuscany.apache.org/import-existing-tuscany-sca-projects-into-eclipse.html</A></P>
<P>Note. these instructions refer to our 1.x code base but it holds true for our 2.x code base.</P>
<P>Once you have a contribution imported into Eclipse and cleanly compiling against the Tuscany runtime jars you probably want to be able to run and debug it. The easiest way to do this is with a simple Java launcher. If you import the running-tuscany/embedded-jse project into Eclipse you'll see a number of such launcher programs which you can copy to launch the contribution(s) of your choice. Alternatively you can add a JUnit test case to the contribution that starts Tuscany and launches the contribution. See maven-junit as an example of how to do this.</P>
<H3><A name="2.0-beta-Samplesdocumentation-embeddedjse"></A>embedded-jse</H3>
<P>This directory contains sample java launchers for the some of the Tuscany sample contributions from the learning-more directory. It shows you how to embed the Tuscany runtime in a Java program. To make you're own launchers simply copy and existing one and change the details of the contribution being loaded. You'll note that the same launcher code is used inside the contribution unit test demonstrated by maven-junit.</P>
<DIV class="panel" style="background-color: pink;border-width: 1px;"><DIV class="panelContent" style="background-color: pink;">
<P>To use the sample JSE launchers with ant execute the command</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
ant <contributionname>
</PRE>
</DIV></DIV>
<P>where <contributionname> is one of the targets in the provided build.xml file</P>
</DIV></DIV>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>To use the sample JSE launchers from Maven do the following:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd embedded-jse
mvn
</PRE>
</DIV></DIV>
<P>This runs a JUnit test case that runs all the launchers in turn.</P>
</DIV></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-embeddedosgi"></A>embedded-osgi</H3>
<P>The Tuscany runtime jars will also work within an OSGi enviroment. If you want to load them into a vanilla OSGi environment see the osgi directory. If you want Tuscany to create an OSGi environment for you this directory contains launchers that do just that.</P>
<DIV class="panel" style="background-color: pink;border-width: 1px;"><DIV class="panelContent" style="background-color: pink;">
<P>To use the sample OSGI launchers with ant do the following:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd embedded-osgi
ant <contributionname>
</PRE>
</DIV></DIV>
<P>where <contributionname> is one of the targets in the build.xml file</P>
</DIV></DIV>
<DIV class="panel" style="background-color: silver;border-width: 1px;"><DIV class="panelContent" style="background-color: silver;">
<P>To use the sample JSE launchers from Maven do the following:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd embedded-osgi
mvn
</PRE>
</DIV></DIV>
<P>This runs a JUnit test case that runs all the launchers in turn.</P>
</DIV></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-maven"></A>maven</H3>
<P>Maven can be used to install contributions. Tuscany has a special plugin (maven-tuscany-plugin) that makes this happen. Look for contributions that have the following configuration in their pom.xml file:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
<plugin>
<groupId>org.apache.tuscany.maven.plugins</groupId>
<artifactId>maven-tuscany-plugin</artifactId>
<version>2.0-SNAPSHOT</version>
</plugin>
</PRE>
</DIV></DIV>
<P>For contributions that have this, for example, learning-more/binding-sca/contribution-calculator, do the following</P>
<P>cd samples/learning-more/binding-sca/contribution-calculator<BR>
mvn tuscany:run</P>
<P>This will install the contribution in the Tuscany runtime, start the composite it contains, and then wait. At this point you can use<BR>
other clients to send messages to services that the running SCA applcation exposes, for example, try learning-more/sca-client/calculator-scaclient.</P>
<H3><A name="2.0-beta-Samplesdocumentation-mavenjunit"></A>maven-junit</H3>
<P>Maven will run JUnit tests found in a module's src/test/java directory automatically. If you use embedded-jse style code in the JUnit test to install a contribution and start any composites it contains they you can unit test your contributions. This directory contains a contribution and a unit test which installs the contribution using very similar code to that found in embedded-jse.</P>
<P>To run the contributions unit test do the following:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd maven-junit/calculator-contribution
mvn
</PRE>
</DIV></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-mavenjunitosgi"></A>maven-junit-osgi</H3>
<P>You can use a special Tuscany Maven plugin (maven-osgi-junit-plugin) to unit test contributions in a JUnit environment. This relies on adding some configuration to the Maven pom.xml. For example, if you look in maven-junit-osgi/calculator-osgi you'll see:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
<plugin>
<groupId>org.apache.tuscany.maven.plugins</groupId>
<artifactId>maven-osgi-junit-plugin</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-launcher-equinox</artifactId>
<version>${pom.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>osgi-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemProperties>
<property>
<name>osgi.configuration.area</name>
<value>${project.build.directory}/equinox</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</PRE>
</DIV></DIV>
<P>This configures the maven-osgi-junit-plugin to use the tuscany-node-launcher-equinox to install the contribution represented by the calculator-osgi directory. As an alternative to this configuration you could use the contents of tuscany-node-launcher-equinox directly in your JUnit test to launch the Tuscany runtime using OSGi.</P>
<P>To run the contributions unit test do the following:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd maven-junit/calculator-contribution
mvn
</PRE>
</DIV></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-osgi"></A>osgi</H3>
<P>The Tuscany runtime can be run in a vanilla OSGi container such as Equinox. To do this you have to:</P>
<UL class="alternate" type="square">
<LI>launch the OSGi container itself</LI>
<LI>load the Tuscany runtime bundles (all our jars are bundles) into the container</LI>
<LI>install a contribution packaged as an OSGi bundle</LI>
</UL>
<P>For example, to install a contribution in Equinox do the following</P>
<P>On Windows, run</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
java -jar ..\..\..\modules\osgi-3.5.0-v20090520.jar -configuration ..\..\..\features\configuration -clean -console
</PRE>
</DIV></DIV>
<P>On *Unix, run</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
java -jar ../../../modules/osgi-3.5.0-v20090520.jar -configuration ../../../features/configuration -clean -console
</PRE>
</DIV></DIV>
<P>You should see the osgi console:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
osgi>
osgi> Jun 22, 2009 1:32:27 PM org.apache.tuscany.sca.extensibility.equinox.EquinoxServiceDiscoveryActivator start
INFO: Equinox-based service discoverer is now configured.
</PRE>
</DIV></DIV>
<P>You can run "ss" command under the osgi> to see the status of the bundles.</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
osgi> ss
</PRE>
</DIV></DIV>
<P>Then you can install and start contributions as bundles by doing the following:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
osgi> install file:./path/to/<contribution_bundle.jar>
</PRE>
</DIV></DIV>
<P>Note that <contribution_bundle.jar> will need an activator in order to register the bundle as a SCA contribution</P>
<P>Running on Felix</P>
<P>See <A href="http://tuscany.apache.org/documentation-2x/running-tuscany-sca-2x-with-equinox-and-felix.html" class="external-link" rel="nofollow">http://tuscany.apache.org/documentation-2x/running-tuscany-sca-2x-with-equinox-and-felix.html</A></P>
<H3><A name="2.0-beta-Samplesdocumentation-shell"></A>shell</H3>
<P>This directory contains a sample shell program supporting simple commands to start and stop SCA composites.</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><B>TODO</B><BR>We currently have two similar approaches available (see command-line). We need to merge the two together.</TD></TR></TABLE></DIV>
<P>To build the sample shell do this:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
mvn install
</PRE>
</DIV></DIV>
<P>To run it:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
./sca
</PRE>
</DIV></DIV>
<P>at the prompt:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
start myNode ../../applications/store/target/sample-store.jar
</PRE>
</DIV></DIV>
<P>or:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
start myNode http:<SPAN class="code-comment">//people.apache.org/~jsdelfino/tuscany/java/test/sample-store.jar</SPAN>
</PRE>
</DIV></DIV>
<P>also try:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
status
stop myNode
bye
</PRE>
</DIV></DIV>
<P>Starting and stopping composites is pretty fast. To see that, try the following<BR>
two scripts, which start/stop the sample store composite 10 times.</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
./sca <scripts/test.txt
</PRE>
</DIV></DIV>
<P>or</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
./sca <scripts/test-remote.txt
</PRE>
</DIV></DIV>
<P>The shell can also run as a Webapp. To try it install target/scashell.war in<BR>
a Web container, point your Web browser to <A href="http://localhost:8080/scashell" class="external-link" rel="nofollow">http://localhost:8080/scashell</A><BR>
and try the links on that page.</P>
<H3><A name="2.0-beta-Samplesdocumentation-webapp"></A>webapp</H3>
<P>Tuscany can be embedded inside a webapp alongside one or more SCA contributions. To execute sample webapp based contributions (contributions that have webapp at the end of their name) you can build the contribution using maven and then copy the resulting war file to your container of choice</P>
<P>For example, for binding-jsonrpc/contribution-calculator-webapp, do the following:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd samples/binding-jsonrpc/contribution-calculator-webapp
mvn
cp target/sample-contribution-binding-jsonrpc-calculator-webapp.war <your_container_deployment-dir>
</PRE>
</DIV></DIV>
<P>As an alternative, sample webapp based contributions can be run within Jetty directly from Maven, look for webapp contributions that have the following configuration in their pom.xml file:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.18</version>
</plugin>
</PRE>
</DIV></DIV>
<P>For contributions that have this, for example, binding-jsonrpc/contribution-calculator-webapp, do the following</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd samples/binding-sca/contribution-calculator
mvn jetty:run
</PRE>
</DIV></DIV>
<P>This will launch the contribution in the Jetty runtime and then wait. At this point you can use HTTP clients to send messages to services that the running SCA applcation exposes. For this example try pointing your browser at:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
http:<SPAN class="code-comment">//localhost:8080/sample-binding-jsonrpc-calculator-webapp/</SPAN>
</PRE>
</DIV></DIV>
<H2><A name="2.0-beta-Samplesdocumentation-extendingtuscany"></A>extending-tuscany</H2>
<H3><A name="2.0-beta-Samplesdocumentation-bindingextension"></A>binding-extension</H3>
<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><B>TODO</B><BR><FONT color="#000000">Understand and Document</FONT></TD></TR></TABLE></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-implementationextension"></A>implementation-extension</H3>
<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><B>TODO</B><BR><FONT color="#000000">Understand and Document</FONT></TD></TR></TABLE></DIV>
<H2><A name="2.0-beta-Samplesdocumentation-applications"></A>applications</H2>
<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><B>TODO</B><BR><FONT color="#000000">Understand and Document</FONT></TD></TR></TABLE></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-store"></A>store</H3>
<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><B>TODO</B><BR><FONT color="#000000">Understand and Document</FONT></TD></TR></TABLE></DIV>
<H3><A name="2.0-beta-Samplesdocumentation-storewebapp"></A>store-webapp</H3>
<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><B>TODO</B><BR><FONT color="#000000">Understand and Document</FONT></TD></TR></TABLE></DIV>
</DIV>
</DIV>
</DIV>
</TD>
</TR>
</TABLE>
<!-- footer -->
<TABLE border="0" cellpadding="2" cellspacing="0" width="100%">
<TR>
<TD align="left" valign="middle" class="footer">
<IMG src="http://static.delicious.com/img/delicious.small.gif" height="10" width="10" alt="Delicious">
<A href="http://delicious.com/save" onclick="window.open('http://delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title),'delicious','toolbar=no,width=550,height=550'); return false;">Bookmark this on Delicious</A>
<IMG src="http://digg.com/img/badges/16x16-digg-guy.gif" width="16" height="16" alt="Digg!">
<A href="" onclick="window.open('http://digg.com/submit?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'&topic=programming');">Digg this</A>
<!-- Slicker, but no text
<script type="text/javascript">
digg_skin = 'icon';
digg_window = 'new';
digg_title = 'Apache Geronimo v2.2 Documentation : 2.0- beta- Samples documentation';
digg_topic = 'programming';
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
-->
</TD>
<TD align="right" valign="middle" class="footer">
<A href="http://cwiki.apache.org/GMOxPMGT/geronimo-privacy-policy.html">Privacy Policy</A> -
Copyright © 2003-2010, The Apache Software Foundation, Licensed under <A href="http://www.apache.org/licenses/LICENSE-2.0">ASL 2.0.</A>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
|