Package org.xbill.DNS

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


        if (isCustomResolver() && ((ExtendedResolver) resolver).getResolvers().length > 1) {
            try {
                Lookup lookup = new Lookup(host, Type.A);
                lookup.setCache(lookupCache);
                lookup.setResolver(resolver);
                Record[] records = lookup.run();
                if (records.length == 0) {
                    throw new UnknownHostException("Failed to resolve host name: " + host);
                }
                addresses = new InetAddress[records.length];
                for (int i = 0; i < records.length; i++) {
View Full Code Here


      lookup = new Lookup(applicationFqdn, Type.SRV);
    } catch (TextParseException e) {
      throw new LookupException("Error parsing DNS response", e);
    }
    lookup.setResolver(resolver);
    org.xbill.DNS.Record[] records = lookup.run();

    if (records != null) {
      List<Record> servers = new ArrayList<Record>();
      for (org.xbill.DNS.Record r : records) {
        if (r.getType() == Type.SRV) {
View Full Code Here

      } else {
        resolver = new SimpleResolver(mDNSHostname);
      }
      Lookup lookup = new Lookup(getRadioDNSFqdn(), Type.CNAME);
      lookup.setResolver(resolver);
      org.xbill.DNS.Record[] records = lookup.run();

      if (records != null) {
        for (org.xbill.DNS.Record record : records) {
          if (record.getType() == Type.CNAME) {
            return ((CNAMERecord) record).getTarget().toString();
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");
                } else {
View Full Code Here

      lookup = new Lookup(name, Type.SRV, DClass.IN);
    } catch (TextParseException e) {
      throw new IllegalArgumentException("unable to create lookup for name: " + name, e);
    }

    Record[] queryResult = lookup.run();

    switch (lookup.getResult()) {
      case Lookup.SUCCESSFUL:
        final ImmutableList.Builder<URI> endpoints = ImmutableList.builder();
        for (Record record : queryResult) {
View Full Code Here

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

            Lookup.getDefaultResolver().setTimeout(timeOut);
            Lookup query = new Lookup(request.getHostname(), dnsJavaType);

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

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

    final List result = new ArrayList();
    final Lookup[] queries = serviceTypeId.getInternalQueries();
    for (int i = 0; i < queries.length; i++) {
      final Lookup query = queries[i];
      query.setResolver(resolver);
      final Record[] queryResult = query.run();
      if(queryResult != null) {
        result.addAll(Arrays.asList(queryResult));
      }
    }
    return (Record[]) result.toArray(new Record[result.size()]);
View Full Code Here

      if(record instanceof PTRRecord) {
        final PTRRecord ptrRecord = (PTRRecord) record;
        final Name target = ptrRecord.getTarget();
        final Lookup srvQuery = new Lookup(target, Type.SRV);
        srvQuery.setResolver(resolver);
        srvQueryResult = srvQuery.run();
      } else if (record instanceof SRVRecord) {
        srvQueryResult = new SRVRecord[]{(SRVRecord) record};
      } else {
        // avoid NPE
        srvQueryResult = new SRVRecord[0];
View Full Code Here

    final Name name = new Name(_DNS_UPDATE + zone);
   
    //query for NS records
    Lookup query = new Lookup(zone, Type.NS);
    query.setResolver(resolver);
    Record[] queryResult = query.run();
    //TODO file bug upstream that queryResult may never be null
    int length = queryResult == null ? 0 : queryResult.length;
    for (int j = 0; j < length; j++) {
      final Record record = queryResult[j];
      if(record instanceof NSRecord) {
View Full Code Here

    }
   
    //query for primary ns in SOA record (may overwrite/be equal to one of the ns records)
    query = new Lookup(zone, Type.SOA);
    query.setResolver(resolver);
    queryResult = query.run();
    //TODO file bug upstream that queryResult may never be null
    length = queryResult == null ? 0 : queryResult.length;
    for (int j = 0; j < length; j++) {
      final Record record = queryResult[j];
      if(record instanceof SOARecord) {
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.