1 /*
2  * Copyright (C) 2011 The Android Open Source Project
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 com.android.tradefed.config;
18 
19 import java.util.Map;
20 import java.util.Set;
21 
22 /**
23  * Interface for retrieving a ConfigurationDef.
24  */
25 interface IConfigDefLoader {
26 
27     /**
28      * Retrieve the {@link ConfigurationDef} for the given name
29      *
30      * @param name
31      * @param templateMap map of template-include names to configuration filenames
32      * @return {@link ConfigurationDef}
33      * @throws ConfigurationException if an error occurred loading the config
34      */
getConfigurationDef(String name, Map<String, String> templateMap)35     ConfigurationDef getConfigurationDef(String name, Map<String, String> templateMap)
36             throws ConfigurationException;
37 
isGlobalConfig()38     boolean isGlobalConfig();
39 
40     /**
41      * Load a config's data into the given {@link ConfigurationDef}
42      *
43      * @param def the {@link ConfigurationDef} to load the data into
44      * @param parentName the name of the parent config
45      * @param name the name of config to include
46      * @param deviceTagObject the name of the current deviceTag or null if not inside a device tag.
47      * @param templateMap the current map of template to be loaded.
48      * @param templateSeen Set of name of template placeholder already encountered.
49      * @throws ConfigurationException if an error occurred loading the config
50      */
loadIncludedConfiguration( ConfigurationDef def, String parentName, String name, String deviceTagObject, Map<String, String> templateMap, Set<String> templateSeen)51     void loadIncludedConfiguration(
52             ConfigurationDef def,
53             String parentName,
54             String name,
55             String deviceTagObject,
56             Map<String, String> templateMap,
57             Set<String> templateSeen)
58             throws ConfigurationException;
59 }
60