Java Doc for Resolver.java in  » Apache-Harmony-Java-SE » org-package » org » apache » harmony » jndi » provider » dns » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » org package » org.apache.harmony.jndi.provider.dns 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.harmony.jndi.provider.dns.Resolver

Resolver
public class Resolver implements Runnable(Code)
This class implements the functionality of a simple DNS resolver.
Following DNS Resource Records are supported:
  • A
  • NS
  • CNAME
  • SOA
  • PTR
  • MX
  • TXT
  • HINFO
  • AAAA (TODO)
  • NAPTR (TODO)
  • SRV
Following DNS classes are supported:
  • IN
  • HS (TODO)

TODO: do we need broadcasting and IP multicasting to obtain initial name server address? TODO: network-preference feature for choosing most welcome address for multihomed hosts (RFC 1123 point 6.1.3.4) TODO: add general IPv6 support and support for AAAA resource record

Inner Class :static class AnalysisReport


Constructor Summary
public  Resolver()
    
public  Resolver(int initialTimeout, int timeoutRetries, int maxThreads, boolean authoritativeAnswerDesired, boolean recursionDesired)
     Constructs a Resolver object with given initial timeout and timeout retries.

Method Summary
public  voidaddInitialServer(String name, String ip, int port, String zoneName)
     Adds initial DNS server the resolver should start with.
 AnalysisReportanalyzeAnswer(Message request, Message answer)
     Analyzes the answer message and constructs an analysis report.
static  MessagecreateMessageForSending(String desiredName, int recType, int recClass)
     Creates a new Message object and fills some of it's standard fields.
public  intgetInitialTimeout()
    
public  intgetThreadNumberLimit()
    
public  intgetTimeoutRetries()
    
public  booleanisAuthoritativeAnswerDesired()
    
public  booleanisRecursionDesired()
    
public  Enumeration<ResourceRecord>list(String name)
     Lists entire DNS zone using zone transfer mechanism.
public  Enumeration<ResourceRecord>lookup(String name, int[] types, int[] classes)
     Checks available name servers if they have any resource records related to given name & type & class combination.
 MessagequeryServers(Message request, String workZone, Hashtable<Server, Object> visitedServers, boolean tcpOnly)
     Query available DNS servers for desired information.
public  voidrun()
    
public  voidsetAuthoritativeAnswerDesired(boolean authoritativeAnswerDesired)
    
public  voidsetInitialTimeout(int initialTimeout)
    
public  voidsetRecursionDesired(boolean recursionDesired)
    
public  voidsetThreadNumberLimit(int threadNumberLimit)
    
public  voidsetTimeoutRetries(int timeoutRetries)
    
 voidstartResolvingThread(String hostname, int dnsClass)
     Starts new resolver thread that will be searching for IP of the given hostname.


Constructor Detail
Resolver
public Resolver()(Code)
Constructs a Resolver object with default initial timeout (1 second), default timeout retries (4 times), default recursion desired switch (true) and default authoritative answer desired
See Also:   Resolver.Resolver(int,int)



Resolver
public Resolver(int initialTimeout, int timeoutRetries, int maxThreads, boolean authoritativeAnswerDesired, boolean recursionDesired)(Code)
Constructs a Resolver object with given initial timeout and timeout retries. Initially the resolver will try to access DNS servers with timeout set to initial timeout. If none of servers answer it will double the timeout and perform the second round. The process will continue for timeoutRetries rounds. If there is no answer still the resolver will give up.
Parameters:
  initialTimeout - the initial timeout that is used during the first round (inmilliseconds)
Parameters:
  timeoutRetries - number of rounds the Resolver should perform before giving up
Parameters:
  authoritativeAnswerDesired - do we want to receive only authoritative answers
Parameters:
  recursionDesired - do we want our outgoing packages to have RD but set




Method Detail
addInitialServer
public void addInitialServer(String name, String ip, int port, String zoneName)(Code)
Adds initial DNS server the resolver should start with. Trying underlying OS services to determine IP from name.
Parameters:
  name - server's name
Parameters:
  ip - server's IP address
Parameters:
  port - port on server



analyzeAnswer
AnalysisReport analyzeAnswer(Message request, Message answer) throws DomainProtocolException(Code)
Analyzes the answer message and constructs an analysis report.
Parameters:
  request - the request has been send to the server
