2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.adapters.requestsdb.application;
23 import javax.xml.ws.Endpoint;
25 import org.apache.cxf.Bus;
26 import org.apache.cxf.feature.LoggingFeature;
27 import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
28 import org.apache.cxf.jaxws.EndpointImpl;
29 import org.apache.cxf.transport.servlet.CXFServlet;
30 import org.onap.so.adapters.requestsdb.MsoRequestsDbAdapter;
31 import org.springframework.beans.factory.annotation.Autowired;
32 import org.springframework.boot.web.servlet.ServletRegistrationBean;
33 import org.springframework.context.annotation.Bean;
34 import org.springframework.context.annotation.Configuration;
38 public class CXFConfiguration {
44 private MsoRequestsDbAdapter requestDbAdapterImpl;
49 public ServletRegistrationBean cxfServlet() {
51 return new ServletRegistrationBean(new CXFServlet(), "/services/*");
55 public Endpoint requestEndpointk() {
56 EndpointImpl endpoint = new EndpointImpl(bus, requestDbAdapterImpl);
57 endpoint.publish("/RequestsDbAdapter");
58 LoggingFeature logFeature = new LoggingFeature();
59 logFeature.setPrettyLogging(true);
60 logFeature.initialize(bus);
61 endpoint.getFeatures().add(logFeature);
66 public Swagger2Feature createSwaggerFeature() {
67 Swagger2Feature swagger2Feature = new Swagger2Feature();
68 swagger2Feature.setPrettyPrint(true);
69 swagger2Feature.setTitle("SO Request Adapter");
70 swagger2Feature.setContact("The ONAP SO team");
71 swagger2Feature.setDescription("This project is the SO Orchestration Engine");
72 swagger2Feature.setVersion("1.0.0");
73 swagger2Feature.setResourcePackage("org.onap.so.adapters.requestdb");
74 swagger2Feature.setScan(true);
75 return swagger2Feature;