blob: 55077f3d53cd5c8f09ba7093dec5a40a7c7e35df [file] [log] [blame]
Jian Li2c63bd22018-07-15 23:35:34 +09001/*
2 * Copyright 2016-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.openstacknetworking.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.openstacknetworking.api.InstancePort;
25import org.onosproject.openstacknetworking.codec.InstancePortCodec;
26import org.slf4j.Logger;
27
28import static org.slf4j.LoggerFactory.getLogger;
29
30/**
31 * Implementation of the JSON codec brokering service for OpenstackNetworking.
32 */
33@Component(immediate = true)
34public class OpenstackNetworkingCodecRegister {
35
36 private final Logger log = getLogger(getClass());
37
38 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
39 protected CodecService codecService;
40
41 @Activate
42 protected void activate() {
43
44 codecService.registerCodec(InstancePort.class, new InstancePortCodec());
45
46 log.info("Started");
47
48 }
49
50 @Deactivate
51 protected void deactivate() {
52
53 codecService.unregisterCodec(InstancePort.class);
54
55 log.info("Stopped");
56 }
57}