All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hp.autonomy.hod.caching.HodPerApplicationCacheResolver Maven / Gradle / Ivy

Go to download

Utility classes to assist with caching in applications using Micro Focus Haven OnDemand and the Spring Caching Abstraction

There is a newer version: 0.6.2
Show newest version
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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy