View Javadoc
1   /*
2    * Copyright 2010 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.openehealth.ipf.platform.camel.ihe.hl7v3;
17  
18  import org.openehealth.ipf.commons.ihe.hl7v3.audit.Hl7v3AuditDataset;
19  import org.openehealth.ipf.commons.ihe.hl7v3.Hl7v3ClientFactory;
20  import org.openehealth.ipf.commons.ihe.hl7v3.Hl7v3ServiceFactory;
21  import org.openehealth.ipf.commons.ihe.hl7v3.Hl7v3WsTransactionConfiguration;
22  import org.openehealth.ipf.commons.ihe.ws.JaxWsClientFactory;
23  import org.openehealth.ipf.commons.ihe.ws.JaxWsServiceFactory;
24  import org.openehealth.ipf.commons.ihe.ws.WsInteractionId;
25  import org.openehealth.ipf.platform.camel.ihe.ws.AbstractWebService;
26  import org.openehealth.ipf.platform.camel.ihe.ws.AbstractWsComponent;
27  import org.openehealth.ipf.platform.camel.ihe.ws.AbstractWsEndpoint;
28  
29  import java.util.Map;
30  
31  /**
32   * Camel endpoint implementation for HL7v3-based IHE components.
33   *
34   * @author Dmytro Rud
35   */
36  public abstract class Hl7v3Endpoint<ConfigType extends Hl7v3WsTransactionConfiguration>
37          extends AbstractWsEndpoint<Hl7v3AuditDataset, ConfigType> {
38  
39      protected Hl7v3Endpoint(
40              String endpointUri,
41              String address,
42              AbstractWsComponent<Hl7v3AuditDataset, ConfigType, ? extends WsInteractionId<ConfigType>> component,
43              Map<String, Object> parameters,
44              Class<? extends AbstractWebService> serviceClass) {
45          super(endpointUri, address, component, parameters, serviceClass);
46      }
47  
48      @Override
49      public JaxWsClientFactory<Hl7v3AuditDataset> getJaxWsClientFactory() {
50          return new Hl7v3ClientFactory(
51                  getComponent().getWsTransactionConfiguration(),
52                  getServiceUrl(),
53                  isAudit() ? getComponent().getClientAuditStrategy() : null,
54                  getAuditContext(),
55                  getCustomInterceptors(),
56                  getFeatures(),
57                  getProperties(),
58                  getCorrelator());
59      }
60  
61  
62      @Override
63      public JaxWsServiceFactory<Hl7v3AuditDataset> getJaxWsServiceFactory() {
64          return new Hl7v3ServiceFactory(
65                  getComponent().getWsTransactionConfiguration(),
66                  getServiceAddress(),
67                  isAudit() ? getComponent().getServerAuditStrategy() : null,
68                  getAuditContext(),
69                  getCustomInterceptors(),
70                  getRejectionHandlingStrategy());
71      }
72  
73  }