gt: 			open_firewall = result.getBoolean(10);
context: /*
   * aoserv-client - Java client for the AOServ Platform.
   * Copyright (C) 2001-2013, 2016, 2017, 2018, 2019, 2020, 2021  AO Industries, Inc.
   *     support@aoindustries.com
   *     7262 Bull Pen Cir
   *     Mobile, AL 36695
   *
   * This file is part of aoserv-client.
   *
   * aoserv-client is free software: you can redistribute it and/or modify
   * it under the terms of the GNU Lesser General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
   *
   * aoserv-client is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public License
   * along with aoserv-client.  If not, see <https://www.gnu.org/licenses/>.
   */
  package com.aoindustries.aoserv.client.net;
  
  import com.aoapps.collections.AoCollections;
  import com.aoapps.collections.IntList;
  import com.aoapps.hodgepodge.io.stream.StreamableInput;
  import com.aoapps.hodgepodge.io.stream.StreamableOutput;
  import com.aoapps.lang.validation.ValidationException;
  import com.aoapps.net.DomainName;
  import com.aoapps.net.EmptyURIParameters;
  import com.aoapps.net.Port;
  import com.aoapps.net.URIParameters;
  import com.aoapps.net.URIParametersMap;
  import com.aoapps.net.URIParametersUtils;
  import com.aoapps.net.UnmodifiableURIParameters;
  import com.aoindustries.aoserv.client.AOServConnector;
  import com.aoindustries.aoserv.client.CachedObjectIntegerKey;
  import com.aoindustries.aoserv.client.CannotRemoveReason;
  import com.aoindustries.aoserv.client.Disablable;
  import com.aoindustries.aoserv.client.Removable;
  import com.aoindustries.aoserv.client.account.Account;
  import com.aoindustries.aoserv.client.billing.Package;
  import com.aoindustries.aoserv.client.distribution.OperatingSystemVersion;
  import com.aoindustries.aoserv.client.email.CyrusImapdBind;
  import com.aoindustries.aoserv.client.email.CyrusImapdServer;
  import com.aoindustries.aoserv.client.email.SendmailBind;
  import com.aoindustries.aoserv.client.email.SendmailServer;
  import com.aoindustries.aoserv.client.ftp.PrivateServer;
  import com.aoindustries.aoserv.client.linux.Server;
  import com.aoindustries.aoserv.client.schema.AoservProtocol;
  import com.aoindustries.aoserv.client.schema.Table;
  import com.aoindustries.aoserv.client.web.HttpdBind;
  import com.aoindustries.aoserv.client.web.HttpdServer;
  import com.aoindustries.aoserv.client.web.Site;
  import com.aoindustries.aoserv.client.web.tomcat.PrivateTomcatSite;
  import com.aoindustries.aoserv.client.web.tomcat.SharedTomcat;
  import com.aoindustries.aoserv.client.web.tomcat.SharedTomcatSite;
  import com.aoindustries.aoserv.client.web.tomcat.Worker;
  import java.io.IOException;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.util.ArrayList;
  import java.util.ConcurrentModificationException;
  import java.util.List;
  import java.util.Locale;
  import java.util.Objects;
  import java.util.Set;
  import java.util.concurrent.ConcurrentHashMap;
  import java.util.concurrent.ConcurrentMap;
  
  /**
   * All listening network ports must be registered as a <code>NetBind</code>.  The
   * <code>NetBind</code> information is also used for internel server and external
   * network monitoring.  If either a network port is not listening that should,
   * or a network port is listening that should not, monitoring personnel are notified
   * to remove the discrepancy.
   *
   * @author  AO Industries, Inc.
   */
  public final class Bind extends CachedObjectIntegerKey<Bind> implements Removable {
  
  	static final int
  		COLUMN_ID = 0,
  		COLUMN_PACKAGE = 1,
  		COLUMN_SERVER = 2,
  		COLUMN_IP_ADDRESS = 3
  	;
  	public static final String COLUMN_SERVER_name = "server";
  	public static final String COLUMN_IP_ADDRESS_name = "ipAddress";
  	public static final String COLUMN_PORT_name = "port";
  
  	private Account.Name packageName;
  	private int server;
  	private int ipAddress;
  	private Port port;
  	private String app_protocol;
  	private boolean monitoring_enabled;
  	private String monitoring_parameters;
  
  	// Protocol conversion
  	private boolean open_firewall;
  
  	/**
  	 * @deprecated  Only required for implementation, do not use directly.
  	 *
  	 * @see  #init(java.sql.ResultSet)
  	 * @see  #read(com.aoapps.hodgepodge.io.stream.StreamableInput, com.aoindustries.aoserv.client.schema.AoservProtocol.Version)
  	 */
  	@Deprecated/* Java 9: (forRemoval = true) */
  	public Bind() {
  		// Do nothing
  	}
  
  	@Override
  	protected Object getColumnImpl(int i) {
  		switch(i) {
  			case COLUMN_ID: return pkey;
  			case COLUMN_PACKAGE: return packageName;
  			case COLUMN_SERVER: return server;
  			case COLUMN_IP_ADDRESS: return ipAddress;
  			case 4: return port;
  			case 5: return app_protocol;
  			case 6: return monitoring_enabled;
  			case 7: return monitoring_parameters;
  			default: throw new IllegalArgumentException("Invalid index: " + i);
  		}
  	}
  
  	public int getId() {
  		return pkey;
  	}
  
  	public Account.Name getPackage_name() {
  		return packageName;
  	}
  
  	public Package getPackage() throws IOException, SQLException {
  		// May be filtered
  		return table.getConnector().getBilling().getPackage().get(packageName);
  	}
  
  	public int getServer_pkey() {
  		return server;
  	}
  
  	public Host getHost() throws SQLException, IOException {
  		Host obj=table.getConnector().getNet().getHost().get(server);
  		if(obj==null) throw new SQLException("Unable to find Host: "+server);
  		return obj;
  	}
  
  	public int getIpAddress_id() {
  		return ipAddress;
  	}
  
  	public IpAddress getIpAddress() throws SQLException, IOException {
  		IpAddress obj=table.getConnector().getNet().getIpAddress().get(ipAddress);
  		if(obj==null) throw new SQLException("Unable to find IPAddress: "+ipAddress);
  		return obj;
  	}
  
  	public Port getPort() {
  		return port;
  	}
  
  	public String getAppProtocol_protocol() {
  		return app_protocol;
  	}
  
  	public AppProtocol getAppProtocol() throws SQLException, IOException {
  		AppProtocol obj=table.getConnector().getNet().getAppProtocol().get(app_protocol);
  		if(obj==null) throw new SQLException("Unable to find Protocol: "+app_protocol);
  		return obj;
  	}
  
  	public boolean isMonitoringEnabled() {
  		return monitoring_enabled;
  	}
  
  	/**
  	 * Gets the unmodifiable map of parameters for this bind.
  	 */
  	public URIParameters getMonitoringParameters() {
  		String myParamString = monitoring_parameters;
  		if(myParamString==null) {
  			return EmptyURIParameters.getInstance();
  		} else {
  			URIParameters params = getMonitoringParametersCache.get(myParamString);
  			if(params==null) {
  				params = UnmodifiableURIParameters.wrap(decodeParameters(myParamString));
  				URIParameters previous = getMonitoringParametersCache.putIfAbsent(myParamString, params);
  				if(previous!=null) params = previous;
  			}
  			return params;
  		}
  	}
  
  	@Override
  	public void init(ResultSet result) throws SQLException {
  		try {
  			pkey = result.getInt(1);
  			packageName = Account.Name.valueOf(result.getString(2));
  			server = result.getInt(3);
  			ipAddress = result.getInt(4);
  			port = Port.valueOf(
  				result.getInt(5),
  				com.aoapps.net.Protocol.valueOf(result.getString(6))
  			);
  			app_protocol = result.getString(7);
  			monitoring_enabled = result.getBoolean(8);
  			monitoring_parameters = result.getString(9);
  