blob: 2c6e103fb8fbd96a99e32c886d4f7da23f4840d8 [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
Thomas Vachuska6d697f12015-03-08 20:59:50 -070018import org.onosproject.cfg.ComponentConfigEvent;
19import org.onosproject.cfg.ComponentConfigStore;
20import org.onosproject.cfg.ComponentConfigStoreDelegate;
21import org.onosproject.store.AbstractStore;
Ray Milkeyd84f89b2018-08-17 14:54:17 -070022import org.osgi.service.component.annotations.Activate;
23import org.osgi.service.component.annotations.Component;
24import org.osgi.service.component.annotations.Deactivate;
Thomas Vachuska6d697f12015-03-08 20:59:50 -070025import org.slf4j.Logger;
26
27import static org.onosproject.cfg.ComponentConfigEvent.Type.PROPERTY_SET;
28import static org.onosproject.cfg.ComponentConfigEvent.Type.PROPERTY_UNSET;
29import static org.slf4j.LoggerFactory.getLogger;
30
31/**
32 * Manages inventory of component configuration properties.
33 */
Ray Milkeyd84f89b2018-08-17 14:54:17 -070034@Component(immediate = true, service = ComponentConfigStore.class)
Thomas Vachuska6d697f12015-03-08 20:59:50 -070035public class SimpleComponentConfigStore
36 extends AbstractStore<ComponentConfigEvent, ComponentConfigStoreDelegate>
37 implements ComponentConfigStore {
38
39 private final Logger log = getLogger(getClass());
40
41 @Activate
42 public void activate() {
43 log.info("Started");
44 }
45
46 @Deactivate
47 public void deactivate() {
48 log.info("Stopped");
49 }
50
51 @Override
52 public void setProperty(String componentName, String name, String value) {
53 delegate.notify(new ComponentConfigEvent(PROPERTY_SET, componentName, name, value));
54 }
55
56 @Override
57 public void unsetProperty(String componentName, String name) {
58 delegate.notify(new ComponentConfigEvent(PROPERTY_UNSET, componentName, name, null));
59 }
60}