You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Lars Trieloff (JIRA)" <ji...@apache.org> on 2008/06/15 15:08:45 UTC

[jira] Created: (SLING-535) Align Node and Property Stores with Dojo's upcoming JsonRestStore

Align Node and Property Stores with Dojo's upcoming JsonRestStore
-----------------------------------------------------------------

                 Key: SLING-535
                 URL: https://issues.apache.org/jira/browse/SLING-535
             Project: Sling
          Issue Type: Improvement
          Components: Extensions
            Reporter: Lars Trieloff
            Priority: Minor


Dojo 1.2 will include (aside from widget beautification) a JsonRestStore that works very closely to what we already have in the dojo extensions, but it provides some additional features like object synchronization (which is good performance-wise if you are doing many reads on a node) and integration with Google Gears for offline support.

Thanks to Michael Marth for spotting this and please assign this issue to me if possible.

http://www.sitepen.com/blog/2008/06/13/restful-json-dojo-data/


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-535) Align Node and Property Stores with Dojo's upcoming JsonRestStore

Posted by "Andreas Hartmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681522#action_12681522 ] 

Andreas Hartmann commented on SLING-535:
----------------------------------------

Yes, I started my application with the SlingNodeStore, but when I learned about the JsonRestStore I considered switching to this one.

I think it will be much easier to implement and maintain a server-side REST API than a Dojo store. Providing the JSON for the JsonRestStore might be much less of a moving target than keeping the SlingNodeStore in sync with Dojo developments. WDYT?

> Align Node and Property Stores with Dojo's upcoming JsonRestStore
> -----------------------------------------------------------------
>
>                 Key: SLING-535
>                 URL: https://issues.apache.org/jira/browse/SLING-535
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Lars Trieloff
>            Assignee: Lars Trieloff
>            Priority: Minor
>
> Dojo 1.2 will include (aside from widget beautification) a JsonRestStore that works very closely to what we already have in the dojo extensions, but it provides some additional features like object synchronization (which is good performance-wise if you are doing many reads on a node) and integration with Google Gears for offline support.
> Thanks to Michael Marth for spotting this and please assign this issue to me if possible.
> http://www.sitepen.com/blog/2008/06/13/restful-json-dojo-data/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (SLING-535) Align Node and Property Stores with Dojo's upcoming JsonRestStore

Posted by "Andreas Hartmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681513#action_12681513 ] 

Andreas Hartmann edited comment on SLING-535 at 3/12/09 2:53 PM:
-----------------------------------------------------------------

I have added some classes to a project of mine:

http://code.google.com/p/lancre/source/browse/#svn/trunk/dojo-sling/src/main/java/org/lancre/sling/json

There are some proprietary things in the code, but I'll try to make it generic asap.

Some details:

The JsonDojoTreeServlet responds to two different selectors:
* foo.tree.dojojson -> Render the resource as a JSON array to use for the store. The children use $ref properties for lazy loading.
* foo.node.dojojson -> Render the resource as a JSON object to load a node.

A ResourceFilter interface is used to control which children and properties are included in the tree. IMO it is a bit cumbersome to control this from the client, e.g. using queries, but maybe makes sense to support both approaches.

I'm not sure how to handle the labelling of tree nodes. Maybe it makes sense to introduce an interface to resolve the label of a resource.



      was (Author: andreas@apache.org):
    I have added some classes to a project of mine:

http://code.google.com/p/lancre/source/browse/#svn/trunk/dojo-sling/src/main/java/org/lancre/sling/json

There are some proprietary things in the code, but I'll try to make it generic asap.

Some details:

The JsonDojoTreeServlet responds to two different selectors:
* foo.tree.dojojson -> Render the resource as a JSON array to use for the store. The children use $ref properties for lazy loading.
* foo.node.dojojson -> Render the resource as a JSON object to lazy-load a node

A ResourceFilter interface is used to control which children and properties are included in the tree. IMO it is a bit cumbersome to control this using queries from the client, e.g. using queries, but maybe makes sense to support both approaches.

I'm not sure how to handle the labelling of tree nodes. Maybe it makes sense to introduce an interface to resolve the label of a resource.


  
> Align Node and Property Stores with Dojo's upcoming JsonRestStore
> -----------------------------------------------------------------
>
>                 Key: SLING-535
>                 URL: https://issues.apache.org/jira/browse/SLING-535
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Lars Trieloff
>            Assignee: Lars Trieloff
>            Priority: Minor
>
> Dojo 1.2 will include (aside from widget beautification) a JsonRestStore that works very closely to what we already have in the dojo extensions, but it provides some additional features like object synchronization (which is good performance-wise if you are doing many reads on a node) and integration with Google Gears for offline support.
> Thanks to Michael Marth for spotting this and please assign this issue to me if possible.
> http://www.sitepen.com/blog/2008/06/13/restful-json-dojo-data/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-535) Align Node and Property Stores with Dojo's upcoming JsonRestStore

Posted by "Andreas Hartmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681416#action_12681416 ] 

Andreas Hartmann commented on SLING-535:
----------------------------------------

I did some experiments and was able to connect a dijit.Tree to a JsonRestStore. The JSON is generated by a custom servlet because the output of the Sling's standard JSON servlets is not suitable for a tree store. I didn't implement any support for write operations yet.

If someone is still working on this, I'd be happy to join.

> Align Node and Property Stores with Dojo's upcoming JsonRestStore
> -----------------------------------------------------------------
>
>                 Key: SLING-535
>                 URL: https://issues.apache.org/jira/browse/SLING-535
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Lars Trieloff
>            Assignee: Lars Trieloff
>            Priority: Minor
>
> Dojo 1.2 will include (aside from widget beautification) a JsonRestStore that works very closely to what we already have in the dojo extensions, but it provides some additional features like object synchronization (which is good performance-wise if you are doing many reads on a node) and integration with Google Gears for offline support.
> Thanks to Michael Marth for spotting this and please assign this issue to me if possible.
> http://www.sitepen.com/blog/2008/06/13/restful-json-dojo-data/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-535) Align Node and Property Stores with Dojo's upcoming JsonRestStore

Posted by "Rory Douglas (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681716#action_12681716 ] 

Rory Douglas commented on SLING-535:
------------------------------------

I think both approaches are equally valid.  I definitely see the advantage in your approach, where we rely on out-of-the-box Dojo components for stores & widgets, and customize the JSON-providing server-side to match what the stores expect.

On the other hand, given the intent of the dojo.data API, I'm not sure it's a considerable maintenance burden implementing a Sling-specific store either.  I don't think any server-side API intended for a dojo.data Store should really be widget-specific - it should be possible to plug the same JSON structure into a store, then that store into a Tree or a ComboBox and get the expected results.

The current SlingNodeStore/SlingPropertyStore were based off of older DataStore examples, they could definitely benefit from being reworked as ServiceStore subclasses.  However, in conjunction with latest Dojo 1.2 releases (i.e., not the one that's included with the build), they work correctly with a variety of widgets (Tree, ComboBox, Grid).  I must admit, I haven't tested them with the Dojo 1.1 that comes with the build ;-)

Regardless, having multiple ways to do things is always great, so I think a JSONRestStore API would be an excellent addition.

> Align Node and Property Stores with Dojo's upcoming JsonRestStore
> -----------------------------------------------------------------
>
>                 Key: SLING-535
>                 URL: https://issues.apache.org/jira/browse/SLING-535
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Lars Trieloff
>            Assignee: Lars Trieloff
>            Priority: Minor
>
> Dojo 1.2 will include (aside from widget beautification) a JsonRestStore that works very closely to what we already have in the dojo extensions, but it provides some additional features like object synchronization (which is good performance-wise if you are doing many reads on a node) and integration with Google Gears for offline support.
> Thanks to Michael Marth for spotting this and please assign this issue to me if possible.
> http://www.sitepen.com/blog/2008/06/13/restful-json-dojo-data/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-535) Align Node and Property Stores with Dojo's upcoming JsonRestStore

Posted by "Andreas Hartmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689549#action_12689549 ] 

Andreas Hartmann commented on SLING-535:
----------------------------------------

OK, reading works now.

ATM I'm struggling with the fact that the JsonRestStore always POSTs to the store URI to create new items. This is not compatible with Sling's default behaviour (creating resources based on the POST request URI). I have absolutely no idea how to extend the JsonRestStore to support Sling's POST URI scheme. Or maybe I have to write a custom servlet to handle the JsonRestStore POST requests?

> Align Node and Property Stores with Dojo's upcoming JsonRestStore
> -----------------------------------------------------------------
>
>                 Key: SLING-535
>                 URL: https://issues.apache.org/jira/browse/SLING-535
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Lars Trieloff
>            Assignee: Lars Trieloff
>            Priority: Minor
>
> Dojo 1.2 will include (aside from widget beautification) a JsonRestStore that works very closely to what we already have in the dojo extensions, but it provides some additional features like object synchronization (which is good performance-wise if you are doing many reads on a node) and integration with Google Gears for offline support.
> Thanks to Michael Marth for spotting this and please assign this issue to me if possible.
> http://www.sitepen.com/blog/2008/06/13/restful-json-dojo-data/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (SLING-535) Align Node and Property Stores with Dojo's upcoming JsonRestStore

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-535?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reassigned SLING-535:
---------------------------------------

    Assignee: Lars Trieloff

Assigning to Lars on request

> Align Node and Property Stores with Dojo's upcoming JsonRestStore
> -----------------------------------------------------------------
>
>                 Key: SLING-535
>                 URL: https://issues.apache.org/jira/browse/SLING-535
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Lars Trieloff
>            Assignee: Lars Trieloff
>            Priority: Minor
>
> Dojo 1.2 will include (aside from widget beautification) a JsonRestStore that works very closely to what we already have in the dojo extensions, but it provides some additional features like object synchronization (which is good performance-wise if you are doing many reads on a node) and integration with Google Gears for offline support.
> Thanks to Michael Marth for spotting this and please assign this issue to me if possible.
> http://www.sitepen.com/blog/2008/06/13/restful-json-dojo-data/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-535) Align Node and Property Stores with Dojo's upcoming JsonRestStore

Posted by "Rory Douglas (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681515#action_12681515 ] 

Rory Douglas commented on SLING-535:
------------------------------------

The current SlingNodeStore can be used with a dijit.Tree, there are examples of this in the example file /dojox/data/demo/demo4.html.  Note, that file is a little outdated and refers to a /samplenodes URL that used to be included in the build prior to some reorg.  Editing that file and setting all the urls of the SlingNodeStore's to / or some other existing URL should make the samples work.  There are some extra options on SlingNodeStore that allow finer control of the content returned when attaching a store to the a TreeModel.

> Align Node and Property Stores with Dojo's upcoming JsonRestStore
> -----------------------------------------------------------------
>
>                 Key: SLING-535
>                 URL: https://issues.apache.org/jira/browse/SLING-535
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Lars Trieloff
>            Assignee: Lars Trieloff
>            Priority: Minor
>
> Dojo 1.2 will include (aside from widget beautification) a JsonRestStore that works very closely to what we already have in the dojo extensions, but it provides some additional features like object synchronization (which is good performance-wise if you are doing many reads on a node) and integration with Google Gears for offline support.
> Thanks to Michael Marth for spotting this and please assign this issue to me if possible.
> http://www.sitepen.com/blog/2008/06/13/restful-json-dojo-data/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-535) Align Node and Property Stores with Dojo's upcoming JsonRestStore

Posted by "Andreas Hartmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12682469#action_12682469 ] 

Andreas Hartmann commented on SLING-535:
----------------------------------------

I have the feeling that utilizing the JsonRestStore might not be as easy as I hoped.

The GET servlet I implemented is based on selectors. Reading seems to work fine with this approach. But when I try to write, the not strictly hierarchical URI schema causes trouble. The JsonRestStore seems to rely on a URI schema like this:

/service/
/service/path/to/node

Strangely, the first path snippet is used to identify the service and therefore the store for an item:

dojox.data._getStoreForItem = function(item){
   return dojox.rpc.JsonRest.services[item.__id.match(/.*\//)[0]]._store;
};

Is it possible to use sling.servlet.prefix to "mount" the REST service at a different path than the actual location in the resource tree? This way I could get rid of the selectors and maybe create a truly hierarchical structure ...

> Align Node and Property Stores with Dojo's upcoming JsonRestStore
> -----------------------------------------------------------------
>
>                 Key: SLING-535
>                 URL: https://issues.apache.org/jira/browse/SLING-535
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Lars Trieloff
>            Assignee: Lars Trieloff
>            Priority: Minor
>
> Dojo 1.2 will include (aside from widget beautification) a JsonRestStore that works very closely to what we already have in the dojo extensions, but it provides some additional features like object synchronization (which is good performance-wise if you are doing many reads on a node) and integration with Google Gears for offline support.
> Thanks to Michael Marth for spotting this and please assign this issue to me if possible.
> http://www.sitepen.com/blog/2008/06/13/restful-json-dojo-data/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-535) Align Node and Property Stores with Dojo's upcoming JsonRestStore

Posted by "Andreas Hartmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681513#action_12681513 ] 

Andreas Hartmann commented on SLING-535:
----------------------------------------

I have added some classes to a project of mine:

http://code.google.com/p/lancre/source/browse/#svn/trunk/dojo-sling/src/main/java/org/lancre/sling/json

There are some proprietary things in the code, but I'll try to make it generic asap.

Some details:

The JsonDojoTreeServlet responds to two different selectors:
* foo.tree.dojojson -> Render the resource as a JSON array to use for the store. The children use $ref properties for lazy loading.
* foo.node.dojojson -> Render the resource as a JSON object to lazy-load a node

A ResourceFilter interface is used to control which children and properties are included in the tree. IMO it is a bit cumbersome to control this using queries from the client, e.g. using queries, but maybe makes sense to support both approaches.

I'm not sure how to handle the labelling of tree nodes. Maybe it makes sense to introduce an interface to resolve the label of a resource.



> Align Node and Property Stores with Dojo's upcoming JsonRestStore
> -----------------------------------------------------------------
>
>                 Key: SLING-535
>                 URL: https://issues.apache.org/jira/browse/SLING-535
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Lars Trieloff
>            Assignee: Lars Trieloff
>            Priority: Minor
>
> Dojo 1.2 will include (aside from widget beautification) a JsonRestStore that works very closely to what we already have in the dojo extensions, but it provides some additional features like object synchronization (which is good performance-wise if you are doing many reads on a node) and integration with Google Gears for offline support.
> Thanks to Michael Marth for spotting this and please assign this issue to me if possible.
> http://www.sitepen.com/blog/2008/06/13/restful-json-dojo-data/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-535) Align Node and Property Stores with Dojo's upcoming JsonRestStore

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681457#action_12681457 ] 

Felix Meschberger commented on SLING-535:
-----------------------------------------

Hi Andreas,

Any contributions here would certainly be helpful and very welcome. To my knowledge noone is currently actively pushing dojo, but it would certainly deserve it. So just go ahead and do it ;-)

Thanks.

> Align Node and Property Stores with Dojo's upcoming JsonRestStore
> -----------------------------------------------------------------
>
>                 Key: SLING-535
>                 URL: https://issues.apache.org/jira/browse/SLING-535
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Lars Trieloff
>            Assignee: Lars Trieloff
>            Priority: Minor
>
> Dojo 1.2 will include (aside from widget beautification) a JsonRestStore that works very closely to what we already have in the dojo extensions, but it provides some additional features like object synchronization (which is good performance-wise if you are doing many reads on a node) and integration with Google Gears for offline support.
> Thanks to Michael Marth for spotting this and please assign this issue to me if possible.
> http://www.sitepen.com/blog/2008/06/13/restful-json-dojo-data/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.