mv com/google/domain/registry google/registry

This change renames directories in preparation for the great package
rename. The repository is now in a broken state because the code
itself hasn't been updated. However this should ensure that git
correctly preserves history for each file.
This commit is contained in:
Justine Tunney 2016-05-13 18:55:08 -04:00
parent a41677aea1
commit 5012893c1d
2396 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,23 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.domain.registry.model.domain.launch;
import com.google.domain.registry.model.eppinput.EppInput.CommandExtension;
/** Marker interface for EPP extensions which override the EPP notion of id with their own. */
public interface ApplicationIdTargetExtension extends CommandExtension {
/** Get the application id to use as the resource id for commands using this extension. */
String getApplicationId();
}

View file

@ -0,0 +1,58 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.domain.registry.model.domain.launch;
import static com.google.common.base.CaseFormat.LOWER_CAMEL;
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
import com.google.domain.registry.model.translators.EnumToAttributeAdapter;
import com.google.domain.registry.model.translators.EnumToAttributeAdapter.EppEnum;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* Represents the EPP application status.
* <p>
* These values are never read from a command and only used in responses, so, we don't need to model
* anything we don't output. We don't model the CUSTOM status because we don't use it. This allows
* us to also avoid modeling the "name" attribute which is only used with CUSTOM. We don't model the
* "lang" attribute because we only support English and that's the default.
* <p>
* Given all of this, we can use {@link EnumToAttributeAdapter} to make this code very simple.
*
* @see "http://tools.ietf.org/html/draft-tan-epp-launchphase-11#section-2.3"
*/
@XmlJavaTypeAdapter(EnumToAttributeAdapter.class)
public enum ApplicationStatus implements EppEnum {
ALLOCATED,
INVALID,
PENDING_ALLOCATION,
PENDING_VALIDATION,
REJECTED,
VALIDATED;
@Override
public String getXmlName() {
return UPPER_UNDERSCORE.to(LOWER_CAMEL, name());
}
/**
* Returns true if this status is a final status - that is, it should not transition to any other
* application status after this one.
*/
public boolean isFinalStatus() {
return ALLOCATED.equals(this) || REJECTED.equals(this);
}
}

View file

@ -0,0 +1,83 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.domain.registry.model.domain.launch;
import static com.google.common.base.MoreObjects.firstNonNull;
import com.google.domain.registry.model.ImmutableObject;
import com.google.domain.registry.model.eppinput.EppInput.CommandExtension;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlRootElement;
/**
* An XML data object that represents a launch extension that may be present on EPP domain check
* commands.
* <p>
* This object holds XML data which JAXB will unmarshal from an EPP domain check command extension.
* The XML will have the following enclosing structure:
*
* <pre> {@code
* <epp>
* <command>
* <create>
* <!-- domain check XML data -->
* </create>
* <extension>
* <launch:check>
* <!-- launch check XML payload data -->
* </launch:check>
* </extension>
* </command>
* </epp>
* } </pre>
*
* @see CommandExtension
*/
@XmlRootElement(name = "check")
public class LaunchCheckExtension extends ImmutableObject implements CommandExtension {
/** The default check type is "claims" if not specified. */
private static final CheckType DEFAULT_CHECK_TYPE = CheckType.CLAIMS;
/** Type of domain check being requested. */
public enum CheckType {
/** A check to see if the specified domain names are available to be provisioned. */
@XmlEnumValue("avail")
AVAILABILITY,
/** A check to see if there are matching trademarks on the specified domain names. */
@XmlEnumValue("claims")
CLAIMS;
}
/**
* The launch phase this command is intended to run against. If it does not match the server's
* current launch phase, the command will be rejected.
*/
LaunchPhase phase;
@XmlAttribute
CheckType type;
public CheckType getCheckType() {
return firstNonNull(type, DEFAULT_CHECK_TYPE);
}
public LaunchPhase getPhase() {
return phase;
}
}

View file

