Hi Clay,

On Thu, Jul 7, 2016 at 6:55 PM, Clay Ferguson <[email protected]> wrote:
> Woosan,
> The contentIdentity is basically a "hash" of the data, so it can't be
> generated for the first time without using the actual data, so the data I
> think has to be read first. But it seems like you could store the hash
> somewhere if you wanted to, You could just set a breakpoing on the
> 'getContentIdentity' and step into the code and see that it's generating a
> hash. Seems like they would have stored this hash so it can be used again,
> but i'm not sure if it's stored or not. If it is, stored you could use the
> stored value rather than let it get recalculated every time.

If I'm not mistaken, I guess the content id should be stored somewhere
by PersistenceManager. DataStore#getRecord(DataIdentifier) is invoked
to retrieve binary data if stored in a DataStore. I'm experimenting
with VfsDataStore (JCR-3975) and seeing the hash-like identifiers all
the time. Should be same as FileDataStore or DbDataStore.
In my debugging, it hits
org.apache.jackrabbit.core.value.BLOBFileValue#getDataIdentifier()
when retrieving a binary value. The method is hard-coded to return
null. Maybe I missed something...

Thanks for your remarks,

Woonsan

>
> Best regards,
> Clay Ferguson
> [email protected]
>
>
> On Thu, Jul 7, 2016 at 4:14 PM, Woonsan Ko <[email protected]> wrote:
>
>> Hi,
>>
>> I'm trying to retrieve Binary Value Identifier by following [1].
>> The example shows retrieving it when creating a binary value.
>> Is it possible to retrieve the identifier when reading binary value
>> afterward?
>> I tried it like this:
>>
>>             if (value instanceof JackrabbitValue) {
>>                 contentId = ((JackrabbitValue) value).getContentIdentity();
>>             }
>>
>> But, it always returns null. In debugging, it hits
>> org.apache.jackrabbit.core.value.BLOBFileValue#getDataIdentifier() in
>> my example and the method always returns null.
>>
>> Is #getContentIdentity() supposed to be used only when creating a
>> binary value once initially, or is it kind of shortcoming at the
>> moment?
>>
>> Regards,
>>
>> Woonsan
>>
>> [1] https://wiki.apache.org/jackrabbit/DataStore#Retrieve_the_Identifier
>>

Reply via email to