blob: a3183207571d204a72fe83a2090ff5a5c2b3e8ac [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
Ray Milkeyd5425682018-10-23 10:21:33 -070018
19
20import org.apache.karaf.shell.api.action.lifecycle.Service;
Jimo Jung14e87bf2018-09-03 16:28:13 +090021import org.onosproject.codec.CodecService;
Jian Lib45ffda2019-10-23 14:05:32 +090022import org.onosproject.openstackvtap.api.OpenstackVtapCriterion;
Jimo Jung14e87bf2018-09-03 16:28:13 +090023import org.onosproject.openstackvtap.api.OpenstackVtapNetwork;
Jian Lib45ffda2019-10-23 14:05:32 +090024import org.onosproject.openstackvtap.codec.OpenstackVtapCriterionCodec;
Jimo Jung14e87bf2018-09-03 16:28:13 +090025import org.onosproject.openstackvtap.codec.OpenstackVtapNetworkCodec;
Ray Milkeyd5425682018-10-23 10:21:33 -070026import org.osgi.service.component.annotations.Activate;
27import org.osgi.service.component.annotations.Component;
28import org.osgi.service.component.annotations.Deactivate;
29import org.osgi.service.component.annotations.Reference;
30import org.osgi.service.component.annotations.ReferenceCardinality;
Jimo Jung14e87bf2018-09-03 16:28:13 +090031
32import static org.slf4j.LoggerFactory.getLogger;
33
34/**
35 * Implementation of the JSON codec brokering service for openstack vtap network.
36 */
Ray Milkeyd5425682018-10-23 10:21:33 -070037@Service
Jimo Jung14e87bf2018-09-03 16:28:13 +090038@Component(immediate = true)
39public class OpenstackVtapNetworkCodecRegister {
40
41 private final org.slf4j.Logger log = getLogger(getClass());
42
Ray Milkeyd5425682018-10-23 10:21:33 -070043 @Reference(cardinality = ReferenceCardinality.MANDATORY)
Jimo Jung14e87bf2018-09-03 16:28:13 +090044 protected CodecService codecService;
45
46 @Activate
47 protected void activate() {
48 codecService.registerCodec(OpenstackVtapNetwork.class, new OpenstackVtapNetworkCodec());
Jian Lib45ffda2019-10-23 14:05:32 +090049 codecService.registerCodec(OpenstackVtapCriterion.class, new OpenstackVtapCriterionCodec());
Jimo Jung14e87bf2018-09-03 16:28:13 +090050
51 log.info("Started");
52 }
53
54 @Deactivate
55 protected void deactivate() {
56 codecService.unregisterCodec(OpenstackVtapNetwork.class);
Jian Lib45ffda2019-10-23 14:05:32 +090057 codecService.unregisterCodec(OpenstackVtapCriterion.class);
Jimo Jung14e87bf2018-09-03 16:28:13 +090058
59 log.info("Stopped");
60 }
61}