View Javadoc
1   /*
2    * Copyright 2016 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  
17  package org.openehealth.ipf.commons.ihe.fhir;
18  
19  import ca.uhn.fhir.rest.server.RestfulServer;
20  
21  /**
22   * Keeps track of {@link RequestConsumer} and {@link IpfFhirServlet} and connects them to each other.
23   *
24   * @author Christian Ohr
25   * @since 3.2
26   */
27  public interface FhirRegistry {
28  
29      /**
30       * Registers the FHIR resource provider.
31       *
32       * @param resourceProvider resource provider
33       * @throws Exception
34       */
35      void register(Object resourceProvider);
36  
37      /**
38       * Unregisters the FHIR resource provider.
39       *
40       * @param resourceProvider resource provider
41       * @throws Exception
42       */
43      void unregister(Object resourceProvider) throws Exception;
44  
45      /**
46       * Registers the FHIR servlet, usually during its init phase.
47       *
48       * @param servlet FHIR servlet
49       * @throws Exception
50       */
51      void register(RestfulServer servlet);
52  
53      /**
54       * Unregisters the FHIR servlet, usually during its destroy phase
55       *
56       * @param servlet FHIR servlet
57       * @throws Exception
58       */
59      void unregister(RestfulServer servlet) throws Exception;
60  
61      /**
62       * Returns true if there is already a registered FHIR servlet with the provided name
63       *
64       * @param servletName
65       * @return true if there is already a registered FHIR servlet with this name
66       */
67      boolean hasServlet(String servletName);
68  }