com.sap.mdm.blobs
Class ObjectCache

java.lang.Object
  extended bycom.sap.mdm.blobs.ObjectCache
All Implemented Interfaces:
PassportSupport

public class ObjectCache
extends Object
implements PassportSupport

A class for caching images, PDFs, text blocks, etc.

Since:
5.5 SP6 Patch 04

Field Summary
static int ON_STARTUP_ALWAYS_REMOVE_FILES
          On startup, always remove the blob files from cache directory.
static int ON_STARTUP_IF_NO_CACHE_REMOVE_FILES
          On startup, remove the blob files from cache directory if cache info doesn't exist or is invalid.
static int ON_STARTUP_NEVER_REMOVE_FILES
          On startup, never remove any blob files from cache directory.
 
Constructor Summary
ObjectCache(ConnectionAccessor connection)
          Empty constructor.
 
Method Summary
 String getCacheDirectory()
          Returns the cache directory.
 String getConnectionTag()
          Returns the connection tag.
 RegionProperties getDataRegion()
          Returns the data region.
 int getMaximumCacheSize()
          Returns the maximum cache size before files are removed as needed.
 String getObject(TableId tableId, RecordId recordId)
          Returns the relative file path for the object.
 String getObject(TableId tableId, RecordId recordId, ImageVariantId variantId)
          Returns the relative file path for the object.
 Passport getPassport()
          Returns the passport use for tracing.
 RepositoryIdentifier getRepositoryIdentifier()
          Returns the repository.
 String getRepositoryUserName()
          Returns the repository user name.
 String getRepositoryUserPassword()
          Returns the repository user password.
 int getStartupType()
          Returns the start up type.
 void initialize()
          Initializes the object cache manager.
 void preload(TableId tableId, ImageVariantId variantId)
          Pre-loads all objects from the table until the cache is full.
 void setCacheDirectory(String cacheDirectory)
          Sets the cache directory.
 void setConnectionTag(String connectionTag)
          Sets the connection tag (required).
 void setDataRegion(RegionProperties dataRegion)
          Sets the data region (required).
 void setMaximumCacheSize(int maxCacheSize)
          The maximum cache size in kilobytes.
 void setPassport(Passport passport)
          Sets the passport use for tracing.
 void setReposIdentifier(RepositoryIdentifier reposId)
          Sets the repository (required).
 void setRepositoryUserName(String repositoryUserName)
          Sets the repository user name (required).
 void setRepositoryUserPassword(String repositoryUserPassword)
          Sets the repository user password.
 void setStartupType(int startupType)
          Sets the startup type.
 void shutdown()
          Shuts down the object cache manager.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ON_STARTUP_ALWAYS_REMOVE_FILES

public static final int ON_STARTUP_ALWAYS_REMOVE_FILES
On startup, always remove the blob files from cache directory.

See Also:
Constant Field Values

ON_STARTUP_IF_NO_CACHE_REMOVE_FILES

public static final int ON_STARTUP_IF_NO_CACHE_REMOVE_FILES
On startup, remove the blob files from cache directory if cache info doesn't exist or is invalid.

See Also:
Constant Field Values

ON_STARTUP_NEVER_REMOVE_FILES

public static final int ON_STARTUP_NEVER_REMOVE_FILES
On startup, never remove any blob files from cache directory.

See Also:
Constant Field Values
Constructor Detail

ObjectCache

public ObjectCache(ConnectionAccessor connection)
Empty constructor.

Method Detail

getConnectionTag

public String getConnectionTag()
Returns the connection tag.

Returns:
a connection tag
See Also:
ConnectionPoolFactory

setConnectionTag

public void setConnectionTag(String connectionTag)
Sets the connection tag (required). The default is localhost.

Parameters:
connectionTag - a connection tag

getRepositoryIdentifier

public RepositoryIdentifier getRepositoryIdentifier()
Returns the repository.

Returns:
a repository

setReposIdentifier

public void setReposIdentifier(RepositoryIdentifier reposId)
Sets the repository (required).

Parameters:
reposId - a repository

getRepositoryUserName

public String getRepositoryUserName()
Returns the repository user name.

Returns:
a repository user name

setRepositoryUserName

public void setRepositoryUserName(String repositoryUserName)
Sets the repository user name (required).

Parameters:
repositoryUserName - a repository user name

getRepositoryUserPassword

public String getRepositoryUserPassword()
Returns the repository user password.

Returns:
a repository user password

setRepositoryUserPassword

public void setRepositoryUserPassword(String repositoryUserPassword)
Sets the repository user password. If the password is null, trusted connection is assumed.

Parameters:
repositoryUserPassword - a repository user password

getDataRegion

public RegionProperties getDataRegion()
Returns the data region.

Returns:
a data region

setDataRegion

public void setDataRegion(RegionProperties dataRegion)
Sets the data region (required).

Parameters:
dataRegion - a data region

getStartupType

public int getStartupType()
Returns the start up type.

Returns:
a startup type

setStartupType

public void setStartupType(int startupType)
Sets the startup type. It indicates what to do with previously cached files. The default is ON_STARTUP_NEVER_REMOVE_FILES.

Parameters:
startupType - a start up type

getCacheDirectory

public String getCacheDirectory()
Returns the cache directory.

Returns:
a cache directory

setCacheDirectory

public void setCacheDirectory(String cacheDirectory)
Sets the cache directory. This is where the files will be cached in. Each instance of ObjectCache should have it's own cache directory.

Parameters:
cacheDirectory - a directory

getMaximumCacheSize

public int getMaximumCacheSize()
Returns the maximum cache size before files are removed as needed.

Returns:
a maximum cache size in kilobytes

setMaximumCacheSize

public void setMaximumCacheSize(int maxCacheSize)
The maximum cache size in kilobytes.

Parameters:
maxCacheSize - the maximum size

getPassport

public Passport getPassport()
Description copied from interface: PassportSupport
Returns the passport use for tracing.

Specified by:
getPassport in interface PassportSupport
Returns:
a passport

setPassport

public void setPassport(Passport passport)
Sets the passport use for tracing.

Parameters:
passport - a passport

initialize

public void initialize()
                throws CommandException
Initializes the object cache manager.

Throws:
CommandException - if there is an error in executing the command.

getObject

public String getObject(TableId tableId,
                        RecordId recordId)
                 throws CommandException
Returns the relative file path for the object. An empty string is returned if the object does not exist for the current language layer.

Parameters:
tableId - a table Id
recordId - a record Id
Returns:
a relative file path
Throws:
CommandException - if there is an error in executing the command.

getObject

public String getObject(TableId tableId,
                        RecordId recordId,
                        ImageVariantId variantId)
                 throws CommandException
Returns the relative file path for the object. An empty string is returned if the object does not exist for the current language layer.

Parameters:
tableId - a table Id
recordId - a record Id
variantId - the image variant
Returns:
a relative file path
Throws:
CommandException - if there is an error in executing the command.

preload

public void preload(TableId tableId,
                    ImageVariantId variantId)
             throws CommandException
Pre-loads all objects from the table until the cache is full.

Parameters:
tableId - a table Id
variantId - a variant Id
Throws:
CommandException - if there is an error in executing the command.

shutdown

public void shutdown()
              throws CommandException
Shuts down the object cache manager.

Throws:
CommandException - if there is an error in executing the command.


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.