2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.policy.common.endpoints.http.server;
23 import java.util.List;
24 import java.util.Properties;
27 * Factory of HTTP Servlet-Enabled Servlets.
29 public interface HttpServletServerFactory {
32 * Builds an http or https server with support for servlets.
35 * @param https use secured http over tls connection
36 * @param host binding host
38 * @param contextPath server base path
39 * @param swagger enable swagger documentation
40 * @param managed is it managed by infrastructure
42 * @throws IllegalArgumentException when invalid parameters are provided
44 HttpServletServer build(String name, boolean https, String host, int port, String contextPath, boolean swagger,
48 * Builds an http server with support for servlets.
51 * @param host binding host
53 * @param contextPath server base path
54 * @param swagger enable swagger documentation
55 * @param managed is it managed by infrastructure
57 * @throws IllegalArgumentException when invalid parameters are provided
59 HttpServletServer build(String name, String host, int port, String contextPath, boolean swagger, boolean managed);
62 * Build a list of http servers per properties.
64 * @param properties properties based configuration
65 * @return list of http servers
66 * @throws IllegalArgumentException when invalid parameters are provided
68 List<HttpServletServer> build(Properties properties);
71 * Gets a server based on the port.
76 HttpServletServer get(int port);
79 * Provides an inventory of servers.
81 * @return inventory of servers
83 List<HttpServletServer> inventory();
86 * Destroys server bound to a port.
88 * @param port the port the server is bound to
90 void destroy(int port);
93 * Destroys the factory and therefore all servers.