com.hp.autonomy.hod.caching.HodPerApplicationCacheResolver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hod-spring-caching Show documentation
Show all versions of hod-spring-caching Show documentation
Utility classes to assist with caching in applications using Micro Focus Haven OnDemand and the Spring Caching Abstraction
package com.hp.autonomy.hod.caching;
import com.hp.autonomy.hod.client.api.resource.ResourceName;
import com.hp.autonomy.hod.sso.HodAuthenticationPrincipal;
/**
* Cache resolver for methods which should be cached per tenant
*/
class HodPerApplicationCacheResolver extends AbstractHodCacheResolver {
private final HodCacheNameResolver hodCacheNameResolver;
HodPerApplicationCacheResolver(final HodCacheNameResolver hodCacheNameResolver) {
this.hodCacheNameResolver = hodCacheNameResolver;
}
/**
* Resolve the cache for the given name, qualified by the HOD application.
*
* @param cacheName The original cache name
* @param principal HoD authentication principal retrieved from context
* @return The cache name qualified with the application
*/
@Override
protected String resolveName(final String cacheName, final HodAuthenticationPrincipal principal) {
final ResourceName hodApplication = principal.getApplication();
return hodCacheNameResolver.resolvePerApplicationCacheName(cacheName, hodApplication);
}
}