View Javadoc

1   /*
2    * Copyright 2012-2013 smartics, Kronseder & Reiner GmbH
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 de.smartics.properties.api.config.domain;
17  
18  import de.smartics.properties.api.config.domain.key.ConfigurationKey;
19  import de.smartics.util.lang.NullArgumentException;
20  
21  /**
22   * Provides access to configurations for applications in the configured
23   * environments.
24   */
25  public interface ConfigurationRepository
26  {
27    // ********************************* Fields *********************************
28  
29    // --- constants ------------------------------------------------------------
30  
31    // ****************************** Initializer *******************************
32  
33    // ****************************** Inner Classes *****************************
34  
35    // ********************************* Methods ********************************
36  
37    // --- get&set --------------------------------------------------------------
38  
39    // --- business -------------------------------------------------------------
40  
41    /**
42     * Fetches the properties for the given configuration {@code key}.
43     *
44     * @param key the key that specifies an application in its environment.
45     * @return the requested configuration properties. Never <code>null</code>.
46     * @throws NullArgumentException if {@code key} is <code>null</code>.
47     * @throws MissingConfigurationException if there is no configuration for the
48     *           given {@code key}.
49     */
50    ConfigurationProperties getProperties(ConfigurationKey<?> key)
51      throws NullArgumentException, MissingConfigurationException;
52  
53    /**
54     * Releases resources acquired by this instance.
55     */
56    void release();
57  
58    // --- object basics --------------------------------------------------------
59  
60  }