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 <[EMAIL PROTECTED]> 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
>
--
-----------------------------------------< [EMAIL PROTECTED] >---
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 >---