1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.commons.ihe.core.atna;
17
18 import org.openehealth.ipf.commons.ihe.core.atna.custom.*;
19 import org.openhealthtools.ihe.atna.auditor.*;
20 import org.openhealthtools.ihe.atna.auditor.context.AuditorModuleConfig;
21 import org.openhealthtools.ihe.atna.auditor.context.AuditorModuleContext;
22
23 import java.net.InetAddress;
24 import java.net.UnknownHostException;
25
26
27
28
29
30
31 public abstract class AuditorManager {
32 private static final Object sync = new Object();
33
34 private AuditorManager() {
35 throw new IllegalStateException("Static helper class cannot be instantiated");
36 }
37
38
39
40
41
42
43
44
45 @SuppressWarnings("unchecked")
46 public static <T extends IHEAuditor> T getAuditor(Class<T> auditorClass) {
47 synchronized (sync) {
48 AuditorModuleContext ctx = AuditorModuleContext.getContext();
49 return (T) ctx.getAuditor(auditorClass);
50 }
51 }
52
53 public static XDSRegistryAuditor getRegistryAuditor() {
54 synchronized (sync) {
55 return XDSRegistryAuditor.getAuditor();
56 }
57 }
58
59 public static XDSRepositoryAuditor getRepositoryAuditor() {
60 synchronized (sync) {
61 return XDSRepositoryAuditor.getAuditor();
62 }
63 }
64
65 public static XDSConsumerAuditor getConsumerAuditor() {
66 synchronized (sync) {
67 XDSConsumerAuditor auditor = XDSConsumerAuditor.getAuditor();
68
69
70 AuditorModuleConfig config = auditor.getConfig();
71 if (config.getSystemUserId() == null) {
72 try {
73 config.setSystemUserId(InetAddress.getLocalHost().getHostAddress());
74 } catch (UnknownHostException e) {
75 config.setSystemUserId("unknown");
76 }
77 }
78 return auditor;
79 }
80 }
81
82 public static XDSSourceAuditor getSourceAuditor() {
83 synchronized (sync) {
84 return XDSSourceAuditor.getAuditor();
85 }
86 }
87
88 public static PIXManagerAuditor getPIXManagerAuditor() {
89 synchronized (sync) {
90 return PIXManagerAuditor.getAuditor();
91 }
92 }
93
94 public static PIXSourceAuditor getPIXSourceAuditor() {
95 synchronized (sync) {
96 return PIXSourceAuditor.getAuditor();
97 }
98 }
99
100 public static PIXConsumerAuditor getPIXConsumerAuditor() {
101 synchronized (sync) {
102 return PIXConsumerAuditor.getAuditor();
103 }
104 }
105
106 public static PDQConsumerAuditor getPDQConsumerAuditor() {
107 synchronized (sync) {
108 return PDQConsumerAuditor.getAuditor();
109 }
110 }
111
112 public static PAMSourceAuditor getPAMSourceAuditor() {
113 synchronized (sync) {
114 return PAMSourceAuditor.getAuditor();
115 }
116 }
117
118 public static Hl7v3Auditor getHl7v3Auditor() {
119 synchronized (sync) {
120 return Hl7v3Auditor.getAuditor();
121 }
122 }
123
124 public static FhirAuditor getFhirAuditor() {
125 synchronized (sync) {
126 return FhirAuditor.getAuditor();
127 }
128 }
129
130 public static CustomXdsAuditor getCustomXdsAuditor() {
131 synchronized (sync) {
132 return CustomXdsAuditor.getAuditor();
133 }
134 }
135
136 public static CustomPixAuditor getCustomPixAuditor() {
137 synchronized (sync) {
138 return CustomPixAuditor.getAuditor();
139 }
140 }
141
142 public static XCAInitiatingGatewayAuditor getXCAInitiatingGatewayAuditor() {
143 synchronized (sync) {
144 return XCAInitiatingGatewayAuditor.getAuditor();
145 }
146 }
147
148 public static XCARespondingGatewayAuditor getXCARespondingGatewayAuditor() {
149 synchronized (sync) {
150 return XCARespondingGatewayAuditor.getAuditor();
151 }
152 }
153
154 public static HpdAuditor getHpdAuditor() {
155 synchronized (sync) {
156 return HpdAuditor.getAuditor();
157 }
158 }
159 }