Hi,
we discussed this topic a little bit from time to time and with the
recent changes of SLING-1420 it's obvious that the current approach, the
JcrResourceNodeTypeProvider which gets a node and maybe returns a
resource type, is not sufficient and has some problems.
Now one solution would be to have something like
interface ResourceTypeProvider {
String getResourceType(Resource)
}
This would be analog to the JcrResourceTypeProvider. However this kind
of looks wrong to me, as first a resource is created - with a resource
type amongst others - and then a new resource (or wrapper) needs to be
created with the new resource type.
So we could change this to something like
interface ResourceTypeProvider {
String getResourceType(String path, String resourceType,
ResourceMetadata metadata)
}
which doesn't look very appealing to me.
While thinking about this, the question came up if we could have the use
case where a provider not only wants to provide a different resource
type but maybe also a different resource super type?
What about additional metadata?
We could make a general approach like (I couldn't make up could names
for the interface and methods...)
interface ResourceProcessor {
Resource process(Resource);
}
so basically this works like kind of a filter which is able to
substitute a resource with a completly different one - this could be
used to change the resource type, the super resource type, metadata,
different implementations of the adaptTo method etc. Everything is
possible....
Is this YAGNI?
WDYT?
Regards
Carsten
--
Carsten Ziegeler
[email protected]