Re: resource type inheritance

2008-02-27 Thread Tobias Bocanegra
thanks. i'll take a look at it today :-)
regards, toby

On 2/27/08, Felix Meschberger <[EMAIL PROTECTED]> wrote:
> This functionality is now implemented as of Rev. 631604.
>
>  Have fun !
>
>  Regards
>  Felix
>
>  Am Donnerstag, den 07.02.2008, 09:17 +0100 schrieb Tobias Bocanegra:
>
> > sounds good!
>  >
>  > On 2/7/08, Felix Meschberger <[EMAIL PROTECTED]> wrote:
>  > > Hi all,
>  > >
>  > > I think this idea is certainly worth considering, though of course with
>  > > a slightly more general approach:
>  > >
>  > > (1) Extend the Resource API to include a method
>  > >
>  > > String getSuperResourceType() - returns the resource super type
>  > > or null if there
>  > > is none
>  > >
>  > > (2) JCR Resource Implementation 1: The JCR implementation of the
>  > > Resource interface based on nodes (JcrNodeResource) will return the
>  > > value of the sling:superResourceType field if such a field is defined.
>  > > The implementation based on properties (JcrPropertyResource) will return
>  > > the value of the sling:superResourceType property of the parent node
>  > > plus the property name, similar as the resource type of the property
>  > > resource is defined.
>  > >
>  > > (3) JCR Resource Implementation 2: If the sling:superResourceType field
>  > > does not exist, the super types of the primary node type may be
>  > > considered: If the primary node type as one or more base types, select
>  > > any of the non-mixin base types as the sling:superResourceType. Most of
>  > > the time, a primary node type will only have a single non-mixin base
>  > > type and multiple mixin base types. So this mechanism should be pretty
>  > > stable. In cases where this might not be the case, the primary node type
>  > > may still be defined with a sling:superResourceType property with a
>  > > predefined (auto created default value) value.
>  > >
>  > > (4) Other Resource Implementations: May or may not support super
>  > > resource types, currently, neither bundle nor the servlet based resource
>  > > implementations will probably support this.
>  > >
>  > > (5) Servlet/Script resolution: The resolver will primarily consider the
>  > > resource type. If no script could be found, the resource's super
>  > > resource type (if defined) is considered. If not script can be found, an
>  > > algorithm as follows may be applied:
>  > >
>  > >  String type = resource.getSuperResourceType();
>  > >  type = JcrResourceUtil.getTypeAsPath(type);
>  > >  Resource typeResource =
>  > > resourceResolver.getResource(type);
>  > >  type = typeResource.getSuperResourceType();
>  > >  while (type != null) {
>  > >  servlet = getServletForType(request, type);
>  > >  if (servelt != null) {
>  > >  ... done ...
>  > >  }
>  > >  type = JcrResourceUtil.getTypeAsPath(type);
>  > >  Resource typeResource =
>  > > resourceResolver.getResource(type);
>  > >  type = typeResource.getSuperResourceType();
>  > >  }
>  > >
>  > >
>  > > WDYT ?
>  > >
>  > > Regards
>  > > Felix
>  > >
>  > > Am Mittwoch, den 06.02.2008, 02:16 +0100 schrieb Tobias Bocanegra:
>  > > > hi,
>  > > > i think we need some sort of resource type inheritance. the use case
>  > > > is the following:
>  > > >
>  > > > assume we have:
>  > > >   /apps/base/html.jsp
>  > > >   /apps/base/title/png.jsp
>  > > >   /content/en/sling:resourceType = "/apps/base"
>  > > >
>  > > > where the image script produces some title image. which is used:
>  > > >   
>  > > >
>  > > > now, i define a 'sub type' which has a different body than the base
>  > > > but uses the same image script:
>  > > >   /apps/special/html.jsp
>  > > >   /content/special/sling:resourceType = "/apps/special"
>  > > >
>  > > > now the img:
>  > > >   
>  > > >
>  > > > this wont work of course, since it does not define the title script.
>  > > > the wor

Re: resource type inheritance

2008-02-27 Thread Felix Meschberger
This functionality is now implemented as of Rev. 631604.

Have fun ! 

Regards
Felix

