blob: 7ac689a85c0865f1daeba8bb882c131ddf1a110c [file] [log] [blame]
Jimo Jung14e87bf2018-09-03 16:28:13 +09001/*
2 * Copyright 2018-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.openstackvtap.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.openstackvtap.api.OpenstackVtapNetwork;
25import org.onosproject.openstackvtap.codec.OpenstackVtapNetworkCodec;
26
27import static org.slf4j.LoggerFactory.getLogger;
28
29/**
30 * Implementation of the JSON codec brokering service for openstack vtap network.
31 */
32@Component(immediate = true)
33public class OpenstackVtapNetworkCodecRegister {
34
35 private final org.slf4j.Logger log = getLogger(getClass());
36
37 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
38 protected CodecService codecService;
39
40 @Activate
41 protected void activate() {
42 codecService.registerCodec(OpenstackVtapNetwork.class, new OpenstackVtapNetworkCodec());
43
44 log.info("Started");
45 }
46
47 @Deactivate
48 protected void deactivate() {
49 codecService.unregisterCodec(OpenstackVtapNetwork.class);
50
51 log.info("Stopped");
52 }
53}