Class DefaultApplicationCache
- java.lang.Object
-
- com.atlassian.confluence.impl.user.crowd.DefaultApplicationCache
-
- All Implemented Interfaces:
ApplicationCache
public final class DefaultApplicationCache extends Object implements ApplicationCache
Implementation ofApplicationCachethat delegates toCacheFactoryfor caching. The key for each entry is a lower-case version of the name and the value is an immutable copy of theApplication.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.atlassian.confluence.impl.user.crowd.ApplicationCache
ApplicationCache.Loader
-
-
Constructor Summary
Constructors Constructor Description DefaultApplicationCache(com.atlassian.cache.CacheFactory cacheFactory, com.atlassian.event.api.EventPublisher eventPublisher)Deprecated.DefaultApplicationCache(TransactionAwareCacheFactory cacheFactory, com.atlassian.event.api.EventPublisher eventPublisher)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddirectoryUpdated(com.atlassian.crowd.event.directory.DirectoryUpdatedEvent directoryUpdatedEvent)com.atlassian.crowd.model.application.ApplicationgetApplication(String name)Returns the cached application with the given name, or null if the application isn't cached.com.atlassian.crowd.model.application.ApplicationgetApplication(String name, ApplicationCache.Loader loader)Returns the cached application with the given name, or null if the application isn't cached.voidinit()voidputApplication(com.atlassian.crowd.model.application.Application application)Caches the application against its name, as returned byApplication.getName().voidremoveAll()Removes all entries from the cache.voidremoveApplication(String name)Removes the application with the given name from the cache.static <T extends Exception>
TunwrapOrRethrow(RuntimeException ex, Class<T> expectedType)Look throw the causal chain until we find an exception that is of the expected type, or just rethrow the full chain if not.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.confluence.impl.user.crowd.ApplicationCache
removeApplication
-
-
-
-
Constructor Detail
-
DefaultApplicationCache
public DefaultApplicationCache(TransactionAwareCacheFactory cacheFactory, com.atlassian.event.api.EventPublisher eventPublisher)
- Since:
- 7.5
-
DefaultApplicationCache
@Deprecated public DefaultApplicationCache(com.atlassian.cache.CacheFactory cacheFactory, com.atlassian.event.api.EventPublisher eventPublisher)
Deprecated.
-
-
Method Detail
-
init
@PostConstruct public void init()
-
directoryUpdated
@EventListener public void directoryUpdated(com.atlassian.crowd.event.directory.DirectoryUpdatedEvent directoryUpdatedEvent)
-
getApplication
public com.atlassian.crowd.model.application.Application getApplication(String name)
Description copied from interface:ApplicationCacheReturns the cached application with the given name, or null if the application isn't cached.- Specified by:
getApplicationin interfaceApplicationCache
-
getApplication
public com.atlassian.crowd.model.application.Application getApplication(String name, ApplicationCache.Loader loader) throws com.atlassian.crowd.exception.ApplicationNotFoundException
Description copied from interface:ApplicationCacheReturns the cached application with the given name, or null if the application isn't cached.- Specified by:
getApplicationin interfaceApplicationCache- Throws:
com.atlassian.crowd.exception.ApplicationNotFoundException- Since:
- 7.5
-
unwrapOrRethrow
public static <T extends Exception> T unwrapOrRethrow(RuntimeException ex, Class<T> expectedType)
Look throw the causal chain until we find an exception that is of the expected type, or just rethrow the full chain if not.
-
putApplication
public void putApplication(com.atlassian.crowd.model.application.Application application)
Description copied from interface:ApplicationCacheCaches the application against its name, as returned byApplication.getName().- Specified by:
putApplicationin interfaceApplicationCache
-
removeApplication
public void removeApplication(String name)
Description copied from interface:ApplicationCacheRemoves the application with the given name from the cache. Does nothing if the name is not in the cache.- Specified by:
removeApplicationin interfaceApplicationCache
-
removeAll
public void removeAll()
Description copied from interface:ApplicationCacheRemoves all entries from the cache. Can be used when the cache is stale, but it's not possible to determine which applications should be removed.- Specified by:
removeAllin interfaceApplicationCache
-
-