Hi,

I think it is a nice and clean way to use SCA with Web 2.0. I have a few comments.

1) To reference the generated JavaScript for a given component, say foo, should we use a naming convention to avoid conflict? For example, sca/foo.js?

2) Why do I have to use the following syntax to declare the references as they are already in the composite file?
//@Reference
var catalog = new Reference("Catalog");

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

With the component definition, we already know "Catalog" and "ShoppingCart" are two references. Cannot we just generate these variables in the store.js?

Thanks,
Raymond


----- Original Message ----- From: "Luciano Resende" <[EMAIL PROTECTED]>
To: "tuscany-dev" <[EMAIL PROTECTED]>
Cc: "tuscany user" <[email protected]>
Sent: Monday, October 29, 2007 12:03 PM
Subject: SCA in Web 2.0 applications...


I have created a new implementation type (implementation.widget) that
starts to extend the SCA programming model to web 2.0 client
applications. This is similar to what was proposed on this thread [1],
we can now turn a html into a SCA component, declare references using
JavaScript, and get them wired using SCA.

Considering the store composite [1],

<component name="store">
  <tuscany:implementation.widget location="content/store.html"/>
  <service name="Widget">
     <tuscany:binding.http/>
  </service>
  <reference name="Catalog" target="Catalog">
     <tuscany:binding.jsonrpc/>
  </reference>
  <reference name="ShoppingCart" target="ShoppingCart">
     <tuscany:binding.atom uri="/ShoppingCart"/>
   </reference>
</component>

<component name="Catalog">
  <implementation.java class="store.CatalogImpl"/>
  <service name="Catalog">
     <tuscany:binding.jsonrpc uri="/Catalog"/>
  </service>
</component>

<component name="ShoppingCart">
  <implementation.java class="store.ShoppingCartImpl"/>
  <service name="Collection">
     <tuscany:binding.atom/>
  </service>
</component>

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

Please, provide your feedback, and let me know if you have more
scenarios that would enhance and simplify the programming model in a
web 2.0 application scenario.


[1] http://www.mail-archive.com/[EMAIL PROTECTED]/msg23094.html
[2] https://svn.apache.org/repos/asf/incubator/tuscany/java/sca/samples/store/src/main/resources/store.composite

--
Luciano Resende
Apache Tuscany Committer
http://people.apache.org/~lresende
http://lresende.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to