Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.openstackvtap.web; |
| 17 | |
Ray Milkey | d542568 | 2018-10-23 10:21:33 -0700 | [diff] [blame] | 18 | |
| 19 | |
| 20 | import org.apache.karaf.shell.api.action.lifecycle.Service; |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 21 | import org.onosproject.codec.CodecService; |
| 22 | import org.onosproject.openstackvtap.api.OpenstackVtapNetwork; |
| 23 | import org.onosproject.openstackvtap.codec.OpenstackVtapNetworkCodec; |
Ray Milkey | d542568 | 2018-10-23 10:21:33 -0700 | [diff] [blame] | 24 | import org.osgi.service.component.annotations.Activate; |
| 25 | import org.osgi.service.component.annotations.Component; |
| 26 | import org.osgi.service.component.annotations.Deactivate; |
| 27 | import org.osgi.service.component.annotations.Reference; |
| 28 | import org.osgi.service.component.annotations.ReferenceCardinality; |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 29 | |
| 30 | import static org.slf4j.LoggerFactory.getLogger; |
| 31 | |
| 32 | /** |
| 33 | * Implementation of the JSON codec brokering service for openstack vtap network. |
| 34 | */ |
Ray Milkey | d542568 | 2018-10-23 10:21:33 -0700 | [diff] [blame] | 35 | @Service |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 36 | @Component(immediate = true) |
| 37 | public class OpenstackVtapNetworkCodecRegister { |
| 38 | |
| 39 | private final org.slf4j.Logger log = getLogger(getClass()); |
| 40 | |
Ray Milkey | d542568 | 2018-10-23 10:21:33 -0700 | [diff] [blame] | 41 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 42 | 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 | } |