org.xbill.DNS
Class Zone

java.lang.Object
  extended byorg.xbill.DNS.NameSet
      extended byorg.xbill.DNS.Zone

public class Zone
extends org.xbill.DNS.NameSet

A DNS Zone. This encapsulates all data related to a Zone, and provides convenient lookup methods.

Author:
Brian Wellington

Field Summary
protected static Object NXRRSET
           
static int PRIMARY
          A primary zone
static int SECONDARY
          A secondary zone
 
Constructor Summary
Zone(Name zone, int dclass, String remote)
          Creates a Zone by performing a zone transfer to the specified host.
Zone(Name zone, int dclass, String remote, Cache cache)
          Creates a Zone by performing a zone transfer to the specified host.
Zone(Record[] records, Cache cache, Name initialOrigin)
          Creates a Zone from an array of records.
Zone(String file, Cache cache)
          Creates a Zone from the records in the specified master file.
Zone(String file, Cache cache, Name initialOrigin)
          Creates a Zone from the records in the specified master file.
 
Method Summary
 void addRecord(Record r)
          Adds a record to the Zone
protected  void addSet(Name name, int type, org.xbill.DNS.TypedObject set)
          Adds a set associated with a name/type.
 Iterator AXFR()
          Returns an Iterator containing the RRsets of the zone that can be used to construct an AXFR.
protected  void clear()
          Deletes all sets in a NameSet
 RRset findExactMatch(Name name, int type)
          Looks up Records in the zone, finding exact matches only.
protected  Object findExactSet(Name name, int type)
          Finds all sets that exactly match.
protected  Object[] findExactSets(Name name)
          Finds all sets at a name.
 SetResponse findRecords(Name name, int type)
          Looks up Records in the Zone.
 void fromXFR(Name zone, int dclass, String remote)
           
 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
protected  Object lookup(Name name, int type)
          Finds all matching sets or something that causes the lookup to stop.
protected  void removeName(Name name)
          Removes all data associated with the given name.
 void removeRecord(Record r)
          Removes a record from the Zone
protected  void removeSet(Name name, int type, org.xbill.DNS.TypedObject set)
          Removes the given set with the name and type.
protected  void setOrigin(Name origin)
          Sets the origin of the NameSet
 String toMasterFile()
          Returns the contents of a Zone in master file format.
 String toString()
          Converts the NameSet to a String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PRIMARY

public static final int PRIMARY
A primary zone

See Also:
Constant Field Values

SECONDARY

public static final int SECONDARY
A secondary zone

See Also:
Constant Field Values

NXRRSET

protected static Object NXRRSET
Constructor Detail

Zone

public Zone(String file,
            Cache cache,
            Name initialOrigin)
     throws IOException
Creates a Zone from the records in the specified master file. All records that do not belong in the Zone are added to the specified Cache.

See Also:
Cache, Master

Zone

public Zone(Record[] records,
            Cache cache,
            Name initialOrigin)
     throws IOException
Creates a Zone from an array of records. All records that do not belong in the Zone are added to the specified Cache.

See Also:
Cache, Master

Zone

public Zone(String file,
            Cache cache)
     throws IOException
Creates a Zone from the records in the specified master file. All records that do not belong in the Zone are added to the specified Cache.

See Also:
Cache, Master

Zone

public Zone(Name zone,
            int dclass,
            String remote)
     throws IOException,
            ZoneTransferException
Creates a Zone by performing a zone transfer to the specified host.

See Also:
Master

Zone

public Zone(Name zone,
            int dclass,
            String remote,
            Cache cache)
     throws IOException
Creates a Zone by performing a zone transfer to the specified host. The cache is unused.

See Also:
Master
Method Detail

fromXFR

public void fromXFR(Name zone,
                    int dclass,
                    String remote)
             throws IOException,
                    ZoneTransferException
Throws:
IOException
ZoneTransferException

getOrigin

public Name getOrigin()
Returns the Zone's origin


getNS

public RRset getNS()
Returns the Zone origin's NS records


getSOA

public SOARecord getSOA()
Returns the Zone's SOA record


getDClass

public int getDClass()
Returns the Zone's class


findRecords

public SetResponse findRecords(Name name,
                               int type)
Looks up Records in the Zone. This follows CNAMEs and wildcards.

Parameters:
name - The name to look up
type - The type to look up
Returns:
A SetResponse object
See Also:
SetResponse

findExactMatch

public RRset findExactMatch(Name name,
                            int type)
Looks up Records in the zone, finding exact matches only.

Parameters:
name - The name to look up
type - The type to look up
Returns:
The matching RRset
See Also:
RRset

addRecord

public void addRecord(Record r)
Adds a record to the Zone

Parameters:
r - The record to be added
See Also:
Record

addSet

protected void addSet(Name name,
                      int type,
                      org.xbill.DNS.TypedObject set)
Adds a set associated with a name/type. The data contained in the set is abstract.


removeRecord

public void removeRecord(Record r)
Removes a record from the Zone

Parameters:
r - The record to be removed
See Also:
Record

AXFR

public Iterator AXFR()
Returns an Iterator containing the RRsets of the zone that can be used to construct an AXFR.


toMasterFile

public String toMasterFile()
Returns the contents of a Zone in master file format.


setOrigin

protected void setOrigin(Name origin)
Sets the origin of the NameSet


clear

protected void clear()
Deletes all sets in a NameSet


lookup

protected Object lookup(Name name,
                        int type)
Finds all matching sets or something that causes the lookup to stop.


findExactSet

protected Object findExactSet(Name name,
                              int type)
Finds all sets that exactly match. This does not traverse CNAMEs or handle Type ANY queries.


findExactSets

protected Object[] findExactSets(Name name)
Finds all sets at a name.


removeSet

protected void removeSet(Name name,
                         int type,
                         org.xbill.DNS.TypedObject set)
Removes the given set with the name and type. The data contained in the set is abstract.


removeName

protected void removeName(Name name)
Removes all data associated with the given name.


toString

public String toString()
Converts the NameSet to a String