
Package ca.uhn.fhir.jpa.binary.svc
Class NullBinaryStorageSvcImpl
java.lang.Object
ca.uhn.fhir.jpa.binary.svc.NullBinaryStorageSvcImpl
- All Implemented Interfaces:
IBinaryStorageSvc
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexpungeBinaryContent(org.hl7.fhir.instance.model.api.IIdType theIdElement, String theBlobId) byte[]fetchBinaryContent(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId) Fetch the contents of the given blobfetchBinaryContentDetails(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId) byte[]fetchDataByteArrayFromBinary(org.hl7.fhir.instance.model.api.IBaseBinary theResource) Fetch the byte[] contents of a given Binary resource's `data` element.longGets the maximum number of bytes that can be stored in a single binary file by this service.intGets the minimum number of bytes that will be stored.booleanisValidBinaryContentId(String theNewBlobId) Given a blob ID, return true if it is valid for the underlying storage mechanism, false otherwise.Generate a new binaryContent ID that will be passed toIBinaryStorageSvc.storeBinaryContent(IIdType, String, String, InputStream)latervoidsetMaximumBinarySize(long theMaximumBinarySize) Sets the maximum number of bytes that can be stored in a single binary file by this service.voidsetMinimumBinarySize(int theMinimumBinarySize) Sets the minimum number of bytes that will be stored.booleanshouldStoreBinaryContent(long theSize, org.hl7.fhir.instance.model.api.IIdType theResourceId, String theContentType) Give the storage service the ability to veto items from storagestoreBinaryContent(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobIdOrNull, String theContentType, InputStream theInputStream, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) Store a new binary blobbooleanwriteBinaryContent(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId, OutputStream theOutputStream) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ca.uhn.fhir.jpa.binary.api.IBinaryStorageSvc
storeBinaryContent
-
Constructor Details
-
NullBinaryStorageSvcImpl
public NullBinaryStorageSvcImpl()
-
-
Method Details
-
getMaximumBinarySize
Description copied from interface:IBinaryStorageSvcGets the maximum number of bytes that can be stored in a single binary file by this service. The default isLong.MAX_VALUE- Specified by:
getMaximumBinarySizein interfaceIBinaryStorageSvc
-
isValidBinaryContentId
Description copied from interface:IBinaryStorageSvcGiven a blob ID, return true if it is valid for the underlying storage mechanism, false otherwise.- Specified by:
isValidBinaryContentIdin interfaceIBinaryStorageSvc- Parameters:
theNewBlobId- the blob ID to validate- Returns:
- true if the blob ID is valid, false otherwise.
-
setMaximumBinarySize
Description copied from interface:IBinaryStorageSvcSets the maximum number of bytes that can be stored in a single binary file by this service. The default isLong.MAX_VALUE- Specified by:
setMaximumBinarySizein interfaceIBinaryStorageSvc- Parameters:
theMaximumBinarySize- The maximum size
-
getMinimumBinarySize
Description copied from interface:IBinaryStorageSvcGets 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:
getMinimumBinarySizein interfaceIBinaryStorageSvc
-
setMinimumBinarySize
Description copied from interface:IBinaryStorageSvcSets 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:
setMinimumBinarySizein interfaceIBinaryStorageSvc
-
shouldStoreBinaryContent
public boolean shouldStoreBinaryContent(long theSize, org.hl7.fhir.instance.model.api.IIdType theResourceId, String theContentType) Description copied from interface:IBinaryStorageSvcGive the storage service the ability to veto items from storage- Specified by:
shouldStoreBinaryContentin interfaceIBinaryStorageSvc- Parameters:
theSize- How large is the itemtheResourceId- What is the resource ID it will be associated withtheContentType- What is the content type- Returns:
trueif the storage service should store the item
-
newBinaryContentId
Description copied from interface:IBinaryStorageSvcGenerate a new binaryContent ID that will be passed toIBinaryStorageSvc.storeBinaryContent(IIdType, String, String, InputStream)later- Specified by:
newBinaryContentIdin interfaceIBinaryStorageSvc
-
storeBinaryContent
@Nonnull public StoredDetails storeBinaryContent(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:IBinaryStorageSvcStore a new binary blob- Specified by:
storeBinaryContentin interfaceIBinaryStorageSvc- 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, forcestheContentType- The content type to associate with this blobtheInputStream- 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
-
fetchBinaryContentDetails
public StoredDetails fetchBinaryContentDetails(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId) - Specified by:
fetchBinaryContentDetailsin interfaceIBinaryStorageSvc
-
writeBinaryContent
public boolean writeBinaryContent(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId, OutputStream theOutputStream) - Specified by:
writeBinaryContentin interfaceIBinaryStorageSvc- Returns:
- Returns
trueif the blob was found and written, offalseif the blob was not found (i.e. it was expunged or the ID was invalid)
-
expungeBinaryContent
public void expungeBinaryContent(org.hl7.fhir.instance.model.api.IIdType theIdElement, String theBlobId) - Specified by:
expungeBinaryContentin interfaceIBinaryStorageSvc
-
fetchBinaryContent
public byte[] fetchBinaryContent(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId) Description copied from interface:IBinaryStorageSvcFetch the contents of the given blob- Specified by:
fetchBinaryContentin interfaceIBinaryStorageSvc- Parameters:
theResourceId- The resource IDtheBlobId- The blob ID- Returns:
- The payload as a byte array
-
fetchDataByteArrayFromBinary
Description copied from interface:IBinaryStorageSvcFetch 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:
fetchDataByteArrayFromBinaryin interfaceIBinaryStorageSvc- Parameters:
theResource- The Binary resource you want to extract data bytes from- Returns:
- The binary data blob as a byte array
-