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.spi.config.domain.key;
17  
18  import de.smartics.properties.api.config.domain.key.ConfigurationKeyFactory;
19  import de.smartics.properties.api.config.domain.key.ConfigurationKeyHelper;
20  import de.smartics.properties.api.config.domain.key.KeyListBuilder;
21  import de.smartics.properties.spi.config.definition.DefinitionConfigParser;
22  import de.smartics.properties.spi.config.definition.DefinitionKeyHelper;
23  import de.smartics.properties.spi.config.definition.PropertiesDefinitionContext;
24  import de.smartics.util.annotations.marker.ServiceInterface;
25  
26  /**
27   * Provides access to utilities to deal with configuration keys.
28   */
29  @ServiceInterface
30  public interface ConfigurationKeyContext
31  {
32    // ********************************* Fields *********************************
33  
34    // --- constants ------------------------------------------------------------
35  
36    // ****************************** Initializer *******************************
37  
38    // ****************************** Inner Classes *****************************
39  
40    // ********************************* Methods ********************************
41  
42    // --- get&set --------------------------------------------------------------
43  
44    /**
45     * Provides access to the configuration key factory.
46     *
47     * @return a factory to create special configuration keys.
48     */
49    ConfigurationKeyFactory<?> configurationKeyFactory();
50  
51    /**
52     * Provides access to the key list builder that creates a list of
53     * configuration keys to fetch property values.
54     *
55     * @return the key list builder that creates a list of configuration keys to
56     *         fetch property values.
57     */
58    KeyListBuilder keyListBuilder();
59  
60    /**
61     * Provides a parser to parse definition files.
62     *
63     * @return a parser to parse definition files.
64     */
65    DefinitionConfigParser<?> definitionConfigParser();
66  
67    /**
68     * Provides a contextless definition helper.
69     *
70     * @return a definition helper.
71     */
72    DefinitionKeyHelper definitionKeyHelper();
73  
74    /**
75     * Provides a helper to create a configuration key at runtime.
76     *
77     * @param preferEarManifest the flag to signal that the manifest of a EAR file
78     *          (with the extension <code>ear</code>) is preferred if present.
79     * @return a configuration key helper.
80     */
81    ConfigurationKeyHelper configurationKeyHelper(boolean preferEarManifest);
82  
83    /**
84     * Provides a contextaware definition helper.
85     *
86     * @param definitionContext the context to base the definition helper.
87     * @return a definition helper.
88     */
89    DefinitionKeyHelper definitionKeyHelper(
90        PropertiesDefinitionContext definitionContext);
91  
92    // --- business -------------------------------------------------------------
93  
94    // --- object basics --------------------------------------------------------
95  
96  }