@ -0,0 +1,94 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.domain.registry.model.domain.launch;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.domain.registry.model.ImmutableObject;
import com.google.domain.registry.model.eppoutput.Response.ResponseExtension;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
/**
* An XML data object that represents a launch extension that may be present on the response to EPP
* domain check commands.
*/
@XmlRootElement(name = "chkData")
@XmlType(propOrder = {"phase", "launchChecks"})
public class LaunchCheckResponseExtension extends ImmutableObject implements ResponseExtension {
/** The launch phase that this domain check was run against. */
LaunchPhase phase;
/** Check responses. */
@XmlElement(name = "cd")
ImmutableList<LaunchCheck> launchChecks;
@VisibleForTesting
public LaunchPhase getPhase() {
return phase;
}
@VisibleForTesting
public ImmutableList<LaunchCheck> getChecks() {
return launchChecks;
}
/** The response for a check on a single resource. */
public static class LaunchCheck extends ImmutableObject {
/** An element containing the name and availability of a resource. */
LaunchCheckName name;
/** A key used to generate a Trademark Claims Notice. Only returned on claims checks. */
String claimKey;
public static LaunchCheck create(LaunchCheckName name, String claimKey) {
LaunchCheck instance = new LaunchCheck();
instance.name = name;
instance.claimKey = claimKey;
return instance;
}
}
/** Holds the name and availability of a checked resource. */
public static class LaunchCheckName extends ImmutableObject {
/** Whether the resource is available. */
@XmlAttribute
boolean exists;
/** The name of the resource being checked. */
@XmlValue
String name;
public static LaunchCheckName create(boolean exists, String name) {
LaunchCheckName instance = new LaunchCheckName();
instance.exists = exists;
instance.name = name;
return instance;
}
}
public static LaunchCheckResponseExtension create(
LaunchPhase phase, ImmutableList<LaunchCheck> launchChecks) {
LaunchCheckResponseExtension instance = new LaunchCheckResponseExtension();
instance.phase = phase;
instance.launchChecks = launchChecks;
return instance;
}
}

View file

@ -0,0 +1,117 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.domain.registry.model.domain.launch;
import static com.google.domain.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
import com.google.common.collect.ImmutableList;
import com.google.domain.registry.model.eppinput.EppInput.CommandExtension;
import com.google.domain.registry.model.smd.AbstractSignedMark;
import com.google.domain.registry.model.smd.EncodedSignedMark;
import com.google.domain.registry.model.smd.SignedMark;
import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementRefs;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlRootElement;
/**
* An XML data object that represents a launch extension that may be present on EPP domain create
* commands.
* <p>
* This object holds XML data which JAXB will unmarshal from an EPP domain create command extension.
* The XML will have the following enclosing structure:
*
* <pre> {@code
* <epp>
* <command>
* <create>
* <!-- domain create XML data -->
* </create>
* <extension>
* <launch:create>
* <!-- launch create XML payload data -->
* </launch:create>
* </extension>
* </command>
* </epp>
* } </pre>
*
* @see CommandExtension
*/
@XmlRootElement(name = "create")
public class LaunchCreateExtension extends LaunchExtension implements CommandExtension {
/** Type of domain creation being requested. */
public enum CreateType {
/**
* A Launch Application refers to a registration made during a launch phase when the server
* accepts multiple applications for the same domain name.
*/
@XmlEnumValue("application")
APPLICATION,
/**
* A Launch Registration refers to a registration made during a launch phase when the server
* uses a "first-come, first-served" model.
*/
@XmlEnumValue("registration")
REGISTRATION;
}
@XmlAttribute
CreateType type;
/**
* A list of signed marks or encoded signed marks which assert the client's ability to register
* the specified domain name. Each one contains both a Mark object with information about its
* claim(s), and an XML signature over that mark object which is cryptographically signed. This is
* used in the "signed mark" validation model.
*/
@XmlElementRefs({
@XmlElementRef(type = EncodedSignedMark.class),
@XmlElementRef(type = SignedMark.class)})
List<AbstractSignedMark> signedMarks;
/**
* A CodeMark is an abstract entity which contains either a secret code or a mark (or both) to
* assert its ability to register a particular mark. It is used in the "code", "mark", and "code
* with mark" validation models, none of which are supported by this codebase at this time. As
* such, it is stored only as an Object to mark its existence, but not further unmarshaled.
*/
List<Object> codeMark;
/** The claims notice for this create, required if creating a domain with a claimed label. */
LaunchNotice notice;
public CreateType getCreateType() {
return type;
}
public ImmutableList<AbstractSignedMark> getSignedMarks() {
return nullToEmptyImmutableCopy(signedMarks);
}
public boolean hasCodeMarks() {
return codeMark != null && !codeMark.isEmpty();
}
public LaunchNotice getNotice() {
return notice;
}
}

