mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 00:47:11 +02:00
Add framework for customizable WHOIS commands
With some additional changes by Ben McIlwain. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=145447136
This commit is contained in:
parent
d3fe6be385
commit
bb3a0c78c5
15 changed files with 155 additions and 47 deletions
|
@ -26,18 +26,23 @@ public final class Whois {
|
|||
|
||||
private final Clock clock;
|
||||
private final String disclaimer;
|
||||
private final WhoisCommandFactory commandFactory;
|
||||
|
||||
@Inject
|
||||
public Whois(Clock clock, @Config("whoisDisclaimer") String disclaimer) {
|
||||
public Whois(
|
||||
Clock clock,
|
||||
@Config("whoisDisclaimer") String disclaimer,
|
||||
@Config("whoisCommandFactory") WhoisCommandFactory commandFactory) {
|
||||
this.clock = clock;
|
||||
this.disclaimer = disclaimer;
|
||||
this.commandFactory = commandFactory;
|
||||
}
|
||||
|
||||
/** Performs a WHOIS lookup on a plaintext query string. */
|
||||
public String lookup(String query, boolean preferUnicode) {
|
||||
DateTime now = clock.nowUtc();
|
||||
try {
|
||||
return new WhoisReader(new StringReader(query), now)
|
||||
return new WhoisReader(new StringReader(query), commandFactory, now)
|
||||
.readCommand()
|
||||
.executeQuery(now)
|
||||
.getPlainTextOutput(preferUnicode, disclaimer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue