blob: 4d1b31f2b77d4c42554a7fbde03c082993a67427 [file] [log] [blame]
Jian Li4545cf12016-02-10 11:06:06 -08001/*
2 * Copyright 2016 Open Networking Laboratory
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 */
16package org.onosproject.cpman.impl.message;
17
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.cpman.ControlMessage;
23import org.onosproject.cpman.message.ControlMessageEvent;
24import org.onosproject.cpman.message.ControlMessageStore;
25import org.onosproject.cpman.message.ControlMessageStoreDelegate;
26import org.onosproject.net.DeviceId;
27import org.onosproject.net.provider.ProviderId;
28import org.onosproject.store.AbstractStore;
29import org.slf4j.Logger;
30
Jian Li72b9b122016-02-11 15:58:51 -080031import java.util.Set;
Jian Li4545cf12016-02-10 11:06:06 -080032
33import static org.slf4j.LoggerFactory.getLogger;
34
35/**
36 * Manages inventory of control message using trivial in-memory structures
37 * implementation.
38 */
39@Component(immediate = true)
40@Service
41public class DefaultControlMessageStore
42 extends AbstractStore<ControlMessageEvent, ControlMessageStoreDelegate>
43 implements ControlMessageStore {
44
45 private final Logger log = getLogger(getClass());
46
47 @Override
48 public ControlMessageEvent updateStatsInfo(ProviderId providerId, DeviceId deviceId,
Jian Li72b9b122016-02-11 15:58:51 -080049 Set<ControlMessage> controlMessages) {
Jian Li4545cf12016-02-10 11:06:06 -080050
51 return new ControlMessageEvent(ControlMessageEvent.Type.STATS_UPDATE, controlMessages);
52 }
53
54 @Activate
55 public void activate() {
56 log.info("Started");
57 }
58
59 @Deactivate
60 public void deactivate() {
61 log.info("Stopped");
62 }
63}