Class NullBinaryStorageSvcImpl

java.lang.Object
ca.uhn.fhir.jpa.binary.svc.NullBinaryStorageSvcImpl
All Implemented Interfaces:
IBinaryStorageSvc

public class NullBinaryStorageSvcImpl extends Object implements IBinaryStorageSvc
  • Constructor Details

  • Method Details

    • getMaximumBinarySize

      public long getMaximumBinarySize()
      Description copied from interface: IBinaryStorageSvc
      Gets the maximum number of bytes that can be stored in a single binary file by this service. The default is Long.MAX_VALUE
      Specified by:
      getMaximumBinarySize in interface IBinaryStorageSvc
    • isValidBlobId

      public boolean isValidBlobId(String theNewBlobId)
      Description copied from interface: IBinaryStorageSvc
      Given a blob ID, return true if it is valid for the underlying storage mechanism, false otherwise.
      Specified by:
      isValidBlobId in interface IBinaryStorageSvc
      Parameters:
      theNewBlobId - the blob ID to validate
      Returns:
      true if the blob ID is valid, false otherwise.
    • setMaximumBinarySize

      public void setMaximumBinarySize(long theMaximumBinarySize)
      Description copied from interface: IBinaryStorageSvc
      Sets the maximum number of bytes that can be stored in a single binary file by this service. The default is Long.MAX_VALUE
      Specified by:
      setMaximumBinarySize in interface IBinaryStorageSvc
      Parameters:
      theMaximumBinarySize - The maximum size
    • getMinimumBinarySize

      public int getMinimumBinarySize()
      Description copied from interface: IBinaryStorageSvc
      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.
      Specified by:
      getMinimumBinarySize in interface IBinaryStorageSvc
    • setMinimumBinarySize

      public void setMinimumBinarySize(int theMinimumBinarySize)
      Description copied from interface: IBinaryStorageSvc
      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.
      Specified by:
      setMinimumBinarySize in interface IBinaryStorageSvc
    • shouldStoreBlob

      public boolean shouldStoreBlob(long theSize, org.hl7.fhir.instance.model.api.IIdType theResourceId, String theContentType)
      Description copied from interface: IBinaryStorageSvc
      Give the storage service the ability to veto items from storage
      Specified by:
      shouldStoreBlob in interface IBinaryStorageSvc
      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

      public String newBlobId()
      Description copied from interface: IBinaryStorageSvc
      Generate a new blob ID that will be passed to IBinaryStorageSvc.storeBlob(IIdType, String, String, InputStream) later
      Specified by:
      newBlobId in interface IBinaryStorageSvc
    • storeBlob

      @Nonnull public StoredDetails storeBlob(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobIdOrNull, String theContentType, InputStream theInputStream, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails)
      Description copied from interface: IBinaryStorageSvc
      Store a new binary blob
      Specified by:
      storeBlob in interface IBinaryStorageSvc
      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.
      theRequestDetails - The operation request details.
      Returns:
      Returns details about the stored data
    • fetchBlobDetails

      public StoredDetails fetchBlobDetails(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId)
      Specified by:
      fetchBlobDetails in interface IBinaryStorageSvc
    • writeBlob

      public boolean writeBlob(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId, OutputStream theOutputStream)
      Specified by:
      writeBlob in interface IBinaryStorageSvc
      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)
    • expungeBlob

      public void expungeBlob(org.hl7.fhir.instance.model.api.IIdType theIdElement, String theBlobId)
      Specified by:
      expungeBlob in interface IBinaryStorageSvc
    • fetchBlob

      public byte[] fetchBlob(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId)
      Description copied from interface: IBinaryStorageSvc
      Fetch the contents of the given blob
      Specified by:
      fetchBlob in interface IBinaryStorageSvc
      Parameters:
      theResourceId - The resource ID
      theBlobId - The blob ID
      Returns:
      The payload as a byte array
    • fetchDataBlobFromBinary

      public byte[] fetchDataBlobFromBinary(org.hl7.fhir.instance.model.api.IBaseBinary theResource)
      Description copied from interface: IBinaryStorageSvc
      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.
      Specified by:
      fetchDataBlobFromBinary in interface IBinaryStorageSvc
      Parameters:
      theResource - The Binary resource you want to extract data bytes from
      Returns:
      The binary data blob as a byte array