From 78f0715d86a055aed11138df5f66b0794e72326a Mon Sep 17 00:00:00 2001 From: Christof Rabensteiner Date: Wed, 3 Jul 2019 15:27:14 +0200 Subject: Refactor: Restructure Project - Move components that depend on the service contracts into scheme package. - Move cxf related components into util package. - Rename SameThread to SingleThreaded. --- ...StoreSOAPBodyBinaryInRepositoryInterceptor.java | 65 ---------------------- 1 file changed, 65 deletions(-) delete mode 100644 src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java (limited to 'src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java') diff --git a/src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java b/src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java deleted file mode 100644 index ac3acc6..0000000 --- a/src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java +++ /dev/null @@ -1,65 +0,0 @@ -package at.gv.egiz.moazs.msg; - -import at.gv.egiz.moazs.repository.DeliveryRepository; -import at.gv.egiz.moazs.scheme.SOAPUtils; -import at.gv.egiz.moazs.util.CXFMessageUtils; -import org.apache.cxf.message.Message; -import org.apache.cxf.phase.AbstractPhaseInterceptor; -import org.apache.cxf.phase.Phase; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.w3c.dom.Element; -import org.xml.sax.SAXException; - -import javax.xml.parsers.ParserConfigurationException; -import java.io.IOException; -import java.nio.charset.StandardCharsets; - -import static at.gv.egiz.moazs.MoaZSException.moaZSException; - -@Component -public class StoreSOAPBodyBinaryInRepositoryInterceptor extends AbstractPhaseInterceptor { - - private static final Logger log = LoggerFactory.getLogger(StoreSOAPBodyBinaryInRepositoryInterceptor.class); - - private final CXFMessageUtils messageUtils; - private final SOAPUtils soapUtils; - private final DeliveryRepository repository; - - @Autowired - public StoreSOAPBodyBinaryInRepositoryInterceptor(CXFMessageUtils extractor, SOAPUtils soapUtils, - DeliveryRepository repository) { - super(Phase.RECEIVE); - this.messageUtils = extractor; - this.soapUtils = soapUtils; - this.repository = repository; - } - - public void handleMessage(Message message) { - - try { - byte[] content = messageUtils.copyContent(message); - - if(log.isTraceEnabled()) { - log.trace("Interceptor received this SOAP message: {}. ", new String(content, StandardCharsets.UTF_8)); - } - - if(content.length > 0) { - Element document = soapUtils.toDOM(content); - byte[] status = soapUtils.unwrapSoapEnvelope(document); - String appDeliveryID = soapUtils.getAppDeliveryIDFrom(document); - repository.addSignedDeliveryRequestStatus(status, appDeliveryID); - - if(log.isTraceEnabled()) { - log.trace("DeliveryRequestStatus with AppDeliveryID={} unwrapped and stored: {}. ", - appDeliveryID, new String(status, StandardCharsets.UTF_8)); - } - } - } catch (ParserConfigurationException | SAXException | IOException | NullPointerException e) { - throw moaZSException("Could not extract signed data from message.", e); - } - } - -} -- cgit v1.2.3