Package org.xbill.DNS

Examples of org.xbill.DNS.Update


    public void refuseUnimplementedOpcodes() throws Exception {
        final List<Message> replies = new LinkedList<Message>();

        Name zone = Name.fromString("dyn.test.example.");
        Name host = Name.fromString("host", zone);
        Update message = new Update(zone);
        message.replace(host, Type.A, 3600, "1.2.3.4");

        Query query = TestUtils.getQuery(replies, message);
        ResolveTask task = new ResolveTask(query);
        task.setCache(TestUtils.getEhcache());
        task.setBackendStore(new BackendRepository() {
View Full Code Here


      final String[] registrationDomains = getRegistrationDomains(serviceID.getServiceTypeID());
   
      for (int i = 0; i < registrationDomains.length; i++) {
        final Name zone = new Name(registrationDomains[i]);
        final Name fqdn = new Name(name.toString() + "." + zone.toString()); //$NON-NLS-1$
        final Update update = new Update(zone);

        //TYPE.SRV
        if(mode == ADD) {
          //TODO add absent/present condition checks
          update.replace(srvRecord.withName(fqdn));
        } else {
          update.delete(srvRecord.withName(fqdn));
        }
       
        //TYPE.TXT
        for (int j = 0; j < txtRecords.length; j++) {
          if(mode == ADD) {
            update.add(txtRecords[j].withName(fqdn));
          } else {
            update.delete(txtRecords[j].withName(fqdn));
          }
        }
       
        // set up a the resolver for the given domain (a scope might use different domains)
        final Collection dnsServers = getUpdateDomain(zone);
View Full Code Here

    List records  = xfr.run();
    for (Iterator itr = records.iterator(); itr.hasNext();) {
      Record record = (Record) itr.next();
      String name = record.getName().toString();
      if(name.startsWith("_" + DnsSdTestHelper.REG_SCHEME + "._" + DnsSdTestHelper.PROTO)) {
        Update update = new Update(Name.fromString(DnsSdTestHelper.REG_DOMAIN + "."));
        update.delete(record);
        SimpleResolver resolver = new SimpleResolver(DnsSdTestHelper.DNS_SERVER);
        resolver.setTCP(true);
        resolver.setTSIGKey(new TSIG(DnsSdTestHelper.TSIG_KEY_NAME, DnsSdTestHelper.TSIG_KEY));
        Message response = resolver.send(update);
        int rcode = response.getRcode();
View Full Code Here

  private void createTXTRecords() throws TextParseException, IOException,
      UnknownHostException {
    final Name zone = Name.fromString(DnsSdTestHelper.REG_DOMAIN + ".");
    final Name name = Name.fromString("_" + DnsSdTestHelper.REG_SCHEME + "._" + DnsSdTestHelper.PROTO, zone);

    Update update = null;
   
    final IServiceProperties properties = serviceInfo.getServiceProperties();
    final Enumeration enumeration = properties.getPropertyNames();
    while (enumeration.hasMoreElements()) {
      final Object property = enumeration.nextElement();
      final String key = property.toString();
      final String value = (String) properties.getProperty(key).toString();
      final Record record = Record.fromString(name, Type.TXT, DClass.IN,
          serviceInfo.getTTL(), key + "=" + value, zone);
      update = new Update(zone);
      update.add(record);
    }
    final SimpleResolver resolver = new SimpleResolver(DnsSdTestHelper.DNS_SERVER);
    resolver.setTCP(true);
    resolver.setTSIGKey(new TSIG(DnsSdTestHelper.TSIG_KEY_NAME, DnsSdTestHelper.TSIG_KEY));
    final Message response = resolver.send(update);
View Full Code Here

    final String s = serviceInfo.getPriority() + " " +
      serviceInfo.getWeight() + " " +
      serviceInfo.getLocation().getPort() + " " +
      serviceInfo.getLocation().getHost() + ".";
    final Record record = Record.fromString(type, Type.SRV, DClass.IN, DnsSdTestHelper.TTL, s, zone);
    final Update update = new Update(zone);
    update.add(record);
    final SimpleResolver resolver = new SimpleResolver(DnsSdTestHelper.DNS_SERVER);
    resolver.setTCP(true);
    resolver.setTSIGKey(new TSIG(DnsSdTestHelper.TSIG_KEY_NAME, DnsSdTestHelper.TSIG_KEY));
    final Message response = resolver.send(update);
    final int rcode = response.getRcode();
View Full Code Here

TOP

Related Classes of org.xbill.DNS.Update

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.