Sanjana Agarwal | eb9f0c5 | 2016-06-07 11:10:34 -0700 | [diff] [blame] | 1 | /** |
| 2 | * Copyright 2016-present Open Networking Laboratory |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at |
| 6 | |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | package org.onosproject.kafkaintegration.impl; |
| 16 | |
| 17 | import org.apache.felix.scr.annotations.Activate; |
| 18 | import org.apache.felix.scr.annotations.Component; |
| 19 | import org.apache.felix.scr.annotations.Deactivate; |
| 20 | import org.apache.felix.scr.annotations.Reference; |
| 21 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 22 | import org.onosproject.codec.CodecService; |
| 23 | import org.onosproject.kafkaintegration.api.dto.EventSubscriber; |
Sanjana Agarwal | eb9f0c5 | 2016-06-07 11:10:34 -0700 | [diff] [blame] | 24 | import org.slf4j.Logger; |
| 25 | import org.slf4j.LoggerFactory; |
| 26 | |
| 27 | /** |
| 28 | * Implementation of the JSON codec brokering service for Kafka app. |
| 29 | */ |
| 30 | @Component(immediate = true) |
| 31 | public class KafkaCodecRegistrator { |
| 32 | private static Logger log = LoggerFactory.getLogger(KafkaCodecRegistrator |
| 33 | .class); |
| 34 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 35 | protected CodecService codecService; |
| 36 | |
| 37 | @Activate |
| 38 | public void activate() { |
| 39 | codecService.registerCodec(EventSubscriber.class, new SubscriberCodec()); |
| 40 | log.info("Started"); |
| 41 | } |
| 42 | |
| 43 | @Deactivate |
| 44 | public void deactivate() { |
| 45 | log.info("Stopped"); |
| 46 | } |
| 47 | } |