Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-16376

Cleanup Blob class hierarchy

    XMLWordPrintable

    Details

    • Type: Clean up
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.2
    • Component/s: Core
    • Tags:
    • Impact type:
      API change
    • Upgrade notes:
      Hide

      A new Blobs utility class has been introduced, providing factory methods for Blob creation. It should be used in preference over the existing constructors.

      So instead of:

      Blob blob = new InputStreamBlob(request.getInputStream());
      Blob blob = new FileBlob(file, mimeType);
      Blob blob = new StringBlob("foo");
      Blob blob = new ByteArrayBlob(contentBytes, mimeType, encoding);

      One should use:

      Blob blob = Blobs.createBlob(request.getInputStream());
      Blob blob = Blobs.createBlob(file, mimeType);
      Blob blob = Blobs.createBlob("foo");
      Blob blob = Blobs.createBlob(contentBytes, mimeType, encoding);

      Note that Blobs.createBlobWithExtension is also available.

      StorageBlob has been renamed to BinaryBlob and must not be used outside of the storage implementations.

      Show
      A new Blobs utility class has been introduced, providing factory methods for Blob creation. It should be used in preference over the existing constructors. So instead of: Blob blob = new InputStreamBlob(request.getInputStream()); Blob blob = new FileBlob(file, mimeType); Blob blob = new StringBlob("foo"); Blob blob = new ByteArrayBlob(contentBytes, mimeType, encoding); One should use: Blob blob = Blobs.createBlob(request.getInputStream()); Blob blob = Blobs.createBlob(file, mimeType); Blob blob = Blobs.createBlob("foo"); Blob blob = Blobs.createBlob(contentBytes, mimeType, encoding); Note that Blobs.createBlobWithExtension is also available. StorageBlob has been renamed to BinaryBlob and must not be used outside of the storage implementations.
    • Sprint:
      Sprint RepoTeam 7.1-2

      Description

      The various implementations of Blob are a mess.

      The current state is:

      • AbstractBlob (transferTo & copy methods) (no direct refs)
        • DefaultBlob (getters) (no direct refs)
          • ByteArrayBlob
          • StringBlob
          • BlobWrapper (changes filename)
          • StreamingBlob (from StreamSource, checks if can reopen)
            • TemporaryFileBlob (new, 2 versions, 1 deprecated)
            • TmpStreamingBlob (unit test)
        • StreamBlob (no direct refs except 1 test)
          • DefaultStreamBlob (getters) (identical to DefaultBlob) (no direct refs)
            • FileBlob
            • InputStreamBlob
            • SQLBlob
            • URLBlob (used once in operation)
      • SQLBlob (adds getBinary)
        • StorageBlob

      Simplify this to:

      • AbstractBlob (getters + transferTo & copy methods) (no direct refs)
        • ByteArrayBlob
        • FileBlob
        • StorageBlob
        • StringBlob
        • URLBlob
        • ZipEntryBlob
      • BlobWrapper

      In addition, InputStreamBlob + ByteArrayInputStream is being used in many operations when StringBlob would be simpler.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: