org.icann.tld
Class TldVerify

java.lang.Object
  extended by org.icann.tld.TldVerify

public class TldVerify
extends java.lang.Object

A class that lets you verify the existence of a domain

Version:
0.1
Author:
Simon Raveh

Field Summary
static java.lang.String TLD_CACHE_FILE
          Default Cache file name
 
Constructor Summary
TldVerify()
           
 
Method Summary
 void refreshTldDB()
          Updates the copy of the fixed database of valid top-level domains.
 void refreshTldDB(java.lang.String cacheStoreFileName)
          Updates the copy of the fixed database of valid top-level domains.
 boolean verifyTld(java.lang.String domainName)
          Verifies a top-level domain exists.
 boolean verifyTldOffline(java.lang.String domainName)
          Verifies a top-level domain exists against a fixed database.
 boolean verifyTldOffline(java.lang.String domainName, java.lang.String cacheFilePath)
          Verifies a top-level domain exists against a fixed database.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TLD_CACHE_FILE

public static final java.lang.String TLD_CACHE_FILE
Default Cache file name

See Also:
Constant Field Values
Constructor Detail

TldVerify

public TldVerify()
Method Detail

verifyTld

public boolean verifyTld(java.lang.String domainName)
Verifies a top-level domain exists. This methods takes a single argument, which can either be a domain name, or a TLD - and verifies its validity using the DNS protocol.

Parameters:
domainName - a domain name or a TLD
Returns:
true if the top-leve domain exist false

verifyTldOffline

public boolean verifyTldOffline(java.lang.String domainName)
                         throws TLDVerifyException
Verifies a top-level domain exists against a fixed database. This methods takes a single argument, which can either be a domain name, or a TLD and verified for validity against a fixed database that has been previously obtained with the refreshTldDB() method.

Parameters:
domainName - the domain name or a TLD to validate
Returns:
true if the top-leve domain exist false
Throws:
TLDVerifyException

verifyTldOffline

public boolean verifyTldOffline(java.lang.String domainName,
                                java.lang.String cacheFilePath)
                         throws TLDVerifyException
Verifies a top-level domain exists against a fixed database. The first argument supplies is either a domain name, or a TLD, which is verified for validity against a fixed database that has been previously obtained with the refreshTldDB() method. The second argument is the filename where the cache is stored. The file format should be the same as the one IANA publish at (http://data.iana.org/TLD/tlds-alpha-by-domain.txt). The version in the first line will be check against the current cache version to prevent loading of old data.

Parameters:
domainName - The domain name or a TLD to validate
cacheFilePath - The full path to where the cache is stored.
Returns:
true if the top-leve domain exist false
Throws:
TLDVerifyException

refreshTldDB

public void refreshTldDB()
                  throws TLDVerifyException
Updates the copy of the fixed database of valid top-level domains. Downloads the official list of valid TLDs from the IANA website, and performs consistency checking to ensure it was downloaded correctly. Store the data in the default location.

Throws:
TLDVerifyException

refreshTldDB

public void refreshTldDB(java.lang.String cacheStoreFileName)
                  throws TLDVerifyException
Updates the copy of the fixed database of valid top-level domains. Downloads the official list of valid TLDs from the IANA website, and performs consistency checking to ensure it was downloaded correctly. The parameter is the filename to store the cache in.

Parameters:
cacheStoreFileName - The full path to the file to store the cache in.
Throws:
TLDVerifyException


Copyright © 2006 ICANN. All Rights Reserved.