[
https://issues.apache.org/jira/browse/SLING-2853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13649399#comment-13649399
]
Amit Gupta commented on SLING-2853:
-----------------------------------
new patch (addressing following comments)
1. BTW, there should probably also be an add(Resource) without the metadata.
2. Namespacing of properties
3. ResourceCollectionAdapterFactory adapts to a collection only if the
"members" child
is present. IMHO the resource type should be enough. If there are no members
yet, the
node could be missing. Any code reading content should be very liberal in
what it
expects, and empty content should always work. So all writing methods should
have
a step in them to create the members node if not present yet.
4. Resource type: ResourceCollectionAdapterFactory should use
Resource.isResourceType() for
the type/super type check.
5. ResourceCollectionManagerImpl.createCollection() could maybe use
ResourceUtil.normalize() on the final concatenated path (solved if using
Resource
instead of path as argument)
6. ResourceCollectionManagerImpl.getCollection relies on adaptTo() in
getCollection()
7. ResourceCollection.DEFAULT_SLING_RES_TYPE rename to simply RESOURCE_TYPE
The "default" and "sling" in it is misleading; it is *the* rt for the
ResourceCollection,
and I guess it's rather unlikely that someone extends the resource collection
rt,
let alone being a central feature to be pointed out.
8. ResourceCollectionManager methods should IMHO all be consistently based on
passing Resource instead of path (makes e.g. the createCollection()
implementation
simpler in that it does not have to getResource() and check for existence)
> 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: collection_v2.zip, collection.zip, 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