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