1 | |
|
2 | |
|
3 | |
|
4 | |
package ca.uhn.hl7v2.protocol.impl; |
5 | |
|
6 | |
import java.util.ArrayList; |
7 | |
import java.util.List; |
8 | |
|
9 | |
import ca.uhn.hl7v2.protocol.AcceptValidator; |
10 | |
import ca.uhn.hl7v2.protocol.ApplicationRouter; |
11 | |
import ca.uhn.hl7v2.protocol.ProcessorContext; |
12 | |
import ca.uhn.hl7v2.protocol.SafeStorage; |
13 | |
import ca.uhn.hl7v2.protocol.TransportLayer; |
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
public class ProcessorContextImpl implements ProcessorContext { |
22 | |
|
23 | |
private final ApplicationRouter myRouter; |
24 | |
private final TransportLayer myLocallyDrivenTransport; |
25 | |
private final TransportLayer myRemotelyDrivenTransport; |
26 | |
private final SafeStorage mySafeStorage; |
27 | |
private final List<AcceptValidator> myValidators; |
28 | |
private final List<String> myMetadataFields; |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
public ProcessorContextImpl( |
39 | |
ApplicationRouter theRouter, |
40 | |
TransportLayer theTransport, |
41 | 25 | SafeStorage theStorage) { |
42 | |
|
43 | 25 | myRouter = theRouter; |
44 | 25 | myRemotelyDrivenTransport = theTransport; |
45 | 25 | myLocallyDrivenTransport = theTransport; |
46 | 25 | mySafeStorage = theStorage; |
47 | |
|
48 | 25 | myValidators = new ArrayList<AcceptValidator>(8); |
49 | 25 | myMetadataFields = new ArrayList<String>(30); |
50 | 25 | } |
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
public ProcessorContextImpl( |
63 | |
ApplicationRouter theRouter, |
64 | |
TransportLayer theLocallyDrivenTransport, |
65 | |
TransportLayer theRemotelyDrivenTransport, |
66 | 60 | SafeStorage theStorage) { |
67 | |
|
68 | 60 | myRouter = theRouter; |
69 | 60 | myRemotelyDrivenTransport = theRemotelyDrivenTransport; |
70 | 60 | myLocallyDrivenTransport = theLocallyDrivenTransport; |
71 | 60 | mySafeStorage = theStorage; |
72 | |
|
73 | 60 | myValidators = new ArrayList<AcceptValidator>(8); |
74 | 60 | myMetadataFields = new ArrayList<String>(30); |
75 | 60 | } |
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
public ApplicationRouter getRouter() { |
81 | 20 | return myRouter; |
82 | |
} |
83 | |
|
84 | |
|
85 | |
|
86 | |
|
87 | |
public TransportLayer getRemotelyDrivenTransportLayer() { |
88 | 788 | return myRemotelyDrivenTransport; |
89 | |
} |
90 | |
|
91 | |
|
92 | |
|
93 | |
|
94 | |
public TransportLayer getLocallyDrivenTransportLayer() { |
95 | 983 | return myLocallyDrivenTransport; |
96 | |
} |
97 | |
|
98 | |
|
99 | |
|
100 | |
|
101 | |
public AcceptValidator[] getValidators() { |
102 | 45 | return myValidators.toArray(new AcceptValidator[0]); |
103 | |
} |
104 | |
|
105 | |
|
106 | |
|
107 | |
|
108 | |
|
109 | |
|
110 | |
|
111 | |
public void addValidator(AcceptValidator theValidator) { |
112 | 10 | myValidators.add(theValidator); |
113 | 10 | } |
114 | |
|
115 | |
|
116 | |
|
117 | |
|
118 | |
public SafeStorage getSafeStorage() { |
119 | 40 | return mySafeStorage; |
120 | |
} |
121 | |
|
122 | |
|
123 | |
|
124 | |
|
125 | |
public List<String> getMetadataFields() { |
126 | 0 | return myMetadataFields; |
127 | |
} |
128 | |
|
129 | |
} |