jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tobias Bocanegra" <tobias.bocane...@day.com>
Subject Re: Difference between nodetypes structure.
Date Thu, 09 Mar 2006 15:11:54 GMT
hi helio,
the first implementation is necessary, since a nt:file is defined to
have a jcr:content child node. the nt:file does not define the
jcr:data or jcr:mimeType properties.

have a look at those relevant nodetypes again:

[nt:hierarchyNode]
  - jcr:created (date) mandatory autocreated protected initialize

[nt:file] > nt:hierarchyNode
  + jcr:content (nt:base) primary mandatory

[nt:resource] > mix:referenceable
  - jcr:encoding (string)
  - jcr:mimeType (string) mandatory
  - jcr:data (binary) primary mandatory
  - jcr:lastModified (date) mandatory ignor


regards, toby

On 3/9/06, hsp <piccinatto@ibest.com.br> wrote:
> Hi;
> I would to know what is the difference between the following implementation code:
> "   Node fileNode = parentnode.addNode(file.getName(), "nt:file");
>      Node resNode = fileNode.addNode("jcr:content", "nt:resource");
>      resNode.setProperty("jcr:mimeType", mimeType);
>      resNode.setProperty("jcr:encoding", "");
>      resNode.setProperty("jcr:data", new FileInputStream(file));
> ...."
>  and the another:
>
> " Node fileNode = parentnode.addNode(file.getName(), "nt:file");
>   fileNode.setProperty("jcr:mimeType", mimeType);
>   fileNode.setProperty("jcr:encoding", "");
>   fileNode.setProperty("jcr:data", new FileInputStream(file));
> ...."
>
> What is the consequences, considerations. Is it wrong? Is the first implementation necessary?
What is the best pratice for?
>
> Thanks
> Helio
>


--
-----------------------------------------< 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 >---

Mime
View raw message