Package org.xbill.DNS

Examples of org.xbill.DNS.Lookup.run()


            // DnsLookupFailedException
            throw new DnsLookupFailedException("Failed to lookup domain:" +
                domainNameToLookup + " error:" + e.getMessage());
        }

        Record[] records = lkup.run();
        int res = lkup.getResult();

        if (res == Lookup.TRY_AGAIN) {
            throw new DnsServerUnavailableException(lkup.getErrorString());
        } else if (lkup.getResult() != Lookup.SUCCESSFUL) {
View Full Code Here


                Lookup lookup = (dnsClass == null)
                    ? (dnsType == null ? new Lookup(dnsName) : new Lookup(dnsName, dnsType))
                        : new Lookup(dnsName, dnsType, dnsClass);

                lookup.run();
                if (lookup.getAnswers() != null) {
                    exchange.getIn().setBody(lookup.getAnswers());
                } else {
                    throw new CamelException(lookup.getErrorString());
                }
View Full Code Here

           
            l.setCache(cache);
            l.setResolver(resolver);
            l.setCredibility(dnsCredibility);
            l.setSearchPath(searchPaths);
            Record[] r = l.run();
           
            try {
                if (l.getResult() == Lookup.TRY_AGAIN) {
                    throw new TemporaryResolutionException(
                            "DNSService is temporary not reachable");
View Full Code Here

  private static void getMXRecord(String name) throws TextParseException, UnknownHostException {
    Lookup lookup = new Lookup(name, Type.MX);
    Resolver resolver = new SimpleResolver();
//    lookup.setResolver(resolver);
//    lookup.setCache(null);
    for (Record dnsRecord: lookup.run()) {
      MXRecord record = (MXRecord)dnsRecord;
      System.out.println(record.getPriority() + " " + record.rdataToString());
    }
  }
}
View Full Code Here

      Resolver resolver = (this.nameserver==null) ? new SimpleResolver() : new SimpleResolver(this.nameserver);

      // try to lookup the MX records
      Lookup lookup = new Lookup(atHost,Type.MX);
      lookup.setResolver(resolver);
      lookup.run();
      Record[] records = lookup.getAnswers();
      if ( records == null ) {
        // in the event there are no MX records, then punt and try to find A record
        Lookup lookup2 = new Lookup(atHost,Type.A);
        lookup2.setResolver(resolver);
View Full Code Here

      Record[] records = lookup.getAnswers();
      if ( records == null ) {
        // in the event there are no MX records, then punt and try to find A record
        Lookup lookup2 = new Lookup(atHost,Type.A);
        lookup2.setResolver(resolver);
        lookup2.run();
        records = lookup2.getAnswers();
        if ( records == null ) {
          // the caller will have to check for an empty result and decide not to put it in the cache.
          return new MXLookupResult(null);
        }
View Full Code Here

        try {
            Lookup query = new Lookup(selector + "._domainkey." + token,
                    Type.TXT);
            query.setResolver(resolver);

            Record[] rr = query.run();
            int queryResult = query.getResult();

            if (queryResult == Lookup.TRY_AGAIN) {
                throw new TempFailException(query.getErrorString());
            }
View Full Code Here

                Lookup lookup = (dnsClass == null)
                    ? (dnsType == null ? new Lookup(dnsName) : new Lookup(dnsName, dnsType))
                        : new Lookup(dnsName, dnsType, dnsClass);

                lookup.run();
                if (lookup.getAnswers() != null) {
                    exchange.getIn().setBody(lookup.getAnswers());
                } else {
                    throw new CamelException(lookup.getErrorString());
                }
View Full Code Here

                    } else {
                        lookup = new Lookup(dnsName);
                    }
                }

                lookup.run();
                if (lookup.getAnswers() != null) {
                    exchange.getIn().setBody(lookup.getAnswers());
                } else {
                    exchange.getIn().setBody(lookup.getErrorString());
                }
View Full Code Here

            log.debug("Start "+recordTypeDescription+"-Record lookup for : " + request.getHostname());

            Lookup query = new Lookup(request.getHostname(), dnsJavaType);
            query.setResolver(resolver);

            Record[] rr = query.run();
            int queryResult = query.getResult();
           

            if (queryResult == Lookup.TRY_AGAIN) {
                throw new TimeoutException(query.getErrorString());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.