blob: 2e78a4e7afb47b3c4c9b0410e0fcddccdddce3f6 [file] [log] [blame]
Jian Li80c12702016-02-20 08:58:19 +09001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Jian Li80c12702016-02-20 08:58:19 +09003 *
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.cpman.rest;
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.cpman.ControlLoad;
25import org.onosproject.cpman.codec.ControlLoadCodec;
26import org.slf4j.Logger;
27
28import static org.slf4j.LoggerFactory.getLogger;
29
30/**
31 * Implementation of the JSON codec brokering service for CPMan app.
32 */
33@Component(immediate = true)
34public class CPManCodecRegistrator {
35
36 private final Logger log = getLogger(getClass());
37
38 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
39 protected CodecService codecService;
40
41 @Activate
42 public void activate() {
43 codecService.registerCodec(ControlLoad.class, new ControlLoadCodec());
44
45 log.info("Started");
46 }
47
48 @Deactivate
49 public void deactivate() {
50 log.info("Stopped");
51 }
52}