import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aai.domain.yang.ServiceInstances;
import org.onap.aai.domain.yang.ServiceSubscription;
-import org.onap.so.aai.simulator.utils.Constant;
+import org.onap.so.aai.simulator.utils.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
*
*/
@Service
-public class CacheServiceProviderImpl implements CacheServiceProvider {
- private static final Logger LOGGER = LoggerFactory.getLogger(CacheServiceProviderImpl.class);
+public class CustomerCacheServiceProviderImpl implements CustomerCacheServiceProvider {
+ private static final Logger LOGGER = LoggerFactory.getLogger(CustomerCacheServiceProviderImpl.class);
public final CacheManager cacheManager;
@Autowired
- public CacheServiceProviderImpl(final CacheManager cacheManager) {
+ public CustomerCacheServiceProviderImpl(final CacheManager cacheManager) {
this.cacheManager = cacheManager;
}
@Override
public Optional<Customer> getCustomer(final String globalCustomerId) {
LOGGER.info("getting customer from cache using key: {}", globalCustomerId);
- final Cache cache = cacheManager.getCache(Constant.CUSTOMER_CACHE);
+ final Cache cache = cacheManager.getCache(Constants.CUSTOMER_CACHE);
final Customer value = cache.get(globalCustomerId, Customer.class);
if (value != null) {
return Optional.of(value);
@Override
public void putCustomer(final String globalCustomerId, final Customer customer) {
LOGGER.info("Adding customer: {} with key: {} in cache ...", customer, globalCustomerId);
- final Cache cache = cacheManager.getCache(Constant.CUSTOMER_CACHE);
+ final Cache cache = cacheManager.getCache(Constants.CUSTOMER_CACHE);
cache.put(globalCustomerId, customer);
}
LOGGER.info("getting service subscription from cache for globalCustomerId: {} and serviceType: {}",
globalCustomerId, serviceType);
- final Cache cache = cacheManager.getCache(Constant.CUSTOMER_CACHE);
+ final Cache cache = cacheManager.getCache(Constants.CUSTOMER_CACHE);
final Customer value = cache.get(globalCustomerId, Customer.class);
public Optional<ServiceInstances> getServiceInstances(final String globalCustomerId, final String serviceType,
final String serviceInstanceName) {
- final Cache cache = cacheManager.getCache(Constant.CUSTOMER_CACHE);
+ final Cache cache = cacheManager.getCache(Constants.CUSTOMER_CACHE);
final Customer value = cache.get(globalCustomerId, Customer.class);
if (value != null) {
@Override
public Optional<ServiceInstance> getServiceInstance(final String globalCustomerId, final String serviceType,
final String serviceInstanceId) {
- final Cache cache = cacheManager.getCache(Constant.CUSTOMER_CACHE);
+ final Cache cache = cacheManager.getCache(Constants.CUSTOMER_CACHE);
final Customer value = cache.get(globalCustomerId, Customer.class);
if (value != null) {
final String serviceInstanceId, final ServiceInstance serviceInstance) {
LOGGER.info("Adding serviceInstance: {} in cache ...", serviceInstance, globalCustomerId);
- final Cache cache = cacheManager.getCache(Constant.CUSTOMER_CACHE);
+ final Cache cache = cacheManager.getCache(Constants.CUSTOMER_CACHE);
final Customer value = cache.get(globalCustomerId, Customer.class);
if (value != null) {
@Override
public void clearAll() {
- final Cache cache = cacheManager.getCache(Constant.CUSTOMER_CACHE);
+ final Cache cache = cacheManager.getCache(Constants.CUSTOMER_CACHE);
final ConcurrentHashMap<?, ?> nativeCache = (ConcurrentHashMap<?, ?>) cache.getNativeCache();
LOGGER.info("Clear all entries from cahce: {}", cache.getName());
nativeCache.clear();