org.neverfear.whois
Class WhoisServerPool

java.lang.Object
  extended by org.neverfear.whois.WhoisServerPool

public class WhoisServerPool
extends java.lang.Object

A class representing a pool of WHOIS servers.

Author:
doug@neverfear.org

Field Summary
static java.util.HashMap<java.lang.String,WhoisServer> servers
          A Map of TLDs to WhoisServce instances.
 
Constructor Summary
WhoisServerPool()
           
 
Method Summary
static WhoisServer getServer(java.lang.String name)
          Get the WhoisServer for the given name.
static java.lang.String getTLD(java.lang.String name)
          Extract the TLD from the given name.
static WhoisResponse query(java.lang.String name)
          Query the given domain name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

servers

public static final java.util.HashMap<java.lang.String,WhoisServer> servers
A Map of TLDs to WhoisServce instances.

Constructor Detail

WhoisServerPool

public WhoisServerPool()
Method Detail

getTLD

public static java.lang.String getTLD(java.lang.String name)
Extract the TLD from the given name.

Parameters:
name - A domain name.
Returns:
The co-responding top level domain name.

getServer

public static WhoisServer getServer(java.lang.String name)
Get the WhoisServer for the given name.

Parameters:
name - A domain name.
Returns:
An initalised WhoisServer instance that can query the given name.

query

public static WhoisResponse query(java.lang.String name)
                           throws java.net.UnknownHostException,
                                  java.io.IOException
Query the given domain name. Calls WhoisServer.query(String).

Parameters:
name - A domain name.
Returns:
A {@link WhoisResponse] instance for this query.
Throws:
java.net.UnknownHostException
java.io.IOException