You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Illarion Kovalchuk <il...@gmail.com> on 2010/02/26 15:40:53 UTC

How to store randomly accessed data in jackrabbit?

Hello!

I'm new to Jackrabbit and JCR, so please forgive me if my question is dumb.

My task is to determine the proper JCR repository structure for storing 
of binary data, so that I'll be able to:

1) Read data starting from any offset
2) Write/Modify data starting from any offset

It seems that binary properties can't be used in such way, so I need to 
implement some logic on top of jcr... Could you help?

-- 
With best regards

Illarion Kovalchuk, COMODO Online Backup.


Re: How to store randomly accessed data in jackrabbit?

Posted by Thomas Müller <th...@day.com>.
Hi,

> does JCR and Jackrabbit support calculated
> Properties?

No. There is one feature that goes in this direction: observation.

See also http://www.day.com/specs/jcr/2.0/

Regards,
Thomas

Re: How to store randomly accessed data in jackrabbit?

Posted by Illarion Kovalchuk <il...@gmail.com>.
Thomas Müller wrote:
> Hi,
>
>   
>> we have to deal with big contents, from hundreds of megabytes
>> to gigabytes, and clients will work remotely
>> via internet, so they just can't get binary content as a whole, modify it
>> and upload again.
>>
>> Is there some other way?
>>     
>
> You could split the file into multiple objects.
>
> Regards,
> Thomas
>
>   
We will have to do so, if there is no other way. So, the question now 
transforms to following: does JCR and Jackrabbit support calculated 
Properties? I mean such properties, that could be:

1) while reading: calculated on the fly from other properties
2) while writing: not stored, but perform some code on other properties.


-- 
With best regards

Illarion Kovalchuk, COMODO Online Backup.



Re: How to store randomly accessed data in jackrabbit?

Posted by Thomas Müller <th...@day.com>.
Hi,

> we have to deal with big contents, from hundreds of megabytes
> to gigabytes, and clients will work remotely
> via internet, so they just can't get binary content as a whole, modify it
> and upload again.
>
> Is there some other way?

You could split the file into multiple objects.

Regards,
Thomas

Re: How to store randomly accessed data in jackrabbit?

Posted by Illarion Kovalchuk <il...@gmail.com>.
Alexander Klimetschek wrote:
> On Fri, Feb 26, 2010 at 15:40, Illarion Kovalchuk
> <il...@gmail.com> wrote:
>   
>> My task is to determine the proper JCR repository structure for storing of
>> binary data, so that I'll be able to:
>>
>> 1) Read data starting from any offset
>> 2) Write/Modify data starting from any offset
>>
>> It seems that binary properties can't be used in such way, so I need to
>> implement some logic on top of jcr... Could you help?
>>     
>
> Yes, binary properties can only be read as a whole (InputStream
> returned is read-only) and stored back as a whole (new input stream).
>
> I think the way to go is to copy the existing binary value (note: pseudo-code)
>
> node.getProperty("jcr:data").getBinary().getInputStream()
>
> into either a local file or an in-memory input stream, do your work
> there and then finally store the whole stream again
>
> node.setProperty("jcr:data", valueFactory.createBinary(stream))
>
> Regards,
> Alex
>
>   
Thanks, but your solution would be acceptable for small amounts of data, 
but in our project we have to deal with big contents, from hundreds of 
megabytes to gigabytes, and clients will work remotely
 via internet, so they just can't get binary content as a whole, modify 
it and upload again.

 Is there some other way?

-- 
With best regards

Illarion Kovalchuk, COMODO Online Backup.


Re: How to store randomly accessed data in jackrabbit?

Posted by Alexander Klimetschek <ak...@day.com>.
On Fri, Feb 26, 2010 at 15:40, Illarion Kovalchuk
<il...@gmail.com> wrote:
> My task is to determine the proper JCR repository structure for storing of
> binary data, so that I'll be able to:
>
> 1) Read data starting from any offset
> 2) Write/Modify data starting from any offset
>
> It seems that binary properties can't be used in such way, so I need to
> implement some logic on top of jcr... Could you help?

Yes, binary properties can only be read as a whole (InputStream
returned is read-only) and stored back as a whole (new input stream).

I think the way to go is to copy the existing binary value (note: pseudo-code)

node.getProperty("jcr:data").getBinary().getInputStream()

into either a local file or an in-memory input stream, do your work
there and then finally store the whole stream again

node.setProperty("jcr:data", valueFactory.createBinary(stream))

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com