
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 TypeMethodDescriptionvoid
expungeBlob
(org.hl7.fhir.instance.model.api.IIdType theIdElement, String theBlobId) byte[]
Fetch the contents of the given blobfetchBlobDetails
(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.long
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 toIBinaryStorageSvc.storeBlob(IIdType, String, String, InputStream)
latervoid
setMaximumBinarySize
(long 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 storagestoreBlob
(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobIdOrNull, String theContentType, InputStream theInputStream) Store a new binary blobboolean
writeBlob
(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId, OutputStream theOutputStream)
-
Constructor Details
-
NullBinaryStorageSvcImpl
public NullBinaryStorageSvcImpl()
-
-
Method Details
-
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 isLong.MAX_VALUE
- Specified by:
getMaximumBinarySize
in interfaceIBinaryStorageSvc
-
setMaximumBinarySize
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 isLong.MAX_VALUE
- Specified by:
setMaximumBinarySize
in interfaceIBinaryStorageSvc
- Parameters:
theMaximumBinarySize
- The maximum size
-
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 interfaceIBinaryStorageSvc
-
setMinimumBinarySize
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 interfaceIBinaryStorageSvc
-
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 interfaceIBinaryStorageSvc
- Parameters:
theSize
- How large is the itemtheResourceId
- What is the resource ID it will be associated withtheContentType
- What is the content type- Returns:
true
if the storage service should store the item
-
newBlobId
Description copied from interface:IBinaryStorageSvc
Generate a new blob ID that will be passed toIBinaryStorageSvc.storeBlob(IIdType, String, String, InputStream)
later- Specified by:
newBlobId
in interfaceIBinaryStorageSvc
-
storeBlob
public StoredDetails storeBlob(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobIdOrNull, String theContentType, InputStream theInputStream) Description copied from interface:IBinaryStorageSvc
Store a new binary blob- Specified by:
storeBlob
in 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.- 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 interfaceIBinaryStorageSvc
-
writeBlob
public boolean writeBlob(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId, OutputStream theOutputStream) - Specified by:
writeBlob
in interfaceIBinaryStorageSvc
- Returns:
- Returns
true
if the blob was found and written, offalse
if the blob was not found (i.e. it was expunged or the ID was invalid)
-
expungeBlob
- Specified by:
expungeBlob
in interfaceIBinaryStorageSvc
-
fetchBlob
Description copied from interface:IBinaryStorageSvc
Fetch the contents of the given blob- Specified by:
fetchBlob
in interfaceIBinaryStorageSvc
- Parameters:
theResourceId
- The resource IDtheBlobId
- The blob ID- Returns:
- The payload as a byte array
-
fetchDataBlobFromBinary
public byte[] fetchDataBlobFromBinary(org.hl7.fhir.instance.model.api.IBaseBinary theResource) throws IOException 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 interfaceIBinaryStorageSvc
- Returns:
- The binary data blob as a byte array
- Throws:
IOException
-