com.sap.mdm.blobs
Interface BlobCache


public interface BlobCache

An interface represents cache for blob (binary) files like images, PDFs, text blocks, etc.

Since:
7.1.04

Method Summary
 String getBlobGUID(TableId tableId, RecordId recordId)
          Returns the GUID for the cached binary object (blob).
 String getBlobGUID(TableId tableId, RecordId recordId, ImageVariantId variantId)
          Returns the GUID for the cached binary object (blob).
 String getBlobPath(String guid)
          Returns the relative file path for the binary object (blob) by its GUID.
 String getBlobPath(TableId tableId, RecordId recordId)
          Returns the relative file path for the binary object (blob).
 String getBlobPath(TableId tableId, RecordId recordId, ImageVariantId variantId)
          Returns the relative file path for the binary object (blob).
 String getCacheDirectory()
          Returns the path of directory in the file system where the cached objects will be stored.
 int getMaximumCacheSize()
          Returns the maximum cache size (total size of cached files) in kilobytes.
 String getRegionName()
          Returns the data region name that used while retrieving blob objects from repository.
 RepositoryIdentifier getRepository()
          Returns the repository where blob objects are stored.
 String getServerName()
          Returns the name of MDM server that runs repository containing blob objects.
 int getStartupType()
          Returns the startup type.
 void preload(TableId tableId)
          Pre-loads all objects from the specified table until the cache is full.
 void preload(TableId tableId, ImageVariantId variantId)
          Pre-loads all objects with the specified variant ID from the specified table until the cache is full.
 

Method Detail

getServerName

public String getServerName()
Returns the name of MDM server that runs repository containing blob objects.

Returns:
the MDM server name.

getRepository

public RepositoryIdentifier getRepository()
Returns the repository where blob objects are stored.

Returns:
the repository identifier.

getRegionName

public String getRegionName()
Returns the data region name that used while retrieving blob objects from repository.

Returns:
the data region name

getCacheDirectory

public String getCacheDirectory()
Returns the path of directory in the file system where the cached objects will be stored.

Returns:
the cache directory

getStartupType

public int getStartupType()
Returns the startup type. It indicates what to do with previously cached files.

Returns:
the startup type.
See Also:
BlobCacheManager.ON_STARTUP_ALWAYS_REMOVE_FILES, BlobCacheManager.ON_STARTUP_IF_NO_CACHE_REMOVE_FILES, BlobCacheManager.ON_STARTUP_NEVER_REMOVE_FILES

getMaximumCacheSize

public int getMaximumCacheSize()
Returns the maximum cache size (total size of cached files) in kilobytes.

Returns:
a maximum cache size in kilobytes

getBlobPath

public String getBlobPath(TableId tableId,
                          RecordId recordId)
                   throws BlobCacheException
Returns the relative file path for the binary object (blob). An empty string is returned if the object does not exist for the current language layer. If specified table is 'Images' or 'PDFs' then THUMBNAIL variant of the object will be searched.

Note, the variant THUMBNAIL of a PDF is a generated image containing the first page of the PDF. To retrieve the PDF itself, use the variant ORIGINAL.

Parameters:
tableId - a table Id
recordId - a record Id
Returns:
a relative file path
Throws:
BlobCacheException - if there is any error while retrieving blob path.
See Also:
getBlobPath(TableId, RecordId, ImageVariantId), ImageVariantId.ORIGINAL, ImageVariantId.THUMBNAIL

getBlobPath

public String getBlobPath(TableId tableId,
                          RecordId recordId,
                          ImageVariantId variantId)
                   throws BlobCacheException
Returns the relative file path for the binary object (blob). An empty string is returned if the object does not exist for the current language layer. The variant ID is relevant only for 'Images' and 'PDFs' tables. For all other blob tables this parameter is not used. If variant ID is 'null' for 'Images' or 'PDFs' table then ImageVariantId.THUMBNAIL variant will be returned.

Parameters:
tableId - a table Id
recordId - a record Id
variantId - the image or PDF variant Id
Returns:
a relative file path
Throws:
BlobCacheException - if there is any error while retrieving blob path or if specified variant ID does not exist (relevant only for 'Images' and 'PDFs' tables).

preload

public void preload(TableId tableId,
                    ImageVariantId variantId)
             throws BlobCacheException
Pre-loads all objects with the specified variant ID from the specified table until the cache is full. The variant ID is relevant only for 'Images' and 'PDFs' tables. For all other blob tables this parameter is not used. For 'PDFs' table, the value of variant ID can be either ImageVariantId.ORIGINAL or ImageVariantId.THUMBNAIL and if any other value is specified then exception is thrown.

Parameters:
tableId - a table Id
variantId - a variant Id
Throws:
BlobCacheException - if there is any error while pre-loading or if specified variant ID does not exist (relevant only for 'Images' and 'PDFs' tables).

preload

public void preload(TableId tableId)
             throws BlobCacheException
Pre-loads all objects from the specified table until the cache is full. If this method is used for 'Images' of 'PDFs' table then only objects with variant ID equals to ImageVariantId.THUMBNAIL will be loaded.

Parameters:
tableId - a table Id
Throws:
BlobCacheException - if there is any error while pre-loading.

getBlobGUID

public String getBlobGUID(TableId tableId,
                          RecordId recordId)
                   throws BlobCacheException
Returns the GUID for the cached binary object (blob). An empty string is returned if the object does not exist for the current language layer. If specified table is 'Images' or 'PDFs' then THUMBNAIL variant of the object will be searched.

Parameters:
tableId - a table Id
recordId - a record Id
Returns:
a GUID of blob
Throws:
BlobCacheException - if there is any error while retrieving blob path.

getBlobGUID

public String getBlobGUID(TableId tableId,
                          RecordId recordId,
                          ImageVariantId variantId)
                   throws BlobCacheException
Returns the GUID for the cached binary object (blob). An empty string is returned if the object does not exist for the current language layer. The variant ID is relevant only for 'Images' and 'PDFs' tables. For all other blob tables this parameter is not used. If variant ID is 'null' for 'Images' or 'PDFs' table then ImageVariantId.THUMBNAIL variant will be returned.

Parameters:
tableId - a table Id
recordId - a record Id
variantId - the image or PDF variant Id
Returns:
a GUID of blob
Throws:
BlobCacheException - if there is any error while retrieving blob path or if specified variant ID does not exist (relevant only for 'Images' and 'PDFs' tables).

getBlobPath

public String getBlobPath(String guid)
                   throws BlobCacheException
Returns the relative file path for the binary object (blob) by its GUID. If blob with specified GUID does not exist in the cache then BlobCacheException is thrown.

Parameters:
guid - a GUID of cached blob
Returns:
a relative file path
Throws:
BlobCacheException - if blob object with specified GUID does not exist in the cache or if there is any error while retrieving blob object.


Copyright 2004-2007 by SAP AG. All Rights Reserved.

SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies (SAP Group) for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.