Parameters:
  answer - the answer has been received
Parameters:
  workZone - the current resolver's work zone analysis report TODO may be optimized



createMessageForSending
static Message createMessageForSending(String desiredName, int recType, int recClass) throws DomainProtocolException(Code)
Creates a new Message object and fills some of it's standard fields. created Message object



getInitialTimeout
public int getInitialTimeout()(Code)
Returns the initialTimeout.



getThreadNumberLimit
public int getThreadNumberLimit()(Code)
Returns the threadNumberLimit.



getTimeoutRetries
public int getTimeoutRetries()(Code)
Returns the timeoutRetries.



isAuthoritativeAnswerDesired
public boolean isAuthoritativeAnswerDesired()(Code)
Returns the authoritativeAnswerDesired.



isRecursionDesired
public boolean isRecursionDesired()(Code)
Returns the recursionDesired.



list
public Enumeration<ResourceRecord> list(String name) throws NamingException(Code)
Lists entire DNS zone using zone transfer mechanism.
Parameters:
  name - DNS zone name enumeration with found ResourceRecord objects
throws:
  SecurityException - if the resolver is not allowed to use a network subsystem
throws:
  NameNotFoundException - if authoritative server(s) was not found
throws:
  ServiceUnavailableException - if none of found servers permits zone transfers
throws:
  DomainProtocolException - if some DNS specific error has occured



lookup
public Enumeration<ResourceRecord> lookup(String name, int[] types, int[] classes) throws SecurityException, NameNotFoundException, ServiceUnavailableException, DomainProtocolException(Code)
Checks available name servers if they have any resource records related to given name & type & class combination. Standard DNS lookup algorithm is used.
Parameters:
  name - well-formed domain name
Parameters:
  types - an array of types; only records that have such types will bereturned
Parameters:
  classes - enumeration with found resource records
throws:
  SecurityException - if the resolver is not allowed to use a network subsystem
throws:
  NameNotFoundException - if authoritative server for desired zone was contacted butgiven name has not been found in that zone
throws:
  ServiceUnavailableException - if no authoritative server for desired name was found or allservers are dead or malfunction
throws:
  DomainProtocolException - if some DNS specific error has occurred



queryServers
Message queryServers(Message request, String workZone, Hashtable<Server, Object> visitedServers, boolean tcpOnly) throws DomainProtocolException, SecurityException(Code)
Query available DNS servers for desired information. This method doesn't look into the local cache. Drops all answers that contains "server fail" and "not implemented" answer codes and returns the first "good" answer.
Parameters:
  request - a DNS message that contains the request record
Parameters:
  workZone - a zone that is closest known (grand-) parent of the desiredname
Parameters:
  visitedServers - the hash list of servers, that should not be examined; thismethod also appends to this list all server that have beenvisited during execution of this method
Parameters:
  tcpOnly - true if we want to use TCP protocol only;otherwise UDP will be tried first the message received; null if none found
throws:
  DomainProtocolException - some domain protocol related error occured
throws:
  SecurityException - if the resolver doesn't have the permission to use sockets



run
public void run()(Code)
Start background search of the address of next unresolved server hostname



setAuthoritativeAnswerDesired
public void setAuthoritativeAnswerDesired(boolean authoritativeAnswerDesired)(Code)

Parameters:
  authoritativeAnswerDesired - The authoritativeAnswerDesired to set.



setInitialTimeout
public void setInitialTimeout(int initialTimeout)(Code)

Parameters:
  initialTimeout - The initialTimeout to set.



setRecursionDesired
public void setRecursionDesired(boolean recursionDesired)(Code)

Parameters:
  recursionDesired - The recursionDesired to set.



setThreadNumberLimit
public void setThreadNumberLimit(int threadNumberLimit)(Code)

Parameters:
  threadNumberLimit - The threadNumberLimit to set.



setTimeoutRetries
public void setTimeoutRetries(int timeoutRetries)(Code)

Parameters:
  timeoutRetries - The timeoutRetries to set.



startResolvingThread
void startResolvingThread(String hostname, int dnsClass)(Code)
Starts new resolver thread that will be searching for IP of the given hostname.
Parameters:
  hostname - hostname to resolve
Parameters:
  dnsClass - DNS class of host



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.