blob: 22705d508165f6c5cc4cc6a606e5037a2e6824e1 [file] [log] [blame]
Sanjana Agarwaleb9f0c52016-06-07 11:10:34 -07001/**
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 */
15package org.onosproject.kafkaintegration.impl;
16
17import org.apache.felix.scr.annotations.Activate;
18import org.apache.felix.scr.annotations.Component;
19import org.apache.felix.scr.annotations.Deactivate;
20import org.apache.felix.scr.annotations.Reference;
21import org.apache.felix.scr.annotations.ReferenceCardinality;
22import org.onosproject.codec.CodecService;
23import org.onosproject.kafkaintegration.api.dto.EventSubscriber;
Sanjana Agarwaleb9f0c52016-06-07 11:10:34 -070024import org.slf4j.Logger;
25import org.slf4j.LoggerFactory;
26
27/**
28 * Implementation of the JSON codec brokering service for Kafka app.
29 */
30@Component(immediate = true)
31public 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}