blob: 3330c253aa4ac9ce531fcb1001cb425a85a71779 [file] [log] [blame]
Phaneendra Manda119469d2015-12-03 15:42:37 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Phaneendra Manda119469d2015-12-03 15:42:37 +05303 *
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.vtnweb.web;
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.vtnrsc.FlowClassifier;
25import org.onosproject.vtnrsc.PortChain;
26import org.onosproject.vtnrsc.PortPair;
27import org.onosproject.vtnrsc.PortPairGroup;
28import org.slf4j.Logger;
29import org.slf4j.LoggerFactory;
30
31/**
32 * Implementation of the JSON codec brokering service for VTN app.
33 */
34@Component(immediate = true)
35public class VtnCodecRegistrator {
36
37 private static Logger log = LoggerFactory.getLogger(VtnCodecRegistrator.class);
38
39 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
40 protected CodecService codecService;
41
42 @Activate
43 public void activate() {
44 codecService.registerCodec(PortPair.class, new PortPairCodec());
45 codecService.registerCodec(PortPairGroup.class, new PortPairGroupCodec());
46 codecService.registerCodec(FlowClassifier.class, new FlowClassifierCodec());
47 codecService.registerCodec(PortChain.class, new PortChainCodec());
48
49 log.info("Started");
50 }
51
52 @Deactivate
53 public void deactivate() {
54 log.info("Stopped");
55 }
56}