1 package org.jacorb.orb.dns; 2 3 22 23 import java.net.InetAddress ; 24 25 import org.jacorb.util.ObjectUtil; 26 27 import org.apache.avalon.framework.configuration.*; 28 import org.apache.avalon.framework.logger.Logger; 29 30 public class DNSLookup 31 implements Configurable 32 { 33 private DNSLookupDelegate delegate = null; 34 private boolean enabled = false; 35 36 public void configure(Configuration configuration) 37 throws ConfigurationException 38 { 39 enabled = configuration.getAttribute("jacorb.dns.enable","off").equals("on"); 40 if (enabled) 41 { 42 delegate = 43 new JdkDelegateImpl(((org.jacorb.config.Configuration)configuration).getNamedLogger("org.jacorb.dns")); 44 } 45 } 46 47 50 private static boolean jdk_DNS_Usable() 51 { 52 try 53 { 54 java.lang.reflect.Method m = java.net.InetAddress .class.getMethod 55 ( 56 "getCanonicalHostName", 57 new Class [] {} 58 ); 59 return m != null; 60 } 61 catch (NoSuchMethodException ex) 62 { 63 return false; 64 } 65 } 66 67 public String inverseLookup(String ip) 68 { 69 return ((delegate == null) ? null : delegate.inverseLookup(ip)); 70 } 71 72 public String inverseLookup(InetAddress addr) 73 { 74 return ((delegate == null) ? null : delegate.inverseLookup(addr)); 75 } 76 77 } | Popular Tags |