close

Filter

loading table of contents...

CoreMedia Content Cloud v12 Upgrade Guide / Version 2404

Table Of Contents

7.2.4 Blob API Changes

Caution

Recompile and Maybe Source Code Changes Necessary

The Blob API has been changed to support blobs larger than 2GB. This change affects the public API. You must at least recompile your project Blueprint workspace against the new CMCC version. Depending on your customizations, you may have to adjust some source code too, as explained below.

Supporting huge blobs implies that we cannot represent blob sizes as int values any longer, but had to switch to long. This required some changes that affect the public API.

To access a blob’s size, a new UAPI method com.coremedia.cap.common.Blob#getSizeLong() has been introduced which returns the blob size as a long value. The still existing method Blob#getSize():int has been deprecated and will be removed in a future release. Please be aware that this deprecated method will fail with an exception when called for a blob of size 2GB and beyond since an int value cannot represent huge numbers (it’s limited to java.lang.Integer#MAX_VALUE). To be safe, only the new method Blob#getSizeLong()}}should be used in UAPI clients and Freemarker templates.

All usages of Blob#getSize() have been replaced by Blob#getSizeLong() in the Blueprint workspace. For backward compatibility, Blob#getSizeLong() is a default method that delegates to Blob#getSize(). Thus, existing custom implementations of the Blob interface will still work until we finally delete Blob#getSize().

Furthermore, avoid the use of method Blob#asBytes():bytes[] if huge blobs are to be processed, as a Java array can only hold up to java.lang.Integer#MAX_VALUE bytes and thus cannot be used for huge blobs. Calling this method on a huge blob will result in an exception being thrown. Ideally, all blobs should be transferred via streams.

The interface com.coremedia.cap.common.BlobService features various blob creation methods which expect a size argument. The type of the size argument has been changed from int to long for all those methods.

In the interface com.coremedia.cap.common.CapConnectionManager the methods setMaxCachedBlobSize and getMaxCachedBlobSize have been changed from int to long.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.