From 200a40b332420f94992eb39a6d0ea1cf1490ffc4 Mon Sep 17 00:00:00 2001 From: coreyg Date: Fri, 21 Nov 2014 09:30:19 +0000 Subject: Adding tuscany's website to their svn repo for svnpubsub git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1640879 13f79535-47bb-0310-9956-ffa450edef68 --- site/trunk/site-publish/sca-java-bindingrss.html | 244 +++++++++++++++++++++++ 1 file changed, 244 insertions(+) create mode 100644 site/trunk/site-publish/sca-java-bindingrss.html (limited to 'site/trunk/site-publish/sca-java-bindingrss.html') diff --git a/site/trunk/site-publish/sca-java-bindingrss.html b/site/trunk/site-publish/sca-java-bindingrss.html new file mode 100644 index 0000000000..b0d81944c9 --- /dev/null +++ b/site/trunk/site-publish/sca-java-bindingrss.html @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + Apache Tuscany : SCA Java binding.rss + + + + + + + + + + + + + + + +
+ + + + +   + +
+ + +
+
+ + + + + + + + + +
+  Apache Tuscany > Home > SCA Overview > SCA Java > Java SCA Documentation Menu > SCA Java binding.rss + + User List | Dev List | Issue Tracker   +
+ + + + + + + +
+ + +
+ +
+
+ + +
+ + + + + + + + + + + +
Resources
+
+ +

<binding.rss> Introduction

+ +

The Tuscany Java SCA runtime supports Really Simple Syndication (RSS) using the <binding.rss> extension. Tuscany can communicate with services that provide or consume items described in the RSS 1.0 or 2.0 syndication format. The RSS protcol is an additional conceptual layer that operates on top of the Hyper Text Transfer Protocol, so it is useful to understand that underlying protocol as well. Reference materials on these specifications is available here.

+ + + + +

Some of the function described here is included in the Tuscany 1.3.2 and 1.4 releases. The complete timeline of available and future plans is given in the Tuscany Web 2.0 Roadmap. Note also that the RSS binding support is similar to the Tuscany Atom Binding Support in both syntax and function.

+ + +

Using the Tuscany RSS binding

+ +

The primary use of the RSS binding is to provide support for collections that can be shared in a distributed fashion. Examples of shared collections includes shopping carts, telephone directories, insurance forms, and blog sites. These collections of items can be added, retrieved, updated, and deleted using the 4 basic actions of the HTTP protocol:

+
    +
  • POST (create or add)
  • +
  • GET (retreive or query)
  • +
  • PUT (update)
  • +
  • DELETE (destroy or remove
  • +
+ + +

The simplest way to use the Atom binding is to declare a collection as a service and provide an HTTP address where one can access the service. This service is declared in an SCA composite file which describes the SCA domain.

+
+
+	<service name="customer" promote="CustomerCollection">
+		<tuscany:binding.rss uri = "http://localhost:8084/customer"/>
+	</service>
+
+
+ +

The service can be implemented in Java or any of the the Tuscany implementation types. For example, here is a way to create an implmentation for the above CustomerCollection service as the Java implementation.

+
+
+    <component name="CustomerCollection">
+        <implementation.java class="org.apache.tuscany.sca.binding.feed.CustomerCollectionImpl"/>
+    </component>
+
+
+ +

A collection that uses the RSS binding usually implements the Collection interface given in the package org.apache.tuscany.sca.binding.atom.collection. This interface declares the basic access methods mentioned above (post, get, put, and delete), and the data types on the methods are expressed as RSS SyndFeed and SyndEntry objects. This shows the basic methods of the RSS Collection interface in Tuscany:

+
+
+public interface Collection {
+
+    SyndFeed getFeed();
+    SyndFeed query(String queryString);
+
+
+ +

It is up to the developer or implementer of the shopping cart, telephone directory, or blog site to provide the code that implements the Collection interface. The developer or implementor also provides the code that translates from the business objects (shopping cart items, directory entries, insurance forms, blog articles) to the Atom model objects Feed and Entry.

+ +

One of the features of using this binding is that your business objects (shopping cart items, directory entries, insurance forms, and blog articles) can now be easily published and shared by the many RSS supporting tools such as feed readers, web browsers, and syndication aggregation. In other words, people can access your collection most anywhere on any device.

+ +

Example

+ +

Continuing with the CustomerCollection example shown above, let's see how to implement one of the common access methods. In this case, let's look at the get method in a client and how one would display the items of a collection. When you declared your RSS binding in your SCA composite, you also provided a uri for your collection. Using a web browser or other device, a user performs an HTTP get request to this uri. The HTTP response for your get request contains a body which has the RSS SyndFeed seruialized as a SyndFeed. You may access this SyndFeed using Java, and display or present to a user the contents of the RSS feed.

+
+
+        SyndFeed feed = resourceCollection.getFeed();
+        for (Object o : feed.getEntries()) {
+            SyndEntry e = (SyndEntry)o;
+            System.out.println("id = " + e.getUri() + " entry = " + e.getTitle());
+        }
+
+
+ +

Much of the code consists of converting from a RSS SyndFeed or SyndEntry to a business data model and storing to a collection.

+ +

Tuscany uses Java Project ROME to provide a model for RSS data. Please see Project ROME for the Java methods to access RSS SyndFeeds and SyndEntries, and how to easily convert these Java objects to and from XML.

+ +

Other Features of the Tuscany RSS Binding

+ +

In contrast to the Tuscany Atom binding, the Tuscany RSS binding does not provide:

+ +
    +
  • Data caching based on ETag and LastModified header fields.
  • +
  • JavaScript Object Notation (JSON) alternative to XML feeds and entry data.
  • +
  • Service document for site introspection.
  • +
  • Full featured JavaScript client for easy client side programming.
  • +
+ + +

See the Tuscany Atom Binding Support for a description of these features and how users may get more benefits from the Atom binding.

+
+
+
+
+ + +
+ + + + + + website stats + + + + + + -- cgit v1.2.3