org.nhindirect.dns
Class DNSServerFactory

java.lang.Object
  extended by org.nhindirect.dns.DNSServerFactory

public class DNSServerFactory
extends Object

The DNSServerFactory is a bootstrapper for creating instances of the DNSServer) based on configuration information. Configurations are loaded from a URL that may take the form of any addressable resource such as a file, HTTP resource, LDAP store, or database. Based on the URL protocol, an appropriate configuration loader and parser is instantiated which creates an injector used to provide instance of the DNSServer. Optionally specific configuration and {@link DNSStore} providers can be passed for specific object creation. This is generally useful for creating mock implementations for testing.

Since:
1.0
Author:
Greg Meyer

Constructor Summary
DNSServerFactory()
           
 
Method Summary
static DNSServer createDNSServer(URL configLocation)
          Creates an instance of a DNSServer using the configuration information stored at the configuration location.
static DNSServer createDNSServer(URL configLocation, com.google.inject.Provider<DNSStore> dnsStore, com.google.inject.Provider<DNSServerSettings> settings)
          Creates an instance of a DNSServer using the configuration information stored at the configuration location.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DNSServerFactory

public DNSServerFactory()
Method Detail

createDNSServer

public static DNSServer createDNSServer(URL configLocation)
                                 throws DNSException
Creates an instance of a DNSServer using the configuration information stored at the configuration location.

Parameters:
configLocation - The URL of the configuration information. The URL may refer to any addressable resource.
Returns:
An initialized instance of a DNSServer.
Throws:
DNSException - Thrown if an error occurs while creating the DNSServer.

createDNSServer

public static DNSServer createDNSServer(URL configLocation,
                                        com.google.inject.Provider<DNSStore> dnsStore,
                                        com.google.inject.Provider<DNSServerSettings> settings)
                                 throws DNSException
Creates an instance of a DNSServer using the configuration information stored at the configuration location. An optional {@link DNSStore> provider can be passed for initializing the server with a specific record store.

Parameters:
configLocation - The URL of the configuration information. The URL may refer to any addressable resource.
dnsStore - Optional provider that will create an instance of a specific DNSStore type. If this is null, the system will create a default store.
settings - Optional DNS server settings. Overridden by settings from the configuration service.
Returns:
An initialized instance of a DNSServer.
Throws:
DNSException - Thrown if an error occurs while creating the DNSServer.


Copyright © 2010-2015 The Direct Project. All Rights Reserved.