/** * Creates a new Message to contain a dynamic update. A random Message ID * and the zone are filled in. * @param zone The zone to be updated */ public static Message newUpdate(Name zone) { return new Update(zone); }
/** * Indicates that the records should be inserted into the zone replacing any * other records with the same name and type as each one. */ public void replace(Record [] records) { for (int i = 0; i < records.length; i++) replace(records[i]); }
/** * Parses a record from the string, and indicates that the record * should be inserted into the zone replacing any other records with the * same name and type. * @throws IOException The record could not be parsed. */ public void replace(Name name, int type, long ttl, String record) throws IOException { delete(name, type); add(name, type, ttl, record); }
private void doUpdate(AdapterOperation op) { OnmsNode node = null; LOG.debug("doUpdate: operation: {}", op.getType().name()); try { node = m_nodeDao.get(op.getNodeId()); if (node == null) { doDelete(op); return; } DnsRecord record = new DnsRecord(node,m_level); LOG.debug("doUpdate: DnsRecord: hostname: {} zone: {} ip address {}", record.getIp().getHostAddress(), record.getHostname(), record.getZone()); DnsRecord oldRecord = m_nodeDnsRecordMap.get(Integer.valueOf(node.getId())); Update update = new Update(Name.fromString(record.getZone())); if (oldRecord != null && oldRecord.getHostname() != record.getHostname()) { update.delete(Name.fromString(oldRecord.getHostname()), Type.A); } update.replace(Name.fromString(record.getHostname()), Type.A, 3600, record.getIp().getHostAddress()); m_resolver.send(update); m_nodeDnsRecordMap.put(Integer.valueOf(op.getNodeId()), record); } catch (Throwable e) { LOG.error("addNode: Error handling node added event.", e); sendAndThrow(op.getNodeId(), e); } }
/** * Inserts a prerequisite that the specified record exists. Due to the way * value-dependent prequisites work, the condition that must be met is that * the set of all records with the same and type in the update message must * be identical to the set of all records with that name and type on the server. */ public void present(Record record) { newPrereq(record); }
/** * Indicates that the record should be inserted into the zone. */ public void add(Record record) { newUpdate(record); }
/** * Creates an update message. * @param zone The name of the zone being updated. * @param dclass The class of the zone being updated. */ public Update(Name zone, int dclass) { super(); if (!zone.isAbsolute()) throw new RelativeNameException(zone); DClass.check(dclass); getHeader().setOpcode(Opcode.UPDATE); Record soa = Record.newRecord(zone, Type.SOA, DClass.IN); addRecord(soa, Section.QUESTION); this.origin = zone; this.dclass = dclass; }
private void doDelete(AdapterOperation op) { try { DnsRecord record = m_nodeDnsRecordMap.get(Integer.valueOf(op.getNodeId())); if (record != null) { Update update = new Update(Name.fromString(record.getZone())); update.delete(Name.fromString(record.getHostname()), Type.A); m_resolver.send(update); m_nodeDnsRecordMap.remove(Integer.valueOf(op.getNodeId())); } } catch (Throwable e) { LOG.error("deleteNode: Error handling node deleted event.", e); sendAndThrow(op.getNodeId(), e); } }
private void doUpdate(AdapterOperation op) { LOG.debug("doUpdate: operation: {}", op.getType().name()); for (ReverseDnsRecord record : m_reverseDnsProvisioningAdapterService.get(op.getNodeId()) ) { LOG.debug("doUpdate: ReverseDnsRecord: hostname: {} zone: {} ip address: {}", record.getIp().getHostAddress(), record.getHostname(), record.getZone()); try { Update update = new Update(Name.fromString(record.getZone())); Name ptrRecord=ReverseMap.fromAddress(record.getIp()); update.replace(ptrRecord, Type.PTR, 3600, record.getHostname()); m_resolver.send(update); m_reverseDnsProvisioningAdapterService.update(op.getNodeId(),record); } catch (Exception e) { LOG.error("updateNode: Error handling updated event.", e); sendAndThrow(op.getNodeId(), e); } } }
private void newPrereq(Record rec) { addRecord(rec, Section.PREREQ); }
/** * Indicates that the records should be inserted into the zone. */ public void add(Record [] records) { for (int i = 0; i < records.length; i++) add(records[i]); }
/** * Indicates that the records should be deleted from the zone. */ public void delete(Record [] records) { for (int i = 0; i < records.length; i++) delete(records[i]); }
final Update[] updates = new Update[] {new Update(domain), new Update(domain)}; Name fullTypeName = new Name(serviceName.getFullType() + "." + domain); Name typeName = new Name(serviceName.getType() + "." + domain); updates[0].add(record); updates[0].addRecord(record, Section.ADDITIONAL); updates[1].add(record);
/** * Inserts a prerequisite that the specified record exists. Due to the way * value-dependent prequisites work, the condition that must be met is that * the set of all records with the same and type in the update message must * be identical to the set of all records with that name and type on the server. */ public void present(Record record) { newPrereq(record); }
/** * Indicates that the record should be inserted into the zone. */ public void add(Record record) { newUpdate(record); }
/** * Creates an update message. * @param zone The name of the zone being updated. * @param dclass The class of the zone being updated. */ public Update(Name zone, int dclass) { super(); if (!zone.isAbsolute()) throw new RelativeNameException(zone); DClass.check(dclass); getHeader().setOpcode(Opcode.UPDATE); Record soa = Record.newRecord(zone, Type.SOA, DClass.IN); addRecord(soa, Section.QUESTION); this.origin = zone; this.dclass = dclass; }
private void newUpdate(Record rec) { addRecord(rec, Section.UPDATE); }
/** * Indicates that the records should be inserted into the zone. */ public void add(Record [] records) { for (int i = 0; i < records.length; i++) add(records[i]); }
/** * Indicates that the records should be deleted from the zone. */ public void delete(Record [] records) { for (int i = 0; i < records.length; i++) delete(records[i]); }