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/10/23 20:16:39 UTC

Re: Restful Objects spec (v0.41)

Hi Dan,

I might have a problem that needs the inverse - there is an external 
(Joomla) application that can expose objects (that would map onto Isis 
domain objects) via a REST interface[1] - represented as either JSON 
or XML.

How can I use that REST interface to read (from) and update (to) the 
external app?

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.

Does this make sense? Is this possible?

It would even be acceptable if I could only access the external REST 
interface via an Isis service that internally calls the external 
application...

Regards,
Kevin

[1] http://techjoomla.com/joomla-extension-news/joomla-rest-api.html

On 18 Sep 2011 at 18:36, Dan Haywood wrote:

> Hi all,
> Following on from a mail I sent back in July [1], I've been working on a 
> specification to define a standard way of making domain object models 
> available over REST through a set of JSON representations.
> 
> The intention is for the Isis json-viewer to implement this spec; hence 
> ISIS-109 [2].  In addition, the Nakedobjects MVC (framework on .NET) [3] 
> also intending to implement the same spec.  So there may be an 
> opportunity to do some community building across platforms... you never 
> know.
> 
> Anyway, if anyone here is interested in REST, I'd really be interested 
> in your feedback.  And/or, if you can suggest any other communities (eg 
> within Apache?), who might be interested, that would also be really great.
> 
> Cheers
> Dan
> 
> 
> [1] http://www.mail-archive.com/isis-dev@incubator.apache.org/msg02037.html
> [2] https://issues.apache.org/jira/browse/ISIS-109
> [3] http://nakedobjects.net/home/index.shtml
> 


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

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
> From: Kevin Meyer - KMZ<ke...@kmz.co.za>
> Date: Sun, Oct 23, 2011 at 8:16 PM
> Subject: Re: Restful Objects spec (v0.41)
> To: isis-dev@incubator.apache.org
>
>
> there is an external
> (Joomla) application that can expose objects (that would map onto Isis
> domain objects) via a REST interface[1] - represented as either JSON
> or XML.
>
> 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





>
> It would even be acceptable if I could only access the external REST
> interface via an Isis service that internally calls the external
> application...
>
> Regards,
> Kevin
>
> [1] http://techjoomla.com/joomla-extension-news/joomla-rest-api.html



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

Posted by Kevin Meyer - KMZ <ke...@kmz.co.za>.
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


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

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
> From: Kevin Meyer - KMZ<ke...@kmz.co.za>
> Date: Sun, Oct 23, 2011 at 8:16 PM
> Subject: Re: Restful Objects spec (v0.41)
> To: isis-dev@incubator.apache.org
>
>
> there is an external
> (Joomla) application that can expose objects (that would map onto Isis
> domain objects) via a REST interface[1] - represented as either JSON
> or XML.
>
> 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





>
> It would even be acceptable if I could only access the external REST
> interface via an Isis service that internally calls the external
> application...
>
> Regards,
> Kevin
>
> [1] http://techjoomla.com/joomla-extension-news/joomla-rest-api.html