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

Introduction

Implementation.widget extends the SCA programming model to web 2.0 client applications.

As for creating a SCA component, below is an sample SCDL

<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="ufservices/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>
    
	<component name="Catalog">
	    <implementation.java class="services.CatalogImpl"/> 
	    <property name="currencyCode">USD</property>
	    <service name="Catalog">
                <t:binding.jsonrpc/>
   	    </service>
	    <reference name="currencyConverter" target="CurrencyConverter"/>	
	</component> 
 	
	<component name="ShoppingCart">
	    <implementation.java class="services.ShoppingCartImpl"/>
	    <service name="Collection">
	        <t:binding.atom/>
	    </service>    	
	</component>
    
	<component name="CurrencyConverter">
		<implementation.java class="services.CurrencyConverterImpl"/>
		<property name="rate">0.7256</property>
	</component>     

</composite>

Declaring SCA references using JavaScript can be done with the syntax below. This references will get properly introspected by the implementation.widget and wired.

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

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

The client application will need to include a generated js, that has the same name as the component being used.

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

Right now there is support for JSONRPC and Atom, and you can see all of this in in action in sca/samples/store.

References

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

website stats