1 // 2 // ======================================================================== 3 // Copyright (c) 1995-2012 Sabre Holdings. 4 // ------------------------------------------------------------------------ 5 // All rights reserved. This program and the accompanying materials 6 // are made available under the terms of the Eclipse Public License v1.0 7 // and Apache License v2.0 which accompanies this distribution. 8 // 9 // The Eclipse Public License is available at 10 // http://www.eclipse.org/legal/epl-v10.html 11 // 12 // The Apache License v2.0 is available at 13 // http://www.opensource.org/licenses/apache2.0.php 14 // 15 // You may elect to redistribute this code under either of these licenses. 16 // ======================================================================== 17 // 18 19 20 package org.eclipse.jetty.ant.types; 21 22 import java.util.ArrayList; 23 import java.util.List; 24 25 /** 26 * 27 * Connectors 28 * 29 * Specifies a jetty configuration <connectors/> element for Ant build file. 30 * 31 */ 32 public class Connectors 33 { 34 private List<Connector> connectors = new ArrayList<Connector>(); 35 private List<Connector> defaultConnectors = new ArrayList<Connector>(); 36 37 /** 38 * Default constructor. 39 */ 40 public Connectors() { 41 this(8080, 30000); 42 } 43 44 /** 45 * Constructor. 46 * 47 * @param port The port that the default connector will listen on 48 * @param maxIdleTime The maximum idle time for the default connector 49 */ 50 public Connectors(int port, int maxIdleTime) 51 { 52 defaultConnectors.add(new Connector(port, maxIdleTime)); 53 } 54 55 /** 56 * Adds a connector to the list of connectors to deploy. 57 * 58 * @param connector A connector to add to the list 59 */ 60 public void add(Connector connector) 61 { 62 connectors.add(connector); 63 } 64 65 /** 66 * Returns the list of known connectors to deploy. 67 * 68 * @return The list of known connectors 69 */ 70 public List<Connector> getConnectors() 71 { 72 return connectors; 73 } 74 75 /** 76 * Gets the default list of connectors to deploy when no connectors 77 * were explicitly added to the list. 78 * 79 * @return The list of default connectors 80 */ 81 public List<Connector> getDefaultConnectors() 82 { 83 return defaultConnectors; 84 } 85 86 }