View file

@ -0,0 +1,32 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.domain.registry.model.domain.launch;
import com.google.domain.registry.model.eppoutput.Response.ResponseExtension;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* An XML data object that represents a launch extension that may be present on the response to EPP
* domain application create commands.
*/
@XmlRootElement(name = "creData")
@XmlType(propOrder = {"phase", "applicationId"})
public class LaunchCreateResponseExtension extends LaunchExtension implements ResponseExtension {
/** Builder for {@link LaunchCreateResponseExtension}. */
public static class Builder
extends LaunchExtension.Builder<LaunchCreateResponseExtension, Builder> {}
}

View file

@ -0,0 +1,25 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.domain.registry.model.domain.launch;
import javax.xml.bind.annotation.XmlRootElement;
/**
* An XML data object that represents a launch extension that may be present on EPP domain delete
* commands.
*/
@XmlRootElement(name = "delete")
public class LaunchDeleteExtension
extends LaunchExtension implements ApplicationIdTargetExtension {}

View file

@ -0,0 +1,58 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.domain.registry.model.domain.launch;
import com.google.domain.registry.model.Buildable.GenericBuilder;
import com.google.domain.registry.model.ImmutableObject;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
/**
* A launch extension which can be passed in to domain update and delete, and also returned from
* domain create.
*/
@XmlTransient
public abstract class LaunchExtension extends ImmutableObject {
/** The launch phase that this domain application was created in. */
LaunchPhase phase;
/** Application ID of the domain application. */
@XmlElement(name = "applicationID")
String applicationId;
public LaunchPhase getPhase() {
return phase;
}
public String getApplicationId() {
return applicationId;
}
/** A builder for constructing {@link LaunchExtension}. */
public static class Builder<T extends LaunchExtension, B extends Builder<?, ?>>
extends GenericBuilder<T, B> {
public B setPhase(LaunchPhase phase) {
getInstance().phase = phase;
return thisCastToDerived();
}
public B setApplicationId(String applicationId) {
getInstance().applicationId = applicationId;
return thisCastToDerived();
}
}
}

View file

@ -0,0 +1,35 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.domain.registry.model.domain.launch;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
/**
* An XML data object that represents a launch extension that may be present on EPP domain info
* commands.
*/
@XmlRootElement(name = "info")
public class LaunchInfoExtension
extends LaunchExtension implements ApplicationIdTargetExtension {
/** Whether or not to include mark information in the response. */
@XmlAttribute
Boolean includeMark;
public Boolean getIncludeMark() {
return includeMark;
}
}

View file

@ -0,0 +1,59 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.domain.registry.model.domain.launch;
import com.google.common.collect.ImmutableList;
import com.google.domain.registry.model.eppoutput.Response.ResponseExtension;
import com.google.domain.registry.model.mark.Mark;
import com.googlecode.objectify.annotation.Embed;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* An XML data object that represents a launch extension that may be present on the response to EPP
* domain application info commands.
*/
@Embed
@XmlRootElement(name = "infData")
@XmlType(propOrder = { "phase", "applicationId", "applicationStatus", "marks"})
public class LaunchInfoResponseExtension extends LaunchExtension implements ResponseExtension {
/** The current status of this application. */
@XmlElement(name = "status")
ApplicationStatus applicationStatus;
/** The marks associated with this application. */
@XmlElement(name = "mark", namespace = "urn:ietf:params:xml:ns:mark-1.0")
List<Mark> marks;
/** Builder for {@link LaunchInfoResponseExtension}. */
public static class Builder
extends LaunchExtension.Builder<LaunchInfoResponseExtension, Builder> {
public Builder setApplicationStatus(ApplicationStatus applicationStatus) {
getInstance().applicationStatus = applicationStatus;
return this;
}
public Builder setMarks(ImmutableList<Mark> marks) {
getInstance().marks = marks;
return this;
}
}
}

