You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Felix Meschberger <fm...@gmail.com> on 2008/02/06 09:26:41 UTC

[Sling API] ResourceWrapper and SyntheticResource

Hi all,

I would like to propose to create a ResourceWrapper class in the Sling
API, which is just a simple wrapper around a delegatee resource
analogous to what we have for servlet requests and responses. This
simplifies the creation of pseudo-resources, for example to create
resource based on another resource but with a different resource type.

Second, I propose to move the SyntheticResource class from the
jcr/resource project to the Sling API because this class is by now way
related to a JCR repository. Rather it is very usefull in general
projects.

WDYT ?

Regards
Felix


Re: [Sling API] ResourceWrapper and SyntheticResource

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Feb 6, 2008 9:26 AM, Felix Meschberger <fm...@gmail.com> wrote:

> ...I would like to propose to create a ResourceWrapper class in the Sling
> API, which is just a simple wrapper around a delegatee resource
> analogous to what we have for servlet requests and responses....

+1

> Second, I propose to move the SyntheticResource class from the
> jcr/resource project to the Sling API ...

+1

-Bertrand

Re: [Sling API] ResourceWrapper and SyntheticResource

Posted by Tobias Bocanegra <to...@day.com>.
> > > I would like to propose to create a ResourceWrapper class in the Sling
> > > API, which is just a simple wrapper around a delegatee resource
> > > analogous to what we have for servlet requests and responses. This
> > > simplifies the creation of pseudo-resources, for example to create
> > > resource based on another resource but with a different resource type.
> > great.
> >
> > > Second, I propose to move the SyntheticResource class from the
> > > jcr/resource project to the Sling API because this class is by now way
> > > related to a JCR repository. Rather it is very usefull in general
> > > projects.
> > could the synthetic resource be more intelligent? i would be very convenient
> >  if it could adapt to node (if the node at the path exists.)
>
> If you would want to just overwrite the resource type with a synthetic
> resource, I suggest to use a ResourceWrapper overwriting the
> getResourceType() method. Thus you get the resource type you want but
> still get the node underlying the actual resource.
of course :-)

-- 
-----------------------------------------< tobias.bocanegra@day.com >---
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: [Sling API] ResourceWrapper and SyntheticResource

Posted by Felix Meschberger <fm...@gmail.com>.
Am Mittwoch, den 06.02.2008, 09:54 +0100 schrieb Tobias Bocanegra:
> > I would like to propose to create a ResourceWrapper class in the Sling
> > API, which is just a simple wrapper around a delegatee resource
> > analogous to what we have for servlet requests and responses. This
> > simplifies the creation of pseudo-resources, for example to create
> > resource based on another resource but with a different resource type.
> great.
> 
> > Second, I propose to move the SyntheticResource class from the
> > jcr/resource project to the Sling API because this class is by now way
> > related to a JCR repository. Rather it is very usefull in general
> > projects.
> could the synthetic resource be more intelligent? i would be very convenient
>  if it could adapt to node (if the node at the path exists.)

If you would want to just overwrite the resource type with a synthetic
resource, I suggest to use a ResourceWrapper overwriting the
getResourceType() method. Thus you get the resource type you want but
still get the node underlying the actual resource.

Regards
Felix

> 
> i suggest a: ResourceResolver.createSynthetic(String path, String resorceType);
> 
> regards, toby


Re: [Sling API] ResourceWrapper and SyntheticResource

Posted by Tobias Bocanegra <to...@day.com>.
> I would like to propose to create a ResourceWrapper class in the Sling
> API, which is just a simple wrapper around a delegatee resource
> analogous to what we have for servlet requests and responses. This
> simplifies the creation of pseudo-resources, for example to create
> resource based on another resource but with a different resource type.
great.

> Second, I propose to move the SyntheticResource class from the
> jcr/resource project to the Sling API because this class is by now way
> related to a JCR repository. Rather it is very usefull in general
> projects.
could the synthetic resource be more intelligent? i would be very convenient
 if it could adapt to node (if the node at the path exists.)

i suggest a: ResourceResolver.createSynthetic(String path, String resorceType);

regards, toby
-- 
-----------------------------------------< tobias.bocanegra@day.com >---
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: [Sling API] ResourceWrapper and SyntheticResource

Posted by Padraic Hannon <pi...@wasabicowboy.com>.
On Feb 6, 2008, at 12:26 AM, Felix Meschberger wrote:

> Hi all,
>
> I would like to propose to create a ResourceWrapper class in the Sling
> API, which is just a simple wrapper around a delegatee resource
> analogous to what we have for servlet requests and responses. This
> simplifies the creation of pseudo-resources, for example to create
> resource based on another resource but with a different resource type.
>

That would be helpful.

> Second, I propose to move the SyntheticResource class from the
> jcr/resource project to the Sling API because this class is by now way
> related to a JCR repository. Rather it is very usefull in general
> projects.
>

+1

> WDYT ?
>
> Regards
> Felix