0c30e3e5beb2de82e0e924096d53591dda8de0e7
[policy/common.git] /
1 /*
2  * ============LICENSE_START=======================================================
3  * policy-endpoints
4  * ================================================================================
5  * Copyright (C) 2017-2019 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 or https server with support for servlets.
33      * 
34      * @param name name
35      * @param https use secured http over tls connection
36      * @param host binding host
37      * @param port port
38      * @param contextPath server base path
39      * @param swagger enable swagger documentation
40      * @param managed is it managed by infrastructure
41      * @return http server
42      * @throws IllegalArgumentException when invalid parameters are provided
43      */
44     HttpServletServer build(String name, boolean https, String host, int port, String contextPath, boolean swagger,
45         boolean managed);
46
47     /**
48      * Builds an http server with support for servlets.
49      *
50      * @param name name
51      * @param host binding host
52      * @param port port
53      * @param contextPath server base path
54      * @param swagger enable swagger documentation
55      * @param managed is it managed by infrastructure
56      * @return http server
57      * @throws IllegalArgumentException when invalid parameters are provided
58      */
59     HttpServletServer build(String name, String host, int port, String contextPath, boolean swagger, boolean managed);
60
61     /**
62      * Build a list of http servers per properties.
63      * 
64      * @param properties properties based configuration
65      * @return list of http servers
66      * @throws IllegalArgumentException when invalid parameters are provided
67      */
68     List<HttpServletServer> build(Properties properties);
69
70     /**
71      * Gets a server based on the port.
72      * 
73      * @param port port
74      * @return http server
75      */
76     HttpServletServer get(int port);
77
78     /**
79      * Provides an inventory of servers.
80      * 
81      * @return inventory of servers
82      */
83     List<HttpServletServer> inventory();
84
85     /**
86      * Destroys server bound to a port.
87      * 
88      * @param port the port the server is bound to
89      */
90     void destroy(int port);
91
92     /**
93      * Destroys the factory and therefore all servers.
94      */
95     void destroy();
96 }