public class ContentItemImpl extends Object implements ContentItem
Modifier and Type | Field and Description |
---|---|
protected String |
qualifier |
protected URI |
uri |
CONTENT_SCHEME, DEFAULT_FILE_NAME, DEFAULT_MIME_TYPE, QUALIFIER
Constructor and Description |
---|
ContentItemImpl(String id,
com.google.common.io.ByteSource byteSource,
String mimeTypeRawData,
Metacard metacard)
An incoming content item where the item's GUID should be known.
|
ContentItemImpl(String id,
com.google.common.io.ByteSource byteSource,
String mimeTypeRawData,
String filename,
long size,
Metacard metacard)
An incoming content item where the item's GUID and size should be known.
|
ContentItemImpl(String id,
String qualifier,
com.google.common.io.ByteSource byteSource,
String mimeTypeRawData,
Metacard metacard)
An incoming content item where the item's GUID and size should be known.
|
ContentItemImpl(String id,
String qualifier,
com.google.common.io.ByteSource byteSource,
String mimeTypeRawData,
String filename,
long size,
Metacard metacard)
An incoming content item where the item's GUID and size should be known.
|
Modifier and Type | Method and Description |
---|---|
String |
getFilename()
Return the filename of the
ContentItem . |
String |
getId()
Return the globally unique ID for the content item.
|
InputStream |
getInputStream()
Return the input stream containing the item's actual data content.
|
Metacard |
getMetacard()
Return the metacard associated with this product.
|
MimeType |
getMimeType()
Return the mime type for the content item, e.g., image/nitf or application/pdf.
|
String |
getMimeTypeRawData()
Return the mime type raw data for the content item, e.g., image/nitf or
application/json;id=geojson.
|
String |
getQualifier()
Return the optional field to describe the
ContentItem as an additional product for a
Metacard . |
long |
getSize()
Return the total number of bytes in the item's input stream.
|
String |
getUri()
Return the URI of the content item.
|
String |
toString() |
public ContentItemImpl(String id, com.google.common.io.ByteSource byteSource, String mimeTypeRawData, Metacard metacard)
id
- the ContentItem
's GUID - can be nullbyteSource
- the ContentItem
's input stream containing its actual datamimeTypeRawData
- the ContentItem
's mime typemetacard
- the ContentItem
's associated metacardpublic ContentItemImpl(String id, String qualifier, com.google.common.io.ByteSource byteSource, String mimeTypeRawData, Metacard metacard)
id
- the ContentItem
's GUID - can be nullqualifier
- the ContentItem
's qualifier - can be null; blank qualifiers are
treated as nullbyteSource
- the ContentItem
's input stream containing its actual datamimeTypeRawData
- the ContentItem
's mime typemetacard
- the ContentItem
's associated metacardpublic ContentItemImpl(String id, com.google.common.io.ByteSource byteSource, String mimeTypeRawData, String filename, long size, Metacard metacard)
id
- the ContentItem
's GUID - can be nullbyteSource
- the ContentItem
's input stream containing its actual datamimeTypeRawData
- the ContentItem
's mime typefilename
- the ContentItem
's file name - can be nullsize
- the ContentItem
's file sizemetacard
- the ContentItem
's associated metacardpublic ContentItemImpl(String id, String qualifier, com.google.common.io.ByteSource byteSource, String mimeTypeRawData, String filename, long size, Metacard metacard)
id
- the ContentItem
's GUID - can be nullqualifier
- the ContentItem
's qualifier - can be null; blank qualifiers are
treated as nullbyteSource
- the ContentItem
's input stream containing its actual datamimeTypeRawData
- the ContentItem
's mime typefilename
- the ContentItem
's file name - can be nullsize
- the ContentItem
's file sizemetacard
- the ContentItem
's associated metacardpublic String getId()
ContentItem
getId
in interface ContentItem
public String getUri()
ContentItem
This is used by the StorageProvider
when the content item is
stored in the content repository and will be of the form
content:<GUID>#<qualifier>
.
Or this is used by the endpoint when the client specifies the content item's location which means the content is stored remote/external to DDF.
getUri
in interface ContentItem
public String getQualifier()
ContentItem
ContentItem
as an additional product for a
Metacard
. ContentItem
s added to a Metacard
as an additional product
must have a non-blank qualifier.getQualifier
in interface ContentItem
ContentItem
. A null qualifier designates this as the main
ContentItem
of the associated Metacard
.public String getFilename()
ContentItem
ContentItem
. If not set it will default to ContentItem.DEFAULT_FILE_NAME
.getFilename
in interface ContentItem
ContentItem
public MimeType getMimeType()
ContentItem
getMimeType
in interface ContentItem
public String getMimeTypeRawData()
ContentItem
getMimeTypeRawData
in interface ContentItem
public InputStream getInputStream() throws IOException
ContentItem
getInputStream
in interface ContentItem
IOException
- if the input stream is not availablepublic long getSize() throws IOException
ContentItem
getSize
in interface ContentItem
IOException
- if the total number of bytes is unknown or not applicable (e.g., in the
case of a live stream)public Metacard getMetacard()
ContentItem
getMetacard
in interface ContentItem
This work is licensed under a Creative Commons Attribution 4.0 International License.