You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Esteban Franqueiro <es...@bea.com> on 2008/04/01 21:05:16 UTC

Question regarding data store

Hi all.
I have a question regarding the handling of binary data that goes to the data store. Why is that in 
InternalValue.create(InputStream), when USE_DATA_STORE is true, getBLOBFileValue() is called with 
null as the data store?
This causes the stream to be dumped in a temp file.
The code I'm following is in BundleBinding.writeState(). A -2 is written as the size and the value 
is stored in the data store, but then the blob store code follows and dumps it to a file.
I don't understand why is this.
Any help is welcomed.
Regards,

Esteban Franqueiro
esteban.franqueiro@bea.com 


Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

Re: Question regarding data store

Posted by Thomas Mueller <th...@gmail.com>.
Hi,

> Why is that in
>  InternalValue.create(InputStream), when USE_DATA_STORE is true, getBLOBFileValue() is called with
>  null as the data store?
>  This causes the stream to be dumped in a temp file.

Yes.

>  The code I'm following is in BundleBinding.writeState(). A -2 is written as the size and the value
>  is stored in the data store

I think you refer to BundleBinding.java line 576:

                    if (InternalValue.USE_DATA_STORE && dataStore != null) {
                        out.writeInt(-2);
                        try {
                            val.store(dataStore);
                        } catch (RepositoryException e) {
                            String msg = "Error while storing blob. id="
                                + state.getId() + " idx=" + i + "
size=" + val.getBLOBFileValue().getLength();
                            log.error(msg, e);
                            throw new IOException(msg);
                        }
                        out.writeUTF(val.toString());
                        break;
                    }

> but then the blob store code follows and dumps it to a file.
Please notice the 'break' at the end if the if statement. That means
the blob is not written to the blob store. A agree the code is not
very clear... It would be good if we don't have 3 possible ways to
store blobs, maybe we can remove the old code (only support reading
from the blob store for compatibility, but not writing).

Regards,
Thomas