Add WHOIS disclaimer text to ConfigModule

This fixes #23 for @parsoj by allowing a custom disclaimer to be
specified via dependency injection modules.

By making the disclaimer part of the dependency injection graph, it can
come from anywhere.

For example, if I was Donuts, I would have my own repository. I'd use an
external http_archive() repository for Domain Registry. Then I would
write my own Dagger @Component for each App Engine module. My Component
would have a list of Dagger Modules, which I copied from the Domain
Registry version. Then I would swap out ConfigModule with my own
DonutsConfigModule, which provides the same values.

So long as a method exists that @Provides @Config("whoisRegistry"), and
the module containing it is listed in the @Component, the dependency
injection graph becomes valid and complete for the whois package
(provided other dependencies are met.)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=128082921
This commit is contained in:
Justine Tunney 2016-07-21 11:18:06 -07:00
parent 2c9567e183
commit e82a40a2fb
34 changed files with 149 additions and 310 deletions

View file

@ -28,7 +28,26 @@ import org.joda.money.CurrencyUnit;
import org.joda.time.DateTimeConstants;
import org.joda.time.Duration;
/** Dagger module for injecting configuration settings. */
/**
* Configuration example for the Domain Registry codebase.
*
* <p>The Domain Registry codebase contains many classes that inject configurable settings. This is
* the centralized class that is used by default to configure them all, in hard-coded type-safe
* Java code.
*
* <p>This class does not represent the total configuration of the Domain Registry service. It's
* <b>only meant for settings that need to be configured <i>once</i></b>. Settings which may
* be subject to change in the future, should instead be retrieved from Datastore. The
* {@link google.registry.model.registry.Registry Registry} class is one such example of this.
*
* <h3>Customization</h3>
*
* <p>It is recommended that users do not modify this file within a forked repository. It is
* preferable to modify these settings by swapping out this module with a separate copied version
* in the user's repository. For this to work, other files need to be copied too, such as
* {@link google.registry.module.backend.BackendComponent BackendComponent}. This allows modules to
* be substituted at the {@code @Component} level.
*/
@Module
public final class ConfigModule {
@ -563,4 +582,27 @@ public final class ConfigModule {
return "tzcyzvm3mn7zkdnx";
}
}
/**
* Disclaimer displayed at the end of WHOIS query results.
*
* @see google.registry.whois.WhoisResponse
*/
@Provides
@Config("whoisDisclaimer")
public static String provideWhoisDisclaimer() {
return "WHOIS information is provided by Charleston Road Registry Inc. (CRR) solely for\n"
+ "query-based, informational purposes. By querying our WHOIS database, you are\n"
+ "agreeing to comply with these terms\n"
+ "(http://www.registry.google/about/whois-disclaimer.html) so please read them\n"
+ "carefully. Any information provided is \"as is\" without any guarantee of\n"
+ "accuracy. You may not use such information to (a) allow, enable, or otherwise\n"
+ "support the transmission of mass unsolicited, commercial advertising or\n"
+ "solicitations; (b) enable high volume, automated, electronic processes that\n"
+ "access the systems of CRR or any ICANN-Accredited Registrar, except as\n"
+ "reasonably necessary to register domain names or modify existing registrations;\n"
+ "or (c) engage in or support unlawful behavior. CRR reserves the right to\n"
+ "restrict or deny your access to the Whois database, and may modify these terms\n"
+ "at any time.\n";
}
}