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 org.onosproject.event.AbstractEvent; |
| 19 | |
| 20 | /** |
| 21 | * Describes a component configuration event. |
| 22 | */ |
| 23 | public class ComponentConfigEvent extends AbstractEvent<ComponentConfigEvent.Type, String> { |
| 24 | |
| 25 | private final String name; |
| 26 | private final String value; |
| 27 | |
| 28 | public enum Type { |
| 29 | /** |
| 30 | * Signifies that a configuration property has set. |
| 31 | */ |
| 32 | PROPERTY_SET, |
| 33 | |
| 34 | /** |
| 35 | * Signifies that a configuration property has been unset. |
| 36 | */ |
| 37 | PROPERTY_UNSET |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Creates an event of a given type and for the specified app and the |
| 42 | * current time. |
| 43 | * |
| 44 | * @param type config property event type |
| 45 | * @param componentName component name event subject |
| 46 | * @param name config property name |
| 47 | * @param value config property value |
| 48 | */ |
| 49 | public ComponentConfigEvent(Type type, String componentName, |
| 50 | String name, String value) { |
| 51 | super(type, componentName); |
| 52 | this.name = name; |
| 53 | this.value = value; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Returns the property name. |
| 58 | * |
| 59 | * @return property name |
| 60 | */ |
| 61 | public String name() { |
| 62 | return name; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Returns the property value as a string. |
| 67 | * |
| 68 | * @return string value |
| 69 | */ |
| 70 | public String value() { |
| 71 | return value; |
| 72 | } |
| 73 | |
| 74 | } |