1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.platform.camel.ihe.mllp.core;
17
18 import org.apache.camel.component.mina2.Mina2Endpoint;
19 import org.openehealth.ipf.commons.ihe.hl7v2.audit.MllpAuditDataset;
20 import org.openehealth.ipf.platform.camel.ihe.core.Interceptor;
21 import org.openehealth.ipf.platform.camel.ihe.mllp.core.intercept.consumer.ConsumerDispatchingInterceptor;
22 import org.openehealth.ipf.platform.camel.ihe.mllp.core.intercept.consumer.ConsumerStringProcessingInterceptor;
23
24 import java.util.ArrayList;
25 import java.util.List;
26
27
28
29
30
31
32 public class MllpDispatchEndpoint extends MllpEndpoint<MllpDispatchEndpointConfiguration, MllpAuditDataset, MllpDispatchComponent> {
33
34 public MllpDispatchEndpoint(
35 MllpDispatchComponent mllpComponent,
36 Mina2Endpoint wrappedEndpoint,
37 MllpDispatchEndpointConfiguration config) {
38 super(mllpComponent, wrappedEndpoint, config);
39 }
40
41 @Override
42 public List<Interceptor> createInitialConsumerInterceptorChain() {
43 List<Interceptor> initialChain = new ArrayList<>();
44 initialChain.add(new ConsumerStringProcessingInterceptor());
45
46 ConsumerDispatchingInterceptor dispatcher = getConfig().getDispatcher();
47 if (dispatcher != null) {
48 dispatcher.addTransactionRoutes(getConfig().getRoutes());
49 } else {
50 dispatcher = new ConsumerDispatchingInterceptor(getCamelContext(), getConfig().getRoutes());
51 }
52 initialChain.add(dispatcher);
53 return initialChain;
54 }
55
56
57 @Override
58 public List<Interceptor> createInitialProducerInterceptorChain() {
59 throw new IllegalStateException("No producer support for MLLP dispatch endpoints.");
60 }
61
62 }