static HostResolver create(HeliosClient client) throws InterruptedException, ExecutionException { final ResolverConfig currentConfig = ResolverConfig.getCurrentConfig(); final Name[] path; if (currentConfig != null) { final Name[] possiblePath = currentConfig.searchPath(); if (possiblePath != null) { path = possiblePath; } else { path = EMPTY_PATH; } } else { path = EMPTY_PATH; } return new HostResolver(Sets.newHashSet(client.listHosts().get()), path); }
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 static synchronized void refreshDefault() { try { defaultResolver = new ExtendedResolver(); } catch (UnknownHostException e) { throw new RuntimeException("Failed to initialize resolver"); } defaultSearchPath = ResolverConfig.getCurrentConfig().searchPath(); defaultCaches = new HashMap(); }
public static synchronized void refreshDefault() { try { defaultResolver = new ExtendedResolver(); } catch (UnknownHostException e) { throw new RuntimeException("Failed to initialize resolver"); } defaultSearchPath = ResolverConfig.getCurrentConfig().searchPath(); defaultCaches = new HashMap(); defaultNdots = ResolverConfig.getCurrentConfig().ndots(); }
static HostResolver create(HeliosClient client) throws InterruptedException, ExecutionException { final ResolverConfig currentConfig = ResolverConfig.getCurrentConfig(); final Name[] path; if (currentConfig != null) { final Name[] possiblePath = currentConfig.searchPath(); if (possiblePath != null) { path = possiblePath; } else { path = EMPTY_PATH; } } else { path = EMPTY_PATH; } return new HostResolver(Sets.newHashSet(client.listHosts().get()), path); }
public static synchronized void refreshDefault() { try { defaultResolver = new ExtendedResolver(); } catch (UnknownHostException e) { throw new RuntimeException("Failed to initialize resolver"); } defaultSearchPath = ResolverConfig.getCurrentConfig().searchPath(); defaultCaches = new HashMap(); defaultNdots = ResolverConfig.getCurrentConfig().ndots(); }
public static synchronized void refreshDefault() { try { defaultResolver = new ExtendedResolver(); } catch (UnknownHostException e) { throw new RuntimeException("Failed to initialize resolver"); } defaultSearchPath = ResolverConfig.getCurrentConfig().searchPath(); defaultCaches = new HashMap(); defaultNdots = ResolverConfig.getCurrentConfig().ndots(); }
Name[] systemSearchPath = ResolverConfig.getCurrentConfig().searchPath(); if (systemSearchPath != null && systemSearchPath.length > 0) { sPaths.addAll(Arrays.asList(systemSearchPath));
Name[] systemSearchPath = ResolverConfig.getCurrentConfig().searchPath(); if (systemSearchPath != null && systemSearchPath.length > 0) { sPaths.addAll(Arrays.asList(systemSearchPath));
Lookup.setDefaultResolver(resolver); Lookup.setDefaultSearchPath(ResolverConfig.getCurrentConfig() .searchPath());
/** * Gets the search path that will be used as the default by future Lookups. * * @return The default search path. */ public static synchronized Name[] getDefaultSearchPath() { if (defaultSearchPath == null) { Name[] configuredSearchPath = ResolverConfig.getCurrentConfig().searchPath(); defaultSearchPath = new Name[(configuredSearchPath != null ? configuredSearchPath.length : 0) + defaultQuerier.getMulticastDomains().length]; int startPos = 0; if (configuredSearchPath != null) { defaultSearchPath = new Name[configuredSearchPath.length + defaultQuerier.getMulticastDomains().length]; System.arraycopy(configuredSearchPath, 0, defaultSearchPath, startPos, configuredSearchPath.length); startPos = configuredSearchPath.length; } else { defaultSearchPath = new Name[defaultQuerier.getMulticastDomains().length]; } System.arraycopy(defaultQuerier.getMulticastDomains(), 0, defaultSearchPath, startPos, defaultQuerier.getMulticastDomains().length); } return defaultSearchPath; }
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 (Name domain : searchPath) { if (hostname.subdomain(domain)) { return hostname.relativize(domain).toString(); } } } } return hostname.toString(); }