Jian Li | 4545cf1 | 2016-02-10 11:06:06 -0800 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.cpman.impl.message; |
| 17 | |
| 18 | import org.apache.felix.scr.annotations.Activate; |
| 19 | import org.apache.felix.scr.annotations.Component; |
| 20 | import org.apache.felix.scr.annotations.Deactivate; |
| 21 | import org.apache.felix.scr.annotations.Service; |
| 22 | import org.onosproject.cpman.ControlMessage; |
| 23 | import org.onosproject.cpman.message.ControlMessageEvent; |
| 24 | import org.onosproject.cpman.message.ControlMessageStore; |
| 25 | import org.onosproject.cpman.message.ControlMessageStoreDelegate; |
| 26 | import org.onosproject.net.DeviceId; |
| 27 | import org.onosproject.net.provider.ProviderId; |
| 28 | import org.onosproject.store.AbstractStore; |
| 29 | import org.slf4j.Logger; |
| 30 | |
| 31 | import java.util.Collection; |
| 32 | |
| 33 | import 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 |
| 41 | public 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, |
| 49 | Collection<ControlMessage> controlMessages) { |
| 50 | |
| 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 | } |