summaryrefslogtreecommitdiffstats
path: root/site/trunk/site-publish/documentation-2x/sca-java-runtime-overview.html
blob: 9a2dc55c164163070389d2350bcdeb27a512915a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
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
<!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>SCA Java Runtime Overview : 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> &gt;&nbsp;<A href="index.html" title="Apache Tuscany Docs 2.x">Apache Tuscany Docs 2.x</A>&nbsp;&gt;&nbsp;<A href="index.html" title="Index">Index</A>&nbsp;&gt;&nbsp;<A href="development-guides.html" title="Development Guides">Development Guides</A>&nbsp;&gt;&nbsp;<A href="" title="SCA Java Runtime Overview">SCA Java Runtime Overview</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%">
                &nbsp;<A href="index.html" title="Apache Tuscany Docs 2.x">Apache Tuscany Docs 2.x</A>&nbsp;&gt;&nbsp;<A href="index.html" title="Index">Index</A>&nbsp;&gt;&nbsp;<A href="development-guides.html" title="Development Guides">Development Guides</A>&nbsp;&gt;&nbsp;<A href="" title="SCA Java Runtime Overview">SCA Java Runtime Overview</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>&nbsp;&nbsp;
            </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">SCA Java Runtime Overview</DIV>

        <DIV class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;">
<!-- -->         
            <A href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=5964723">
            <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=5964723">Edit Page</A>
          &nbsp;
          <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>
          &nbsp;
          <A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANYxDOCx2x&fromPageId=5964723">
            <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=5964723">Add Page</A>
          &nbsp;
          <A href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=TUSCANYxDOCx2x&fromPageId=5964723">
            <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=5964723">Add News</A>
<!-- -->	 
        </DIV>
      </DIV>

      <DIV class="pagecontent">
        <DIV class="wiki-content">
          <H1><A name="SCAJavaRuntimeOverview-SoftwareOrganization"></A>Software Organization</H1>
<H3><A name="SCAJavaRuntimeOverview-SourceCodeLocations"></A>Source Code Locations</H3>
<P>If you take a Tuscany SCA Java source distribution or look in the Tuscany subversion repository (<A href="http://svn.apache.org/repos/asf/tuscany/java/sca/" class="external-link" rel="nofollow">http://svn.apache.org/repos/asf/tuscany/java/sca/</A>) you'll see the code layed out as follows:</P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
BUILDING
CHANGES
LICENSE
NOTICE
README
RELEASE_NOTES

distribution           - the code that defines and build Tuscany distributions
features               - Maven projects that collect together Tuscany modules 
maven         
  archetypes           - Maven archetypes <SPAN class="code-keyword">for</SPAN> creating Tuscany project templates
  maven-tuscany-plugin - ???
modules                - the source code <SPAN class="code-keyword">for</SPAN> the runtime and the SCA extensions
samples                - project samples
testing
  itest                - project integration tests
  compliance-tests     - OASIS compliance tests
pom.xml  
</PRE>
</DIV></DIV>

<P>There is some related source code  that's worth mentioning up front. Firstly the project Maven build relies on a set of Maven plugins that have been written specifically for Tuscany. They can also be found in the Tuscany subversion repository (<A href="http://svn.apache.org/repos/asf/tuscany/maven-plugins/trunk/" class="external-link" rel="nofollow">http://svn.apache.org/repos/asf/tuscany/maven-plugins/trunk/</A>) and are as follows:</P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
maven-bundle-plugin     - Creates Tuscany OSGi bundles based on the Tuscany modules and their dependencies
                          also generates eclipse PDE projects <SPAN class="code-keyword">for</SPAN> Tuscany modules
maven-eclipse-compiler  - Compiles using the Eclipse compiler and performs OSGi validation
maven-java2wsdl-plugin  - TBD
maven-osgi-junit        - Runs Junit tests in an OSGi environment
maven-tuscany-plugin    - TBD
maven-wsdl2java-plugin  - TBD
</PRE>
</DIV></DIV>

<P>Secondly there are a set of tests that the OASIS SCA specifications define called otests. These test the Tuscany SCA runtime for compliance with the specifications. The tests themselves are stored in the OASIS subversion system (<A href="http://tools.oasis-open.org/version-control/browse/" class="external-link" rel="nofollow">http://tools.oasis-open.org/version-control/browse/</A>). Tuscany has a set of modules that retrieve these tests automatically and configure the Tuscany environment to run them (<A href="http://svn.apache.org/repos/asf/tuscany/otest/" class="external-link" rel="nofollow">http://svn.apache.org/repos/asf/tuscany/otest/</A>) as follows:</P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
README
build.xml                    - Ant utility script
pom.xml
sca-assembly                 - Generated automatically by svn externals when you check <SPAN class="code-keyword">this</SPAN> directory out
sca-java-caa                 - Generated automatically by svn externals when you check <SPAN class="code-keyword">this</SPAN> directory out
sca-java-ci                  - Generated automatically by svn externals when you check <SPAN class="code-keyword">this</SPAN> directory out
sca-policy                   - Generated automatically by svn externals when you check <SPAN class="code-keyword">this</SPAN> directory out
tuscany-java-caa-test-runner - Java Common Annotations and APIs test runner
tuscany-java-ci-test-runner  - Java Component Implementation test runner
tuscany-policy-test-runner   - Policy test runner
tuscany-test-runner          - Assembly test runner
</PRE>
</DIV></DIV>

<H3><A name="SCAJavaRuntimeOverview-SCAJavaModules"></A>SCA Java Modules</H3>
<P>All of the functional code in Tuscany Java SCA can be found under the modules directory. There are a lot of sub-directories here but they basically fall into one of two categories, core function or extensions. We are using the term extension here in the sense that the SCA Assembly specification talks about and extension model You always have to have the core functions but most of the extensions are optional (we say most here because without some of the basic extensions the runtime won't do anything)  Finding extension modules is easy. Modules that start with the following words are extensions.</P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
binding
databinding
implementation
<SPAN class="code-keyword">interface</SPAN>
policy
</PRE>
</DIV></DIV>

<P>As you can see SCA extensions relate to the extensible parts of the SCA composite file. For example, if you want to use &lt;binding.jms/&gt; in you SCA composite files then you need to include the Tuscany modules for this extension in you installation. In this case that would mean the modules binding-jms and binding-jms-runtime. </P>

<P>All of the other modules in the modules directory are core modules and are generally required to be present in you Tuscany runtime installation. The use of the word &quot;generally&quot; here sounds a bit vague. This is because the Tuscany runtime itself is based on an extensibility mechanism which means that many parts of the runtime (as well as the SCA extensions) are pluggable. In this way, for example, different hosting environments can be supported. Well talk about runtime extensibility further down this article but for the time being consider all core modules to be mandatory. </P>

<H1><A name="SCAJavaRuntimeOverview-RuntimeBuildingBlocks"></A>Runtime Building Blocks</H1>

<P>As you may have realized the Tuscany SCA Java runtime is just a Java program that, once started listens for incoming messages (via SCA component services) and, sometimes responds with outgoing messages (via SCA component references).</P>

<P><SPAN class="image-wrap" style="display: block; text-align: center"><IMG src="sca-java-runtime-overview.data/tuscany-runtime-context.png" style="border: 0px solid black"></SPAN></P>

<P>The runtime then provides the context within which SCA composite applications run. If we crack open the Tuscany Runtime box we see the following structure.</P>

<P><SPAN class="image-wrap" style="display: block; text-align: center"><IMG src="sca-java-runtime-overview.data/tuscany-runtime-structure.png" style="border: 0px solid black"></SPAN></P>

<P>We'll take a high level look at these different blocks in turn starting with Core.</P>

<H2><A name="SCAJavaRuntimeOverview-TuscanyCore"></A>Tuscany Core</H2>
<P>The Tuscany core is made up of several modules that provide basic runtime and extensibility support to the extensions that provide the real SCA functions. If you look in the modules directory of a Tuscany distribtuion (2.0-M4 at the time of writing - this list may change in subsequent releases) the modules that make up the Tuscany core are as follows:</P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
assembly                - The in-memory model of an OASIS SCA composite application (sometimes called an assembly)
assembly-xml            - The Tuscany processors that translate to and from XML and the in-memory model
assembly-xsd            - The schema used to validate the contents of various SCA files, e.g. the composite file
builder                 - <SPAN class="code-object">Process</SPAN> the in-memory model to build a complete SCA application representation
common-java             - General Java utilities
common-xml              - General XML utilities
contribution            - Read and process SCA contributions
core                    - The core Tuscany SCA Java runtime functions
core-databinding        - The core databinding functions
core-spi                - The Java interfaces that extension developers use to create and register extensions
databinding             - Builds on the core databinding functions to provide features common to all databindings???
deployment              - Loads the runtime and orchestrates the loading of SCA contributions 
extensibility           - Reads META-INF/services files and manages Tuscany extensibility
extensibility-equinox   - Manages Tuscany extensibility in an OSGi environment
host-http               - Base interfaces <SPAN class="code-keyword">for</SPAN> providing integration with a servlet container
<SPAN class="code-keyword">interface</SPAN>-java          - Java <SPAN class="code-keyword">interface</SPAN> model and instrospection
<SPAN class="code-keyword">interface</SPAN>-java-jaxws    - <SPAN class="code-object">Process</SPAN> JAX-WS annotations from a Java <SPAN class="code-keyword">interface</SPAN>
<SPAN class="code-keyword">interface</SPAN>-wsdl          - WSDL <SPAN class="code-keyword">interface</SPAN> model 
launcher                - Command line Tuscany runtime launcher
monitor                 - Collects errors as they occur in the Tuscany runtime
node-api                - API <SPAN class="code-keyword">for</SPAN> accessing an embedded Tuscany node (A node loads/runs contributions)
node-impl               - The JSE implementation <SPAN class="code-keyword">for</SPAN> the node API
node-impl-osgi          - The OSGi implementation <SPAN class="code-keyword">for</SPAN> the node API ????
node-launcher           - The JSE based command line launcher <SPAN class="code-keyword">for</SPAN> a Tuscany node
node-launcher-equinox   - The OSGi based command line launcher <SPAN class="code-keyword">for</SPAN> a Tuscany node
sca-api                 - The OASIS defined SCA API
sca-client-impl         - The Tuscany implementation of the OASIS defined SCA client
xsd                     - The in-memory model of an XSD file, along with the processors to read it
</PRE>
</DIV></DIV>

<P>We have already said that there are a set of extensions that, while in theory they are are optional, are in practice required to do anything useful. These are are follows:</P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
binding-sca-runtime          - The implementation <SPAN class="code-keyword">for</SPAN> the local version of binding.sca
binding-sca-axis2-runtime    - The implementation <SPAN class="code-keyword">for</SPAN> the remote version of binding.sca based on web services
binding-ws                   - The in-memory model <SPAN class="code-keyword">for</SPAN> binding.ws 
binding-ws-axis2             - TBD - should be called runtime
binding-ws-axis2-policy      - TBD
binding-ws-wsdlgen           - TBD
databinding-axiom            - The databinding <SPAN class="code-keyword">for</SPAN> Axiom 
databinding-jaxb             - The databinding <SPAN class="code-keyword">for</SPAN> JAXB
databinding-jaxb-axiom       - TBD
endpoint-tribes              - The distributed endpoint registry based on tribes
host-jetty                   - Allows Jetty to be started automatically to support HTTP based bindings
host-webapp                  - Allows Tuscany to be embedded in a WAR
implementation-java          - The in-memory model <SPAN class="code-keyword">for</SPAN> implementation.java
implementation-java-runtime  - The runtime artifacts <SPAN class="code-keyword">for</SPAN> implementation.java
</PRE>
</DIV></DIV>

<P>The rest of the modules are optional and can be omitted. In practice the easiest way to get started is to keep all of the modules. By default this is what you get when you install the binding distribution. In the future you're free to remove the extensions you don't use to reduce the size of the installation. The Tuscany project may even make releases in the future that package sets of extensions targeted at particular types of application. </P>

<H2><A name="SCAJavaRuntimeOverview-TuscanySCAAPI"></A>Tuscany SCA API</H2>

<P>The Tuscany SCA API is used by SCA applications to access various information from the runtime. It's not mandatory to use the API but it can be useful in some circumstances. </P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
launcher  
  Tuscany API                          
node-api   
  Tuscany API             
node-launcher           
  Tuscany API
node-launcher-equinox   
  Tuscany API 
sca-api    
  OASIS API             
sca-client-impl        
  OASIS API
</PRE>
</DIV></DIV>

<H2><A name="SCAJavaRuntimeOverview-TuscanySPI"></A>Tuscany SPI</H2>

<P>The Tuscany SPI is generally used for building extensions. Extensions come in two flavours SCA extensions, like implementation and binding types, and Tuscany runtime extensions, like builders and binders. Both of these types of extension are discussed a little later in this article. The modules and module packages that describe the Tuscany SPI are as follows:</P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
assembly    
  org.apache.tuscany.sca.assembly
  org.apache.tuscany.sca.definitions
  org.apache.tuscany.sca.interfacedef
  org.apache.tuscany.sca.policy
assembly-xsd            
  sca-core-1.1.xsd
  sca-policy-1.1.xsd
contribution        
  org.apache.tuscany.sca.contribution
  org.apache.tuscany.sca.contribution.java
  org.apache.tuscany.sca.contribution.namespace
  org.apache.tuscany.sca.contribution.processor
  org.apache.tuscany.sca.contribution.resolver
  org.apache.tuscany.sca.contribution.scanner
core        
  org.apache.tuscany.sca.core.assembly    
  org.apache.tuscany.sca.core.context
  org.apache.tuscany.sca.core.factory
  org.apache.tuscany.sca.core.invocation
  org.apache.tuscany.sca.core.scope
core-databinding   
  org.apache.tuscany.sca.core.databinding.processor
core-spi (why not extension SPI?)
  org.apache.tuscany.sca.context
  org.apache.tuscany.sca.invocation
  org.apache.tuscany.sca.provider
  org.apache.tuscany.sca.runtime
  org.apache.tuscany.sca.work
databinding             
  org.apache.tuscany.sca.databinding
  org.apache.tuscany.sca.databinding.annotation
  org.apache.tuscany.sca.databinding.javabeans
  org.apache.tuscany.sca.databinding.util
  org.apache.tuscany.sca.databinding.xml
deployment            
  org.apache.tuscany.sca.deployment
extensibility  
  org.apache.tuscany.sca.core
  org.apache.tuscany.sca.extensibility            
monitor   
  org.apache.tuscany.sca.monitor              
xsd                    
  org.apache.tuscany.sca.xsd
</PRE>
</DIV></DIV>

<P>More detail on extension points and SPIs can be found <A href="tuscany-2x-extensibility-and-spis.html" title="Tuscany 2.x Extensibility and SPIs">here </A></P>

<H2><A name="SCAJavaRuntimeOverview-TuscanyRuntimeExtensibilityandExtensions"></A>Tuscany Runtime Extensibility and Extensions</H2>

<P>As we've already mentioned the Tuscany core doesn't do much on it's own apart from providing basic features and support the plugging in of extensions which do the real work. Extensions come in two forms. Extension types defined by the OASIS SCA specifications and those that are particular to Tuscany. In the first category are the extension types defined by the OASIS Assembly specification:</P>

<UL class="alternate" type="square">
	<LI>interface</LI>
	<LI>implementation</LI>
	<LI>binding</LI>
	<LI>import</LI>
	<LI>export</LI>
</UL>


<P>The Tuscany runtime defines it's own extension types which exploit the core runtimes extensibility features</P>

<UL class="alternate" type="square">
	<LI>policy</LI>
	<LI>databinding</LI>
	<LI>contribution</LI>
	<LI>host</LI>
</UL>


<P>The Tuscany extensibility framework is based on two simple ideas. Firstly that the Tuscany runtime provides extension points into which extension functions can be plugged. Secondly that the the Java META-INF/services mechanism provides a way for extension developers to register new extension functions with these extension points. </P>

<P>The Tuscany extensibility framework exposes quite a few extension points, for example,(o.a.t.s = org.apache.tuscany) </P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint
  org.apache.tuscany.sca.assembly.builder.BindingBuilder
  org.apache.tuscany.sca.assembly.builder.CompositeBuilder
  org.apache.tuscany.sca.assembly.builder.ContractBuilder
  org.apache.tuscany.sca.assembly.builder.ImplementationBuilder

org.apache.tuscany.sca.core.FactoryExtensionPoint
  org.apache.tuscany.sca.assembly.AssemblyFactory
  org.apache.tuscany.sca.assembly.SCABindingFactory
  org.apache.tuscany.sca.binding.atom.AtomBindingFactory
  org.apache.tuscany.sca.binding.comet.CometBindingFactory
  org.apache.tuscany.sca.binding.corba.CorbaBindingFactory
  org.apache.tuscany.sca.binding.ejb.EJBBindingFactory
  org.apache.tuscany.sca.binding.http.HTTPBindingFactory
  org.apache.tuscany.sca.binding.jsonp.JSONPBindingFactory
  org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBindingFactory
  org.apache.tuscany.sca.binding.<SPAN class="code-keyword">rest</SPAN>.operationselector.jaxrs.JAXRSOperationSelectorFactory
  org.apache.tuscany.sca.binding.<SPAN class="code-keyword">rest</SPAN>.operationselector.rpc.RPCOperationSelectorFactory
  org.apache.tuscany.sca.binding.<SPAN class="code-keyword">rest</SPAN>.RESTBindingFactory
  org.apache.tuscany.sca.binding.<SPAN class="code-keyword">rest</SPAN>.wireformat.json.JSONWireFormatFactory
  org.apache.tuscany.sca.binding.<SPAN class="code-keyword">rest</SPAN>.wireformat.xml.XMLWireFormatFactory
  org.apache.tuscany.sca.binding.rmi.RMIBindingFactory
  org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory
  org.apache.tuscany.sca.contribution.ContributionFactory
  org.apache.tuscany.sca.contribution.java.JavaImportExportFactory
  org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory
  org.apache.tuscany.sca.contribution.processor.ValidatingXMLInputFactory
  org.apache.tuscany.sca.definitions.DefinitionsFactory
  org.apache.tuscany.sca.implementation.bpel.BPELFactory
  org.apache.tuscany.sca.implementation.java.JavaImplementationFactory
    org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor
    org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor
  org.apache.tuscany.sca.implementation.jaxrs.JAXRSImplementationFactory
  org.apache.tuscany.sca.implementation.script.ScriptImplementationFactory
  org.apache.tuscany.sca.implementation.web.WebImplementationFactory
  org.apache.tuscany.sca.implementation.widget.WidgetImplementationFactory
  org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory
  org.apache.tuscany.sca.invocation.MessageFactory
  org.apache.tuscany.sca.node.configuration.NodeConfigurationFactory
  org.apache.tuscany.sca.policy.PolicyFactory

org.apache.tuscany.sca.context.ContextFactoryExtensionPoint
  org.apache.tuscany.sca.context.ComponentContextFactory
  org.apache.tuscany.sca.context.PropertyValueFactory
  org.apache.tuscany.sca.context.RequestContextFactory

org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint
  org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor

org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint
  org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor

org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint
  org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor

org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint
  org.apache.tuscany.sca.contribution.processor.ValidationSchema

org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint
  org.apache.tuscany.sca.contribution.resolver.ModelResolver

org.apache.tuscany.sca.contribution.scanner.ContributionScannerExtensionPoint

org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint

org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint
  org.apache.tuscany.sca.core.ModuleActivator

org.apache.tuscany.sca.databinding.DataBindingExtensionPoint
  org.apache.tuscany.sca.databinding.DataBinding

org.apache.tuscany.sca.databinding.jaxb.XMLAdapterExtensionPoint

org.apache.tuscany.sca.databinding.TransformerExtensionPoint
  org.apache.tuscany.sca.databinding.PullTransformer
  org.apache.tuscany.sca.databinding.PushTransformer

org.apache.tuscany.sca.definitions.xml.DefinitionsExtensionPoint
  org.apache.tuscany.sca.definitions.xml.Definitions

org.apache.tuscany.sca.host.corba.CorbaHostExtensionPoint

org.apache.tuscany.sca.host.http.ServletHostExtensionPoint
  org.apache.tuscany.sca.host.http.ServletHost

org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory

org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint
  org.apache.tuscany.sca.provider.BindingProviderFactory
  org.apache.tuscany.sca.provider.ImplementationProviderFactory
  org.apache.tuscany.sca.provider.PolicyProviderFactory
  org.apache.tuscany.sca.provider.WireFormatProviderFactory
  org.apache.tuscany.sca.provider.OperationSelectorProviderFactory

org.apache.tuscany.sca.runtime.DomainRegistryFactoryExtensionPoint
  org.apache.tuscany.sca.runtime.DomainRegistryFactory

org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint
  org.apache.tuscany.sca.runtime.RuntimeWireProcessor

org.apache.tuscany.sca.core.UtilityExtensionPoint
  org.apache.tuscany.sca.databinding.Mediator
  org.apache.tuscany.sca.databinding.SimpleTypeMapper
  org.apache.tuscany.sca.core.scope.ScopeRegistry
  org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper
  org.apache.tuscany.sca.deployment.Deployer
  org.apache.tuscany.sca.interfacedef.FaultExceptionMapper
  org.apache.tuscany.sca.interfacedef.InterfaceContractMapper
  org.apache.tuscany.sca.monitor.MonitorFactory
  org.apache.tuscany.sca.runtime.CompositeActivator
  org.apache.tuscany.sca.runtime.EndpointReferenceBinder
  org.apache.tuscany.sca.runtime.EndpointSerializer
  org.apache.tuscany.sca.runtime.RuntimeProperties
  org.apache.tuscany.sca.work.WorkScheduler

org.apache.tuscany.sca.node.NodeFactory
org.apache.tuscany.sca.xsd.XSDFactory
</PRE>
</DIV></DIV>

<P>Extension points are usually used in groups. You have to populate the right extension points when implementing say an implementation or a binding extensions. The best way to get a grip on how this works is to look at existing extensions and see what they do. As an example, if you look at how the implementation.java extension registers an extension to read the &lt;implemenation.java/&gt; element from a composite file and turn it into an in-memory Java model you will see the following file:</P>

<P>modules/implementation-java/src/main/resources/META-INF/services/o.a.t.s.contribution.processor.StAXArtifactProcessor</P>

<P>Which contains a single line as follows:</P>

<P>org.apache.tuscany.sca.implementation.java.xml.JavaImplementationProcessor;qname=<A href="http://docs.oasis-open.org/ns/opencsa/sca/200903#implementation.java,model=org.apache.tuscany.sca.implementation.java.JavaImplementation" class="external-link" rel="nofollow">http://docs.oasis-open.org/ns/opencsa/sca/200903#implementation.java,model=org.apache.tuscany.sca.implementation.java.JavaImplementation</A></P>

<P>This tells the Tuscany runtime to register and extension in the StAXArtifactProcessorExtensionPoint with the follwing properties:</P>

<UL class="alternate" type="square">
	<LI>org.apache.tuscany.sca.implementation.java.xml.JavaImplementationProcessor
	<UL class="alternate" type="square">
		<LI>The name of the process that turns the XML &lt;implementation.java&gt; element into a Java model</LI>
	</UL>
	</LI>
	<LI>qname=<A href="http://docs.oasis-open.org/ns/opencsa/sca/200903#implementation.java" class="external-link" rel="nofollow">http://docs.oasis-open.org/ns/opencsa/sca/200903#implementation.java</A>
	<UL class="alternate" type="square">
		<LI>The QName of the &lt;implementation.java/&gt; element to look for in incoming composite files</LI>
	</UL>
	</LI>
	<LI>model=org.apache.tuscany.sca.implementation.java.JavaImplementation
	<UL class="alternate" type="square">
		<LI>The name of the Java model interface that will be used to represent the XML element in-memory.</LI>
	</UL>
	</LI>
</UL>


<P>The full set of extension points required to represent the implementation.java extension is spread across the implemenation-java and implementation-java-runtime modules as follows:</P>

<P>implementation-java</P>

<UL class="alternate" type="square">
	<LI>resources/META-INF/services/
	<UL class="alternate" type="square">
		<LI>o.a.t.s.contribution.processor.StAXArtifactProcessor    - Converts &lt;implementation.java/&gt; to/from JavaImplementation model</LI>
		<LI>o.a.t.s.implementation.java.JavaImplementationFactory   - Creates JavaImplementation model objects</LI>
		<LI>o.a.t.s.implementation.java.introspect.JavaClassVisitor - Registers visitors used to introspect Java classes</LI>
	</UL>
	</LI>
</UL>


<P>implementation-java-runtime</P>

<UL class="alternate" type="square">
	<LI>resources/META-INF/services/
	<UL class="alternate" type="square">
		<LI>o.a.t.s.context.PropertyValueFactory                    - ???</LI>
		<LI>o.a.t.s.definitions.xml.Definitions                     - Registers a definitions.xml file for implementation.java</LI>
		<LI>o.a.t.s.provider.ImplementationProviderFactory          - Creates a runtime provider for implementation.java</LI>
		<LI>o.a.t.s.runtime.RuntimeWireProcessor                    - Registers a processor for endpoint and endpoint reference interceptor chains</LI>
	</UL>
	</LI>
</UL>


<P>All of these extension point entries come together at runtime to allow Tuscany to process implementation.java elements that appear in composite files. </P>

<P>Most extension are packaged in a least two modules. For example the implementation.java extension is provided in the following modules:</P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
modules/implementation-java            - the implementation.java model classes and XML processor
modules/implementation-java-runtime    - the runtime artifacts such as the runtime providers 
</PRE>
</DIV></DIV>

<P>You will currently see extension that don't match this pattern. Often this is because the extension has been moved into 2.x from 1.x but has not been tidied up yet. </P>

<P>More detail on extension points and SPIs can be found <A href="tuscany-2x-extensibility-and-spis.html" title="Tuscany 2.x Extensibility and SPIs">here </A></P>

<H2><A name="SCAJavaRuntimeOverview-Runtimehostingandcontainers%2COSGi%2CJSE%2CWebappsetc."></A>Runtime hosting and containers, OSGi, JSE, Webapps etc.</H2>

<P>The Tuscany runtime will work in the JSE environment and when deployed to an OSGi runtime like Felix or Equinox. Since 1.x we have been through an exercise of refactoring all of the runtime modules into OSGi bundles and providing consistent OSGi manifest files. See (<A href="http://cwiki.apache.org/confluence/display/TUSCANYxDOCx2x/OSGi%20Enablement%20for%20Tuscany%20Runtime" class="external-link" rel="nofollow">http://cwiki.apache.org/confluence/display/TUSCANYxDOCx2x/OSGi+Enablement+for+Tuscany+Runtime</A>) for more details on how we OSGi-igfied the Tuscany runtime. </P>

<P>A launcher is provided to each environment. For JSE use the following class from modules/node-launcher:</P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
org.apache.tuscany.sca.node.launcher.NodeLauncher
</PRE>
</DIV></DIV>

<P>For in OSGi in the Equinoz framework use the following class from modules/node-launcher-equinox:</P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
org.apache.tuscany.sca.node.equinox.launcher.NodeLauncher
</PRE>
</DIV></DIV>

<P>In both cases you use the launcher to create a node instance as follows:</P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
Node node = launcher.createNode(<SPAN class="code-keyword">new</SPAN> Contribution(<SPAN class="code-quote">&quot;contrib1&quot;</SPAN>, <SPAN class="code-quote">&quot;./contrib1.jar&quot;</SPAN>),                    
                                <SPAN class="code-keyword">new</SPAN> Contribution(<SPAN class="code-quote">&quot;contrib2&quot;</SPAN>, <SPAN class="code-quote">&quot;./contrib2.jar&quot;</SPAN>));
node.start();
</PRE>
</DIV></DIV>

<P>When you use the JSE launcher the runtime starts and creates a classpath to load the Tuscany runtime. It uses the following algorithm (coded in the NodeLauncherUtil.runtimeClassloader method) to create the classpath:</P>

<UL class="alternate" type="square">
	<LI>Check to see if the runtime has been added to the current classpath already. If it has don't do anything more</LI>
	<LI>Determine where the launcher class was loaded from and load all the Tuscany classes from that location</LI>
	<LI>Look for an environment variable called TUSCANY_HOME which should point to a distribution. Load jars from there and from lib and modules sub directories</LI>
	<LI>Look for an environment variable called TUSCANY_PATCH which contains a list of Jars to load?</LI>
</UL>


<P>When you use the OSGI launcher the algorithm is similar but of course this time the Tuscany bundles are loaded into the OSGi framework. The node launcher starts up the Equinox framework and then goes looking for bundles to load using the following algorithm:</P>

<UL class="alternate" type="square">
	<LI>TBD</LI>
</UL>


<P>There is no single classpath that gives access to the Tuscany runtime. </P>

<P>TODO what features of the OSGi integration do we need to cover in this overview?<BR>
(In the OSGi runtime special processing is applied to collect together all the META-INF/services information so that it is all accessible without having to delve inside each bundle. See the runtime enviroments section for more information)</P>

<P>You can of course use the launchers from the command line in various guises. </P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
TBD
</PRE>
</DIV></DIV>

<P>TODO - what other ways are we actually going to support for starting the runtime?</P>


<H1><A name="SCAJavaRuntimeOverview-SCADomainandNodes"></A>SCA Domain and Nodes</H1>

<P>The design for the 2.x SCA domain is based on a registry that is accessible from all nodes that are running composites in the domain. There is also the intention to add a management mechanism to allow for central control of the nodes. This is not in place yet. </P>

<P><SPAN class="image-wrap" style="display: block; text-align: center"><IMG src="sca-java-runtime-overview.data/tuscany-domain-overview.png" style="border: 0px solid black"></SPAN></P>

<P>It is out intention to bring the Domain Manager function over from the 1.x code base to provide a central place for adding contributions and assigning them to nodes. This time though it won't be mandatory to run a Domain Manager to have nodes run a distributed SCA application. If you are happy to configure nodes directly and start them individually you are able to do that. The domain manager will just be one of a number of applications that can sit on top of and exploit the distributed registry. </P>

<P>The registry holds information that is common across the domain including:</P>

<UL class="alternate" type="square">
	<LI>available endpoints (the result of specifying a binding on a component services)</LI>
	<LI>policy model</LI>
	<LI>extension type model</LI>
</UL>


<P>The following diagram shows an example of domain data populating the registry and two nodes, in separate JVMs, running separate composites from the SCA application</P>

<P><SPAN class="image-wrap" style="display: block; text-align: center"><IMG src="sca-java-runtime-overview.data/tuscany-domain-registry.png" style="border: 0px solid black"></SPAN></P>

<P>With no domain manager each node is started with a set of contributions. A node reads the contributions and processes deployed composites ready to run. As part of this processing domain level information, such as deployed endpoints and available policies, is published to the registry for other nodes to find. When domain level information is required by a node, for example, when a component reference targets a service running on a different node in the domain, the information can be obtained by looking in the registry. </P>

<P>If a domain manager is present it can pre-process all available contributions and pre-populate the registry as required. This is however not mandatory. </P>

<H1><A name="SCAJavaRuntimeOverview-RuntimeLifecycle"></A>Runtime Lifecycle</H1>
<H2><A name="SCAJavaRuntimeOverview-Create"></A>Create</H2>
<P>Runtime creation is contrilled by the environment in which the runtime is being started. For example, if you are running Tuscany from the runtime then using the node launcher will start the runtime. Alternatively if you are deploying Tuscany embedded in a web app then the runtime will not be started until the WAR file is deployed. See the previous hosting section for more details. </P>
<H2><A name="SCAJavaRuntimeOverview-Read"></A>Read</H2>
<P>When a node is started and configured with the location of a contribution, for example, </P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
Node node = launcher.createNode(<SPAN class="code-keyword">new</SPAN> Contribution(<SPAN class="code-quote">&quot;contrib1&quot;</SPAN>, <SPAN class="code-quote">&quot;./contrib1.jar&quot;</SPAN>),                    
                                <SPAN class="code-keyword">new</SPAN> Contribution(<SPAN class="code-quote">&quot;contrib2&quot;</SPAN>, <SPAN class="code-quote">&quot;./contrib2.jar&quot;</SPAN>));
</PRE>
</DIV></DIV>

<P>the node will look at each contribution and identify all of the aritifacts that it holds. Artifacts can be anything from XML, XSD, WSDL and Java .class files to the SCA .composite files. Once the node knows what artifacts are available in all of its input contributions it will read the composite files. It does this using the extension processors that are provided with each extension. The output of reading the composite file is an in-memory model of the SCA application. This model is used to configured the runtime in later phases. </P>

<H2><A name="SCAJavaRuntimeOverview-Resolve"></A>Resolve</H2>

<P>The in-memory model that results from the read phase will contain a lot of unresolved references. For example, for a component that uses </P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
&lt;implementation.java class=<SPAN class="code-quote">&quot;my.<SPAN class="code-keyword">package</SPAN>.MyClassImpl&quot;</SPAN>/&gt;
</PRE>
</DIV></DIV>
<P>The model knows the name of the class file that will be used to implement the component but it doesn't actually have a reference to that real Java class. These references are resolved in the resolve phase. Again the extension processors are used and this time their resolve method looks through the available contributions, using the import/export relationships, to locate referenced artifacts. </P>

<H2><A name="SCAJavaRuntimeOverview-Build"></A>Build</H2>

<P>Once we get to this stage we have an in-memory model that faithfully matches what was present in the .composite files that are deployed to the node. We now need to build the model to prepare it read for creating the runtime artifacts. There are a number of things that we need to do an primarily the process involves applying the SCA rules to calculate a complete model of the application based on the input composite files. The input composite files don't necessarily contain all of the right details in the right places, for example, imagine a Java component implementation as follows:</P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
@Service(MyClass.class)
class MyClassImpl <SPAN class="code-keyword">implements</SPAN> MyClass {
  @Reference
  <SPAN class="code-keyword">protected</SPAN> MyOtherClass myOtherClassReference;

  <SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">String</SPAN> doSomething(<SPAN class="code-object">String</SPAN> input){
     <SPAN class="code-keyword">return</SPAN> myOtherClassReference.doSomething(input);
  }
}
</PRE>
</DIV></DIV>

<P>We can define an SCA component as follows:</P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
&lt;component name=<SPAN class="code-quote">&quot;MyComponent&quot;</SPAN>&gt;
    &lt;implementation.java class=<SPAN class="code-quote">&quot;my.<SPAN class="code-keyword">package</SPAN>.MyClassImpl&quot;</SPAN>/&gt;
&lt;/component&gt;
</PRE>
</DIV></DIV>

<P>We haven't said that this component defines any services or references but based on the component type implied by the MyClassImpl class we know that it really as a service called &quot;MyClass&quot; and a reference called &quot;myOtherClassReference&quot;. </P>

<H4><A name="SCAJavaRuntimeOverview-Thebuildprocess"></A>The build process</H4>
<P>The build process applies these kinds of rules and enhances the in-memory model with all of the implied information. </P>

<P>The following diagram shows the basic process and the steps that form the process. </P>

<P><SPAN class="image-wrap" style="display: block; text-align: center"><IMG src="sca-java-runtime-overview.data/tuscany-builders.png" style="border: 0px solid black"></SPAN></P>

<P>The steps are as follows:</P>

<OL>
	<LI>Flatten includes - this copies all information from an included composite into the including composite.</LI>
	<LI>Attach policies - policies that specify external attachment are applied to the model here</LI>
	<LI>Calculate composite component types - the use of implementation.composite implies a hierarchical organization of composite and the components that use them as implementations. This step calculates the component type for a composite recursively so that the configuration of the component that the composite implements can be configured correctly</LI>
	<LI>Binding specific building - Sometimes bindings have specific processing to do, for example, the web services binding created WSDL at this stage.</LI>
	<LI>Construct endpoints - endpoints represent the service endpoints that components expose. They are the runtime representation of the service binding configuration.</LI>
	<LI>Construct endpoint references - endpoint references represent the references that components expose. They are the runtime representation of the reference binding configuration.</LI>
	<LI>Compute policy - all of the intents and policy sets should be applied in their correct locations by this stage. This processing computes the policy sets that actually applies and performs policy specific processing</LI>
</OL>


<P>The endpoints and endpoint references provide the runtime connection between the component implementations and the bindings protocols used when communicating with other components. The hold all of the message handling chains in the runtime. </P>

<H4><A name="SCAJavaRuntimeOverview-EndpointsandEndpointReferences"></A>Endpoints and Endpoint References</H4>
<P>The following diagram shows how enpoints and enpoint references relate to the model of the more recognizable component references and services. </P>

<P><SPAN class="image-wrap" style="display: block; text-align: center"><IMG src="sca-java-runtime-overview.data/tuscany-endpoint-structure.png" style="border: 0px solid black"></SPAN></P>

<P>And endpoint maps to a service binding and an endpoint reference maps to a reference target (or a configured reference binding if one is present instead of a target).You will note that endpoints and endpoint references are used to represent callbacks too. An service that specifies a callback gives rise to one or more callback endpoint references. These sit behind the callback proxy at runtime. An endpoint reference that specifies a callback gives rise to a callback endpoint. This endpoint receives callback messages. </P>

<P>Looking in more detail you can see that both endpoints and endpoint references hold the interceptor chains that proces references side (endpoint reference) and service side (endpoint) messages. At the end of the interceptor chain endpoint information is placed into the protocol message. The following diagram shows how the web service binding uses endpoint information in forward and callback messages. </P>

<P><SPAN class="image-wrap" style="display: block; text-align: center"><IMG src="sca-java-runtime-overview.data/tuscany-endpoint-callback.png" style="border: 0px solid black"></SPAN></P>

<P>The twist here is that while a forward Tuscany message has a from field that points to the source endpoint reference when this gets turned into a SOAP envelope the from field represents the callback endpoint if there is one. </P>

<H4><A name="SCAJavaRuntimeOverview-Buildingendpointsandendpointreferences"></A>Building endpoints and endpoint references</H4>

<P>The following diagram shows how endpoints and endpoint references are created and used at a very high level. </P>

<P><SPAN class="image-wrap" style="display: block; text-align: center"><IMG src="sca-java-runtime-overview.data/tuscany-endpoint-build.png" style="border: 0px solid black"></SPAN></P>

<OL>
	<LI>First endoints and endpoint references are created during the build phase. An endpoint is created for every service binding. Endpoint references are created for every reference target or configured binding. Reference targets are either explicit specified through the reference or the binding uri or are implicitly specified through the use of autowire. If the endpoint to which an endpoint reference is available locally at this point the the two are linked (or bound) together at this point. If the node is running in a distributed domain, endpoint references can be created at this point where the target endpoint is not bound because it's not running in the same node. These endpoint references will be boundat runtime when the first messages passes through the endpoint reference</LI>
	<LI>Second, during the activation phase, all endpoints are added to the endpoint registry. In this way any node that has access to the endpoint registry can see the details of these endpoints</LI>
	<LI>Lastly, on first use, endpoint references that remain unbound are bound using a pluggable binding algorithm which will usually involve looking up and endpoint in the registry.</LI>
</OL>


<H2><A name="SCAJavaRuntimeOverview-Activate"></A>Activate</H2>

<P>At the activate stage the various extension providers are created as required. </P>

<H2><A name="SCAJavaRuntimeOverview-Start"></A>Start</H2>

<P>During start the &quot;start&quot; operation is called on all active providers in order to perform any extension specific start processing. </P>

<H2><A name="SCAJavaRuntimeOverview-MessageProcessing"></A>Message Processing</H2>

<H3><A name="SCAJavaRuntimeOverview-Referencesideoperationandbindingchains"></A>Reference side operation and binding chains</H3>

<P><SPAN class="image-wrap" style="display: block; text-align: center"><IMG src="sca-java-runtime-overview.data/tuscany-reference-interceptors.png" style="border: 0px solid black"></SPAN></P>

<H3><A name="SCAJavaRuntimeOverview-Servicesideoperationandbindingchains"></A>Service side operation and binding chains</H3>

<P><SPAN class="image-wrap" style="display: block; text-align: center"><IMG src="sca-java-runtime-overview.data/tuscany-service-interceptors.png" style="border: 0px solid black"></SPAN></P>

<H2><A name="SCAJavaRuntimeOverview-Stop"></A>Stop</H2>

<P>During stop the &quot;stop&quot; operation is called on all started providers in order to perform any extension specific stop processing. </P>

<H2><A name="SCAJavaRuntimeOverview-Deactivate"></A>Deactivate</H2>

<P>During the deactivate stage the various parts of the runtime model are picked apart to allow for successful garbage collection.</P>

<H1><A name="SCAJavaRuntimeOverview-Interfaces"></A>Interfaces </H1>

<H2><A name="SCAJavaRuntimeOverview-Mappinginterfacestotheruntimemodel"></A>Mapping interfaces to the runtime model </H2>
<P><SPAN class="image-wrap" style="display: block; text-align: center"><IMG src="sca-java-runtime-overview.data/tuscany-interface-contracts.png" style="border: 0px solid black"></SPAN></P>

<H2><A name="SCAJavaRuntimeOverview-Referencesideruntimeinterfacedrivendatabindingprocessing"></A>Reference side runtime interface driven databinding processing</H2>
<P><SPAN class="image-wrap" style="display: block; text-align: center"><IMG src="sca-java-runtime-overview.data/tuscany-reference-databinding.png" style="border: 0px solid black"></SPAN></P>

<H2><A name="SCAJavaRuntimeOverview-Servicesideruntimeinterfacedrivendatabindingprocessing"></A>Service side runtime interface driven databinding processing</H2>
<P><SPAN class="image-wrap" style="display: block; text-align: center"><IMG src="sca-java-runtime-overview.data/tuscany-service-databinding.png" style="border: 0px solid black"></SPAN></P>



        </DIV>

                  <DIV class="tabletitle">
            Children
            <SPAN class="smalltext" id="show" style="display: inline;">
              <A href="javascript:showChildren()">Show Children</A></SPAN>
            <SPAN class="smalltext" id="hide" style="display: none;">
              <A href="javascript:hideChildren()">Hide Children</A></SPAN>
          </DIV>
          <DIV class="greybox" id="children" style="display: none;">
                                      <A href="tuscany-2x-extensibility-and-spis.html" title="Tuscany 2.x Extensibility and SPIs">Tuscany 2.x Extensibility and SPIs</A>
              <SPAN class="smalltext">(Apache Tuscany Docs 2.x)</SPAN>
              <BR>
                          <A href="serialization-deserialization-of-endpoints-and-endpointreferences.html" title="Serialization Deserialization of Endpoints and EndpointReferences">Serialization Deserialization of Endpoints and EndpointReferences</A>
              <SPAN class="smalltext">(Apache Tuscany Docs 2.x)</SPAN>
              <BR>
                          <A href="classloading.html" title="Classloading">Classloading</A>
              <SPAN class="smalltext">(Apache Tuscany Docs 2.x)</SPAN>
              <BR>
                      </DIV>
              </DIV>
    </DIV>
                </TD>
            </TR>
        </TABLE>

            <!-- footer -->
    <TABLE border="0" cellpadding="2" cellspacing="0" width="100%">
        <TR>
          <TD align="left" valign="middle" class="footer">
            &nbsp;&nbsp;
            <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>
            &nbsp;&nbsp;
            <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 : SCA Java Runtime Overview';
              digg_topic = 'programming';
            </script>
            <script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
            -->
            &nbsp;&nbsp;
          </TD>
          <TD align="right" valign="middle" class="footer">
            <A href="http://cwiki.apache.org/GMOxPMGT/geronimo-privacy-policy.html">Privacy Policy</A>&nbsp;&nbsp;-&nbsp;&nbsp;
            Copyright &copy; 2003-2010, The Apache Software Foundation, Licensed under <A href="http://www.apache.org/licenses/LICENSE-2.0">ASL 2.0.</A>&nbsp;&nbsp;
          </TD>
        </TR>
    </TABLE> 

    </BODY>
</HTML>