Examples of MXRecord


Examples of org.xbill.DNS.MXRecord

    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

Examples of org.xbill.DNS.MXRecord

      ArrayList<MXRecord> list = new ArrayList<MXRecord>(records.length);
      for (int i=0;i<records.length;i++) {
        if ( records[i] instanceof ARecord ) {
          ARecord rec = (ARecord) records[i];
          MXRecord mx = new MXRecord(
            rec.getName(),
            rec.getDClass(),
            rec.getTTL(),
            100,
            rec.getName()
          );
          list.add(mx);
        } else {
          list.add((MXRecord)records[i]);
        }
      }
      Collections.sort(list, new MXPriorityComparator());

      String answers[] = new String[list.size()];
      for (int i = 0; i < list.size(); i++) {
        MXRecord mx = list.get(i);
        answers[i] = mx.getTarget().toString();
// System.out.println("host="+mx.getTarget()+" priority="+mx.getPriority());
      }
      return new MXLookupResult(answers);
    } catch (TextParseException e) {
      throw new MXResolverException("Can only get this if you used the wrong constants in your code.");
View Full Code Here

Examples of org.xbill.DNS.MXRecord

        try {
            if (answers == null) {
                return servers;
            }

            MXRecord mxAnswers[] = new MXRecord[answers.length];
            for (int i = 0; i < answers.length; i++) {
                mxAnswers[i] = (MXRecord)answers[i];
            }

            Arrays.sort(mxAnswers, mxComparator);
View Full Code Here

Examples of org.xbill.DNS.MXRecord

            /* We loop once through the rawMxRecords, finding the lowest priority
             * greater than priorListPriority, and collecting all the hostnames
             * with that priority into equiPriorityList.
             */
            for (int i = 0; i < mxRecords.length; i++) {
                MXRecord thisRecord = (MXRecord)mxRecords[i];
                int thisRecordPriority = thisRecord.getPriority();
                if (thisRecordPriority > priorListPriority) {
                    if (thisRecordPriority < leastPriorityFound) {
                        equiPriorityList.clear();
                        leastPriorityFound = thisRecordPriority;
                        equiPriorityList.add(thisRecord.getTarget().toString());
                    } else if (thisRecordPriority == leastPriorityFound) {
                        equiPriorityList.add(thisRecord.getTarget().toString());
                    }
                }
            }
            priorListPriority = leastPriorityFound;
        }
View Full Code Here

Examples of org.xbill.DNS.MXRecord

        this.keeper = keeper;

        Backend jgroups = new JGroupsBackend();
        this.backends.put(Type.A, jgroups);
        this.backends.put(Type.AAAA, jgroups);
        MXRecord mx = new MXRecord(
                new Name("example.com."), DClass.IN, 30,
                1, new Name(configuration.getMX()));
        this.backends.put(Type.MX, new SimpleBackend("MX", mx));

        for (Backend backend : this.backends.values()) {
View Full Code Here

Examples of org.xbill.DNS.MXRecord

    else if (rec instanceof CNAMERecord) {
      CNAMERecord cname = (CNAMERecord) rec;
      rmap.put("alias", cname.getAlias().toString());
    }
    else if (rec instanceof MXRecord) {
      MXRecord mxrec = (MXRecord) rec;
      rmap.put("priority", mxrec.getPriority());
      rmap.put("target", mxrec.getTarget().toString());
    }
    else if (rec instanceof NSRecord) {
      NSRecord nsrec = (NSRecord) rec;
      rmap.put("target", nsrec.getTarget().toString());
    }
View Full Code Here

Examples of org.xbill.DNS.MXRecord

                                        Long prio = (Long) mxs.next();
                                        String cname = (String) mxs.next();
                                        if (cname != null) {
                                            if (cname.length() > 0 &&  !cname.endsWith(".")) cname += ".";
                                           
                                            records.add(new MXRecord(hostname,
                                                    DClass.IN, 3600, prio
                                                            .intValue(), Name
                                                            .fromString(cname)));
                                        }
                                    }
View Full Code Here

Examples of org.xbill.DNS.MXRecord

                    case Type.AAAA:
                        AAAARecord aaaa = (AAAARecord) rr[i];
                        records.add(aaaa.getAddress().getHostAddress());
                        break;
                    case Type.MX:
                        MXRecord mx = (MXRecord) rr[i];
                        records.add(mx.getTarget().toString());
                        break;
                    case Type.PTR:
                        PTRRecord ptr = (PTRRecord) rr[i];
                        records.add(IPAddr.stripDot(ptr.getTarget().toString()));
                        break;
View Full Code Here

Examples of org.xbill.DNS.MXRecord

        List servers = new ArrayList();
        if (answers == null) {
            return servers;
        }

        MXRecord mxAnswers[] = new MXRecord[answers.length];
        for (int i = 0; i < answers.length; i++) {
            mxAnswers[i] = (MXRecord)answers[i];
        }

        Arrays.sort(mxAnswers, mxComparator);
View Full Code Here

Examples of org.xbill.DNS.MXRecord

        List servers = new ArrayList();
        if (answers == null) {
            return servers;
        }

        MXRecord mxAnswers[] = new MXRecord[answers.length];
        for (int i = 0; i < answers.length; i++) {
            mxAnswers[i] = (MXRecord)answers[i];
        }

        Arrays.sort(mxAnswers, mxComparator);
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.