Change second-level domain name to fully-qualified domain name

Second-level domain name isn't accurate because we support multi-part
TLDs, so standardize on the "fullyQualifiedDomainName" name that is
used throughout the code base.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122693009
This commit is contained in:
mcilwain 2016-05-18 19:16:27 -07:00 committed by Ben McIlwain
parent ca0e546230
commit a2d2764115
14 changed files with 58 additions and 49 deletions

View file

@ -23,7 +23,7 @@ import static google.registry.util.CollectionUtils.nullToEmpty;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableSortedCopy;
import static google.registry.util.CollectionUtils.union;
import static google.registry.util.DomainNameUtils.getTldFromSld;
import static google.registry.util.DomainNameUtils.getTldFromDomainName;
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
import com.google.common.base.Function;
@ -237,7 +237,7 @@ public abstract class DomainBase extends EppResource {
checkArgumentNotNull(
emptyToNull(instance.fullyQualifiedDomainName), "Missing fullyQualifiedDomainName");
checkArgumentNotNull(instance.registrant, "Missing registrant");
instance.tld = getTldFromSld(instance.fullyQualifiedDomainName);
instance.tld = getTldFromDomainName(instance.fullyQualifiedDomainName);
instance.allContacts = union(
instance.getContacts(),
DesignatedContact.create(REGISTRANT, instance.registrant.getLinked()));

View file

@ -23,9 +23,12 @@ import org.joda.time.DateTime;
public interface PricingEngine {
/**
* Returns the premium price for the given second-level domain name at the given time for the
* given registrar, or absent if the domain name isn't premium.
* Returns the premium price for the given domain name at the given time for the given registrar,
* or absent if the domain name isn't premium.
*
* <p>Note that fullyQualifiedDomainName must not include any subdomains. It should be a single
* level above the TLD (which may be multi-part).
*/
public Optional<Money> getPremiumPrice(
String secondLevelDomainName, DateTime priceTime, String clientIdentifier);
String fullyQualifiedDomainName, DateTime priceTime, String clientIdentifier);
}

View file

@ -16,7 +16,7 @@ package google.registry.model.pricing;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import static google.registry.util.DomainNameUtils.getTldFromSld;
import static google.registry.util.DomainNameUtils.getTldFromDomainName;
import com.google.common.base.Optional;
import com.google.common.net.InternetDomainName;
@ -36,10 +36,10 @@ public final class StaticPremiumListPricingEngine implements PricingEngine {
@Override
public Optional<Money> getPremiumPrice(
String secondLevelDomainName, DateTime priceTime, String clientIdentifier) {
String fullyQualifiedDomainName, DateTime priceTime, String clientIdentifier) {
// Note that clientIdentifier and priceTime are not used for determining premium pricing for
// static premium lists.
String tld = getTldFromSld(secondLevelDomainName);
String tld = getTldFromDomainName(fullyQualifiedDomainName);
Registry registry = Registry.get(checkNotNull(tld, "tld"));
if (registry.getPremiumList() == null) {
return Optional.<Money>absent();
@ -47,7 +47,7 @@ public final class StaticPremiumListPricingEngine implements PricingEngine {
String listName = registry.getPremiumList().getName();
Optional<PremiumList> premiumList = PremiumList.get(listName);
checkState(premiumList.isPresent(), "Could not load premium list: %s", listName);
String label = InternetDomainName.from(secondLevelDomainName).parts().get(0);
String label = InternetDomainName.from(fullyQualifiedDomainName).parts().get(0);
return premiumList.get().getPremiumPrice(label);
}
}

View file

@ -22,6 +22,7 @@ import static com.google.common.collect.Maps.filterValues;
import static google.registry.model.common.EntityGroupRoot.getCrossTldKey;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.util.CacheUtils.memoizeWithShortExpiration;
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
import com.google.common.base.Optional;
import com.google.common.base.Supplier;
@ -92,7 +93,7 @@ public final class Registries {
*
* <p><b>Note:</b> This routine will only work on names under TLDs for which this registry is
* authoritative. To extract TLDs from domains (not hosts) that other registries control, use
* {@link google.registry.util.DomainNameUtils#getTldFromSld(String)
* {@link google.registry.util.DomainNameUtils#getTldFromDomainName(String)
* DomainNameUtils#getTldFromDomainName}.
*
* @param domainName domain name or host name (but not TLD) under an authoritative TLD
@ -114,7 +115,7 @@ public final class Registries {
* match exists.
*/
public static InternetDomainName findTldForNameOrThrow(InternetDomainName domainName) {
return checkNotNull(
return checkArgumentNotNull(
findTldForName(domainName).orNull(),
"Domain name is not under a recognized TLD: %s", domainName.toString());
}

View file

@ -158,7 +158,10 @@ public class Registry extends ImmutableObject implements Buildable {
*/
QUIET_PERIOD,
/** The steady state of a TLD in which all SLDs are available via first-come, first-serve. */
/**
* The steady state of a TLD in which all domain names are available via first-come,
* first-serve.
*/
GENERAL_AVAILABILITY,
/** A "fake" state for use in predelegation testing. Acts like {@link #GENERAL_AVAILABILITY}. */