aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/moazs/config
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-07-08 18:02:37 +0200
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-07-08 18:02:37 +0200
commitc1a1a5130a4ecf755da72941ad3525beb919447f (patch)
treeecaca5da80571e10f25186402ee73d8e062d4544 /src/main/java/at/gv/egiz/moazs/config
parent78f0715d86a055aed11138df5f66b0794e72326a (diff)
downloadmoa-zs-c1a1a5130a4ecf755da72941ad3525beb919447f.tar.gz
moa-zs-c1a1a5130a4ecf755da72941ad3525beb919447f.tar.bz2
moa-zs-c1a1a5130a4ecf755da72941ad3525beb919447f.zip
Implement Zuse2App Services
- Add zuse2app.wsdl contract. - Add MsgResponse as an type-agnostic view for DeliveryRequestStatus and DeliveryNotification messages. Reason: Both DeliveryNotification and DeliveryRequestStatus messages have similar fields and need to be treated similarly (e.g.: receive from msg service, store to repository, verify signature, store to file...). In order to prevent duplicated code, the wrapper interface provides a type-agnostic view onto these messages for depending components to operate on. - Add MsgResponseHandler interface; decides how to process MsgResponse. Also implement this handler with a multi-threaded single-node implementation. - Add MsgResponseSink interface; decides how to archive MsgResponse. - Implement and test SafeResponseToFileSink. Change Identifier for MsgResponses: - Before, DeliveryRequestStatus and DeliveryNotifications had their own repositories. Now, both types are stored in the same repository (the MsgResponse repository) to streamline the handling of MsgResponses. We need to change the identification of MsgReponses, otherwise the identifiers (AppDeliveryID) clash. - MsgResponses are not identified by: <AppDeliveryId>+<typeSpecificSuffix> - Rewrite StoreSOAPInterceptor to accommodate fact that, both DeliveryRequestStatus and DeliveryNotification messages have different IDs upon storage / retrieval. Restructure packages and components as follows: - client: All components that are involved when consuming a web service. - process: "fabric" of MoaZS; contains business logic that orchestrates back-end tasks of MoaZS's operational services, e.g.: by processing a delivery request. - service: Implementation of MoaZS's front-end services. Refactoring: - MoaZSException: Remove unused fields. Before: Store mzsrequest, tnvzresult, msgrequest and msgresult as members. Now: Only keep the fields that are needed later, e.g for generating a msg:DeliveryRequestStatus element. Add copy constructor to Builder. - Put storage of byte[] into a dedicated "BinaryRepository". Reason: This was useful in a former design. Now it's not really needed anymore. - Put "create Endpoint" code into EndpointFactory. Reason: Eliminate duplicated code when configuring a service. Testing: - Activate Stacktraces in surefire.
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/config')
-rw-r--r--src/main/java/at/gv/egiz/moazs/config/MzsServiceConfig.java30
-rw-r--r--src/main/java/at/gv/egiz/moazs/config/PreprocessConfig.java2
-rw-r--r--src/main/java/at/gv/egiz/moazs/config/RepositoryConfig.java32
-rw-r--r--src/main/java/at/gv/egiz/moazs/config/ServicesConfig.java46
4 files changed, 79 insertions, 31 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/config/MzsServiceConfig.java b/src/main/java/at/gv/egiz/moazs/config/MzsServiceConfig.java
deleted file mode 100644
index 9fd14eb..0000000
--- a/src/main/java/at/gv/egiz/moazs/config/MzsServiceConfig.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package at.gv.egiz.moazs.config;
-
-import at.gv.egiz.moazs.scheme.MzsService;
-import at.gv.zustellung.app2mzs.xsd.App2Mzs;
-import org.apache.cxf.Bus;
-import org.apache.cxf.jaxws.EndpointImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import javax.xml.ws.Endpoint;
-
-@Configuration
-public class MzsServiceConfig {
-
- @Bean
- @Autowired
- public Endpoint endpoint(Bus bus, MzsService mzsService, App2Mzs app2mzs) {
- EndpointImpl endpoint = new EndpointImpl(bus, mzsService);
- endpoint.setAddress("/");
- endpoint.setServiceName(app2mzs.getServiceName());
- endpoint.setWsdlLocation(app2mzs.getWSDLDocumentLocation().toString());
- endpoint.publish();
- return endpoint;
- }
-
- @Bean public App2Mzs app2mzs() {
- return new App2Mzs();
- }
-}
diff --git a/src/main/java/at/gv/egiz/moazs/config/PreprocessConfig.java b/src/main/java/at/gv/egiz/moazs/config/PreprocessConfig.java
index b24db28..76bfb30 100644
--- a/src/main/java/at/gv/egiz/moazs/config/PreprocessConfig.java
+++ b/src/main/java/at/gv/egiz/moazs/config/PreprocessConfig.java
@@ -1,6 +1,6 @@
package at.gv.egiz.moazs.config;
-import at.gv.egiz.moazs.scheme.MzsDeliveryRequestValidator;
+import at.gv.egiz.moazs.preprocess.MzsDeliveryRequestValidator;
import at.gv.egiz.moazs.preprocess.*;
import at.gv.zustellung.app2mzs.xsd.ConfigType;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/src/main/java/at/gv/egiz/moazs/config/RepositoryConfig.java b/src/main/java/at/gv/egiz/moazs/config/RepositoryConfig.java
new file mode 100644
index 0000000..ee73b9e
--- /dev/null
+++ b/src/main/java/at/gv/egiz/moazs/config/RepositoryConfig.java
@@ -0,0 +1,32 @@
+package at.gv.egiz.moazs.config;
+
+import at.gv.egiz.moazs.repository.BinaryRepository;
+import at.gv.egiz.moazs.repository.InMemoryBinaryRepository;
+import at.gv.egiz.moazs.scheme.NameSpace;
+import at.gv.egiz.moazs.scheme.NotificationResponse;
+import at.gv.egiz.moazs.scheme.RequestStatusResponse;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+
+import java.util.Map;
+
+@Configuration
+@Profile("!cluster")
+public class RepositoryConfig {
+
+ @Value("${repository.expiresAfterWrite}")
+ private int expiresAfterWrite;
+
+ @Bean
+ public BinaryRepository binaryRepository() {
+ return new InMemoryBinaryRepository(expiresAfterWrite);
+ }
+
+ @Bean
+ public Map<String, String> idSuffixes() {
+ return Map.of(NameSpace.MSG_DELIVERY_REQUEST_STATUS, RequestStatusResponse.getIdSuffix(),
+ NameSpace.MSG_DELIVERY_NOTIFICATION, NotificationResponse.getIdSuffix());
+ }
+}
diff --git a/src/main/java/at/gv/egiz/moazs/config/ServicesConfig.java b/src/main/java/at/gv/egiz/moazs/config/ServicesConfig.java
new file mode 100644
index 0000000..8e354ab
--- /dev/null
+++ b/src/main/java/at/gv/egiz/moazs/config/ServicesConfig.java
@@ -0,0 +1,46 @@
+package at.gv.egiz.moazs.config;
+
+import at.gv.egiz.moazs.service.MsgService;
+import at.gv.egiz.moazs.service.MzsService;
+import at.gv.egiz.moazs.util.EndpointFactory;
+import at.gv.egiz.moazs.util.StoreSOAPBodyBinaryInRepositoryInterceptor;
+import at.gv.zustellung.app2mzs.xsd.App2Mzs;
+import at.gv.zustellung.msg.xsd.Zuse2AppPortService;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.message.Message;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.xml.ws.Endpoint;
+
+@Configuration
+public class ServicesConfig {
+
+ @Autowired
+ private EndpointFactory endpointFactory;
+
+ @Bean
+ @Autowired
+ public Endpoint msgEndpoint(MsgService msgService,
+ Zuse2AppPortService zuse2app,
+ Interceptor<Message> msgInterceptor) {
+ return endpointFactory.create(msgService, zuse2app, msgInterceptor);
+ }
+
+ @Bean
+ @Autowired
+ public Endpoint mzsEndpoint(MzsService mzsService, App2Mzs app2mzs) {
+ return endpointFactory.create(mzsService, app2mzs);
+ }
+
+ @Bean
+ public Zuse2AppPortService zuse2App() {
+ return new Zuse2AppPortService();
+ }
+
+ @Bean public App2Mzs app2mzs() {
+ return new App2Mzs();
+ }
+
+}