Am Donnerstag, den 07.02.2008, 09:17 +0100 schrieb Tobias Bocanegra:
> sounds good!
> 
> On 2/7/08, Felix Meschberger <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > I think this idea is certainly worth considering, though of course with
> > a slightly more general approach:
> >
> > (1) Extend the Resource API to include a method
> >
> > String getSuperResourceType() - returns the resource super type
> > or null if there
> > is none
> >
> > (2) JCR Resource Implementation 1: The JCR implementation of the
> > Resource interface based on nodes (JcrNodeResource) will return the
> > value of the sling:superResourceType field if such a field is defined.
> > The implementation based on properties (JcrPropertyResource) will return
> > the value of the sling:superResourceType property of the parent node
> > plus the property name, similar as the resource type of the property
> > resource is defined.
> >
> > (3) JCR Resource Implementation 2: If the sling:superResourceType field
> > does not exist, the super types of the primary node type may be
> > considered: If the primary node type as one or more base types, select
> > any of the non-mixin base types as the sling:superResourceType. Most of
> > the time, a primary node type will only have a single non-mixin base
> > type and multiple mixin base types. So this mechanism should be pretty
> > stable. In cases where this might not be the case, the primary node type
> > may still be defined with a sling:superResourceType property with a
> > predefined (auto created default value) value.
> >
> > (4) Other Resource Implementations: May or may not support super
> > resource types, currently, neither bundle nor the servlet based resource
> > implementations will probably support this.
> >
> > (5) Servlet/Script resolution: The resolver will primarily consider the
> > resource type. If no script could be found, the resource's super
> > resource type (if defined) is considered. If not script can be found, an
> > algorithm as follows may be applied:
> >
> >  String type = resource.getSuperResourceType();
> >  type = JcrResourceUtil.getTypeAsPath(type);
> >  Resource typeResource =
> > resourceResolver.getResource(type);
> >  type = typeResource.getSuperResourceType();
> >  while (type != null) {
> >  servlet = getServletForType(request, type);
> >  if (servelt != null) {
> >  ... done ...
> >  }
> >  type = JcrResourceUtil.getTypeAsPath(type);
> >  Resource typeResource =
> > resourceResolver.getResource(type);
> >  type = typeResource.getSuperResourceType();
> >  }
> >
> >
> > WDYT ?
> >
> > Regards
> > Felix
> >
> > Am Mittwoch, den 06.02.2008, 02:16 +0100 schrieb Tobias Bocanegra:
> > > hi,
> > > i think we need some sort of resource type inheritance. the use case
> > > is the following:
> > >
> > > assume we have:
> > >   /apps/base/html.jsp
> > >   /apps/base/title/png.jsp
> > >   /content/en/sling:resourceType = "/apps/base"
> > >
> > > where the image script produces some title image. which is used:
> > >   
> > >
> > > now, i define a 'sub type' which has a different body than the base
> > > but uses the same image script:
> > >   /apps/special/html.jsp
> > >   /content/special/sling:resourceType = "/apps/special"
> > >
> > > now the img:
> > >   
> > >
> > > this wont work of course, since it does not define the title script.
> > > the workaround is to add a /apps/special/title/png.jsp which
> > > jsp-includes the base one, eg:
> > >
> > > <[EMAIL PROTECTED] file="/apps/base/title.png.jsp" %>
> > >
> > > but this is not usable at all.
> > >
> > > what i suggest is to introduce a "sling:parentType" which you place to
> > > the folder of the script, eg:
> > >
> > > /apps/special/sling:parentType="/apps/base"
> > >
> > > and the script resolution would check if the resource type node
> > > defines such a property and uses it as new resource type for the
> > > resolution.
> > >
> > > WDYT ?
> > > regards, toby
> > >
> > > btw: this is not only a problem just for 'image scripts' but also for
> > > all resources that are included via an url and not via the path /
> > > resource type.
> >
> >
> 
> 



[jira] Commented: (SLING-278) Add Resource Type inheritance

2008-02-27 Thread Felix Meschberger (JIRA)

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

Felix Meschberger commented on SLING-278:
-

In Rev. 631604:
   * Added ServletResource.getResourceSuperType() method
   * Enhanced script/servlet search to include resource super types before 
looking for default servlets