View file

@ -0,0 +1,133 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.domain.registry.model.domain.launch;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.hash.Hashing.crc32;
import static com.google.common.io.BaseEncoding.base16;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import com.google.common.base.CharMatcher;
import com.google.common.base.Optional;
import com.google.common.primitives.Ints;
import com.google.domain.registry.model.ImmutableObject;
import com.googlecode.objectify.annotation.Embed;
import com.googlecode.objectify.annotation.IgnoreSave;
import com.googlecode.objectify.condition.IfNull;
import org.joda.time.DateTime;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
/** The claims notice id from the claims phase. */
@Embed
@XmlType(propOrder = {"noticeId", "expirationTime", "acceptedTime"})
public class LaunchNotice extends ImmutableObject {
/** An empty instance to use in place of null. */
private static final NoticeIdType EMPTY_NOTICE_ID = new NoticeIdType();
/** An id with a validator-id attribute. */
@Embed
public static class NoticeIdType extends ImmutableObject {
/**
* The Trademark Claims Notice ID from
* {@link "http://tools.ietf.org/html/draft-lozano-tmch-func-spec-08#section-6.3"}.
*/
@XmlValue
String tcnId;
/** The identifier of the TMDB provider to use, defaulting to the TMCH. */
@IgnoreSave(IfNull.class)
@XmlAttribute(name = "validatorID")
String validatorId;
public String getTcnId() {
return tcnId;
}
public String getValidatorId() {
// The default value is "tmch".
return Optional.fromNullable(validatorId).or("tmch");
}
}
@XmlElement(name = "noticeID")
NoticeIdType noticeId;
@XmlElement(name = "notAfter")
DateTime expirationTime;
@XmlElement(name = "acceptedDate")
DateTime acceptedTime;
public NoticeIdType getNoticeId() {
return Optional.fromNullable(noticeId).or(EMPTY_NOTICE_ID);
}
public DateTime getExpirationTime() {
return expirationTime;
}
public DateTime getAcceptedTime() {
return acceptedTime;
}
/**
* Validate the checksum of the notice against the domain label.
*
* @throws IllegalArgumentException
* @throws InvalidChecksumException
*/
public void validate(String domainLabel) throws InvalidChecksumException {
// According to http://tools.ietf.org/html/draft-lozano-tmch-func-spec-08#section-6.3, a TCNID
// is always 8 chars of checksum + 19 chars of a decimal notice id. Check the length before
// taking substrings to avoid an IndexOutOfBoundsException.
String tcnId = getNoticeId().getTcnId();
checkArgument(tcnId.length() == 27);
int checksum = Ints.fromByteArray(base16().decode(tcnId.substring(0, 8).toUpperCase()));
String noticeId = tcnId.substring(8);
checkArgument(CharMatcher.inRange('0', '9').matchesAllOf(noticeId));
// The checksum in the first 8 chars must match the crc32 of label + expiration + notice id.
String stringToHash =
domainLabel + MILLISECONDS.toSeconds(getExpirationTime().getMillis()) + noticeId;
int computedChecksum = crc32().hashString(stringToHash, UTF_8).asInt();
if (checksum != computedChecksum) {
throw new InvalidChecksumException();
}
}
/** Thrown from validate() if the checksum is invalid. */
public static class InvalidChecksumException extends Exception {}
public static LaunchNotice create(
String tcnId, String validatorId, DateTime expirationTime, DateTime acceptedTime) {
LaunchNotice instance = new LaunchNotice();
instance.noticeId = new NoticeIdType();
instance.noticeId.tcnId = tcnId;
instance.noticeId.validatorId = "tmch".equals(validatorId) ? null : validatorId;
instance.expirationTime = expirationTime;
instance.acceptedTime = acceptedTime;
return instance;
}
}

View file

