Thomas Vachuska | 6d697f1 | 2015-03-08 20:59:50 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Thomas Vachuska | 6d697f1 | 2015-03-08 20:59:50 -0700 | [diff] [blame] | 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 org.onosproject.cfg; |
| 17 | |
| 18 | import java.util.Set; |
| 19 | |
| 20 | /** |
| 21 | * Service for tracking system-wide configurations for various software components. |
| 22 | */ |
| 23 | public interface ComponentConfigService { |
| 24 | |
| 25 | /** |
| 26 | * Returns names of all components that have registered their |
| 27 | * configuration properties. |
| 28 | * |
| 29 | * @return set of component names |
| 30 | */ |
| 31 | Set<String> getComponentNames(); |
| 32 | |
| 33 | /** |
| 34 | * Registers configuration properties for the specified component. |
| 35 | * |
| 36 | * @param componentClass class of configurable component |
| 37 | */ |
| 38 | void registerProperties(Class<?> componentClass); |
| 39 | |
| 40 | /** |
| 41 | * Unregisters configuration properties for the specified component. |
| 42 | * |
| 43 | * @param componentClass class of configurable component |
| 44 | * @param clear true indicates any settings should be cleared |
| 45 | */ |
| 46 | void unregisterProperties(Class<?> componentClass, boolean clear); |
| 47 | |
| 48 | /** |
| 49 | * Returns configuration properties of the named components. |
| 50 | * |
| 51 | * @param componentName component name |
| 52 | * @return set of configuration properties |
| 53 | */ |
| 54 | Set<ConfigProperty> getProperties(String componentName); |
| 55 | |
| 56 | /** |
| 57 | * Sets the value of the specified configuration property. |
| 58 | * |
| 59 | * @param componentName component name |
| 60 | * @param name property name |
| 61 | * @param value new property value |
| 62 | */ |
| 63 | void setProperty(String componentName, String name, String value); |
| 64 | |
| 65 | /** |
andrea | dd106a6 | 2015-10-02 13:39:48 -0700 | [diff] [blame] | 66 | * Presets the value of the specified configuration property, regardless |
| 67 | * of the component's state. |
| 68 | * |
| 69 | * @param componentName component name |
| 70 | * @param name property name |
| 71 | * @param value new property value |
| 72 | */ |
| 73 | void preSetProperty(String componentName, String name, String value); |
| 74 | |
| 75 | /** |
Thomas Vachuska | 6d697f1 | 2015-03-08 20:59:50 -0700 | [diff] [blame] | 76 | * Clears the value of the specified configuration property thus making |
| 77 | * the property take on its default value. |
| 78 | * |
| 79 | * @param componentName component name |
| 80 | * @param name property name |
| 81 | */ |
| 82 | void unsetProperty(String componentName, String name); |
| 83 | |
psneha | 459608e | 2018-08-02 01:16:46 -0400 | [diff] [blame] | 84 | /** |
| 85 | * Returns configuration property of the named components. |
| 86 | * |
| 87 | * @param componentName component name |
| 88 | * @param attribute component attribute |
| 89 | * @return configuration property |
| 90 | */ |
| 91 | ConfigProperty getProperty(String componentName, String attribute); |
| 92 | |
Thomas Vachuska | 6d697f1 | 2015-03-08 20:59:50 -0700 | [diff] [blame] | 93 | } |
andrea | dd106a6 | 2015-10-02 13:39:48 -0700 | [diff] [blame] | 94 | |