aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/moazs/util
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-07-09 10:32:54 +0200
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-07-09 10:32:54 +0200
commitd8c668bbca31a835c387a3d52293c9938c424f58 (patch)
tree819c44930a05071e8f8645a1427f9485a79da664 /src/main/java/at/gv/egiz/moazs/util
parentc1a1a5130a4ecf755da72941ad3525beb919447f (diff)
downloadmoa-zs-d8c668bbca31a835c387a3d52293c9938c424f58.tar.gz
moa-zs-d8c668bbca31a835c387a3d52293c9938c424f58.tar.bz2
moa-zs-d8c668bbca31a835c387a3d52293c9938c424f58.zip
Refactor MsgResponse and its IDs
StoreSOAPBodyBinaryInRepositoryInterceptor: - Replace "generate body's id via concatenation" with "give the right generator function the app delivery id and let the generator function do the work". Reason: Prevent the logistics of deriving IDs to spill into unrelated components. MsgResponse refactor: - Make MsgResponse an abstract class. - Derive ResponseID's ONLY in MsgResponse::createResponseID. Others: - Ensure that all invocations to DeliveryRepository.getResponse and BinaryRepository.get use "responseID" instead of ambiguous "id" or incorrect "appDeliveryID". - Move SingleThreadedDeliveryPipeline into process package.
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/util')
-rw-r--r--src/main/java/at/gv/egiz/moazs/util/StoreSOAPBodyBinaryInRepositoryInterceptor.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/util/StoreSOAPBodyBinaryInRepositoryInterceptor.java b/src/main/java/at/gv/egiz/moazs/util/StoreSOAPBodyBinaryInRepositoryInterceptor.java
index d70c8bd..39566fe 100644
--- a/src/main/java/at/gv/egiz/moazs/util/StoreSOAPBodyBinaryInRepositoryInterceptor.java
+++ b/src/main/java/at/gv/egiz/moazs/util/StoreSOAPBodyBinaryInRepositoryInterceptor.java
@@ -16,6 +16,7 @@ import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Map;
+import java.util.function.Function;
import static at.gv.egiz.moazs.MoaZSException.moaZSException;
@@ -26,16 +27,17 @@ public class StoreSOAPBodyBinaryInRepositoryInterceptor extends AbstractPhaseInt
private final CXFMessageUtils messageUtils;
private final SOAPUtils soapUtils;
- private final Map<String, String> idSuffixes;
+ private final Map<String, Function<String, String>> idGenerators;
private final BinaryRepository repository;
@Autowired
public StoreSOAPBodyBinaryInRepositoryInterceptor(CXFMessageUtils extractor, SOAPUtils soapUtils,
- Map<String, String> idSuffixes, BinaryRepository repository) {
+ Map<String, Function<String, String>> idGenerators,
+ BinaryRepository repository) {
super(Phase.RECEIVE);
this.messageUtils = extractor;
this.soapUtils = soapUtils;
- this.idSuffixes = idSuffixes;
+ this.idGenerators = idGenerators;
this.repository = repository;
}
@@ -57,12 +59,12 @@ public class StoreSOAPBodyBinaryInRepositoryInterceptor extends AbstractPhaseInt
String appDeliveryID = soapUtils.getAppDeliveryIDFrom(document);
String rootTag = document.getTagName();
- if (!idSuffixes.containsKey(rootTag)) {
+ if (!idGenerators.containsKey(rootTag)) {
log.trace("Will not add message of type {}. ", rootTag);
return;
}
- var id = appDeliveryID + idSuffixes.get(rootTag);
+ var id = idGenerators.get(rootTag).apply(appDeliveryID);
repository.add(id, response);
if(log.isTraceEnabled()) {