public static String shortHostname(final String host) { final Name root = Name.fromConstantString("."); final Name hostname; try { hostname = Name.fromString(host, root); } catch (TextParseException e) { throw new IllegalArgumentException("Invalid hostname '" + host + "'"); } final ResolverConfig currentConfig = ResolverConfig.getCurrentConfig(); if (currentConfig != null) { final Name[] searchPath = currentConfig.searchPath(); if (searchPath != null) { for (final Name domain : searchPath) { if (hostname.subdomain(domain)) { return hostname.relativize(domain).toString(); } } } } return hostname.toString(); }
public SecondaryZone(String zoneName, String remoteServerAddress, String dclass) throws TextParseException { super(); this.zoneName = Name.fromString(zoneName, Name.root); this.remoteServerAddress = remoteServerAddress; this.dclass = dclass; }
public SecondaryZone(String zoneName, String remoteServerAddress, String dclass, Timestamp zoneDownloaded, Zone zone) throws TextParseException { this.zoneName = Name.fromString(zoneName, Name.root); this.remoteServerAddress = remoteServerAddress; this.dclass = dclass; this.zoneCopy = zone; this.downloaded = zoneDownloaded; }
/** * Create a new name from a string. This does not automatically make the name * absolute; it will be absolute if it has a trailing dot. This is identical * to the constructor, except that it will avoid creating new objects in some * cases. * @param s The string to be converted * @throws TextParseException The name is invalid. */ public static Name fromString(String s) throws TextParseException { return fromString(s, null); }
/** * Create a Lookup object that will find records of type A at the given name * in the IN class. * @param name The name of the desired records * @throws TextParseException The name is not a valid DNS name * @see #Lookup(Name,int,int) */ public Lookup(String name) throws TextParseException { this(Name.fromString(name), Type.A, DClass.IN); }
/** * Create a Lookup object that will find records of type A at the given name * in the IN class. * @param name The name of the desired records * @throws TextParseException The name is not a valid DNS name * @see #Lookup(Name,int,int) */ public Lookup(String name) throws TextParseException { this(Name.fromString(name), Type.A, DClass.IN); }
/** * Create a new name from a string. This does not automatically make the name * absolute; it will be absolute if it has a trailing dot. This is identical * to the constructor, except that it will avoid creating new objects in some * cases. * @param s The string to be converted * @throws TextParseException The name is invalid. */ public static Name fromString(String s) throws TextParseException { return fromString(s, null); }
public void addTSIG(final String algstr, final String namestr, final String key) throws IOException { final Name name = Name.fromString(namestr, Name.root); m_TSIGs.put(name, new TSIG(algstr, namestr, key)); }
@SuppressWarnings("unused") private void addTSIG(String algstr, String namestr, String key) throws IOException { Name name = Name.fromString(namestr, Name.root); TSIGs.put(name, new TSIG(algstr, namestr, key)); }
public void addSecondaryZone(final String zone, final String remote) throws IOException, ZoneTransferException { final Name zname = Name.fromString(zone, Name.root); final Zone newzone = new Zone(zname, DClass.IN, remote); m_znames.put(zname, newzone); }
public void addSecondaryZone(String zone, String remote) throws IOException, ZoneTransferException { Name zname = Name.fromString(zone, Name.root); Zone newzone = new Zone(zname, DClass.IN, remote); znames.put(zname, newzone); }
public void addTSIG(String algstr, String namestr, String key) throws IOException { Name name = Name.fromString(namestr, Name.root); TSIGs.put(name, new TSIG(algstr, namestr, key)); }
public void addPrimaryZone(final String zname, final String zonefile) throws IOException { Name origin = null; if (zname != null) origin = Name.fromString(zname, Name.root); final Zone newzone = new Zone(origin, zonefile); m_znames.put(newzone.getOrigin(), newzone); }
public void addPrimaryZone(String zname, String zonefile) throws IOException { Name origin = null; if (zname != null) origin = Name.fromString(zname, Name.root); Zone newzone = new Zone(origin, zonefile); znames.put(newzone.getOrigin(), newzone); }
private Name parseName(String s, Name origin) throws TextParseException { try { return Name.fromString(s, origin); } catch (TextParseException e) { throw st.exception(e.getMessage()); } }
public Name getName(String propertyName) throws AppClusterConfigurationException { try { return Name.fromString(getString(propertyName, true)); } catch(TextParseException exc) { throw new AppClusterConfigurationException(exc); } }
private Name parseName(String s, Name origin) throws TextParseException { try { return Name.fromString(s, origin); } catch (TextParseException e) { throw st.exception(e.getMessage()); } }
public void addPrimaryZone(String zname, String zonefile) throws IOException { Name origin = null; if (zname != null) { origin = Name.fromString(zname, Name.root); } final Zone newzone = new Zone(origin, zonefile); addPrimaryZone(newzone); }
private Name parseName(String s, Name origin) throws TextParseException { try { return Name.fromString(s, origin); } catch (TextParseException e) { throw st.exception(e.getMessage()); } }
@Test public void testExampleDotCom() throws Exception { Name name = Name.fromString("example.com."); Record[] records = getRegistryDNS().getRecords(name, Type.SOA); assertNotNull("example.com exists:", records); }