aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/moazs/repository
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/repository')
-rw-r--r--src/main/java/at/gv/egiz/moazs/repository/DeliveryRepository.java4
-rw-r--r--src/main/java/at/gv/egiz/moazs/repository/InMemoryDeliveryRepository.java20
-rw-r--r--src/main/java/at/gv/egiz/moazs/repository/RedisDeliveryRepository.java10
3 files changed, 30 insertions, 4 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/repository/DeliveryRepository.java b/src/main/java/at/gv/egiz/moazs/repository/DeliveryRepository.java
index 228d55e..be61d1e 100644
--- a/src/main/java/at/gv/egiz/moazs/repository/DeliveryRepository.java
+++ b/src/main/java/at/gv/egiz/moazs/repository/DeliveryRepository.java
@@ -17,5 +17,9 @@ public interface DeliveryRepository {
Optional<DeliveryRequestStatusType> getDeliveryRequestStatus(String appDeliveryID);
+ void addSignedDeliveryRequestStatus(byte[] bytes, String appDeliveryId);
+
+ Optional<byte[]> getSignedDeliveryRequestStatus(String appDeliveryID);
+
}
diff --git a/src/main/java/at/gv/egiz/moazs/repository/InMemoryDeliveryRepository.java b/src/main/java/at/gv/egiz/moazs/repository/InMemoryDeliveryRepository.java
index 570296f..58ec92c 100644
--- a/src/main/java/at/gv/egiz/moazs/repository/InMemoryDeliveryRepository.java
+++ b/src/main/java/at/gv/egiz/moazs/repository/InMemoryDeliveryRepository.java
@@ -30,6 +30,10 @@ public class InMemoryDeliveryRepository implements DeliveryRepository {
.expireAfterWrite(30, TimeUnit.MINUTES)
.build();
+ private static final Cache<String, byte[]> signedStatusRepository = CacheBuilder.newBuilder()
+ .expireAfterWrite(30, TimeUnit.MINUTES)
+ .build();
+
@Override
public void add(DeliveryRequestType request) {
var key = request.getMetaData().getAppDeliveryID();
@@ -38,8 +42,7 @@ public class InMemoryDeliveryRepository implements DeliveryRepository {
@Override
public Optional<DeliveryRequestType> getDeliveryRequest(String appDeliveryID) {
- var deliveryRequestType = requestRepository.getIfPresent(appDeliveryID);
- return ofNullable(deliveryRequestType);
+ return ofNullable(requestRepository.getIfPresent(appDeliveryID));
}
@Override
@@ -51,7 +54,16 @@ public class InMemoryDeliveryRepository implements DeliveryRepository {
@Override
public Optional<DeliveryRequestStatusType> getDeliveryRequestStatus(String appDeliveryID) {
- var deliveryRequestType = statusRepository.getIfPresent(appDeliveryID);
- return ofNullable(deliveryRequestType);
+ return ofNullable(statusRepository.getIfPresent(appDeliveryID));
+ }
+
+ @Override
+ public void addSignedDeliveryRequestStatus(byte[] bytes, String appDeliveryId) {
+ signedStatusRepository.put(appDeliveryId, bytes);
+ }
+
+ @Override
+ public Optional<byte[]> getSignedDeliveryRequestStatus(String appDeliveryID) {
+ return ofNullable(signedStatusRepository.getIfPresent(appDeliveryID));
}
}
diff --git a/src/main/java/at/gv/egiz/moazs/repository/RedisDeliveryRepository.java b/src/main/java/at/gv/egiz/moazs/repository/RedisDeliveryRepository.java
index c24902d..4ffe85d 100644
--- a/src/main/java/at/gv/egiz/moazs/repository/RedisDeliveryRepository.java
+++ b/src/main/java/at/gv/egiz/moazs/repository/RedisDeliveryRepository.java
@@ -69,4 +69,14 @@ public class RedisDeliveryRepository implements DeliveryRepository {
public Optional<DeliveryRequestStatusType> getDeliveryRequestStatus(String appDeliveryID) {
throw new UnsupportedOperationException("Not Implemented Yet");
}
+
+ @Override
+ public void addSignedDeliveryRequestStatus(byte[] bytes, String appDeliveryId) {
+ throw new UnsupportedOperationException("Not Implemented Yet");
+ }
+
+ @Override
+ public Optional<byte[]> getSignedDeliveryRequestStatus(String appDeliveryID) {
+ return Optional.empty();
+ }
}