Hi Chetan

On 15/07/16 09:47, "Chetan Mehrotra" <[email protected]> wrote:

>In most cases where code uses JcrUtils.putFile [1] it leads to
>creation of below content structure
>
>+ foo.jpg (nt:file)
>   + jcr:content (nt:resource)
>       - jcr:data
>
>Due to usage of nt:resource each nt:file node creates a entry in uuid
>index as nt:resource is referenceable [2]. So if a system has 1M
>nt:file nodes then we would have 1M entries in /oak:index/uuid as in
>most cases the files are created via [1] and hence all such files are
>referenceable
>
>The nodetype defn for nt:file [3] does not mandate that the
>requirement for jcr:content being nt:resource.
>
>So should we register a new oak:Resource nodetype which is same as
>nt:resource but not referenceable. This would be similar to
>oak:Unstructured.

+1

>
>Also what should we do for [1]. Should we provide an overloaded method
>which also accepts a nodetype for jcr:content node as it cannot use
>oak:Resource

Yes, we can do that.

Additionally or alternatively we could create a separate method (e.g.
putOakFile
or putOakResource or something explicitly mentioning the non-referenceable
nature of the content) that uses 'oak:Resource' and state that it requires
the
node type to be registered and will fail otherwise... that would be as easy
to use as 'putFile', which is IMO important.

Also I should explicitly refer to the oak-variant in the javadoc of
'putFile'
and explain the difference (and vice versa).

Kind regards
Angela


>
>Chetan Mehrotra
>[1] 
>https://github.com/apache/jackrabbit/blob/trunk/jackrabbit-jcr-commons/src
>/main/java/org/apache/jackrabbit/commons/JcrUtils.java#L1062
>
>[2]
>[nt:resource] > mix:lastModified, mix:mimeType, mix:referenceable
>  primaryitem jcr:data
>   - jcr:data (binary) mandatory
>
>[3]
>
>[nt:file] > nt:hierarchyNode
>  primaryitem jcr:content
>  + jcr:content (nt:base) mandatory

Reply via email to