Difference between revisions of "ECF/REST abstraction"

From Eclipsepedia

< ECF
Jump to: navigation, search
Line 1: Line 1:
This document acts as the project proposal for the GSoC project: [http://wiki.eclipse.org/Google_Summer_of_Code_2009_Ideas REST abstraction for ECF] and was created by [http://eclipsesource.com/blogs/author/hstaudacher/ Holger Staudacher] for his GSoC application. This is a living document. Feel free to edit or add things.
+
==OSGi Services for Rest Clients==
  
<hr />
+
ECF's focus has been the support of OSGi remote services...i.e. exposing OSGi services remotely, via proxies that have underneath them some protocol for communicating with the actual remote service.
  
Committer Lead: Holger Staudacher (IRC: staudi)
+
REST-based services use http to access remote resources via http get, put, post, and delete actions.
  
Other participating committers: Scott Lewis, Marcelo Mayworm
+
The ECF REST abstraction allows REST-based services to be exposed to clients/consumers as OSGi services.  This allows the automatic use of a number of useful technologies based upon OSGi services (e.g. declarative services, spring, ServiceTracker, etc) for accessing REST-based services.
  
This project started as part of the [[Google Summer of Code 2009]]
+
UNDER CONSTRUCTION
 
+
==Abstract==
+
Many service providers using a REST based API to offer developers access to their services, i.e. [http://apiwiki.twitter.com/ Twitter], [http://developers.facebook.com/?ref=pf Facebook] and so on. The result of this is that some third parties provide Java based libraries, which covers this API's. The [[Eclipse_Communication_Framework_Project|ECF]] team played a little bit with the Twitter API and use therefore a library called [http://yusuke.homeip.net/twitter4j/en/index.html Twitter4J]. <br>The disadvantage of this technique is a dependency to the third parties library. This means an ECF container based on such a library is dependent on the diversity of this.
+
To decouple these dependencies an own ECF based REST abstraction should be created within this [http://socghop.appspot.com/ GSoC] project.
+
 
+
==How does it fit in the ECF context?==
+
The Eclipse Communication Framework use containers for the connections to different systems. Many service providers i.e. Twitter, Facebook and so on provide their API’s over REST. Instead of using a different library for each, ECF will use the REST abstraction to realize the provider’s service. The integration can look like this.
+
 
+
[[Image:RESTabstraction2.png]]
+
 
+
REST use HTTP to communicate between client and server. So a coupling to a HTTP Client is necessary. The HTTP connections can be realized by an implementation of the [http://wiki.eclipse.org/ECF_Remote_Services_API_Bundle ECF Remote Services API].<br>
+
This implementation would be used by the REST abstraction to realize the basic communication. The abstraction itself can be a set of classes, which provides the basic REST functionality. On top of this many different ECF Containers can be created easily.
+
 
+
==The REST abstraction==
+
The Representational State Transfer is not a technology; it’s more a technique to use the web correctly. REST defines three different element types:
+
* Components
+
* Connectors
+
* Data
+
For a full definition of REST take a look at [http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm Roy Fielding’s Dissertation].<br>
+
The type, which is most important for this project, is data because data contains the resource. A resource is a basic REST concept. It’s a URL, which represents one web service. As REST use HTTP to send requests to a resource it uses the HTTP verbs: GET, POST, PUT, DELETE. If a client sends a request to a resource, the server answers with a resource representation. This representation can be a XML, HTML or RDF document i.e. <br>
+
The REST abstraction constitutes an implementation of the REST definition focused on things needed by ECF (the client side). The most difficult part of this project is to figure out what REST based ECF containers really need and how to implement it usable and persistent.
+
 
+
==Primary goals==
+
 
+
There are some requirements for this project, which can be defined in this early state. Some are out of the project’s scope, but these can be completed after the GSoC project has finished.<br><br>
+
 
+
'''In the project’s scope''':
+
* A full working API for the REST client side to communicate to any RESTful web service.
+
* Implementation of the ECF Remote Services API.
+
* Lightweight implementation of the REST definition (client side).
+
** Resource abstraction to cover many resource representations (maybe over an extension point).
+
** Definition of REST requests
+
** Cover security issues (i.e. HTTP auth or HTTPS)
+
* Usable API documentation
+
* Test driven development
+
 
+
'''Out of project’s scope''':
+
* Implementation of new ECF containers using the REST abstraction. This can be containers for Twitter, Facebook and so on.
+
* More resource representations (the exotics)
+
 
+
=== Getting the source ===
+
See the appropriate project set below.
+
 
+
Project set file for anonymous CVS access:
+
<source lang="xml">
+
<?xml version="1.0" encoding="UTF-8"?>
+
<psf version="2.0">
+
  <provider id="org.eclipse.team.cvs.core.cvsnature">
+
    <project reference="1.0,:pserver:anonymous@dev.eclipse.org:/cvsroot/rt,org.eclipse.ecf/framework/bundles/org.eclipse.ecf.remoteservice.rest,org.eclipse.ecf.remoteservice.rest"/>
+
    <project reference="1.0,:pserver:anonymous@dev.eclipse.org:/cvsroot/rt,org.eclipse.ecf/framework/bundles/org.eclipse.ecf.tests.remoteservice.rest,org.eclipse.ecf.tests.remoteservice.rest"/>
+
    <project reference="1.0,:pserver:anonymous@dev.eclipse.org:/cvsroot/rt,org.eclipse.ecf/incubation/bundles/org.json,org.json"/>
+
  </provider>
+
</psf>
+
</source>
+
 
+
These projects depend upon relatively new code in the ECF sdk.  A project set file for all ECF projects can be found [http://www.eclipse.org/ecf/projectsetfiles/projectSet-anonymous.psf here] or via the ECF releng project at
+
 
+
'''Protocol''':  '''pserver'''
+
 
+
'''Host''':  '''dev.eclipse.org'''
+
 
+
'''CVS Root''':  '''/cvsroot/rt'''
+
 
+
'''Module''':  '''org.eclipse.ecf/releng/org.eclipse.ecf.releng'''
+
 
+
Or see [http://www.eclipse.org/ecf/dev_resources.php this page] for instructions on getting the ECF releng project.
+
  
 
==Test/Example code==
 
==Test/Example code==
  
 
See the test cases in '''org.eclipse.ecf.tests.remoteservice.rest'''.  Particularly the test classes:  '''[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ecf/tests/bundles/org.eclipse.ecf.tests.remoteservice.rest/src/org/eclipse/ecf/tests/remoteservice/rest/RestRemoteServiceTest.java?root=RT_Project&view=log org.eclipse.ecf.tests.remoteservice.rest.RestRemoteServiceTest]''' and '''[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ecf/tests/bundles/org.eclipse.ecf.tests.remoteservice.rest/src/org/eclipse/ecf/tests/remoteservice/rest/twitter/TwitterRemoteServiceTest.java?root=RT_Project&view=log org.eclipse.ecf.tests.remoteservice.rest.twitter.TwitterRemoteServiceTest]'''.
 
See the test cases in '''org.eclipse.ecf.tests.remoteservice.rest'''.  Particularly the test classes:  '''[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ecf/tests/bundles/org.eclipse.ecf.tests.remoteservice.rest/src/org/eclipse/ecf/tests/remoteservice/rest/RestRemoteServiceTest.java?root=RT_Project&view=log org.eclipse.ecf.tests.remoteservice.rest.RestRemoteServiceTest]''' and '''[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ecf/tests/bundles/org.eclipse.ecf.tests.remoteservice.rest/src/org/eclipse/ecf/tests/remoteservice/rest/twitter/TwitterRemoteServiceTest.java?root=RT_Project&view=log org.eclipse.ecf.tests.remoteservice.rest.twitter.TwitterRemoteServiceTest]'''.
 
=== New ideas ===
 
Please open a [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=ECF new feature request].
 
  
 
=== Javadocs ===  
 
=== Javadocs ===  
  
Documentation is available in [http://www.eclipse.org/ecf/org.eclipse.ecf.docs/api/ org.eclipse.ecf Javadoc API].  The REST API is in these packages:
+
Documentation is available in [http://download.eclipse.org/rt/ecf/3.5Test/javadoc pse.ecf Javadoc API].  The REST client API is in these packages:
  
 
* <tt>org.eclipse.ecf.remoteservice.rest</tt>
 
* <tt>org.eclipse.ecf.remoteservice.rest</tt>
Line 90: Line 21:
 
* <tt>org.eclipse.ecf.remoteservice.rest.identity</tt>
 
* <tt>org.eclipse.ecf.remoteservice.rest.identity</tt>
 
* <tt>org.eclipse.ecf.remoteservice.rest.util</tt>
 
* <tt>org.eclipse.ecf.remoteservice.rest.util</tt>
 
==Weblinks/Literature==
 
* [http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm Fielding’s definition of REST]
 
* [https://bugs.eclipse.org/bugs/show_bug.cgi?id=256519 Bug 256519 - create twitter provider]
 
* [https://bugs.eclipse.org/bugs/show_bug.cgi?id=249240 Bug 249240 - Implement RFC 119]
 
* [[ECF/API_Docs#Remote_Services_API ECF Remote Services API]]
 
* http://eclipsesource.com/blogs/2009/07/29/rest-the-osgi-way/
 
* http://eclipsesource.com/blogs/2009/04/08/ecf-kisses-rest/
 
* http://eclipseecf.blogspot.com/2010/01/soap-rest-and-ecf-remote-services.html
 
* http://eclipseecf.blogspot.com/2009/12/cloud-osgi-gwt-ecf-rest-twitter-api.html
 
* http://eclipseecf.blogspot.com/2009/11/ecf-provides-some-additional-rest.html
 
  
 
[[Category:SOC]]
 
[[Category:SOC]]
 
[[Category:Draft Documentation]]
 
[[Category:Draft Documentation]]
 
[[Category:ECF]]
 
[[Category:ECF]]

Revision as of 14:31, 14 March 2011

OSGi Services for Rest Clients

ECF's focus has been the support of OSGi remote services...i.e. exposing OSGi services remotely, via proxies that have underneath them some protocol for communicating with the actual remote service.

REST-based services use http to access remote resources via http get, put, post, and delete actions.

The ECF REST abstraction allows REST-based services to be exposed to clients/consumers as OSGi services. This allows the automatic use of a number of useful technologies based upon OSGi services (e.g. declarative services, spring, ServiceTracker, etc) for accessing REST-based services.

UNDER CONSTRUCTION

Test/Example code

See the test cases in org.eclipse.ecf.tests.remoteservice.rest. Particularly the test classes: org.eclipse.ecf.tests.remoteservice.rest.RestRemoteServiceTest and org.eclipse.ecf.tests.remoteservice.rest.twitter.TwitterRemoteServiceTest.

Javadocs

Documentation is available in pse.ecf Javadoc API. The REST client API is in these packages:

  • org.eclipse.ecf.remoteservice.rest
  • org.eclipse.ecf.remoteservice.rest.client
  • org.eclipse.ecf.remoteservice.rest.identity
  • org.eclipse.ecf.remoteservice.rest.util