[haiku] Re: [GSoC] Services Kit

  • From: PulkoMandy <pulkomandy@xxxxxxxxx>
  • To: haiku@xxxxxxxxxxxxx
  • Date: Mon, 29 Mar 2010 13:34:40 +0200

Despite my few searches, I don't really understand the differences
between add-ons and replicants. From what I understood, add-ons would
be (for example) sharing the same API to offer the same
functionalities but based on different services, while an replicant
would be a resident application waiting for an application to need it
? (like an ActiveX in MS Windows).

Yes, that's it.
Basically, a replicant is just using an application window to draw itself, it's not communicating with the app besides of this. Replicants are used to make systray icons like in Windows, or to embed things on the desktop, for example you can have a calculator as part of your desktop in haiku. You can see that an application can act as a replicant when there is a small hand icon at the bottom right of some widget or window.

Add-ons, on the other hand, can't run by themselves. An app requests and loads an add-on from disk. This is what is usually called a "plug-in" in other systems.


 Additionally, I read the overview of the IMKit and understood how it
is implemented : it handle all the IM connections through a server and
the forward events to connected applications. IMHO, the Services Kit
would not need a single application grouping all the services stuff,
as it doesn't need persistent connections to web services, this is why
I'm thinking of multiple applications using multiple add-ons (each of
them providing unique stuff for each web services), based on the "raw"
Services API which gather the low level client part of web services,
such as forging SOAP or REST request and decoding the responses,
encoding/decoding URL, ...

The point in using add-ons is to allow the app to use the service kit regardless of the service that's actually used in the end. For example, you could make a blog post in an app without having to know if it's going to be posted in skyblog or blogspot or somewhere else. Picture storing and pastewall services are examples of services that are available at multiple places.

 A server could be used to save various user account informations
(login, password and so on) required to authenticate the user on the
various services implemented, but I don't now if it would really be
useful.

I don't think you need a server for that. A "roster" class can do it. Basically, it's a static class living in a library, that provides a convenient starting point to get various information available in this library. See http://haiku.it.su.se:8180/source/xref/headers/os/locale/LocaleRoster.h for an example of such a class (handling the internationalization stuff in haiku). There are some others in the others kits in Haiku.

Such a class is needed to know which add-on you are going to instanciate. For example, let's imagine an app that would send some text to a pastewall service. The process would be :

 * Start the app
* Request the WebServiceRoster to see if there is an available pastewall service with a known login
 * Get the addon allowing to post to this service (let's say PastebinAddOn)
 * Give the text to paste and eventually the settings to the add on
 * Let the add on submit all the stuff to the website and give us the url
 * Display the url, add it to the clipboard, and let the user exit the app

This is quite a simple sequence, I guess one may want more complex services for uploading a gallery of pictures to Picasa along with comments and everything... but let's start simple :)

--
Adrien Destugues / PulkoMandy
http://pulkomandy.ath.cx

Other related posts: