Hi,
The resource resolver provides the following method for creating a new 
resource: 

"Resource create(@NotNull Resource parent, @NotNull String name, Map<String, 
Object> properties) throws PersistenceException" [1]

However there is neither a parameter for providing the mandatory resource type 
nor for the (optional) resource super type or ResourceMetadata [2]. The 
resource type is not necessarily exposed via the underlying ValueMap() (just 
for the JCR resource provider this is the case as it stores the resource type 
in the node property with name “sling:resourceType”). Also those are immutable 
properties of a resource (i.e. there is no API to change those on existing 
resources).

Compare also with the signature for creating a synthetic resource (which lacks 
support of resource super types, but supports at least resource type and 
resource metadata) [3].

So how is one supposed to create a resource with a dedicated resource type and 
super type in a provider-agnostic way?

Thanks for your input,
Konrad

[1] - 
https://github.com/apache/sling-org-apache-sling-api/blob/13ac9b09bb7bdc7e4baa2c62fd622421628a61f3/src/main/java/org/apache/sling/api/resource/ResourceResolver.java#L787
[2] - 
https://sling.apache.org/documentation/the-sling-engine/resources.html#resource-properties
[3] - 
https://github.com/apache/sling-org-apache-sling-api/blob/13ac9b09bb7bdc7e4baa2c62fd622421628a61f3/src/main/java/org/apache/sling/api/resource/SyntheticResource.java#L65

Reply via email to