blob: 9ba2659a26b0c4ba500e6f9725799f088cf5343e [file] [log] [blame]
Thomas Vachuska6d697f12015-03-08 20:59:50 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Thomas Vachuska6d697f12015-03-08 20:59:50 -07003 *
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 */
Thomas Vachuskac97aa612015-06-23 16:00:18 -070016package org.onosproject.store.trivial;
Thomas Vachuska6d697f12015-03-08 20:59:50 -070017
18import org.apache.felix.scr.annotations.Activate;
19import org.apache.felix.scr.annotations.Component;
20import org.apache.felix.scr.annotations.Deactivate;
21import org.apache.felix.scr.annotations.Service;
22import org.onosproject.cfg.ComponentConfigEvent;
23import org.onosproject.cfg.ComponentConfigStore;
24import org.onosproject.cfg.ComponentConfigStoreDelegate;
25import org.onosproject.store.AbstractStore;
26import org.slf4j.Logger;
27
28import static org.onosproject.cfg.ComponentConfigEvent.Type.PROPERTY_SET;
29import static org.onosproject.cfg.ComponentConfigEvent.Type.PROPERTY_UNSET;
30import static org.slf4j.LoggerFactory.getLogger;
31
32/**
33 * Manages inventory of component configuration properties.
34 */
35@Component(immediate = true)
36@Service
37public class SimpleComponentConfigStore
38 extends AbstractStore<ComponentConfigEvent, ComponentConfigStoreDelegate>
39 implements ComponentConfigStore {
40
41 private final Logger log = getLogger(getClass());
42
43 @Activate
44 public void activate() {
45 log.info("Started");
46 }
47
48 @Deactivate
49 public void deactivate() {
50 log.info("Stopped");
51 }
52
53 @Override
54 public void setProperty(String componentName, String name, String value) {
55 delegate.notify(new ComponentConfigEvent(PROPERTY_SET, componentName, name, value));
56 }
57
58 @Override
59 public void unsetProperty(String componentName, String name) {
60 delegate.notify(new ComponentConfigEvent(PROPERTY_UNSET, componentName, name, null));
61 }
62}