blob: eda361a2bc021f7178276f9b48ecf2113f928371 [file] [log] [blame]
Jian Li4545cf12016-02-10 11:06:06 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Jian Li4545cf12016-02-10 11:06:06 -08003 *
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 */
16package org.onosproject.cpman.impl.message;
17
Jian Li4545cf12016-02-10 11:06:06 -080018import org.onosproject.cpman.ControlMessage;
19import org.onosproject.cpman.message.ControlMessageEvent;
20import org.onosproject.cpman.message.ControlMessageStore;
21import org.onosproject.cpman.message.ControlMessageStoreDelegate;
22import org.onosproject.net.DeviceId;
23import org.onosproject.net.provider.ProviderId;
24import org.onosproject.store.AbstractStore;
Ray Milkeyd84f89b2018-08-17 14:54:17 -070025import org.osgi.service.component.annotations.Activate;
26import org.osgi.service.component.annotations.Component;
27import org.osgi.service.component.annotations.Deactivate;
Jian Li4545cf12016-02-10 11:06:06 -080028import org.slf4j.Logger;
29
Jian Li72b9b122016-02-11 15:58:51 -080030import java.util.Set;
Jian Li4545cf12016-02-10 11:06:06 -080031
32import static org.slf4j.LoggerFactory.getLogger;
33
34/**
35 * Manages inventory of control message using trivial in-memory structures
36 * implementation.
37 */
Ray Milkeyd84f89b2018-08-17 14:54:17 -070038@Component(immediate = true, service = ControlMessageStore.class)
Jian Li4545cf12016-02-10 11:06:06 -080039public class DefaultControlMessageStore
40 extends AbstractStore<ControlMessageEvent, ControlMessageStoreDelegate>
41 implements ControlMessageStore {
42
43 private final Logger log = getLogger(getClass());
44
45 @Override
46 public ControlMessageEvent updateStatsInfo(ProviderId providerId, DeviceId deviceId,
Jian Li72b9b122016-02-11 15:58:51 -080047 Set<ControlMessage> controlMessages) {
Jian Li4545cf12016-02-10 11:06:06 -080048
49 return new ControlMessageEvent(ControlMessageEvent.Type.STATS_UPDATE, controlMessages);
50 }
51
52 @Activate
53 public void activate() {
54 log.info("Started");
55 }
56
57 @Deactivate
58 public void deactivate() {
59 log.info("Stopped");
60 }
61}