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:
Justin Graham 2017-01-24 11:46:30 -08:00 committed by Ben McIlwain
parent d3fe6be385
commit bb3a0c78c5
15 changed files with 155 additions and 47 deletions

View file

@ -14,8 +14,12 @@
package google.registry.whois;
import static google.registry.util.TypeUtils.getClassFromString;
import static google.registry.util.TypeUtils.instantiate;
import dagger.Module;
import dagger.Provides;
import google.registry.config.RegistryConfig.Config;
import java.io.IOException;
import java.io.Reader;
import javax.servlet.http.HttpServletRequest;
@ -26,7 +30,7 @@ import javax.servlet.http.HttpServletRequest;
* <h3>Dependencies</h3>
*
* <ul>
* <li>{@link google.registry.request.RequestModule RequestModule}
* <li>{@link google.registry.request.RequestModule RequestModule}
* </ul>
*
* @see "google.registry.module.frontend.FrontendComponent"
@ -42,4 +46,11 @@ public final class WhoisModule {
throw new RuntimeException(e);
}
}
@Provides
@Config("whoisCommandFactory")
static WhoisCommandFactory provideWhoisCommandFactory(
@Config("whoisCommandFactoryClass") String factoryClass) {
return instantiate(getClassFromString(factoryClass, WhoisCommandFactory.class));
}
}