Package org.xbill.DNS

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


                    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

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

                });
                // Create records collection
                recordsColl = new Vector<URLName>(records.length);
                for (int i = 0; i < records.length; i++)
        {
          MXRecord mx = (MXRecord) records[i];
          String targetString = mx.getTarget().toString();
          URLName uName = new URLName(
              RemoteDelivery.SMTPScheme +
              targetString.substring(0, targetString.length() - 1)
          );
          recordsColl.add(uName);
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

        List<String> servers = new ArrayList<String>();
        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

                });
                // Create records collection
                recordsColl = new Vector<URLName>(records.length);
                for (int i = 0; i < records.length; i++)
        {
          MXRecord mx = (MXRecord) records[i];
          String targetString = mx.getTarget().toString();
          URLName uName = new URLName(
              SMTP_PROTOCOL_PREFIX +
              targetString.substring(0, targetString.length() - 1)
          );
          recordsColl.add(uName);
View Full Code Here

    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

      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

        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

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.