2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2020 Nordix Foundation.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.common.endpoints.http.server;
24 import java.util.List;
25 import java.util.Properties;
28 * Factory of HTTP Servlet-Enabled Servlets.
30 public interface HttpServletServerFactory {
33 * Builds an http or https rest server with support for servlets.
36 * @param https use secured http over tls connection
37 * @param host binding host
39 * @param contextPath server base path
40 * @param swagger enable swagger documentation
41 * @param managed is it managed by infrastructure
43 * @throws IllegalArgumentException when invalid parameters are provided
45 HttpServletServer build(String name, boolean https, String host, int port, String contextPath, boolean swagger,
49 * Builds an http rest server with support for servlets.
52 * @param host binding host
54 * @param contextPath server base path
55 * @param swagger enable swagger documentation
56 * @param managed is it managed by infrastructure
58 * @throws IllegalArgumentException when invalid parameters are provided
60 HttpServletServer build(String name, String host, int port, String contextPath, boolean swagger, boolean managed);
63 * Build a list of http rest servers per properties.
65 * @param properties properties based configuration
66 * @return list of http servers
67 * @throws IllegalArgumentException when invalid parameters are provided
69 List<HttpServletServer> build(Properties properties);
72 * Builds an http or https server to manage static resources.
75 * @param https use secured http over tls connection
76 * @param host binding host
78 * @param contextPath server base path
79 * @param managed is it managed by infrastructure
81 * @throws IllegalArgumentException when invalid parameters are provided
83 HttpServletServer buildStaticResourceServer(String name, boolean https, String host, int port, String contextPath,
87 * Gets a server based on the port.
92 HttpServletServer get(int port);
95 * Provides an inventory of servers.
97 * @return inventory of servers
99 List<HttpServletServer> inventory();
102 * Destroys server bound to a port.
104 * @param port the port the server is bound to
106 void destroy(int port);
109 * Destroys the factory and therefore all servers.