d0909b58e94e084ac78fc6d37cfdb2d3f2ab1027
[policy/common.git] /
1 /*
2  * ============LICENSE_START=======================================================
3  * policy-endpoints
4  * ================================================================================
5  * Copyright (C) 2017-2018 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.policy.common.endpoints.http.server;
22
23 import java.util.List;
24 import java.util.Properties;
25
26 /**
27  * Factory of HTTP Servlet-Enabled Servlets
28  */
29 public interface HttpServletServerFactory {
30
31     /**
32      * builds an http server with support for servlets
33      * 
34      * @param name name
35      * @param host binding host
36      * @param port port
37      * @param contextPath server base path
38      * @param swagger enable swagger documentation
39      * @param managed is it managed by infrastructure
40      * @return http server
41      * @throws IllegalArgumentException when invalid parameters are provided
42      */
43     public HttpServletServer build(String name, String host, int port, String contextPath, boolean swagger,
44             boolean managed);
45
46     /**
47      * list of http servers per properties
48      * 
49      * @param properties properties based configuration
50      * @return list of http servers
51      * @throws IllegalArgumentException when invalid parameters are provided
52      */
53     public List<HttpServletServer> build(Properties properties);
54
55     /**
56      * gets a server based on the port
57      * 
58      * @param port port
59      * @return http server
60      */
61     public HttpServletServer get(int port);
62
63     /**
64      * provides an inventory of servers
65      * 
66      * @return inventory of servers
67      */
68     public List<HttpServletServer> inventory();
69
70     /**
71      * destroys server bound to a port
72      * 
73      * @param port
74      */
75     public void destroy(int port);
76
77     /**
78      * destroys the factory and therefore all servers
79      */
80     public void destroy();
81 }