Interface IBinaryStorageSvc

All Known Implementing Classes:
BaseBinaryStorageSvcImpl, FilesystemBinaryStorageSvcImpl, MemoryBinaryStorageSvcImpl, NullBinaryStorageSvcImpl

public interface IBinaryStorageSvc
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    expungeBlob(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId)
     
    byte[]
    fetchBlob(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId)
    Fetch the contents of the given blob
    fetchBlobDetails(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId)
     
    byte[]
    fetchDataBlobFromBinary(org.hl7.fhir.instance.model.api.IBaseBinary theResource)
    Fetch the byte[] contents of a given Binary resource's `data` element.
    int
    Gets the maximum number of bytes that can be stored in a single binary file by this service.
    int
    Gets the minimum number of bytes that will be stored.
    Generate a new blob ID that will be passed to storeBlob(IIdType, String, String, InputStream) later
    void
    setMaximumBinarySize(int theMaximumBinarySize)
    Sets the maximum number of bytes that can be stored in a single binary file by this service.
    void
    setMinimumBinarySize(int theMinimumBinarySize)
    Sets the minimum number of bytes that will be stored.
    boolean
    shouldStoreBlob(long theSize, org.hl7.fhir.instance.model.api.IIdType theResourceId, String theContentType)
    Give the storage service the ability to veto items from storage
    storeBlob(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobIdOrNull, String theContentType, InputStream theInputStream)
    Store a new binary blob
    boolean
    writeBlob(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId, OutputStream theOutputStream)
     
  • Method Details

    • getMaximumBinarySize

      Gets the maximum number of bytes that can be stored in a single binary file by this service. The default is Integer.MAX_VALUE
    • setMaximumBinarySize

      void setMaximumBinarySize(int theMaximumBinarySize)
      Sets the maximum number of bytes that can be stored in a single binary file by this service. The default is Integer.MAX_VALUE
      Parameters:
      theMaximumBinarySize - The maximum size
    • getMinimumBinarySize

      Gets the minimum number of bytes that will be stored. Binary content smaller * than this threshold may be inlined even if a binary storage service * is active.
    • setMinimumBinarySize

      void setMinimumBinarySize(int theMinimumBinarySize)
      Sets the minimum number of bytes that will be stored. Binary content smaller than this threshold may be inlined even if a binary storage service is active.
    • shouldStoreBlob

      boolean shouldStoreBlob(long theSize, org.hl7.fhir.instance.model.api.IIdType theResourceId, String theContentType)
      Give the storage service the ability to veto items from storage
      Parameters:
      theSize - How large is the item
      theResourceId - What is the resource ID it will be associated with
      theContentType - What is the content type
      Returns:
      true if the storage service should store the item
    • newBlobId

      Generate a new blob ID that will be passed to storeBlob(IIdType, String, String, InputStream) later
    • storeBlob

      @Nonnull StoredDetails storeBlob(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobIdOrNull, String theContentType, InputStream theInputStream) throws IOException
      Store a new binary blob
      Parameters:
      theResourceId - The resource ID that owns this blob. Note that it should not be possible to retrieve a blob without both the resource ID and the blob ID being correct.
      theBlobIdOrNull - If set, forces
      theContentType - The content type to associate with this blob
      theInputStream - An InputStream to read from. This method should close the stream when it has been fully consumed.
      Returns:
      Returns details about the stored data
      Throws:
      IOException
    • fetchBlobDetails

      StoredDetails fetchBlobDetails(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId) throws IOException
      Throws:
      IOException
    • writeBlob

      boolean writeBlob(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId, OutputStream theOutputStream) throws IOException
      Returns:
      Returns true if the blob was found and written, of false if the blob was not found (i.e. it was expunged or the ID was invalid)
      Throws:
      IOException
    • expungeBlob

      void expungeBlob(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId)
    • fetchBlob

      byte[] fetchBlob(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId) throws IOException
      Fetch the contents of the given blob
      Parameters:
      theResourceId - The resource ID
      theBlobId - The blob ID
      Returns:
      The payload as a byte array
      Throws:
      IOException
    • fetchDataBlobFromBinary

      byte[] fetchDataBlobFromBinary(org.hl7.fhir.instance.model.api.IBaseBinary theResource) throws IOException
      Fetch the byte[] contents of a given Binary resource's `data` element. If the data is a standard base64encoded string that is embedded, return it. Otherwise, attempt to load the externalized binary blob via the the externalized binary storage service.
      Parameters:
      theResourceId - The resource ID The ID of the Binary resource you want to extract data bytes from
      Returns:
      The binary data blob as a byte array
      Throws:
      IOException