blob: 8402ad0c7e859f2d0f1abc173b65298580b9a95b [file] [log] [blame]
Ray Milkey2d572dd2017-04-14 10:01:24 -07001/*
Sanjana Agarwaleb9f0c52016-06-07 11:10:34 -07002 * Copyright 2016-present Open Networking Laboratory
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
18import org.apache.felix.scr.annotations.Activate;
19import org.apache.felix.scr.annotations.Component;
20import org.apache.felix.scr.annotations.Deactivate;
21import org.apache.felix.scr.annotations.Reference;
22import org.apache.felix.scr.annotations.ReferenceCardinality;
23import 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);
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}