001/* 002 * (C) Copyright 2018 Nuxeo (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Florent Guillaume 018 */ 019package org.nuxeo.runtime.server; 020 021import org.nuxeo.common.server.WebApplication; 022 023/** 024 * Configuration interface for an embedded server implementation. 025 * 026 * @since 10.2 027 */ 028public interface ServerConfigurator { 029 030 /** 031 * Initializes this server configurator 032 * 033 * @param port the HTTP port to use 034 * @return the actual port used 035 */ 036 int initialize(int port); 037 038 /** 039 * Closes this server configurator and releases resources. 040 */ 041 void close(); 042 043 /** 044 * Starts the server. 045 */ 046 void start(); 047 048 /** 049 * Stops the server. 050 */ 051 void stop(); 052 053 /** 054 * Adds a web app to the server. 055 * 056 * @param descriptor the descriptor 057 */ 058 void addWepApp(WebApplication descriptor); 059 060 /** 061 * Adds a filter to the server. 062 * 063 * @param descriptor the descriptor 064 */ 065 void addFilter(FilterDescriptor descriptor); 066 067 /** 068 * Adds a servlet to the server. 069 * 070 * @param descriptor the descriptor 071 */ 072 void addServlet(ServletDescriptor descriptor); 073 074 /** 075 * Adds a lifecycle listener to the server. 076 * 077 * @param descriptor the descriptor 078 */ 079 void addLifecycleListener(ServletContextListenerDescriptor descriptor); 080 081}