blob: b2121297eae91fafe41f675697a9d89c496ea803 [file] [log] [blame]
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001/*
Yuta HIGUCHIbcc2ce92018-03-07 16:42:11 -08002 * Copyright ${year}-present Open Networking Foundation
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003 *
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 HIGUCHIbcc2ce92018-03-07 16:42:11 -080015 *
16 * Auto-generated by OnosSwaggerMojo.
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017 */
18package ${api.package};
19
Thomas Vachuskaf205a972018-11-01 15:25:38 -070020import org.osgi.service.component.annotations.Activate;
21import org.osgi.service.component.annotations.Component;
22import org.osgi.service.component.annotations.Deactivate;
23import org.osgi.service.component.annotations.Reference;
24import org.osgi.service.component.annotations.ReferenceCardinality;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025import org.onosproject.rest.ApiDocProvider;
Thomas Vachuskaf205a972018-11-01 15:25:38 -070026import org.onosproject.rest.ApiDocService;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070027
28@Component(immediate = true)
Thomas Vachuskaf205a972018-11-01 15:25:38 -070029public class ApiDocRegistrator {
30
31 protected final ApiDocProvider provider;
32
33 @Reference(cardinality = ReferenceCardinality.MANDATORY)
34 protected ApiDocService service;
35
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070036 public ApiDocRegistrator() {
Thomas Vachuskaf205a972018-11-01 15:25:38 -070037 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 Vachuska0fa2aa12015-08-18 12:53:04 -070049 }
50}