kmcpeake | e462182 | 2015-12-08 14:24:36 +0000 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
kmcpeake | e462182 | 2015-12-08 14:24:36 +0000 | [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.faultmanagement.web; |
| 17 | |
Ray Milkey | d84f89b | 2018-08-17 14:54:17 -0700 | [diff] [blame] | 18 | import org.osgi.service.component.annotations.Activate; |
| 19 | import org.osgi.service.component.annotations.Component; |
| 20 | import org.osgi.service.component.annotations.Deactivate; |
| 21 | import org.osgi.service.component.annotations.Reference; |
| 22 | import org.osgi.service.component.annotations.ReferenceCardinality; |
kmcpeake | e462182 | 2015-12-08 14:24:36 +0000 | [diff] [blame] | 23 | import org.onosproject.codec.CodecService; |
| 24 | import org.onosproject.incubator.net.faultmanagement.alarm.Alarm; |
| 25 | |
| 26 | import org.slf4j.Logger; |
| 27 | import org.slf4j.LoggerFactory; |
| 28 | |
| 29 | /** |
| 30 | * Implementation of the JSON codec brokering service for FM app. |
| 31 | */ |
| 32 | @Component(immediate = true) |
| 33 | public class AlarmCodecRegistrator { |
| 34 | |
| 35 | private static final Logger log = LoggerFactory.getLogger(AlarmCodecRegistrator.class); |
| 36 | |
Ray Milkey | d84f89b | 2018-08-17 14:54:17 -0700 | [diff] [blame] | 37 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
kmcpeake | e462182 | 2015-12-08 14:24:36 +0000 | [diff] [blame] | 38 | protected CodecService codecService; |
| 39 | |
| 40 | @Activate |
| 41 | public void activate() { |
| 42 | codecService.registerCodec(Alarm.class, new AlarmCodec()); |
| 43 | log.info("Started"); |
| 44 | } |
| 45 | |
| 46 | @Deactivate |
| 47 | public void deactivate() { |
| 48 | log.info("Stopped"); |
| 49 | } |
| 50 | } |