All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aoindustries.aoserv.client.dns.TopLevelDomain Maven / Gradle / Ivy

/*
 * aoserv-client - Java client for the AOServ Platform.
 * Copyright (C) 2001-2013, 2016, 2017, 2018, 2019  AO Industries, Inc.
 *     [email protected]
 *     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 .
 */
package com.aoindustries.aoserv.client.dns;

import com.aoindustries.aoserv.client.GlobalObjectDomainNameKey;
import com.aoindustries.aoserv.client.schema.AoservProtocol;
import com.aoindustries.aoserv.client.schema.Table;
import com.aoindustries.io.stream.StreamableInput;
import com.aoindustries.io.stream.StreamableOutput;
import com.aoindustries.net.DomainName;
import com.aoindustries.validation.ValidationException;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * A DNSTLD is a name server top level domain.  A top level domain
 * is a domain that is one level above that which is controlled by AO Industries'
 * name servers.  Some common examples include com, net,
 * org, co.uk, aq (OK - not so common), and
 * med.pro.  The domains added to the name servers must be in the
 * format subdomain.dns_tld, where subdomain
 * is a word without dots (.), and dns_tld is one of
 * the top level domains in the database.  If a top level domain does not exist
 * that properly should, please contact AO Industries to have it added.
 * 

* Also, this is a list of effective top-level domains, for the purposes of * domain allocation. This means it includes things like com.au, * whereas the {@link com.aoindustries.tlds.TopLevelDomain} only includes au. *

* * @see Zone * * @author AO Industries, Inc. */ // TODO: Rename something different, to distinguish from top-level domains proper. // Perhaps "RegistrationDomain"/"RegistrarDomain"/"RegistrableDomain"? // Or "Tier"/"UsableDomain"? // Evaluated: https://github.com/whois-server-list/public-suffix-list // Seems dead, also not self-updating // // https://wiki.mozilla.org/Public_Suffix_List // https://publicsuffix.org/ // https://publicsuffix.org/list/ // https://publicsuffix.org/list/public_suffix_list.dat final public class TopLevelDomain extends GlobalObjectDomainNameKey { static final int COLUMN_DOMAIN=0; static final String COLUMN_DOMAIN_name = "domain"; private String description; @Override protected Object getColumnImpl(int i) { if(i==COLUMN_DOMAIN) return pkey; if(i==1) return description; throw new IllegalArgumentException("Invalid index: " + i); } public String getDescription() { return description; } public DomainName getDomain() { return pkey; } @Override public Table.TableID getTableID() { return Table.TableID.DNS_TLDS; } @Override public void init(ResultSet result) throws SQLException { try { pkey=DomainName.valueOf(result.getString(1)); description=result.getString(2); } catch(ValidationException e) { throw new SQLException(e); } } @Override public void read(StreamableInput in, AoservProtocol.Version protocolVersion) throws IOException { try { pkey=DomainName.valueOf(in.readUTF()).intern(); description=in.readUTF(); } catch(ValidationException e) { throw new IOException(e); } } @Override public void write(StreamableOutput out, AoservProtocol.Version protocolVersion) throws IOException { out.writeUTF(pkey.toString()); out.writeUTF(description); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy