You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Bertrand Delacretaz <bd...@apache.org> on 2008/03/25 11:09:05 UTC
path-based resource types: JcrDefaultResourceTypeProvider service
Hi,
Two of my colleagues are working on apps where path-based resource
types would be useful.
The typical use case is existing content in a JCR repository, where it
is not practical to add a sling:resourceType property to each node,
but where paths can be used to infer resource types.
Another use case is for simple examples and tutorials, where for
example nodes under /content/blog can be mapped to scripts found under
/apps/blog without requiring a sling:resourceType property (which
would be explained in a later phase of the tutorial).
I had a brief chat with Felix about this, we suggest adding a
JcrDefaultResourceTypeProvider interface (in o.a.s.jcr.resource), with
a getResourceTypeForItem(Item) method.
JcrDefaultResourceTypeProvider can then be used as an OSGi service, to
define the resourceType of a JCR Item being loaded, as follows:
1) Use the sling:resourceType if provided (unchanged)
2) Else, use the JcrDefaultResourceTypeProvider service if present
3) Else, use the node's primary type name (unchanged)
A default JcrDefaultResourceTypeProvider implementation is provided by
Sling (in a separate bundle, to make it easy to replace), which maps
Node paths to resource types using a configurable expression, for
paths that match another configurable regexp.
Comments are welcome - I'll create a first implementation today, but
that can of course change if there are better ideas.
-Bertrand
Re: path-based resource types: JcrDefaultResourceTypeProvider service
Posted by Bertrand Delacretaz <bd...@apache.org>.
On Tue, Mar 25, 2008 at 11:09 AM, Bertrand Delacretaz
<bd...@apache.org> wrote:
> ...I'll create a first implementation today...
see https://issues.apache.org/jira/browse/SLING-340
-Bertrand