removing unused db file
[policy/engine.git] / PyPDPServer / src / main / java / org / openecomp / policy / pypdp / controller / Application.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ECOMP Policy Engine
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.openecomp.policy.pypdp.controller;
22
23 import javax.servlet.Filter;
24
25 import org.openecomp.policy.pypdp.authorization.AuthenticationFilter;
26 import org.springframework.boot.SpringApplication;
27 import org.springframework.boot.autoconfigure.SpringBootApplication;
28 import org.springframework.boot.builder.SpringApplicationBuilder;
29 import org.springframework.boot.context.web.SpringBootServletInitializer;
30 import org.springframework.context.annotation.Bean;
31 import org.springframework.context.annotation.ComponentScan;
32
33 import springfox.documentation.builders.ApiInfoBuilder;
34 import springfox.documentation.builders.RequestHandlerSelectors;
35 import springfox.documentation.service.ApiInfo;
36 import springfox.documentation.service.Contact;
37 import springfox.documentation.spi.DocumentationType;
38 import springfox.documentation.spring.web.plugins.Docket;
39 import springfox.documentation.swagger2.annotations.EnableSwagger2;
40
41 @SpringBootApplication
42 @EnableSwagger2
43 @ComponentScan(basePackageClasses = {PolicyEngineServices.class})
44 public class Application extends SpringBootServletInitializer {
45
46         public static void main(String[] args) {
47                 SpringApplication.run(Application.class, args);
48         }
49         
50         @Override
51         protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
52                 return application.sources(applicationClass);
53         }
54         
55         private static Class<Application> applicationClass = Application.class;
56         
57         @Bean
58         public Filter authenticationFilter(){
59                 return new AuthenticationFilter();
60         }
61         
62         private ApiInfo apiInfo(){
63                 return new ApiInfoBuilder()
64                                 .title("Policy Engine REST API")
65                                 .description("This API helps applications across Domain 2.0 Platform to make queries against Policy Engine")
66                                 .version("2.0")
67                                 .build();
68         }
69         
70         @Bean
71         public Docket policyAPI(){
72                 return new Docket(DocumentationType.SWAGGER_2)
73                                 .apiInfo(apiInfo())
74                                 .select()
75                                 .apis(RequestHandlerSelectors.basePackage("org.openecomp.policy.pypdp.controller"))
76                                 .build()
77                                 .pathMapping("/")
78                                 ;
79         }
80 }