diff options
author | Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at> | 2019-07-09 11:13:35 +0200 |
---|---|---|
committer | Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at> | 2019-07-09 11:13:35 +0200 |
commit | 8e36fa01ea42d282eacdc78d6749daf9ae1ede9c (patch) | |
tree | ee691b4ec4a522c0b35c8251d3422702b90d2073 /src/main/java/at/gv/egiz/moazs/service | |
parent | d8c668bbca31a835c387a3d52293c9938c424f58 (diff) | |
download | moa-zs-8e36fa01ea42d282eacdc78d6749daf9ae1ede9c.tar.gz moa-zs-8e36fa01ea42d282eacdc78d6749daf9ae1ede9c.tar.bz2 moa-zs-8e36fa01ea42d282eacdc78d6749daf9ae1ede9c.zip |
Refactor: Merge BinaryRepository into DeliveryRepository
- Reason: Components, which rely on one of those, usually also rely on
the other, so merging them reduces amount of dependencies.
- Frame operations in DeliveryRepository API as "store" and "retrieve"
operations.
- Rename: Convert *Id in local variable names to upper case.
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/service')
-rw-r--r-- | src/main/java/at/gv/egiz/moazs/service/MsgService.java | 2 | ||||
-rw-r--r-- | src/main/java/at/gv/egiz/moazs/service/MzsService.java | 11 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/service/MsgService.java b/src/main/java/at/gv/egiz/moazs/service/MsgService.java index 93f1ed5..87644a0 100644 --- a/src/main/java/at/gv/egiz/moazs/service/MsgService.java +++ b/src/main/java/at/gv/egiz/moazs/service/MsgService.java @@ -58,7 +58,7 @@ public class MsgService implements Zuse2AppPort { } private void sendToWork(MsgResponse response) { - runAsync(() -> repository.add(response)) + runAsync(() -> repository.store(response)) .thenRunAsync(() -> handler.handle(response.getResponseID())); } diff --git a/src/main/java/at/gv/egiz/moazs/service/MzsService.java b/src/main/java/at/gv/egiz/moazs/service/MzsService.java index c41740f..2755a37 100644 --- a/src/main/java/at/gv/egiz/moazs/service/MzsService.java +++ b/src/main/java/at/gv/egiz/moazs/service/MzsService.java @@ -2,7 +2,6 @@ package at.gv.egiz.moazs.service; import at.gv.egiz.moazs.preprocess.DeliveryRequestAugmenter; import at.gv.egiz.moazs.process.DeliveryPipeline; -import at.gv.egiz.moazs.repository.BinaryRepository; import at.gv.egiz.moazs.repository.DeliveryRepository; import at.gv.egiz.moazs.scheme.Msg2MzsConverter; import at.gv.egiz.moazs.client.MzsClient; @@ -41,17 +40,15 @@ public class MzsService implements App2MzsPortType { private final MzsClient appClient; private final DeliveryRequestAugmenter augmenter; private final Msg2MzsConverter converter; - private final BinaryRepository binaryStatusRepository; @Autowired public MzsService(DeliveryRepository repository, DeliveryPipeline pipeline, MzsClient appClient, - DeliveryRequestAugmenter augmenter, Msg2MzsConverter converter, BinaryRepository binaryStatusRepository) { + DeliveryRequestAugmenter augmenter, Msg2MzsConverter converter) { this.repository = repository; this.pipeline = pipeline; this.appClient = appClient; this.augmenter = augmenter; this.converter = converter; - this.binaryStatusRepository = binaryStatusRepository; } @Override @@ -65,7 +62,7 @@ public class MzsService implements App2MzsPortType { var future = supplyAsync(() -> augmenter.augment(deliveryRequest)) .thenApply(this::process) - .thenApply(status -> converter.convert(status, binaryStatusRepository.get(responseID))); + .thenApply(status -> converter.convert(status, repository.retrieveBinaryResponse(responseID))); try { return future.get(TIMEOUT_FOR_ANWSER, TimeUnit.SECONDS); @@ -89,11 +86,11 @@ public class MzsService implements App2MzsPortType { var appDeliveryID = deliveryRequest.getMetaData().getAppDeliveryID(); logger.info("Receive request with appDeliveryID = {}.", appDeliveryID); - repository.add(deliveryRequest); + repository.store(deliveryRequest); pipeline.processRequest(appDeliveryID); var statusId = RequestStatusResponse.getResponseID(appDeliveryID); - var response = repository.getResponse(statusId) + var response = repository.retrieveResponse(statusId) .orElseThrow(() -> moaZSException("Could not get a response for AppDeliveryID=%s.", appDeliveryID)); return (DeliveryRequestStatusType) response.getResponse(); } |