Package org.xbill.DNS

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


        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

    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

                                        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

                    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

        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

        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

        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];
            }

            Comparator prioritySort = new Comparator () {
                    public int compare (Object a, Object b) {
                        MXRecord ma = (MXRecord)a;
                        MXRecord mb = (MXRecord)b;
                        return ma.getPriority () - mb.getPriority ();
                    }
                };

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

        int currentPrio = -1;
        List<String> samePrio = new ArrayList<String>();
        for (int i = 0; i < mxAnswers.length; i++) {
            boolean same = false;
            boolean lastItem = i + 1 == mxAnswers.length;
            MXRecord mx = mxAnswers[i];
            if (i == 0) {
                currentPrio = mx.getPriority();
            } else {
                same = currentPrio == mx.getPriority();
            }

            String mxRecord = mx.getTarget().toString();
            if (same) {
                samePrio.add(mxRecord);
            } else {
                // shuffle entries with same prio
                // JAMES-913
View Full Code Here

  }

  @Override
  protected MXRecord createRecord(final Name name, final int dclass,
      final long ttl, final ObjectNode recordNode) {
    return new MXRecord(name, dclass, ttl, getNodeIntegerValue(recordNode,
        "priority"), getNodeNameValue(recordNode, "target"));
  }
View Full Code Here

TOP

Related Classes of org.xbill.DNS.MXRecord

Copyright © 2018 www.massapicom. 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.