Apache Tuscany > Home > SCA Overview > SCA Java > Java SCA Documentation Menu > SCA Java implementation.widget User List | Dev List | Issue Tracker  

Introduction

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

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.

<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>

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.

//@Reference
var catalog = new Reference("catalog");

//@Reference
var shoppingCart = new Reference("shoppingCart");

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.

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

Supported binding types

Currently, you can define references to remote services using the following bindings :

References

http://incubator.apache.org/tuscany/getting-started-with-tuscany.html

website stats