blob: 4ab9a0da6737d4755cf6f9ba4ca54b4710295bd3 [file] [log] [blame]
Ray Milkey2d572dd2017-04-14 10:01:24 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Ray Milkey2d572dd2017-04-14 10:01:24 -07003 *
Sanjana Agarwaleb9f0c52016-06-07 11:10:34 -07004 * 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 Milkey2d572dd2017-04-14 10:01:24 -07007 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
Sanjana Agarwaleb9f0c52016-06-07 11:10:34 -070010 * 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 */
16package org.onosproject.kafkaintegration.impl;
17
Ray Milkeyd84f89b2018-08-17 14:54:17 -070018import org.osgi.service.component.annotations.Activate;
19import org.osgi.service.component.annotations.Component;
20import org.osgi.service.component.annotations.Deactivate;
21import org.osgi.service.component.annotations.Reference;
22import org.osgi.service.component.annotations.ReferenceCardinality;
Sanjana Agarwaleb9f0c52016-06-07 11:10:34 -070023import org.onosproject.codec.CodecService;
24import org.onosproject.kafkaintegration.api.dto.EventSubscriber;
Sanjana Agarwaleb9f0c52016-06-07 11:10:34 -070025import org.slf4j.Logger;
26import org.slf4j.LoggerFactory;
27
28/**
29 * Implementation of the JSON codec brokering service for Kafka app.
30 */
31@Component(immediate = true)
32public class KafkaCodecRegistrator {
33 private static Logger log = LoggerFactory.getLogger(KafkaCodecRegistrator
34 .class);
Ray Milkeyd84f89b2018-08-17 14:54:17 -070035 @Reference(cardinality = ReferenceCardinality.MANDATORY)
Sanjana Agarwaleb9f0c52016-06-07 11:10:34 -070036 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}