Ray Milkey | 2d572dd | 2017-04-14 10:01:24 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | ce2a03d | 2017-08-03 19:21:03 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Ray Milkey | 2d572dd | 2017-04-14 10:01:24 -0700 | [diff] [blame] | 3 | * |
Sanjana Agarwal | eb9f0c5 | 2016-06-07 11:10:34 -0700 | [diff] [blame] | 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 |
Ray Milkey | 2d572dd | 2017-04-14 10:01:24 -0700 | [diff] [blame] | 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
Sanjana Agarwal | eb9f0c5 | 2016-06-07 11:10:34 -0700 | [diff] [blame] | 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.kafkaintegration.impl; |
| 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.Reference; |
| 22 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 23 | import org.onosproject.codec.CodecService; |
| 24 | import org.onosproject.kafkaintegration.api.dto.EventSubscriber; |
Sanjana Agarwal | eb9f0c5 | 2016-06-07 11:10:34 -0700 | [diff] [blame] | 25 | import org.slf4j.Logger; |
| 26 | import org.slf4j.LoggerFactory; |
| 27 | |
| 28 | /** |
| 29 | * Implementation of the JSON codec brokering service for Kafka app. |
| 30 | */ |
| 31 | @Component(immediate = true) |
| 32 | public class KafkaCodecRegistrator { |
| 33 | private static Logger log = LoggerFactory.getLogger(KafkaCodecRegistrator |
| 34 | .class); |
| 35 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 36 | protected CodecService codecService; |
| 37 | |
| 38 | @Activate |
| 39 | public void activate() { |
| 40 | codecService.registerCodec(EventSubscriber.class, new SubscriberCodec()); |
| 41 | log.info("Started"); |
| 42 | } |
| 43 | |
| 44 | @Deactivate |
| 45 | public void deactivate() { |
| 46 | log.info("Stopped"); |
| 47 | } |
| 48 | } |