I saw how it is coded to return null. You are right. I'm not familiar with this exact class, but probably means this is a class used as a base class usually and normally some other class will extend it and implement that method to actually return some value. I'd search the entire source (you may need to unzip onto your machine to search it) and see what other classes derive from this as a base class. See if your code is actually this base class or some other class. If you step into it and it goes right to that "return null" then you know you have somehow gotten the base class instantiated or else you just have a class that doesn't provide the implementation. Probably implementing this method is not defined. Just detect if this is the case, and do your own checksum may be the best you can do if you need an actual checksum.
Best regards, Clay Ferguson [email protected] On Thu, Jul 7, 2016 at 11:20 PM, Woonsan Ko <[email protected]> wrote: > 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 > >> >
