Replaced all tabs with spaces in java and pom.xml
[so.git] / adapters / mso-requests-db-adapter / src / main / java / org / onap / so / adapters / requestsdb / application / CXFConfiguration.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.so.adapters.requestsdb.application;
22
23 import javax.xml.ws.Endpoint;
24 import org.apache.cxf.Bus;
25 import org.apache.cxf.feature.LoggingFeature;
26 import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
27 import org.apache.cxf.jaxws.EndpointImpl;
28 import org.apache.cxf.transport.servlet.CXFServlet;
29 import org.onap.so.adapters.requestsdb.MsoRequestsDbAdapter;
30 import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor;
31 import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor;
32 import org.springframework.beans.factory.annotation.Autowired;
33 import org.springframework.boot.web.servlet.ServletRegistrationBean;
34 import org.springframework.context.annotation.Bean;
35 import org.springframework.context.annotation.Configuration;
36
37
38 @Configuration
39 public class CXFConfiguration {
40
41     @Autowired
42     private Bus bus;
43
44     @Autowired
45     private MsoRequestsDbAdapter requestDbAdapterImpl;
46
47     @Bean
48     public ServletRegistrationBean cxfServlet() {
49
50         return new ServletRegistrationBean(new CXFServlet(), "/services/*");
51     }
52
53     @Bean
54     public Endpoint requestEndpointk() {
55         EndpointImpl endpoint = new EndpointImpl(bus, requestDbAdapterImpl);
56         endpoint.publish("/RequestsDbAdapter");
57         LoggingFeature logFeature = new LoggingFeature();
58         logFeature.setPrettyLogging(true);
59         logFeature.initialize(bus);
60         endpoint.getFeatures().add(logFeature);
61         endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor());
62         endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor());
63         endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
64         return endpoint;
65     }
66
67     @Bean
68     public Swagger2Feature createSwaggerFeature() {
69         Swagger2Feature swagger2Feature = new Swagger2Feature();
70         swagger2Feature.setPrettyPrint(true);
71         swagger2Feature.setTitle("SO Request Adapter");
72         swagger2Feature.setContact("The ONAP SO team");
73         swagger2Feature.setDescription("This project is the SO Orchestration Engine");
74         swagger2Feature.setVersion("1.0.0");
75         swagger2Feature.setResourcePackage("org.onap.so.adapters.requestdb");
76         swagger2Feature.setScan(true);
77         return swagger2Feature;
78     }
79
80 }