Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 1 | /* |
Yuta HIGUCHI | bcc2ce9 | 2018-03-07 16:42:11 -0800 | [diff] [blame] | 2 | * Copyright ${year}-present Open Networking Foundation |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 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. |
Yuta HIGUCHI | bcc2ce9 | 2018-03-07 16:42:11 -0800 | [diff] [blame] | 15 | * |
| 16 | * Auto-generated by OnosSwaggerMojo. |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 17 | */ |
| 18 | package ${api.package}; |
| 19 | |
Thomas Vachuska | f205a97 | 2018-11-01 15:25:38 -0700 | [diff] [blame] | 20 | import org.osgi.service.component.annotations.Activate; |
| 21 | import org.osgi.service.component.annotations.Component; |
| 22 | import org.osgi.service.component.annotations.Deactivate; |
| 23 | import org.osgi.service.component.annotations.Reference; |
| 24 | import org.osgi.service.component.annotations.ReferenceCardinality; |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 25 | import org.onosproject.rest.ApiDocProvider; |
Thomas Vachuska | f205a97 | 2018-11-01 15:25:38 -0700 | [diff] [blame] | 26 | import org.onosproject.rest.ApiDocService; |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 27 | |
| 28 | @Component(immediate = true) |
Thomas Vachuska | f205a97 | 2018-11-01 15:25:38 -0700 | [diff] [blame] | 29 | public class ApiDocRegistrator { |
| 30 | |
| 31 | protected final ApiDocProvider provider; |
| 32 | |
| 33 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
| 34 | protected ApiDocService service; |
| 35 | |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 36 | public ApiDocRegistrator() { |
Thomas Vachuska | f205a97 | 2018-11-01 15:25:38 -0700 | [diff] [blame] | 37 | provider = new ApiDocProvider("${web.context}", "${api.title}", |
| 38 | getClass().getClassLoader()); |
| 39 | } |
| 40 | |
| 41 | @Activate |
| 42 | protected void activate() { |
| 43 | service.register(provider); |
| 44 | } |
| 45 | |
| 46 | @Deactivate |
| 47 | protected void deactivate() { |
| 48 | service.unregister(provider); |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 49 | } |
| 50 | } |