Class CurrentCacheContext
java.lang.Object
eu.europa.esig.dss.tsl.cache.state.CurrentCacheContext
- All Implemented Interfaces:
CacheContext
public class CurrentCacheContext extends Object implements CacheContext
-
Constructor Summary
Constructors Constructor Description CurrentCacheContext() -
Method Summary
Modifier and Type Method Description voiddesync()Set the context as DESYNCHRONIZEDvoiderror(CachedException cachedException)Store the exception for its occurrence timevoiderrorUpdateDate(CachedException updatedException)Store the last occurrence of this exceptionCacheStateEnumgetCurrentState()Returns the current state in the cacheCachedExceptiongetException()Returns the met exceptionDategetLastStateTransitionTime()Returns the date of the last state transitionDategetLastSuccessSynchronizationTime()Returns the last time when the cache has been synchronized successfully NOTE: can be null in case if the cache has never been synchronizedbooleanisDesync()Returns TRUE if the cache is in DESYNC statusbooleanisError()Returns TRUE if the cache is in a error statusbooleanisRefreshNeeded()Returns TRUE is a refresh is needed (missing / expired data)booleanisToBeDeleted()Returns TRUE if the cache is in TO_BE_DELETED statusvoidrefreshNeeded()Set the context as REFRESH_NEEDEDvoidstate(CacheState newState)This method operates a state changevoidsync()Set the context as SYNCHRONIZEDvoidsyncUpdateDate()Updates the lastSuccessSynchronization datevoidtoBeDeleted()Set the context as TO_BE_DELETED
-
Constructor Details
-
CurrentCacheContext
public CurrentCacheContext()
-
-
Method Details
-
getCurrentState
Description copied from interface:CacheContextReturns the current state in the cache- Specified by:
getCurrentStatein interfaceCacheContext- Returns:
- the Cache state
-
getLastStateTransitionTime
Description copied from interface:CacheContextReturns the date of the last state transition- Specified by:
getLastStateTransitionTimein interfaceCacheContext- Returns:
- the last date when the state has had a transition
-
getLastSuccessSynchronizationTime
Description copied from interface:CacheContextReturns the last time when the cache has been synchronized successfully NOTE: can be null in case if the cache has never been synchronized- Specified by:
getLastSuccessSynchronizationTimein interfaceCacheContext- Returns:
- the last date when the state has been synchronized
-
state
Description copied from interface:CacheContextThis method operates a state change- Specified by:
statein interfaceCacheContext- Parameters:
newState- the new state to be assigned
-
syncUpdateDate
public void syncUpdateDate()Description copied from interface:CacheContextUpdates the lastSuccessSynchronization date- Specified by:
syncUpdateDatein interfaceCacheContext
-
error
Description copied from interface:CacheContextStore the exception for its occurrence time- Specified by:
errorin interfaceCacheContext- Parameters:
cachedException- an instance ofCachedException
-
errorUpdateDate
Description copied from interface:CacheContextStore the last occurrence of this exception- Specified by:
errorUpdateDatein interfaceCacheContext- Parameters:
updatedException- an instance ofCachedException
-
desync
public void desync()Description copied from interface:CacheContextSet the context as DESYNCHRONIZED- Specified by:
desyncin interfaceCacheContext
-
sync
public void sync()Description copied from interface:CacheContextSet the context as SYNCHRONIZED- Specified by:
syncin interfaceCacheContext
-
refreshNeeded
public void refreshNeeded()Description copied from interface:CacheContextSet the context as REFRESH_NEEDED- Specified by:
refreshNeededin interfaceCacheContext
-
toBeDeleted
public void toBeDeleted()Description copied from interface:CacheContextSet the context as TO_BE_DELETED- Specified by:
toBeDeletedin interfaceCacheContext
-
isRefreshNeeded
public boolean isRefreshNeeded()Description copied from interface:CacheContextReturns TRUE is a refresh is needed (missing / expired data)- Specified by:
isRefreshNeededin interfaceCacheContext- Returns:
- TRUE if a refresh is required
-
isError
public boolean isError()Description copied from interface:CacheContextReturns TRUE if the cache is in a error status- Specified by:
isErrorin interfaceCacheContext- Returns:
- TRUE if an exception is stored
-
getException
Description copied from interface:CacheContextReturns the met exception- Specified by:
getExceptionin interfaceCacheContext- Returns:
- an object with the exception and its occurrence time
-
isToBeDeleted
public boolean isToBeDeleted()Description copied from interface:CacheContextReturns TRUE if the cache is in TO_BE_DELETED status- Specified by:
isToBeDeletedin interfaceCacheContext- Returns:
- TRUE if the entry must be deleted
-
isDesync
public boolean isDesync()Description copied from interface:CacheContextReturns TRUE if the cache is in DESYNC status- Specified by:
isDesyncin interfaceCacheContext- Returns:
- TRUE if the entry is desynchronized
-