public class LazyProcessResourceImpl extends Object implements ProcessResource
UNKNOWN_SIZE
Constructor and Description |
---|
LazyProcessResourceImpl(String metacardId,
Supplier<Resource> resourceSupplier)
|
Modifier and Type | Method and Description |
---|---|
void |
close()
This is used to close the input stream.
|
InputStream |
getInputStream()
Return the input stream containing the
ProcessResource 's actual data content. |
String |
getMimeType()
Return the mime type raw data for the
ProcessResource , e.g., image/nitf or
application/json;id=geojson |
String |
getName()
A human friendly readable name.
|
String |
getQualifier()
An optional field to provide additional information about a
ProcessResource , that if
present, indicates that this ProcessResource is derived from another Resource . |
long |
getSize()
Return the total number of bytes in the
ProcessResource 's input stream. |
URI |
getUri()
Gets a URI that represents the resource in the catalog.
|
boolean |
isModified()
Determines if the
ProcessResource has been modified or created by any of the PostProcessPlugin s during processing by the ProcessingFramework . |
void |
markAsModified() |
void |
setSize(long size) |
void |
setUri(URI uri) |
public LazyProcessResourceImpl(String metacardId, Supplier<Resource> resourceSupplier)
ProcessResource
with a Supplier
used to load the Resource
.
The resource will not be loaded until the first time one of the following fields is accessed:
inputStream mimeType namemetacardId
- schema specific part of URI
, throws IllegalArgumentException
if empty or nullresourceSupplier
- a Supplier
used to load the resourceIllegalArgumentException
- if the input provided is not validpublic InputStream getInputStream() throws IOException
ProcessResource
's actual data content.
This will load the resource.
getInputStream
in interface ProcessResource
ProcessResource
's input streamIOException
- if the input stream is not availablepublic String getMimeType()
ProcessResource
, e.g., image/nitf or
application/json;id=geojson
This will load the resource.
getMimeType
in interface ProcessResource
ProcessResource
public String getName()
This will load the resource.
getName
in interface ProcessResource
ProcessResource
public String getQualifier()
ProcessResource
, that if
present, indicates that this ProcessResource
is derived from another Resource
. The parent content of this ProcessResource
is this
ProcessResource
's URI
without the qualifier.
This value should not require the resources to be loaded.
getQualifier
in interface ProcessResource
ProcessResource
public long getSize()
ProcessResource
's input stream.
This value should not require the resources to be loaded.
getSize
in interface ProcessResource
ProcessResource.UNKNOWN_SIZE
if the total number of bytes is unknown or not applicable (e.g., in the case
of a live stream)public URI getUri()
This value should not require the resources to be loaded.
getUri
in interface ProcessResource
ProcessResource
public void setSize(long size)
public void setUri(URI uri)
public boolean isModified()
ProcessResource
ProcessResource
has been modified or created by any of the PostProcessPlugin
s during processing by the ProcessingFramework
. This is used to
determine whether or not a UpdateStorageRequest
for this
ProcessResource
needs to be made back to the CatalogFramework
.isModified
in interface ProcessResource
true
if modified, false
otherwisepublic void close()
ProcessResource
Look into having the ProcessResource implement InputStream
close
in interface ProcessResource
public void markAsModified()
This work is licensed under a Creative Commons Attribution 4.0 International License.