| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
package ca.uhn.hl7v2; |
| 27 | |
|
| 28 | |
import java.io.IOException; |
| 29 | |
import java.util.concurrent.ExecutorService; |
| 30 | |
|
| 31 | |
import ca.uhn.hl7v2.app.Connection; |
| 32 | |
import ca.uhn.hl7v2.app.ConnectionHub; |
| 33 | |
import ca.uhn.hl7v2.app.HL7Service; |
| 34 | |
import ca.uhn.hl7v2.app.ServerConfiguration; |
| 35 | |
import ca.uhn.hl7v2.conf.store.CodeStoreRegistry; |
| 36 | |
import ca.uhn.hl7v2.conf.store.ProfileStore; |
| 37 | |
import ca.uhn.hl7v2.llp.LowerLayerProtocol; |
| 38 | |
import ca.uhn.hl7v2.model.Message; |
| 39 | |
import ca.uhn.hl7v2.parser.*; |
| 40 | |
import ca.uhn.hl7v2.util.SocketFactory; |
| 41 | |
import ca.uhn.hl7v2.validation.ValidationContext; |
| 42 | |
import ca.uhn.hl7v2.validation.ValidationExceptionHandlerFactory; |
| 43 | |
import ca.uhn.hl7v2.validation.Validator; |
| 44 | |
import ca.uhn.hl7v2.validation.builder.ValidationRuleBuilder; |
| 45 | |
|
| 46 | |
|
| 47 | |
|
| 48 | |
|
| 49 | |
|
| 50 | |
|
| 51 | |
public abstract class HapiContextSupport { |
| 52 | |
|
| 53 | |
private HapiContext context; |
| 54 | |
|
| 55 | |
public HapiContextSupport(HapiContext context) { |
| 56 | 6640 | super(); |
| 57 | 6640 | this.context = context; |
| 58 | 6640 | } |
| 59 | |
|
| 60 | |
|
| 61 | |
|
| 62 | |
|
| 63 | |
public final HapiContext getHapiContext() { |
| 64 | 485409 | return unmodifiableContext(context); |
| 65 | |
} |
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | |
|
| 72 | |
|
| 73 | |
protected void setHapiContext(HapiContext context) { |
| 74 | 0 | this.context = context; |
| 75 | 0 | } |
| 76 | |
|
| 77 | |
|
| 78 | |
|
| 79 | |
|
| 80 | |
|
| 81 | |
|
| 82 | |
|
| 83 | |
|
| 84 | |
private static HapiContext unmodifiableContext(HapiContext context) { |
| 85 | 485409 | return new UnmodifiableHapiContext(context); |
| 86 | |
} |
| 87 | |
|
| 88 | |
private static class UnmodifiableHapiContext implements HapiContext { |
| 89 | |
|
| 90 | |
private HapiContext context; |
| 91 | |
|
| 92 | 485409 | public UnmodifiableHapiContext(HapiContext context) { |
| 93 | 485409 | this.context = context; |
| 94 | 485409 | } |
| 95 | |
|
| 96 | |
public CodeStoreRegistry getCodeStoreRegistry() { |
| 97 | 735 | return context.getCodeStoreRegistry(); |
| 98 | |
} |
| 99 | |
|
| 100 | |
public ca.uhn.hl7v2.conf.check.Validator getConformanceValidator() { |
| 101 | 30 | return context.getConformanceValidator(); |
| 102 | |
} |
| 103 | |
|
| 104 | |
|
| 105 | |
|
| 106 | |
|
| 107 | |
public ConnectionHub getConnectionHub() { |
| 108 | 0 | return context.getConnectionHub(); |
| 109 | |
} |
| 110 | |
|
| 111 | |
public ExecutorService getExecutorService() { |
| 112 | 315 | return context.getExecutorService(); |
| 113 | |
} |
| 114 | |
|
| 115 | |
public GenericParser getGenericParser() { |
| 116 | 1300 | return context.getGenericParser(); |
| 117 | |
} |
| 118 | |
|
| 119 | |
public LowerLayerProtocol getLowerLayerProtocol() { |
| 120 | 1260 | return context.getLowerLayerProtocol(); |
| 121 | |
} |
| 122 | |
|
| 123 | |
public <R> Validator<R> getMessageValidator() { |
| 124 | 11228 | return context.getMessageValidator(); |
| 125 | |
} |
| 126 | |
|
| 127 | |
public ModelClassFactory getModelClassFactory() { |
| 128 | 8943 | return context.getModelClassFactory(); |
| 129 | |
} |
| 130 | |
|
| 131 | |
public ParserConfiguration getParserConfiguration() { |
| 132 | 303029 | return context.getParserConfiguration(); |
| 133 | |
} |
| 134 | |
|
| 135 | |
public PipeParser getPipeParser() { |
| 136 | 170 | return context.getPipeParser(); |
| 137 | |
} |
| 138 | |
|
| 139 | |
public ProfileStore getProfileStore() { |
| 140 | 30 | return context.getProfileStore(); |
| 141 | |
} |
| 142 | |
|
| 143 | |
public SocketFactory getSocketFactory() { |
| 144 | 1260 | return context.getSocketFactory(); |
| 145 | |
} |
| 146 | |
|
| 147 | |
public ValidationContext getValidationContext() { |
| 148 | 134483 | return context.getValidationContext(); |
| 149 | |
} |
| 150 | |
|
| 151 | |
public <R> ValidationExceptionHandlerFactory<R> getValidationExceptionHandlerFactory() { |
| 152 | 11228 | return context.getValidationExceptionHandlerFactory(); |
| 153 | |
} |
| 154 | |
|
| 155 | |
public ValidationRuleBuilder getValidationRuleBuilder() { |
| 156 | 0 | return context.getValidationRuleBuilder(); |
| 157 | |
} |
| 158 | |
|
| 159 | |
public XMLParser getXMLParser() { |
| 160 | 0 | return context.getXMLParser(); |
| 161 | |
} |
| 162 | |
|
| 163 | |
public Connection newClient(String host, int port, boolean tls) throws HL7Exception { |
| 164 | 0 | return context.newClient(host, port, tls); |
| 165 | |
} |
| 166 | |
|
| 167 | |
public Connection newClient(String host, int outboundPort, int inboundPort, boolean tls) throws HL7Exception { |
| 168 | 0 | return context.newClient(host, outboundPort, inboundPort, tls); |
| 169 | |
} |
| 170 | |
|
| 171 | |
public Connection newLazyClient(String host, int port, boolean tls) throws HL7Exception { |
| 172 | 0 | return context.newLazyClient(host, port, tls); |
| 173 | |
} |
| 174 | |
|
| 175 | |
public Connection newLazyClient(String host, int outboundPort, int inboundPort, boolean tls) throws HL7Exception { |
| 176 | 0 | return context.newLazyClient(host, outboundPort, inboundPort, tls); |
| 177 | |
} |
| 178 | |
|
| 179 | |
public HL7Service newServer(int port, boolean tls) { |
| 180 | 0 | return context.newServer(port, tls); |
| 181 | |
} |
| 182 | |
|
| 183 | |
public HL7Service newServer(int inboundPort, int outboundPort, boolean tls) { |
| 184 | 0 | return context.newServer(inboundPort, outboundPort, tls); |
| 185 | |
} |
| 186 | |
|
| 187 | |
public Message newMessage(String eventType, String triggerEvent, Version version) throws HL7Exception { |
| 188 | 0 | return context.newMessage(eventType, triggerEvent, version); |
| 189 | |
} |
| 190 | |
|
| 191 | |
public <T extends Message> T newMessage(Class<T> clazz) throws HL7Exception { |
| 192 | 0 | return context.newMessage(clazz); |
| 193 | |
} |
| 194 | |
|
| 195 | |
public void setCodeStoreRegistry(CodeStoreRegistry store) { |
| 196 | 0 | throw new UnsupportedOperationException("Read-only instance"); |
| 197 | |
} |
| 198 | |
|
| 199 | |
public void setExecutorService(ExecutorService executorService) { |
| 200 | 0 | throw new UnsupportedOperationException("Read-only instance"); |
| 201 | |
} |
| 202 | |
|
| 203 | |
public void setLowerLayerProtocol(LowerLayerProtocol llp) { |
| 204 | 0 | throw new UnsupportedOperationException("Read-only instance"); |
| 205 | |
} |
| 206 | |
|
| 207 | |
public void setModelClassFactory(ModelClassFactory modelClassFactory) { |
| 208 | 0 | throw new UnsupportedOperationException("Read-only instance"); |
| 209 | |
} |
| 210 | |
|
| 211 | |
public void setParserConfiguration(ParserConfiguration configuration) { |
| 212 | 0 | throw new UnsupportedOperationException("Read-only instance"); |
| 213 | |
} |
| 214 | |
|
| 215 | |
public void setProfileStore(ProfileStore store) { |
| 216 | 0 | throw new UnsupportedOperationException("Read-only instance"); |
| 217 | |
} |
| 218 | |
|
| 219 | |
public void setSocketFactory(SocketFactory socketFactory) { |
| 220 | 0 | throw new UnsupportedOperationException("Read-only instance"); |
| 221 | |
} |
| 222 | |
|
| 223 | |
public void setValidationContext(String contextClassName) { |
| 224 | 0 | throw new UnsupportedOperationException("Read-only instance"); |
| 225 | |
} |
| 226 | |
|
| 227 | |
public void setValidationContext(ValidationContext context) { |
| 228 | 0 | throw new UnsupportedOperationException("Read-only instance"); |
| 229 | |
} |
| 230 | |
|
| 231 | |
public <R> void setValidationExceptionHandlerFactory( |
| 232 | |
ValidationExceptionHandlerFactory<R> factory) { |
| 233 | 0 | context.setValidationExceptionHandlerFactory(factory); |
| 234 | 0 | } |
| 235 | |
|
| 236 | |
public void setValidationRuleBuilder(String builderClassName) { |
| 237 | 0 | throw new UnsupportedOperationException("Read-only instance"); |
| 238 | |
} |
| 239 | |
|
| 240 | |
public void setValidationRuleBuilder(ValidationRuleBuilder ruleBuilder) { |
| 241 | 0 | throw new UnsupportedOperationException("Read-only instance"); |
| 242 | |
} |
| 243 | |
|
| 244 | |
public ServerConfiguration getServerConfiguration() { |
| 245 | 30 | return context.getServerConfiguration(); |
| 246 | |
} |
| 247 | |
|
| 248 | |
public void setServerConfiguration(ServerConfiguration theServerConfiguration) { |
| 249 | 0 | throw new UnsupportedOperationException("Read-only instance"); |
| 250 | |
} |
| 251 | |
|
| 252 | |
public void close() throws IOException { |
| 253 | 0 | context.close(); |
| 254 | 0 | } |
| 255 | |
} |
| 256 | |
|
| 257 | |
} |