Hi Marcel,

I figured out my mistake! It works like a charm as expected and
described in the wiki page [1].
So, even when retrieving a Binary value from existing property, the
following example works fine, too:

    Value value = prop.getValue();
    if (value instanceof JackrabbitValue) {
        String contentId = ((JackrabbitValue) value).getContentIdentity();
    }

My mistake was I didn't realize that DataStore component is optional,
so if not specified with any, no DataStore used by default. Not from
DataStore, no contentIdentity like you mentioned insightfully. :-)

For others' information, I simply added the following for a simple H2
based demo:

  <DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
    <param name="url" value="jdbc:h2:file:${rep.home}/version/db"/>
    <param name="databaseType" value="h2"/>
    <param name="driver" value="org.h2.Driver"/>
    <param name="minRecordLength" value="1024"/>
    <param name="copyWhenReading" value="true"/>
  </DataStore>

By the way, minRecoredLength is 100 bytes by default, not 1024 bytes
as configured in the above example.

Cheers,

Woonsan

[1] https://wiki.apache.org/jackrabbit/DataStore

On Wed, Jul 13, 2016 at 8:52 AM, Woonsan Ko <[email protected]> wrote:
> Hi Marcel,
>
> On Wed, Jul 13, 2016 at 2:40 AM, Marcel Reutegger <[email protected]> wrote:
>> Hi,
>>
>> On 08/07/16 06:20, "Woonsan Ko" wrote:
>>>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...
>>
>> Only Binary objects served from a DataStore have an identifier.
>> Smaller binaries are usually inlined by the PersistenceManager.
>> IIRC the threshold is 4k. Maybe your test creates binaries smaller
>> than this threshold?
>
> I guess I already checked that possibility and made sure on binary
> from DataStore at the moment.
> But it reminds me of the possibility to put a debugger to see how
> PersistenceManager passes the DataIdentifier to DataStore through the
> stack trace.
> I'll take a look again later and let you know if I find anything interesting.
>
> Thanks,
>
> Woonsan
>
>>
>> Regards
>>  Marcel
>>

Reply via email to