@ -0,0 +1,126 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.domain.registry.model.domain.launch;
import static com.google.common.base.CaseFormat.LOWER_CAMEL;
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
import static com.google.domain.registry.util.TypeUtils.getTypesafeEnumMapping;
import static java.util.Objects.hash;
import com.google.common.collect.ImmutableMap;
import com.google.domain.registry.model.ImmutableObject;
import com.googlecode.objectify.annotation.Embed;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlValue;
/**
* The launch phase of the TLD being addressed by this command.
* <p>
* The launch phase refers to the various stages that a TLD goes through before entering general
* availability. The various phases are described below (in order that they usually occur).
*/
@Embed
public class LaunchPhase extends ImmutableObject {
/**
* The phase during which trademark holders can submit registrations or applications with
* trademark information that can be validated by the server.
*/
public static final LaunchPhase SUNRISE = create("sunrise", null);
/**
* A post-Sunrise phase when non-trademark holders are allowed to register domain names with steps
* taken to address a large volume of initial registrations.
*/
public static final LaunchPhase LANDRUSH = create("landrush", null);
/** A combined sunrise/landrush phase. */
public static final LaunchPhase SUNRUSH = create("sunrise", "landrush");
/**
* The Trademark Claims phase, as defined in the TMCH Functional Specification, in which a Claims
* Notice must be displayed to a prospective registrant of a domain name that matches trademarks.
*/
public static final LaunchPhase CLAIMS = create("claims", null);
/** A post-launch phase that is also referred to as "steady state". */
public static final LaunchPhase OPEN = create("open", null);
/** A custom server launch phase that is defined using the "name" attribute. */
public static final LaunchPhase CUSTOM = create("custom", null);
private static final Map<String, LaunchPhase> LAUNCH_PHASES = initEnumMapping();
/**
* Returns a map of the static final fields to their values, case-converted.
*/
private static final ImmutableMap<String, LaunchPhase> initEnumMapping() {
ImmutableMap.Builder<String, LaunchPhase> builder = new ImmutableMap.Builder<>();
for (Entry<String, LaunchPhase> entry : getTypesafeEnumMapping(LaunchPhase.class).entrySet()) {
builder.put(UPPER_UNDERSCORE.to(LOWER_CAMEL, entry.getKey()), entry.getValue());
}
return builder.build();
}
/** Private create function for the typesafe enum pattern. */
public static LaunchPhase create(String phase, String subphase) {
LaunchPhase instance = new LaunchPhase();
instance.phase = phase;
instance.subphase = subphase;
return instance;
}
@XmlValue
String phase;
/**
* Holds the name of a custom phase if the main phase is "custom", or a sub-phase for all other
* values.
*/
@XmlAttribute(name = "name")
String subphase;
public String getPhase() {
return phase;
}
public String getSubphase() {
return subphase;
}
public static LaunchPhase fromValue(String value) {
return LAUNCH_PHASES.get(value);
}
/** A special equals implementation that only considers the string value. */
@Override
public boolean equals(Object other) {
return other instanceof LaunchPhase
&& Objects.equals(phase, ((LaunchPhase) other).phase)
&& Objects.equals(subphase, ((LaunchPhase) other).subphase);
}
/** A special hashCode implementation that only considers the string value. */
@Override
public int hashCode() {
return hash(phase, subphase);
}
}

View file

@ -0,0 +1,25 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.domain.registry.model.domain.launch;
import javax.xml.bind.annotation.XmlRootElement;
/**
* An XML data object that represents a launch extension that may be present on EPP domain update
* commands.
*/
@XmlRootElement(name = "update")
public class LaunchUpdateExtension
extends LaunchExtension implements ApplicationIdTargetExtension {}

View file

@ -0,0 +1,31 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
@XmlSchema(
namespace = "urn:ietf:params:xml:ns:launch-1.0",
xmlns = @XmlNs(prefix = "launch", namespaceURI = "urn:ietf:params:xml:ns:launch-1.0"),
elementFormDefault = XmlNsForm.QUALIFIED)
@XmlAccessorType(XmlAccessType.FIELD)
@XmlJavaTypeAdapter(UtcDateTimeAdapter.class)
package com.google.domain.registry.model.domain.launch;
import com.google.domain.registry.xml.UtcDateTimeAdapter;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlSchema;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;