blob: ab0c99053e3f03a294d6b1977636e51e7bcb440a [file] [log] [blame]
Andrea Campanella644a8a62018-03-21 19:08:21 -07001/*
2 * Copyright 2017-present Open Networking Foundation
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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 */
16package org.onosproject.mcast.web;
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;
Andrea Campanella644a8a62018-03-21 19:08:21 -070023import org.onosproject.codec.CodecService;
24import org.onosproject.mcast.api.McastRoute;
25import org.slf4j.Logger;
26import org.slf4j.LoggerFactory;
27
28
29/**
30 * Implementation of the JSON codec brokering service for route service app.
31 */
32@Component(immediate = true)
33public class McastServiceCodecRegistrator {
34
35 private static Logger log = LoggerFactory.getLogger(McastServiceCodecRegistrator.class);
36
Ray Milkeyd84f89b2018-08-17 14:54:17 -070037 @Reference(cardinality = ReferenceCardinality.MANDATORY)
Andrea Campanella644a8a62018-03-21 19:08:21 -070038 protected CodecService codecService;
39
40 @Activate
41 public void activate() {
42 codecService.registerCodec(McastRoute.class, new McastHostRouteCodec());
43 log.info("Started");
44 }
45
46 @Deactivate
47 public void deactivate() {
48 codecService.unregisterCodec(McastRoute.class);
49 log.info("Stopped");
50 }
51}