public class Zone
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
(package private) class |
Zone.ZoneIterator |
Modifier and Type | Field and Description |
---|---|
private java.util.Map<Name,java.lang.Object> |
data |
private boolean |
hasWild |
private RRset |
NS |
private Name |
origin |
private java.lang.Object |
originNode |
static int |
PRIMARY
A primary zone
|
static int |
SECONDARY
A secondary zone
|
private static long |
serialVersionUID |
private SOARecord |
SOA |
Constructor and Description |
---|
Zone(Name zone,
int dclass,
java.lang.String remote)
Creates a Zone by performing a zone transfer to the specified host.
|
Zone(Name zone,
Record[] records)
Creates a Zone from an array of records.
|
Zone(Name zone,
java.lang.String file)
Creates a Zone from the records in the specified master file.
|
Zone(ZoneTransferIn xfrin)
Creates a Zone by doing the specified zone transfer.
|
Modifier and Type | Method and Description |
---|---|
<T extends Record> |
addRecord(T r)
Adds a Record to the Zone
|
private void |
addRRset(Name name,
RRset rrset) |
void |
addRRset(RRset rrset)
Adds an RRset to the Zone
|
private RRset[] |
allRRsets(java.lang.Object types) |
java.util.Iterator<RRset> |
AXFR()
Returns an Iterator over the RRsets in the zone that can be used to construct an AXFR response.
|
private java.lang.Object |
exactName(Name name) |
private RRset |
expandSet(RRset set,
Name tname) |
RRset |
findExactMatch(Name name,
int type)
Looks up Records in the zone, finding exact matches only.
|
SetResponse |
findRecords(Name name,
int type)
Looks up Records in the Zone.
|
private RRset |
findRRset(Name name,
int type) |
private void |
fromXFR(ZoneTransferIn xfrin) |
int |
getDClass()
Returns the Zone's class
|
RRset |
getNS()
Returns the Zone origin's NS records
|
Name |
getOrigin()
Returns the Zone's origin
|
SOARecord |
getSOA()
Returns the Zone's SOA record
|
java.util.Iterator<RRset> |
iterator()
Returns an Iterator over the RRsets in the zone.
|
private SetResponse |
lookup(Name name,
int type) |
private void |
maybeAddRecord(Record record) |
private void |
nodeToString(java.lang.StringBuffer sb,
java.lang.Object node) |
private RRset |
oneRRset(java.lang.Object types,
int type) |
void |
removeRecord(Record r)
Removes a record from the Zone
|
private void |
removeRRset(Name name,
int type) |
java.lang.String |
toMasterFile()
Returns the contents of the Zone in master file format.
|
java.lang.String |
toString()
Returns the contents of the Zone as a string (in master file format).
|
private void |
validate() |
private static final long serialVersionUID
public static final int PRIMARY
public static final int SECONDARY
private java.util.Map<Name,java.lang.Object> data
private Name origin
private java.lang.Object originNode
private RRset NS
private SOARecord SOA
private boolean hasWild
public Zone(Name zone, java.lang.String file) throws java.io.IOException
zone
- The name of the zone.file
- The master file to read from.java.io.IOException
Master
public Zone(Name zone, Record[] records) throws java.io.IOException
zone
- The name of the zone.records
- The records to add to the zone.java.io.IOException
Master
public Zone(ZoneTransferIn xfrin) throws java.io.IOException, ZoneTransferException
xfrin
- The incoming zone transfer to execute.java.io.IOException
ZoneTransferException
ZoneTransferIn
public Zone(Name zone, int dclass, java.lang.String remote) throws java.io.IOException, ZoneTransferException
java.io.IOException
ZoneTransferException
ZoneTransferIn
private void validate() throws java.io.IOException
java.io.IOException
private void maybeAddRecord(Record record) throws java.io.IOException
java.io.IOException
private void fromXFR(ZoneTransferIn xfrin) throws java.io.IOException, ZoneTransferException
java.io.IOException
ZoneTransferException
public Name getOrigin()
public RRset getNS()
public SOARecord getSOA()
public int getDClass()
private java.lang.Object exactName(Name name)
private RRset[] allRRsets(java.lang.Object types)
private RRset oneRRset(java.lang.Object types, int type)
private void removeRRset(Name name, int type)
private SetResponse lookup(Name name, int type)
public SetResponse findRecords(Name name, int type)
CNAME
instead of the actual requested
type and wildcards are expanded.name
- The name to look uptype
- The type to look upSetResponse
public RRset findExactMatch(Name name, int type)
name
- The name to look uptype
- The type to look upRRset
public void addRRset(RRset rrset)
rrset
- The RRset to be addedRRset
public <T extends Record> void addRecord(T r)
r
- The record to be addedRecord
public void removeRecord(Record r)
r
- The record to be removedRecord
public java.util.Iterator<RRset> iterator()
public java.util.Iterator<RRset> AXFR()
iterator()
except that the SOA is returned at the end as well as
the beginning.private void nodeToString(java.lang.StringBuffer sb, java.lang.Object node)
public java.lang.String toMasterFile()
public java.lang.String toString()
toString
in class java.lang.Object