From 7a003c9287be57fe90173e4dd728ad995ed7036e Mon Sep 17 00:00:00 2001 From: Christof Rabensteiner Date: Wed, 17 Apr 2019 15:34:48 +0200 Subject: Refactor: Move Repositories to Repository Package --- .../gv/egiz/moazs/InMemoryDeliveryRepository.java | 40 ---------------------- 1 file changed, 40 deletions(-) delete mode 100644 src/main/java/at/gv/egiz/moazs/InMemoryDeliveryRepository.java (limited to 'src/main/java/at/gv/egiz/moazs/InMemoryDeliveryRepository.java') diff --git a/src/main/java/at/gv/egiz/moazs/InMemoryDeliveryRepository.java b/src/main/java/at/gv/egiz/moazs/InMemoryDeliveryRepository.java deleted file mode 100644 index aa1e3e9..0000000 --- a/src/main/java/at/gv/egiz/moazs/InMemoryDeliveryRepository.java +++ /dev/null @@ -1,40 +0,0 @@ -package at.gv.egiz.moazs; - -import at.gv.e_government.reference.namespace.zustellung.mzs.app2mzs_.DeliveryRequestType; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.annotation.Profile; -import org.springframework.stereotype.Repository; - -import java.util.Optional; -import java.util.concurrent.TimeUnit; - -@Repository -@Profile("!cluster") -public class InMemoryDeliveryRepository implements DeliveryRepository { - - private static final Logger logger = LoggerFactory.getLogger(InMemoryDeliveryRepository.class); - - private static final Cache rep = CacheBuilder.newBuilder() - .expireAfterWrite(30, TimeUnit.MINUTES) - .build(); - - public InMemoryDeliveryRepository() { - logger.info("InMemoryDeliveryRepository()"); - } - - @Override - public void add(DeliveryRequestType request) { - String key = request.getMetaData().getAppDeliveryID(); - logger.info("Save DeliveryRequest with AppDeliveryId = {} to Cache.", key); - rep.put(key, request); - } - - @Override - public Optional getDeliveryRequest(String appDeliveryID) { - DeliveryRequestType deliveryRequestType = rep.getIfPresent(appDeliveryID); - return Optional.ofNullable(deliveryRequestType); - } -} -- cgit v1.2.3