You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Amit Gupta (JIRA)" <ji...@apache.org> on 2013/05/03 15:04:16 UTC

[jira] [Commented] (SLING-2853) Add ResourceCollection to Sling

    [ https://issues.apache.org/jira/browse/SLING-2853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13648382#comment-13648382 ] 

Amit Gupta commented on SLING-2853:
-----------------------------------

> The ResourceCollection interface exposes the resources exposed but does not expose the collection entries are said to have additional properties in the future. What is the way forward here ?
There are two options
1. expose the member resource with additional api i.e. getMembers() and this return member resource iterator instead of iterator of resource referred to.
2. give api getMemberProperties(Resource resource); this can return a ModifiableValueMap.

While adding resource, we can take a map i.e. add(Resource resource, Map<String, Object> props);

Above has not been added to api, as there was no immediate need. But content structure has been proposed to accomodate future extensions

> ResourceCollections don't seem to be orderable ? Would ordering be simulated by an order property on the resourceCollection root resource ? 
Not too sure about making it orderable, would collection needs to be ordered in general use cases. Basically should it be a list or set?
Ordering is simple to add
+ P: sling:resourceType
        + N : members (nt:unstructured)
            +P: memberPaths > String[] [member_res1, member_res2]
            + N: member_res1 > nt:unstructured
                + P: path > string, reference to actual resource
            + N: member_res2 > nt:unstructured
                + P: path > string, reference to actual resource

Or order can be stored as a property with each node. I like the first one, as to change the order only one property needs to be changed.

                
> Add ResourceCollection to Sling
> -------------------------------
>
>                 Key: SLING-2853
>                 URL: https://issues.apache.org/jira/browse/SLING-2853
>             Project: Sling
>          Issue Type: New Feature
>          Components: API
>    Affects Versions: API 2.0.2
>            Reporter: Amit Gupta
>            Priority: Minor
>         Attachments: resourcecollection.zip
>
>
> Creating a collection of resources has been a use case for a while and there has been no inherent support in SLING for the same.
> This proposal is to add a ResourceCollection interface and implementation that allows creation of collection of resources. 
> Collection is a simple list of members, where each member contains path of resource it refers to. In future, we might need to store additional information with the member, hence following structure is proposed
> N: resourceCollection (nt:unstructured)
>         + P: sling:resourceType
>         + N : members (nt:unstructured)
>             + N: member_res1  > nt:unstructured
>                 + P: path > string, reference to actual resource
>             + N: member_res2  > nt:unstructured
>                 + P: path > string, reference to actual resource

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira