jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From travmik <trav...@gmail.com>
Subject Re: Empty content from any version
Date Mon, 09 Jun 2008 15:31:24 GMT

Thank you for you prompt reply. But method getInStream() in my transfer
object returns byte[]. In this section it's alright. 
I run my project using jcr-jca on jboss 4.2. Maybe it helps.
I am confusion.((



Alexander Klimetschek wrote:
> 
> The JCR API access looks good. I think the problem lies in the usage
> of the input stream. For example, ByteArrayInputStream does not take
> an InputStream as parameter in any of its constructors (it should be a
> byte[] parameter, but doc2.getInStream() sounds like it returns an
> InputStream):
> 
> resNode.setProperty("jcr:data", new
> ByteArrayInputStream(doc2.getInStream()));
> 
> Regards,
> Alex
> 
> On Mon, Jun 9, 2008 at 4:11 PM, travmik <travmik@gmail.com> wrote:
>>
>> Hi, all
>> I have very big problem. Can somebody help me?
>>
>> I create node:
>>
>>
>> Node rootNode = session.getRootNode();
>> Node documentNode = rootNode.addNode("test.txt", "nt:file");
>> Node resNode = contentNode.addNode("jcr:content", "nt:resource");
>> resNode.setProperty("jcr:mimeType", "text/plain");
>> resNode.setProperty("jcr:encoding", "UTF8");
>> resNode.setProperty("jcr:lastModified", System.currentTimeMillis());
>> resNode.setProperty("jcr:data", new
>> ByteArrayInputStream(doc1.getInStream()));
>> documentNode.addMixin("mix:versionable");
>> session.save();
>> documentNode.checkin();
>>
>>
>> Then i update node like this:
>>
>>
>> Node documentNode = session.getRootNode().getNode("test.txt");
>> documentNode.checkout();
>> Node resNode = contentNode.getNode("jcr:content");
>> resNode.setProperty("jcr:data", new
>> ByteArrayInputStream(doc2.getInStream()));
>> session.save();
>> documentNode.checkin();
>>
>>
>> And then i try to get data from content node:
>>
>>
>> Node node = session.getRootNode().getNode("test.txt");
>> VersionHistory hist = node.getVersionHistory();
>> Version vers = hist.getVersion(versionName);
>> Node frozenNode= vers.getNode("jcr:frozenNode");
>> Node versionNode = frozenNode.getNode("jcr:content");
>> InputStream  data = versionNode.getProperty("jcr:data").getStream();
>>
>> And all properties are setting up, but property with key "jcr:data" is
>> empty
>> for all versions from versionhistory. Why?? What do i do wrong?
>> Many thanks,
>> Stas
>> --
>> View this message in context:
>> http://www.nabble.com/Empty-content-from-any-version-tp17733642p17733642.html
>> Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.
>>
>>
> 
> -- 
> Alexander Klimetschek
> alexander.klimetschek@day.com
> 
> 

-- 
View this message in context: http://www.nabble.com/Empty-content-from-any-version-tp17733642p17735316.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.


Mime
View raw message