public class PostgresMediaBlobHelper extends MediaBlobHelper
Modifier and Type | Class and Description |
---|---|
static class |
PostgresMediaBlobHelper.LargeObjectProxy
LargeObjectProxy is a proxy for LargeObject,
used so that the availability of the LargeObject can be managed to
avoid SQL failures on the LibraryConnection from which the
LargeObject was obtained.
|
m_MediaBlob, m_Session
Constructor and Description |
---|
PostgresMediaBlobHelper(S_MediaBlob mediaBlob)
Constructs an PostgresMediaBlobHelper instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
copyContent(S_MediaBfile srcMedia,
Long srcCid,
Long dstCid,
Long partitionValue,
AttributeValue[] mediaOptions)
Stores a copy of existing content as the content for the specified
content id, with a S_MediaBfile being the source.
|
protected void |
copyContent(S_MediaBlob srcMedia,
Long srcCid,
Long dstCid,
Long partitionValue,
AttributeValue[] mediaOptions)
Stores a copy of existing content as the content for the specified
content id, with a S_MediaBlob being the source.
|
void |
createContentIndexProcedure(Connection conn)
Recreates the content index procedure, if any, for this MediaBlob instance.
|
protected void |
destroyContent(Long cid,
AttributeValue[] mediaOptions)
Destroys the content for the specified content ID.
|
protected InputStream |
getContent(Long cid)
Gets the content stream for the specified content id.
|
protected long |
getContentSize(Long cid)
Gets the size of the content stream for the specified content id.
|
protected PostgresMediaBlobHelper.LargeObjectProxy |
getLargeObject(Long cid)
Gets the LargeObject for the specified content id.
|
protected RandomAccessDriver |
getRandomAccessDriver(Long cid)
Returns a RandomAccessDriver to use to retrieve the indicated content.
|
protected void |
setContent(Long cid,
InputStream is,
Long partitionValue,
AttributeValue[] mediaOptions)
Stores content read from the specified InputStream using the specified
content id.
|
protected void |
setEmptyContent(Long cid,
Long partitionValue,
AttributeValue[] mediaOptions)
Stores zero-length content for the specified content id.
|
getSession
public PostgresMediaBlobHelper(S_MediaBlob mediaBlob) throws IfsException
mediaBlob
- the S_MediaBlob instance being servicedIfsException
- if the operation failspublic void createContentIndexProcedure(Connection conn) throws IfsException
createContentIndexProcedure
in class MediaBlobHelper
conn
- the connectionIfsException
- if the operation failsprotected InputStream getContent(Long cid) throws IfsException
getContent
in class MediaBlobHelper
cid
- the content id; requiredIfsException
- if the operation failsprotected PostgresMediaBlobHelper.LargeObjectProxy getLargeObject(Long cid) throws IfsException
Not part of the interface, but closely related to getContent
.
cid
- the content IDIfsException
- if the operation failsprotected long getContentSize(Long cid) throws IfsException
getContentSize
in class MediaBlobHelper
cid
- the content id; requiredIfsException
- if the operation failsprotected void setContent(Long cid, InputStream is, Long partitionValue, AttributeValue[] mediaOptions) throws IfsException
The implementation of this method is responsible for inserting a row into
the content table whose ID column is cid
, storing content
read from the InputStream, and closing the InputStream.
setContent
in class MediaBlobHelper
cid
- the content id; requiredis
- the InputStream from which content is readpartitionValue
- the value for the PARTITIONVALUE column in the
content table, or null if nonemediaOptions
- a set of name/value pairs whose semantics are
Media determined, or null for no media optionsIfsException
- if the operation failsprotected void setEmptyContent(Long cid, Long partitionValue, AttributeValue[] mediaOptions) throws IfsException
The implementation of this method is responsible for inserting a row into
the content table whose ID column is cid
.
Althrough a concrete implementation is provided here (by calling
setContent
and immediately closing the returned
OutputStream), subclasses should override this method with a more
performant implementation, if possible.
setEmptyContent
in class MediaBlobHelper
cid
- the content id; requiredpartitionValue
- the value for the PARTITIONVALUE column in the
content table, or null if nonemediaOptions
- a set of name/value pairs whose semantics are
Media determined, or null for no media optionsIfsException
- if the operation failsprotected void copyContent(S_MediaBlob srcMedia, Long srcCid, Long dstCid, Long partitionValue, AttributeValue[] mediaOptions) throws IfsException
The implementation of this method is responsible for inserting a row into
the content table whose ID column is dstCid
.
Although a concrete implementation is provided here (by copying the
InputStream returned by srcMedia.getContent(srcCid)
to the
OutputStream returned by setContent
), subclasses should
override this method with a more performant implementation, if possible.
copyContent
in class MediaBlobHelper
srcMedia
- the S_MediaBlob source media; requiredsrcCid
- the source content id; requireddstCid
- the destination content id; requiredpartitionValue
- the value for the PARTITIONVALUE column in the
content table, or null if nonemediaOptions
- a set of name/value pairs whose semantics are
Media determined, or null for no media optionsIfsException
- if the operation failsprotected void copyContent(S_MediaBfile srcMedia, Long srcCid, Long dstCid, Long partitionValue, AttributeValue[] mediaOptions) throws IfsException
The implementation of this method is responsible for inserting a row into
the content table whose ID column is dstCid
.
Although a concrete implementation is provided here (by copying the
InputStream returned by srcMedia.getContent(srcCid)
to the
OutputStream returned by setContent
), subclasses should
override this method with a more performant implementation, if possible.
copyContent
in class MediaBlobHelper
srcMedia
- the S_MediaBfile source media; requiredsrcCid
- the source content id; requireddstCid
- the destination content id; requiredpartitionValue
- the value for the PARTITIONVALUE column in the
content table, or null if nonemediaOptions
- a set of name/value pairs whose semantics are
Media determined, or null for no media optionsIfsException
- if the operation failsprotected void destroyContent(Long cid, AttributeValue[] mediaOptions) throws IfsException
destroyContent
in class MediaBlobHelper
cid
- the content id; requiredmediaOptions
- a set of name/value pairs whose semantics are
Media determined, or null for no media optionsIfsException
- if the operation failsprotected RandomAccessDriver getRandomAccessDriver(Long cid) throws IfsException
getRandomAccessDriver
in class MediaBlobHelper
cid
- the content id; requiredIfsException
- if the operation failsCopyright © 2023. All rights reserved.