You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by Kevin Meyer - KMZ <ke...@kmz.co.za> on 2011/11/09 05:03:27 UTC

Re: Isis/Joomla via REST [was: Re: Restful Objects spec (v0.41)]

Hi Dan,

I just received this yesterday...

For authentication, I've implemented my own override of the 
SqlAuthenticator (though I could use me REST API, see below).

For persistance, I followed Rob's advice, which is the same as your 
version 3: provide an objectstore that splits access two ways. Currently 
I'm using a "instanceof" declaration, and manually mapping between 
my Isis entity and the REST transfer object, which takes care of 
mapping my entity properties onto the Joomla table columns, which 
have different names.

I'm using a modified version of "ActiveResource like RESTClient for 
java"  [1][2] on the Java side - it basically provides a wrapper for 
org.apache.commons.httpclient.HttpClient 
and 
com.google.gson.Gson
which do the heavy lifting.

Regards,
Kevin

[1] http://code.google.com/p/rapa/
[2] https://github.com/harikrishnan83/rapa



On 26 Oct 2011 at 20:16, Dan Haywood wrote:

> > How can I use that REST interface to read (from) and update (to) the
> > external app?
> 
> Hi Kevin,
> Just piecing together this earlier mail with your request today for 
> lightweight RESTful APIs...
> 
> 
> >
> > Basically, for certain domain objects (the "user" object), the "read" and
> > "write" must be achieved via REST while for all other domain objects
> > the default object store would be used, I guess.
> ...presumably this is the requirement you have?
> 
> > Does this make sense? Is this possible?
> I can see three different places where you might integrate.
> 
> 1. given that this is for users, you could write an implementation of 
> the oai.core.runtime.authentication.standard.Authenticator interface? 
> This would only allow the Joomla user Id to be exposed via UserMemento
> 
> 2. or, you could write a domain service and inject it into your 
> Isis-hosted domain objects.  The RestEasy client-side support would be 
> useful here, I would think.
> 
> 3. or, you could write an object store implementation (probably wrapping 
> the primary objectstore) so that it would resolve certain objects via 
> REST.  You could use a custom FacetFactory to provide a hint for this OS 
> to know whether to make a REST call or just to delegate to the underlying.
> 
> eg:
> 
> public JoomlaObjectStore implements ObjectStore {
> 
>      public JoomlaObjectStore(ObjectStore underlying) { ... }
> 
>      public void resolveImmediately(ObjectAdapter adapter) {
>          if(adapter.getSpecification().containsFacet(JoomlaFacet.class)) {
>              ... make a REST call ...
>          } else {
>             underlying.resolveImmediately(adapter);
>          }
>      }
> 
> }
> 
> Hope that helps...
> 
> Dan