Space: Apache Tuscany Docs 2.x 
(http://cwiki.apache.org/confluence/display/TUSCANYxDOCx2x)
Page: SCA Java implementation.widget 
(http://cwiki.apache.org/confluence/display/TUSCANYxDOCx2x/SCA+Java+implementation.widget)

Added by Luciano Resende:
---------------------------------------------------------------------
h3.Introduction

The Tuscany Widget Implementation extends the SCA programing model to HTML 
and/or Web 2.0 client applications.


h3.Using Implementation.Widget to model your Web 2.0 component

This component type allows you to model your HTML and/or Web 2.0 as an SCA 
component, the implementation artifact would be html resource that represents 
the application, and you can define SCA References, that would be wired to 
server side services.

{code}
<composite      xmlns="http://www.osoa.org/xmlns/sca/1.0";
                xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0";
                targetNamespace="http://store";                  
                name="store">
                
       <component name="store">
           <t:implementation.widget location="contents/store.html"/>
           <service name="Widget">
               <t:binding.http/> 
           </service>
           <reference name="catalog" target="Catalog">
               <t:binding.jsonrpc/>
           </reference>
           <reference name="shoppingCart" target="ShoppingCart">
               <t:binding.atom/>
           </reference>
        </component>
    
        .....
</composite>
{code}


h3. Defining references in HTML resources

The widget implementation introduces SCA annotations to JavaScript code using 
the syntax below. These references will get properly introspected by the 
implementation.widget and wired to the proper server side services.

{code}
//@Reference
var catalog = new Reference("catalog");

//@Reference
var shoppingCart = new Reference("shoppingCart");
{code}


h3.Including generated JavaScript client proxy

The client application will need to include a generated JavaScript that will 
contain the necessary client proxy used to access the server side services. The 
name of the generated JavaScript is the same as the HTML resource being 
specified as the implementation artifact.


{code}
<!-- one js include per sca component -->
<script type="text/javascript" src="store.js"></script>
{code}

h3.Supported binding types

Currently, you can define references to remote services using the following 
bindings :
* [ATOM|SCA Java binding.atom]
* [JSON-RPC|SCA Java binding.jsonrpc]
* [HTTP|SCA Java binding.http]

h3.References
[http://incubator.apache.org/tuscany/getting-started-with-tuscany.html]





Change your notification preferences: 
http://cwiki.apache.org/confluence/users/viewnotifications.action

Reply via email to