blob: 509a2869c44c6de1e8e90c45a2686c337b0653a5 [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;
22import org.onosproject.openstackvtap.api.OpenstackVtapNetwork;
23import org.onosproject.openstackvtap.codec.OpenstackVtapNetworkCodec;
Ray Milkeyd5425682018-10-23 10:21:33 -070024import org.osgi.service.component.annotations.Activate;
25import org.osgi.service.component.annotations.Component;
26import org.osgi.service.component.annotations.Deactivate;
27import org.osgi.service.component.annotations.Reference;
28import org.osgi.service.component.annotations.ReferenceCardinality;
Jimo Jung14e87bf2018-09-03 16:28:13 +090029
30import static org.slf4j.LoggerFactory.getLogger;
31
32/**
33 * Implementation of the JSON codec brokering service for openstack vtap network.
34 */
Ray Milkeyd5425682018-10-23 10:21:33 -070035@Service
Jimo Jung14e87bf2018-09-03 16:28:13 +090036@Component(immediate = true)
37public class OpenstackVtapNetworkCodecRegister {
38
39 private final org.slf4j.Logger log = getLogger(getClass());
40
Ray Milkeyd5425682018-10-23 10:21:33 -070041 @Reference(cardinality = ReferenceCardinality.MANDATORY)
Jimo Jung14e87bf2018-09-03 16:28:13 +090042 protected CodecService codecService;
43
44 @Activate
45 protected void activate() {
46 codecService.registerCodec(OpenstackVtapNetwork.class, new OpenstackVtapNetworkCodec());
47
48 log.info("Started");
49 }
50
51 @Deactivate
52 protected void deactivate() {
53 codecService.unregisterCodec(OpenstackVtapNetwork.class);
54
55 log.info("Stopped");
56 }
57}