> Add Resource Type inheritance
> -
>
> Key: SLING-278
> URL: https://issues.apache.org/jira/browse/SLING-278
> Project: Sling
>  Issue Type: New Feature
>  Components: Resource, ServletResolver
>Reporter: Felix Meschberger
>Assignee: Felix Meschberger
> Fix For: 2.0.0
>
>
> As discussed on the dev-list [1], resource type inheritance for 
> script/servlet resolution should be implemented as follows:
>* define an optional property sling:resourceSuperType which may take a 
> resource type used as 
> the super type of a resource type. This property is stored at the 
> node where the scripts
> are located for the resource type or at the node itself. (see below)
>* the resourceSuperType of a property resource is the resourceSuperType of 
> the parent node
> plus the property name.
>* define a sling:ResourceSuperType mixin node type, which defines the 
> sling:resourceType
> property for it to be attachable to any node.
>* Add Resource.getResourceSuperType() returning the super type of the 
> resource type or
> null if no such super type exists.
>* Add support to the Servlet Resolver to resolve scripts not just for the 
> resource type but also
> for the super type (if defined). This super type resolution takes 
> place before falling back
> default scripts !
> Sample:
> /
> +--- types
> +--- type1
> +--- type2
>  +--- sling:resourceSuperType = type1
> +--- type3
> +--- content
>  +--- en
>  +--- sling:resourceType = type2
>  +--- en
>  +--- sling:resourceType = type2
>  +--- sling:resourceSuperType = type3
> The resource super types are defined as follows:
>  /types/type1 --> no super type
>  /types/type2 --> type1, due to sling:resoureSuperType property
>  /content/en  --> type1, due to sling:resourceSuperType property in 
> types/type2
>  /conent/de   --> type3, due to sling:resourceSuperType property
> [1] http://www.mail-archive.com/[email protected]/msg02365.html

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



[jira] Closed: (SLING-278) Add Resource Type inheritance

