We should not forget that we're running in a service oriented framework. So
the number one citizen is a service. And the manager is in fact a service.
So why not leverage this and make it available as service?
People always complain that the adapter pattern is too confusing and you
never know what can be adopted to which and so on. So having a proper
service oriented way is imho a must. And in addition provide the adapter
factory to do the adaptions.

Regards
Carsten


2013/5/6 Bertrand Delacretaz <[email protected]>

> On Mon, May 6, 2013 at 3:47 PM, Alexander Klimetschek
> <[email protected]> wrote:
> > ...This touches on the topic on how things like this on top of the
> resource API should work in general. AFAIK, this is a first here...
> ...
> >   The ResourceCollectionManager is really only needed to create a new
> collection
> >   (get and delete can be done via adaptTo and Resource directly)...
>
> I agree that this doesn't sound consistent with the Sling's way of
> doing things - you have to get a special service or utility if the
> Resource that you want to create is of a specific type (collection).
>
> Without checking if that's doable, I'd be less surprised with
>
>   properties.put("sling:resourceType", ResourceCollection.RESOURCE_TYPE);
>   final Resource r = resourceResolver.create(parent, name, properties);
>   final ResourceCollection c = r.adaptTo(ResourceCollection.class);
>
> Or even c = (ResourceCollection)resourceResolver.create(parent, name,
> properties) but that might fail.
>
> -Bertrand
>



-- 
Carsten Ziegeler
[email protected]

Reply via email to