Jian Li | 4545cf1 | 2016-02-10 11:06:06 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Jian Li | 4545cf1 | 2016-02-10 11:06:06 -0800 | [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.cpman.impl.message; |
| 17 | |
Jian Li | 4545cf1 | 2016-02-10 11:06:06 -0800 | [diff] [blame] | 18 | import org.onosproject.cpman.ControlMessage; |
| 19 | import org.onosproject.cpman.message.ControlMessageEvent; |
| 20 | import org.onosproject.cpman.message.ControlMessageStore; |
| 21 | import org.onosproject.cpman.message.ControlMessageStoreDelegate; |
| 22 | import org.onosproject.net.DeviceId; |
| 23 | import org.onosproject.net.provider.ProviderId; |
| 24 | import org.onosproject.store.AbstractStore; |
Ray Milkey | d84f89b | 2018-08-17 14:54:17 -0700 | [diff] [blame^] | 25 | import org.osgi.service.component.annotations.Activate; |
| 26 | import org.osgi.service.component.annotations.Component; |
| 27 | import org.osgi.service.component.annotations.Deactivate; |
Jian Li | 4545cf1 | 2016-02-10 11:06:06 -0800 | [diff] [blame] | 28 | import org.slf4j.Logger; |
| 29 | |
Jian Li | 72b9b12 | 2016-02-11 15:58:51 -0800 | [diff] [blame] | 30 | import java.util.Set; |
Jian Li | 4545cf1 | 2016-02-10 11:06:06 -0800 | [diff] [blame] | 31 | |
| 32 | import static org.slf4j.LoggerFactory.getLogger; |
| 33 | |
| 34 | /** |
| 35 | * Manages inventory of control message using trivial in-memory structures |
| 36 | * implementation. |
| 37 | */ |
Ray Milkey | d84f89b | 2018-08-17 14:54:17 -0700 | [diff] [blame^] | 38 | @Component(immediate = true, service = ControlMessageStore.class) |
Jian Li | 4545cf1 | 2016-02-10 11:06:06 -0800 | [diff] [blame] | 39 | public 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 Li | 72b9b12 | 2016-02-11 15:58:51 -0800 | [diff] [blame] | 47 | Set<ControlMessage> controlMessages) { |
Jian Li | 4545cf1 | 2016-02-10 11:06:06 -0800 | [diff] [blame] | 48 | |
| 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 | } |