2008-02-27 Thread Felix Meschberger (JIRA)

 [ 
https://issues.apache.org/jira/browse/SLING-278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Felix Meschberger closed SLING-278.
---

Resolution: Fixed

Everything is in place and works. So I close this issue.

> Add Resource Type inheritance
> -
>
> Key: SLING-278
> URL: https://issues.apache.org/jira/browse/SLING-278
> Project: Sling
>  Issue Type: New Feature
>  Components: Resource, ServletResolver
>Reporter: Felix Meschberger
>Assignee: Felix Meschberger
> Fix For: 2.0.0
>
>
> As discussed on the dev-list [1], resource type inheritance for 
> script/servlet resolution should be implemented as follows:
>* define an optional property sling:resourceSuperType which may take a 
> resource type used as 
> the super type of a resource type. This property is stored at the 
> node where the scripts
> are located for the resource type or at the node itself. (see below)
>* the resourceSuperType of a property resource is the resourceSuperType of 
> the parent node
> plus the property name.
>* define a sling:ResourceSuperType mixin node type, which defines the 
> sling:resourceType
> property for it to be attachable to any node.
>* Add Resource.getResourceSuperType() returning the super type of the 
> resource type or
> null if no such super type exists.
>* Add support to the Servlet Resolver to resolve scripts not just for the 
> resource type but also
> for the super type (if defined). This super type resolution takes 
> place before falling back
> default scripts !
> Sample:
> /
> +--- types
> +--- type1
> +--- type2
>  +--- sling:resourceSuperType = type1
> +--- type3
> +--- content
>  +--- en
>  +--- sling:resourceType = type2
>  +--- en
>  +--- sling:resourceType = type2
>  +--- sling:resourceSuperType = type3
> The resource super types are defined as follows:
>  /types/type1 --> no super type
>  /types/type2 --> type1, due to sling:resoureSuperType property
>  /content/en  --> type1, due to sling:resourceSuperType property in 
> types/type2
>  /conent/de   --> type3, due to sling:resourceSuperType property
> [1] http://www.mail-archive.com/[email protected]/msg02365.html

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



[jira] Commented: (SLING-278) Add Resource Type inheritance

2008-02-27 Thread Felix Meschberger (JIRA)

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

Felix Meschberger commented on SLING-278:
-

In Rev. 631601:
   * Resource.getResourceSuperType() implementation for JCR based Resources
   * mixin node type to be able to set the sling:resourceSuperType property
   * constant for the sling:resourceSuperType property
   * utility method to retrieve the super type of a given resource type
   (JcrResourceUtil.getResourceSuperType())
   * unit tests



> Add Resource Type inheritance
> -
>
> Key: SLING-278
> URL: https://issues.apache.org/jira/browse/SLING-278
> Project: Sling
>  Issue Type: New Feature
>  Components: Resource, ServletResolver
>Reporter: Felix Meschberger
>Assignee: Felix Meschberger
> Fix For: 2.0.0
>
>
> As discussed on the dev-list [1], resource type inheritance for 
> script/servlet resolution should be implemented as follows:
>* define an optional property sling:resourceSuperType which may take a 
> resource type used as 
> the super type of a resource type. This property is stored at the 
> node where the scripts
> are located for the resource type or at the node itself. (see below)
>* the resourceSuperType of a property resource is the resourceSuperType of 
> the parent node
> plus the property name.
>* define a sling:ResourceSuperType mixin node type, which defines the 
> sling:resourceType
> property for it to be attachable to any node.
>* Add Resource.getResourceSuperType() returning the super type of the 
> resource type or
> null if no such super type exists.
>* Add support to the Servlet Resolver to resolve scripts not just for the 
> resource type but also
> for the super type (if defined). This super type resolution takes 
> place before falling back
> default scripts !
> Sample:
> /
> +--- types
> +--- type1
> +--- type2
>  +--- sling:resourceSuperType = type1
> +--- type3
> +--- content
>  +--- en
>  +--- sling:resourceType = type2
>  +--- en
>  +--- sling:resourceType = type2
>  +--- sling:resourceSuperType = type3
> The resource super types are defined as follows:
>  /types/type1 --> no super type
>  /types/type2 --> type1, due to sling:resoureSuperType property
>  /content/en  --> type1, due to sling:resourceSuperType property in 
> types/type2
>  /conent/de   --> type3, due to sling:resourceSuperType property
> [1] http://www.mail-archive.com/[email protected]/msg02365.html

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



[jira] Commented: (SLING-278) Add Resource Type inheritance

2008-02-27 Thread Felix Meschberger (JIRA)

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

Felix Meschberger commented on SLING-278:
-

Extended the Sling API with the new Resource.getResourceSuperType method in 
Rev. 631599.

> Add Resource Type inheritance
> -
>
> Key: SLING-278
> URL: https://issues.apache.org/jira/browse/SLING-278
> Project: Sling
>  Issue Type: New Feature
>  Components: Resource, ServletResolver
>Reporter: Felix Meschberger
>Assignee: Felix Meschberger
> Fix For: 2.0.0
>
>
> As discussed on the dev-list [1], resource type inheritance for 
> script/servlet resolution should be implemented as follows:
>* define an optional property sling:resourceSuperType which may take a 
> resource type used as 
> the super type of a resource type. This property is stored at the 
> node where the scripts
> are located for the resource type or at the node itself. (see below)
>* the resourceSuperType of a property resource is the resourceSuperType of 
> the parent node
> plus the property name.
>* define a sling:ResourceSuperType mixin node type, which defines the 
> sling:resourceType
> property for it to be attachable to any node.
>* Add Resource.getResourceSuperType() returning the super type of the 
> resource type or
> null if no such super type exists.
>* Add support to the Servlet Resolver to resolve scripts not just for the 
> resource type but also
> for the super type (if defined). This super type resolution takes 
> place before falling back
> default scripts !
> Sample:
> /
> +--- types
> +--- type1
> +--- type2
>  +--- sling:resourceSuperType = type1
> +--- type3
> +--- content
>  +--- en
>  +--- sling:resourceType = type2
>  +--- en
>  +--- sling:resourceType = type2
>  +--- sling:resourceSuperType = type3
> The resource super types are defined as follows:
>  /types/type1 --> no super type
>  /types/type2 --> type1, due to sling:resoureSuperType property
>  /content/en  --> type1, due to sling:resourceSuperType property in 
> types/type2
>  /conent/de   --> type3, due to sling:resourceSuperType property
> [1] http://www.mail-archive.com/[email protected]/msg02365.html

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



[jira] Updated: (SLING-278) Add Resource Type inheritance

2008-02-26 Thread Felix Meschberger (JIRA)

 [ 
https://issues.apache.org/jira/browse/SLING-278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Felix Meschberger updated SLING-278:


Description: 
As discussed on the dev-list [1], resource type inheritance for script/servlet 
resolution should be implemented as follows:

   * define an optional property sling:resourceSuperType which may take a 
resource type used as 
the super type of a resource type. This property is stored at the node 
where the scripts
are located for the resource type or at the node itself. (see below)

   * the resourceSuperType of a property resource is the resourceSuperType of 
the parent node
plus the property name.

   * define a sling:ResourceSuperType mixin node type, which defines the 
sling:resourceType
property for it to be attachable to any node.

   * Add Resource.getResourceSuperType() returning the super type of the 
resource type or
null if no such super type exists.

   * Add support to the Servlet Resolver to resolve scripts not just for the 
resource type but also
for the super type (if defined). This super type resolution takes place 
before falling back
default scripts !


Sample:

/
+--- types
+--- type1
+--- type2
 +--- sling:resourceSuperType = type1
+--- type3
+--- content
 +--- en
 +--- sling:resourceType = type2
 +--- en
 +--- sling:resourceType = type2
 +--- sling:resourceSuperType = type3

The resource super types are defined as follows:
 /types/type1 --> no super type
 /types/type2 --> type1, due to sling:resoureSuperType property
 /content/en  --> type1, due to sling:resourceSuperType property in 
types/type2
 /conent/de   --> type3, due to sling:resourceSuperType property


[1] http://www.mail-archive.com/[email protected]/msg02365.html

  was:
As discussed on the dev-list [1], resource type inheritance for script/servlet 
resolution should be implemented as follows:

   * define an optional property sling:resourceSuperType which may take a 
resource type used as 
the super type of a resource type. This property is stored at the node 
where the scripts
located for the resource type. (see below)

   * if the sling:resourceSuperType is not set for a given resource type, any 
non-mixin base type
of the primary node type of the resource node may be selected.

   * the resourceSuperType of a property resource is the resourceSuperType of 
the parent node
plus the property name.

   * define a sling:ResourceSuperType mixin node type, which defines the 
sling:resourceType
property for it to be attachable to any node.

   * Add Resource.getResourceSuperType() returning the super type of the 
resource type or
null if no such super type exists.

   * Add support to the Servlet Resolver to resolve scripts not just for the 
resource type but also
for the super type (if defined). This super type resolution takes place 
before falling back
default scripts !


[1] http://www.mail-archive.com/[email protected]/msg02365.html


* Remove fall back to JCR node type hierarchy. This is confusing as it mixes 
two concepts switching back and forth.
* Add example use of sling:resourceSuperType settings

> Add Resource Type inheritance
> -
>
> Key: SLING-278
> URL: https://issues.apache.org/jira/browse/SLING-278
> Project: Sling
>  Issue Type: New Feature
>  Components: Resource, ServletResolver
>Reporter: Felix Meschberger
>Assignee: Felix Meschberger
> Fix For: 2.0.0
>
>
> As discussed on the dev-list [1], resource type inheritance for 
> script/servlet resolution should be implemented as follows:
>* define an optional property sling:resourceSuperType which may take a 
> resource type used as 
> the super type of a resource type. This property is stored at the 
> node where the scripts
> are located for the resource type or at the node itself. (see below)
>* the resourceSuperType of a property resource is the resourceSuperType of 
> the parent node
> plus the property name.
>* define a sling:ResourceSuperType mixin node type, which defines the 
> sling:resourceType
> property for it to be attachable to any node.
>* Add Resource.getResourceSuperType() returning the super type of the 
> resource type or
> null if no such super type exists.
>* Add support to the Servlet Resolver to resolve scripts not just for the 
> resource type but also
> for the supe

[jira] Created: (SLING-278) Add Resource Type inheritance

2008-02-26 Thread Felix Meschberger (JIRA)
Add Resource Type inheritance
-

 Key: SLING-278
 URL: https://issues.apache.org/jira/browse/SLING-278
 Project: Sling
  Issue Type: New Feature
  Components: Resource, ServletResolver
Reporter: Felix Meschberger
Assignee: Felix Meschberger
 Fix For: 2.0.0


As discussed on the dev-list [1], resource type inheritance for script/servlet 
resolution should be implemented as follows:

   * define an optional property sling:resourceSuperType which may take a 
resource type used as 
the super type of a resource type. This property is stored at the node 
where the scripts
located for the resource type. (see below)

   * if the sling:resourceSuperType is not set for a given resource type, any 
non-mixin base type
of the primary node type of the resource node may be selected.

   * the resourceSuperType of a property resource is the resourceSuperType of 
the parent node
plus the property name.

   * define a sling:ResourceSuperType mixin node type, which defines the 
sling:resourceType
property for it to be attachable to any node.

   * Add Resource.getResourceSuperType() returning the super type of the 
resource type or
null if no such super type exists.

   * Add support to the Servlet Resolver to resolve scripts not just for the 
resource type but also
for the super type (if defined). This super type resolution takes place 
before falling back
default scripts !


[1] http://www.mail-archive.com/[email protected]/msg02365.html

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



Re: resource type inheritance

2008-02-07 Thread Bertrand Delacretaz
On Feb 7, 2008 8:42 AM, Felix Meschberger <[EMAIL PROTECTED]> wrote:

> WDYT ?

It all sounds good to me, except that I'd call the property

  sling:resourceSupertype

instead of

  sling:superResourceType

and talk of "resource supertype" instead of "super resource type",
that sounds clearer to me as supertypes and subtypes are known
concepts.

-Bertrand


Re: resource type inheritance

2008-02-07 Thread Tobias Bocanegra
sounds good!

On 2/7/08, Felix Meschberger <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I think this idea is certainly worth considering, though of course with
> a slightly more general approach:
>
> (1) Extend the Resource API to include a method
>
> String getSuperResourceType() - returns the resource super type
> or null if there
> is none
>
> (2) JCR Resource Implementation 1: The JCR implementation of the
> Resource interface based on nodes (JcrNodeResource) will return the
> value of the sling:superResourceType field if such a field is defined.
> The implementation based on properties (JcrPropertyResource) will return
> the value of the sling:superResourceType property of the parent node
> plus the property name, similar as the resource type of the property
> resource is defined.
>
> (3) JCR Resource Implementation 2: If the sling:superResourceType field
> does not exist, the super types of the primary node type may be
> considered: If the primary node type as one or more base types, select
> any of the non-mixin base types as the sling:superResourceType. Most of
> the time, a primary node type will only have a single non-mixin base
> type and multiple mixin base types. So this mechanism should be pretty
> stable. In cases where this might not be the case, the primary node type
> may still be defined with a sling:superResourceType property with a
> predefined (auto created default value) value.
>
> (4) Other Resource Implementations: May or may not support super
> resource types, currently, neither bundle nor the servlet based resource
> implementations will probably support this.
>
> (5) Servlet/Script resolution: The resolver will primarily consider the
> resource type. If no script could be found, the resource's super
> resource type (if defined) is considered. If not script can be found, an
> algorithm as follows may be applied:
>
>  String type = resource.getSuperResourceType();
>  type = JcrResourceUtil.getTypeAsPath(type);
>  Resource typeResource =
> resourceResolver.getResource(type);
>  type = typeResource.getSuperResourceType();
>  while (type != null) {
>  servlet = getServletForType(request, type);
>  if (servelt != null) {
>  ... done ...
>  }
>  type = JcrResourceUtil.getTypeAsPath(type);
>  Resource typeResource =
> resourceResolver.getResource(type);
>  type = typeResource.getSuperResourceType();
>      }
>
>
> WDYT ?
>
> Regards
> Felix
>
> Am Mittwoch, den 06.02.2008, 02:16 +0100 schrieb Tobias Bocanegra:
> > hi,
> > i think we need some sort of resource type inheritance. the use case
> > is the following:
> >
> > assume we have:
> >   /apps/base/html.jsp
> >   /apps/base/title/png.jsp
> >   /content/en/sling:resourceType = "/apps/base"
> >
> > where the image script produces some title image. which is used:
> >   
> >
> > now, i define a 'sub type' which has a different body than the base
> > but uses the same image script:
> >   /apps/special/html.jsp
> >   /content/special/sling:resourceType = "/apps/special"
> >
> > now the img:
> >   
> >
> > this wont work of course, since it does not define the title script.
> > the workaround is to add a /apps/special/title/png.jsp which
> > jsp-includes the base one, eg:
> >
> > <[EMAIL PROTECTED] file="/apps/base/title.png.jsp" %>
> >
> > but this is not usable at all.
> >
> > what i suggest is to introduce a "sling:parentType" which you place to
> > the folder of the script, eg:
> >
> > /apps/special/sling:parentType="/apps/base"
> >
> > and the script resolution would check if the resource type node
> > defines such a property and uses it as new resource type for the
> > resolution.
> >
> > WDYT ?
> > regards, toby
> >
> > btw: this is not only a problem just for 'image scripts' but also for
> > all resources that are included via an url and not via the path /
> > resource type.
>
>


-- 
-< [EMAIL PROTECTED] >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
---< http://www.day.com >---


Re: resource type inheritance

2008-02-06 Thread Felix Meschberger
Hi all,

I think this idea is certainly worth considering, though of course with
a slightly more general approach:

(1) Extend the Resource API to include a method

String getSuperResourceType() - returns the resource super type
or null if there
is none

(2) JCR Resource Implementation 1: The JCR implementation of the
Resource interface based on nodes (JcrNodeResource) will return the
value of the sling:superResourceType field if such a field is defined.
The implementation based on properties (JcrPropertyResource) will return
the value of the sling:superResourceType property of the parent node
plus the property name, similar as the resource type of the property
resource is defined.

(3) JCR Resource Implementation 2: If the sling:superResourceType field
does not exist, the super types of the primary node type may be
considered: If the primary node type as one or more base types, select
any of the non-mixin base types as the sling:superResourceType. Most of
the time, a primary node type will only have a single non-mixin base
type and multiple mixin base types. So this mechanism should be pretty
stable. In cases where this might not be the case, the primary node type
may still be defined with a sling:superResourceType property with a
predefined (auto created default value) value.

(4) Other Resource Implementations: May or may not support super
resource types, currently, neither bundle nor the servlet based resource
implementations will probably support this.

(5) Servlet/Script resolution: The resolver will primarily consider the
resource type. If no script could be found, the resource's super
resource type (if defined) is considered. If not script can be found, an
algorithm as follows may be applied:

 String type = resource.getSuperResourceType();
 type = JcrResourceUtil.getTypeAsPath(type);
 Resource typeResource =
resourceResolver.getResource(type);
 type = typeResource.getSuperResourceType();
 while (type != null) {
 servlet = getServletForType(request, type);
 if (servelt != null) {
 ... done ...
 }
 type = JcrResourceUtil.getTypeAsPath(type);
 Resource typeResource =
resourceResolver.getResource(type);
 type = typeResource.getSuperResourceType();
 }


WDYT ?

Regards
Felix

Am Mittwoch, den 06.02.2008, 02:16 +0100 schrieb Tobias Bocanegra:
> hi,
> i think we need some sort of resource type inheritance. the use case
> is the following:
> 
> assume we have:
>   /apps/base/html.jsp
>   /apps/base/title/png.jsp
>   /content/en/sling:resourceType = "/apps/base"
> 
> where the image script produces some title image. which is used:
>   
> 
> now, i define a 'sub type' which has a different body than the base
> but uses the same image script:
>   /apps/special/html.jsp
>   /content/special/sling:resourceType = "/apps/special"
> 
> now the img:
>   
> 
> this wont work of course, since it does not define the title script.
> the workaround is to add a /apps/special/title/png.jsp which
> jsp-includes the base one, eg:
> 
> <[EMAIL PROTECTED] file="/apps/base/title.png.jsp" %>
> 
> but this is not usable at all.
> 
> what i suggest is to introduce a "sling:parentType" which you place to
> the folder of the script, eg:
> 
> /apps/special/sling:parentType="/apps/base"
> 
> and the script resolution would check if the resource type node
> defines such a property and uses it as new resource type for the
> resolution.
> 
> WDYT ?
> regards, toby
> 
> btw: this is not only a problem just for 'image scripts' but also for
> all resources that are included via an url and not via the path /
> resource type.



resource type inheritance

2008-02-05 Thread Tobias Bocanegra
hi,
i think we need some sort of resource type inheritance. the use case
is the following:

assume we have:
  /apps/base/html.jsp
  /apps/base/title/png.jsp
  /content/en/sling:resourceType = "/apps/base"

where the image script produces some title image. which is used:
  

now, i define a 'sub type' which has a different body than the base
but uses the same image script:
  /apps/special/html.jsp
  /content/special/sling:resourceType = "/apps/special"

now the img:
  

this wont work of course, since it does not define the title script.
the workaround is to add a /apps/special/title/png.jsp which
jsp-includes the base one, eg:

<[EMAIL PROTECTED] file="/apps/base/title.png.jsp" %>

but this is not usable at all.

what i suggest is to introduce a "sling:parentType" which you place to
the folder of the script, eg:

/apps/special/sling:parentType="/apps/base"

and the script resolution would check if the resource type node
defines such a property and uses it as new resource type for the
resolution.

WDYT ?
regards, toby

btw: this is not only a problem just for 'image scripts' but also for
all resources that are included via an url and not via the path /
resource type.
-- 
-< [EMAIL PROTECTED] >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
---< http://www.day.com >---