atg.adapter.integrations
Class PersistentCacheManager

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.adapter.integrations.PersistentCacheManager
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.io.Serializable, java.util.EventListener

public class PersistentCacheManager
extends GenericService
implements java.io.Serializable

This class implements a few common functions for remembering information about the local copies of integration data. This should be extended if any of these methods are inadequate. It uses a gsa repository to store the times of each import and a flag indicating if a particular item is invalid. Created: Wed Aug 28 09:29:24 2002

See Also:
Serialized Form

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String INTEGRATION_DATA_ITEM
           
static java.lang.String KEY_DELIMITER
           
static java.lang.String LAST_IMPORT_TIME
           
static java.lang.String STATE
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
PersistentCacheManager()
           
 
Method Summary
 void addedRemoteItem(RepositoryItem pItem, atg.adapter.integrations.IntegrationRepositoryItemDescriptor pItemDescriptor, Command pCommand)
          Update the time for the add command.
 void changeItemState(java.lang.String pId, atg.adapter.integrations.IntegrationRepositoryItemDescriptor pItemDescriptor, java.lang.Integer pState)
          Change the state of the given item to UNKNOWN
 java.lang.String getCommandName(Command pCommand)
          Get the name of the command.
 MutableRepository getIntegrationData()
          The repository that stores the command information for remote integration data
 java.lang.String getItemType(java.lang.String pId, RepositoryItemDescriptor pItemDescriptor)
          Return the item descriptor name that stores the integration date for the given item
 java.lang.String getKey(java.lang.String pId, RepositoryItemDescriptor pItemDescriptor)
          Get the composite key for the given item
 java.lang.Integer getState(RepositoryItem pItem)
          Get the state as Integer for this item.
 java.lang.String getStringState(java.lang.Integer state, atg.adapter.integrations.IntegrationRepository repository)
          Takes an Integer representing the State of the repository item as input, and generates the corresponding String value for the state.
 void importedRemoteItem(RepositoryItem pItem, atg.adapter.integrations.IntegrationRepositoryItemDescriptor pItemDescriptor, Command pCommand)
          Update the cache entry for this item.
 boolean isLocalItemInvalid(java.lang.String pId, atg.adapter.integrations.IntegrationRepositoryItemDescriptor pItemDescriptor, Command pCommand)
          Check if the local item is still valid.
 boolean isTransientCacheData()
          If true, then all cache data is transient.
 void removedRemoteItem(java.lang.String pId, atg.adapter.integrations.IntegrationRepositoryItemDescriptor pItemDescriptor, Command pCommand)
          Update the time for the remove command.
 void setIntegrationData(MutableRepository pIntegrationData)
           
 void setTransientCacheData(boolean pTransientCacheData)
           
 void updatedRemoteItem(RepositoryItem pItem, atg.adapter.integrations.IntegrationRepositoryItemDescriptor pItemDescriptor, Command pCommand)
          Update the time for the update command.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


INTEGRATION_DATA_ITEM

public static java.lang.String INTEGRATION_DATA_ITEM

STATE

public static java.lang.String STATE

LAST_IMPORT_TIME

public static java.lang.String LAST_IMPORT_TIME

KEY_DELIMITER

public static java.lang.String KEY_DELIMITER
Constructor Detail

PersistentCacheManager

public PersistentCacheManager()
Method Detail

setIntegrationData

public void setIntegrationData(MutableRepository pIntegrationData)

getIntegrationData

public MutableRepository getIntegrationData()
The repository that stores the command information for remote integration data


setTransientCacheData

public void setTransientCacheData(boolean pTransientCacheData)

isTransientCacheData

public boolean isTransientCacheData()
If true, then all cache data is transient. The default is false


isLocalItemInvalid

public boolean isLocalItemInvalid(java.lang.String pId,
                                  atg.adapter.integrations.IntegrationRepositoryItemDescriptor pItemDescriptor,
                                  Command pCommand)
Check if the local item is still valid. If the item is null it is invalid. If the item's localValueValidProperty is false then the item is invalid. If the item's lastImportTimeProperty is more than localValueTimeout milliseconds from the current time then the item is invalid. Otherwise, the item is valid.

Parameters:
pId - The id of the repository item in question
pItemDescriptor - The item descriptor for this item
pCommand - The command that will be used to retrieve the item if it is invalid.
Returns:
true if the item is invalid, false if it is fine

changeItemState

public void changeItemState(java.lang.String pId,
                            atg.adapter.integrations.IntegrationRepositoryItemDescriptor pItemDescriptor,
                            java.lang.Integer pState)
Change the state of the given item to UNKNOWN


importedRemoteItem

public void importedRemoteItem(RepositoryItem pItem,
                               atg.adapter.integrations.IntegrationRepositoryItemDescriptor pItemDescriptor,
                               Command pCommand)
Update the cache entry for this item. This will load the integration data for the given item and update the commandStatus entry for this command. If there is no entry for this item, a new one will be created.

Parameters:
pItem - The recently imported repository item
pItemDescriptor - The item descriptor for this item
pCommand - The command used to import the item

updatedRemoteItem

public void updatedRemoteItem(RepositoryItem pItem,
                              atg.adapter.integrations.IntegrationRepositoryItemDescriptor pItemDescriptor,
                              Command pCommand)
Update the time for the update command. This method currently does nothing. If it is important that update times are recorded, override this method.


addedRemoteItem

public void addedRemoteItem(RepositoryItem pItem,
                            atg.adapter.integrations.IntegrationRepositoryItemDescriptor pItemDescriptor,
                            Command pCommand)
Update the time for the add command. This method currently does nothing. If it is important that update times are recorded, override this method.


removedRemoteItem

public void removedRemoteItem(java.lang.String pId,
                              atg.adapter.integrations.IntegrationRepositoryItemDescriptor pItemDescriptor,
                              Command pCommand)
Update the time for the remove command. This method currently does nothing. If it is important that update times are recorded, override this method.


getState

public java.lang.Integer getState(RepositoryItem pItem)
Get the state as Integer for this item. This method will load the integration data for the given item and gets its state.

Parameters:
pItem - The repository item corresponding to an item in Integration repository
Returns:
Integer that represents the state of the integration repository item.

getStringState

public java.lang.String getStringState(java.lang.Integer state,
                                       atg.adapter.integrations.IntegrationRepository repository)
Takes an Integer representing the State of the repository item as input, and generates the corresponding String value for the state.


getKey

public java.lang.String getKey(java.lang.String pId,
                               RepositoryItemDescriptor pItemDescriptor)
Get the composite key for the given item

Returns:
pId:itemDescriptorName:repositoryName

getCommandName

public java.lang.String getCommandName(Command pCommand)
Get the name of the command. By default this is the nucleus path


getItemType

public java.lang.String getItemType(java.lang.String pId,
                                    RepositoryItemDescriptor pItemDescriptor)
Return the item descriptor name that stores the integration date for the given item

Returns:
integration-data