public class DNSJavaService extends Object implements DNSService, DNSServiceMBean, LogEnabled, Configurable
| Modifier and Type | Field and Description |
|---|---|
protected org.xbill.DNS.Cache |
cache
A TTL cache of results received from the DNS server.
|
protected org.xbill.DNS.Resolver |
resolver
A resolver instance used to retrieve DNS records.
|
| Constructor and Description |
|---|
DNSJavaService() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearCache()
Clear the cache of the service
|
void |
configure(org.apache.commons.configuration.HierarchicalConfiguration configuration)
Configure the object.
|
Collection<String> |
findMXRecords(String hostname)
Return a prioritized unmodifiable list of host handling mail for the
domain.
|
Collection<String> |
findTXTRecords(String hostname)
Get a collection of DNS TXT Records
|
InetAddress[] |
getAllByName(String host)
Resolve the given hostname to an array of InetAddress based on the DNS
Server.
|
InetAddress |
getByName(String host)
Resolve the given hostname to an InetAddress based on the DNS Server.
|
int |
getCurrentCacheSize()
Return the current size of the cache
|
String[] |
getDNSServers()
Return the list of DNS servers in use by this service
|
String |
getHostName(InetAddress addr)
Resolve the given InetAddress to an host name based on the DNS Server.
|
InetAddress |
getLocalHost()
Resolve the local hostname of the machine and returns it.
|
int |
getMaximumCacheSize()
Return the maximum cache size
|
org.xbill.DNS.Name[] |
getSearchPaths()
Return the list of DNS servers in use by this service
|
void |
init() |
protected org.xbill.DNS.Record[] |
lookup(String namestr,
int type,
String typeDesc)
Looks up DNS records of the specified type for the specified name.
|
protected org.xbill.DNS.Record[] |
lookupNoException(String namestr,
int type,
String typeDesc) |
void |
setLog(org.slf4j.Logger logger)
Sets the service log.
|
protected org.xbill.DNS.Resolver resolver
protected org.xbill.DNS.Cache cache
public void setLog(org.slf4j.Logger logger)
LogEnabledsetLog in interface LogEnabledlogger - not nullLogEnabled.setLog(org.slf4j.Logger)public void configure(org.apache.commons.configuration.HierarchicalConfiguration configuration)
throws org.apache.commons.configuration.ConfigurationException
Configurableconfigure in interface Configurableorg.apache.commons.configuration.ConfigurationExceptionConfigurable.configure(org.apache.commons.configuration.HierarchicalConfiguration)@PostConstruct public void init() throws Exception
Exceptionpublic String[] getDNSServers()
getDNSServers in interface DNSServiceMBeanpublic org.xbill.DNS.Name[] getSearchPaths()
public Collection<String> findMXRecords(String hostname) throws TemporaryResolutionException
DNSServiceReturn a prioritized unmodifiable list of host handling mail for the domain.
First lookup MX hosts, then MX hosts of the CNAME address, and if no server is found return the IP of the hostname
findMXRecords in interface DNSServicehostname - domain name to look upTemporaryResolutionException - get thrown on temporary problemsDNSService.findMXRecords(String)protected org.xbill.DNS.Record[] lookup(String namestr, int type, String typeDesc) throws TemporaryResolutionException
namestr - the name of the host to be looked uptype - the type of record desiredtypeDesc - the description of the record type, for debugging purposeTemporaryResolutionExceptionprotected org.xbill.DNS.Record[] lookupNoException(String namestr, int type, String typeDesc)
public InetAddress getByName(String host) throws UnknownHostException
DNSServicegetByName in interface DNSServiceUnknownHostExceptionDNSService.getByName(String)public InetAddress[] getAllByName(String host) throws UnknownHostException
DNSServicegetAllByName in interface DNSServiceUnknownHostExceptionDNSService.getAllByName(String)public Collection<String> findTXTRecords(String hostname)
DNSServicefindTXTRecords in interface DNSServicehostname - The hostname to checkDNSService.findTXTRecords(String)public String getHostName(InetAddress addr)
DNSServicegetHostName in interface DNSServiceDNSService.getHostName(java.net.InetAddress)public InetAddress getLocalHost() throws UnknownHostException
DNSServicegetLocalHost in interface DNSServiceUnknownHostExceptionDNSService.getLocalHost()public int getMaximumCacheSize()
DNSServiceMBeangetMaximumCacheSize in interface DNSServiceMBeanDNSServiceMBean.getMaximumCacheSize()public int getCurrentCacheSize()
DNSServiceMBeangetCurrentCacheSize in interface DNSServiceMBeanDNSServiceMBean.getCurrentCacheSize()public void clearCache()
DNSServiceMBeanclearCache in interface DNSServiceMBeanDNSServiceMBean.clearCache()Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.