InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IHTTPLinkResourceServerCache Class Referenceabstract

#include <IHTTPLinkResourceServerCache.h>

Inheritance diagram for IHTTPLinkResourceServerCache:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IHTTPLINKRESOURCESERVERCACHE }
 
typedef boost::function< void(const
URI &inUri, const
HTTPLinkSubsystemTypes::HTTPAssetDownloadState
&inState, const float
inProgress)> 
AssetDownloadProgressCallback
 
typedef boost::function< void(const
URI &inUri, const
HTTPLinkSubsystemTypes::HTTPAssetDownloadState
&inState, std::shared_ptr
< IHTTPLinkCachedAssetEntry >
cachedAssetEntry)> 
AssetDownloadCompletionCallback
 

Public Member Functions

virtual bool16 Initialize ()=0
 
virtual bool16 Shutdown ()=0
 
virtual std::shared_ptr
< IHTTPLinkCachedAssetEntry
GetCachedAssetEntry (const URI &inUri, bool16 inDownloadIfMissing=kTrue, HTTPLinkSubsystemTypes::AssetDownloadMode inDownloadMode=HTTPLinkSubsystemTypes::kAssetDownloadMode_Sync, IHTTPLinkResourceServerCache::AssetDownloadProgressCallback downloadProgressCallback=NULL, IHTTPLinkResourceServerCache::AssetDownloadCompletionCallback downloadCompletionCallback=NULL)=0
 
virtual bool16 InvalidateCacheForURI (const URI &inUri)=0
 
virtual bool16 IsCachedAssetEntryStale (const URI &inUri, const IHTTPLinkResourceServerAPIWrapper::AssetMetadataPtr assetCurrentAttributes)=0
 
virtual bool16 PurgeCache (bool16 forcePurgeAll=kFalse)=0
 
virtual
HTTPLinkSubsystemTypes::HTTPAssetDownloadState 
GetDownloadState (const URI &inUri)=0
 
virtual void ReadWriteSnapshotForBackgroundThread (IPMStream *s)=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

This interface provides deals with caching mechanism for files and metadata for HTTP links. This interface is responsible for storing asset metadata. Ideally it should persist across the session. Also it should clear cache and metadata also, so that it doesn't bloat.

To subclass create a boss based on kHTTPAssetLinkResourceServerHelperBoss with the implementation of this interface. And return this connection instance from the IHTTPLinkSubsystemObjectFactory.

Member Typedef Documentation

typedef boost::function<void( const URI& inUri, const HTTPLinkSubsystemTypes::HTTPAssetDownloadState& inState, std::shared_ptr<IHTTPLinkCachedAssetEntry> cachedAssetEntry)> IHTTPLinkResourceServerCache::AssetDownloadCompletionCallback

Asset Download Completion callback

Parameters
inUri[IN] Input URI whose download progress is to be retrieved
inState[IN] Download state for the given input URI
cachedAssetEntry[IN] Cached Entry for the given uri.
typedef boost::function<void( const URI& inUri, const HTTPLinkSubsystemTypes::HTTPAssetDownloadState& inState, const float inProgress)> IHTTPLinkResourceServerCache::AssetDownloadProgressCallback

Asset Download Progress callback

Parameters
inUri[IN] Input URI whose download progress is to be retrieved
inState[IN] Download state for the given input URI
inProgress[IN] Download progress for the asset corresponding to input URI

Member Function Documentation

virtual std::shared_ptr<IHTTPLinkCachedAssetEntry> IHTTPLinkResourceServerCache::GetCachedAssetEntry (const URIinUri,
bool16 inDownloadIfMissing = kTrue,
HTTPLinkSubsystemTypes::AssetDownloadMode inDownloadMode = HTTPLinkSubsystemTypes::kAssetDownloadMode_Sync,
IHTTPLinkResourceServerCache::AssetDownloadProgressCallback downloadProgressCallback = NULL,
IHTTPLinkResourceServerCache::AssetDownloadCompletionCallback downloadCompletionCallback = NULL 
)
pure virtual

Fetches the the cached entry of the file downloaded for the input URI.

Parameters
inUri[IN] input Uri.
inDownloadIfMissing[IN] asset corresponding to input Uri requres download or not.
inDownloadMode[IN] sync/async mode.
downloadProgressCallback[IN] download progress callback
downloadCompletionCallback[IN] download completion callback
Returns
CachedAssetEntry
virtual HTTPLinkSubsystemTypes::HTTPAssetDownloadState IHTTPLinkResourceServerCache::GetDownloadState (const URIinUri)
pure virtual

Gets the download state for the input URI.

Parameters
inUri[IN] input URI.
Returns
download state for the uri
virtual bool16 IHTTPLinkResourceServerCache::Initialize ()
pure virtual

Initializes the HTTP Link Resource Server Cache

Returns
kTrue if the initialization is successful
virtual bool16 IHTTPLinkResourceServerCache::InvalidateCacheForURI (const URIinUri)
pure virtual

Invalidate the cache entry of the file downloaded for the input URI.

Parameters
inUri[IN] inUri.
Returns
kTrue on success else kFalse.
virtual bool16 IHTTPLinkResourceServerCache::IsCachedAssetEntryStale (const URIinUri,
const IHTTPLinkResourceServerAPIWrapper::AssetMetadataPtr assetCurrentAttributes 
)
pure virtual

Checks if the cached asset entry is stale

Parameters
inUri[IN] input URI for the cached asset entry.
serverAssetAttribute[IN] current HTTP Asset Attribute.
Returns
kTrue if cached asset entry is stale else kFalse.
virtual bool16 IHTTPLinkResourceServerCache::PurgeCache (bool16 forcePurgeAll = kFalse)
pure virtual

Purges the cache.

Parameters
forcePurgeAll[IN] true if we want forceful purging.
Returns
kTrue on success else kFalse.
virtual void IHTTPLinkResourceServerCache::ReadWriteSnapshotForBackgroundThread (IPMStreams)
pure virtual

Used when snapshot is created for the object for running in background thread. Snapshots are used in some of the InDesign workflows like PDF export, to pass objects for processing in background thread. In this function, object should write relevant data into stream or read from it to create necessary data depending on type of stream.

Parameters
sstream for reading/writing object's data
virtual bool16 IHTTPLinkResourceServerCache::Shutdown ()
pure virtual

Shuts down the HTTP Link Resource Server Cache

Returns
kTrue if the shutdown is successful