diff --git a/java/google/registry/flows/EppXmlTransformer.java b/java/google/registry/flows/EppXmlTransformer.java index c5c0dd0d7..23866ce33 100644 --- a/java/google/registry/flows/EppXmlTransformer.java +++ b/java/google/registry/flows/EppXmlTransformer.java @@ -63,7 +63,8 @@ public class EppXmlTransformer { "dsig.xsd", "smd.xsd", "launch.xsd", - "allocate.xsd"); + "allocate.xsd", + "regtype.xsd"); private static final XmlTransformer INPUT_TRANSFORMER = new XmlTransformer(SCHEMAS, EppInput.class); diff --git a/java/google/registry/flows/domain/DomainCreateFlow.java b/java/google/registry/flows/domain/DomainCreateFlow.java index 950d17e8f..7bba89edc 100644 --- a/java/google/registry/flows/domain/DomainCreateFlow.java +++ b/java/google/registry/flows/domain/DomainCreateFlow.java @@ -32,6 +32,7 @@ import google.registry.model.domain.DomainResource.Builder; import google.registry.model.domain.GracePeriod; import google.registry.model.domain.fee.FeeCreateExtension; import google.registry.model.domain.launch.LaunchCreateExtension; +import google.registry.model.domain.regtype.RegTypeCreateExtension; import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.registry.Registry; import google.registry.model.registry.Registry.TldState; @@ -98,6 +99,8 @@ public class DomainCreateFlow extends DomainCreateOrAllocateFlow { private static final Set QLP_SMD_ALLOWED_STATES = Sets.immutableEnumSet(TldState.SUNRISE, TldState.SUNRUSH); + protected RegTypeCreateExtension regTypeExtension; + private boolean isAnchorTenant() { return isAnchorTenantViaReservation || isAnchorTenantViaExtension; } @@ -123,7 +126,9 @@ public class DomainCreateFlow extends DomainCreateOrAllocateFlow { @Override protected final void initDomainCreateOrAllocateFlow() { - registerExtensions(FeeCreateExtension.class, LaunchCreateExtension.class); + registerExtensions( + FeeCreateExtension.class, LaunchCreateExtension.class, RegTypeCreateExtension.class); + regTypeExtension = eppInput.getSingleExtension(RegTypeCreateExtension.class); } @Override diff --git a/java/google/registry/model/domain/regtype/BaseRegTypeCommand.java b/java/google/registry/model/domain/regtype/BaseRegTypeCommand.java new file mode 100644 index 000000000..1b07e7b7e --- /dev/null +++ b/java/google/registry/model/domain/regtype/BaseRegTypeCommand.java @@ -0,0 +1,42 @@ +// 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 google.registry.model.domain.regtype; + +import com.google.common.base.Splitter; + +import google.registry.model.ImmutableObject; +import google.registry.model.eppinput.EppInput.CommandExtension; + +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; + +/** + * Base class for general domain commands with registration types (create, update, check, and + * info). + * + * @see "https://gitlab.centralnic.com/centralnic/epp-registration-type-extension/tree/master" + */ +public class BaseRegTypeCommand extends ImmutableObject implements CommandExtension { + + /** The registration type (which may be a comma-delimited list of values). */ + @XmlElement(name = "type") + String type; + + public List getRegistrationTypes() { + return Splitter.on(',').splitToList(type); + } +} + diff --git a/java/google/registry/model/domain/regtype/RegTypeCreateExtension.java b/java/google/registry/model/domain/regtype/RegTypeCreateExtension.java new file mode 100644 index 000000000..f7c12e911 --- /dev/null +++ b/java/google/registry/model/domain/regtype/RegTypeCreateExtension.java @@ -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 google.registry.model.domain.regtype; + +import javax.xml.bind.annotation.XmlRootElement; + +/** + * A registration type extension that may be present on EPP domain create commands. + */ +@XmlRootElement(name = "create") +public class RegTypeCreateExtension extends BaseRegTypeCommand {} diff --git a/java/google/registry/model/domain/regtype/package-info.java b/java/google/registry/model/domain/regtype/package-info.java new file mode 100644 index 000000000..70414a24f --- /dev/null +++ b/java/google/registry/model/domain/regtype/package-info.java @@ -0,0 +1,27 @@ +// 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:regtype-0.2", + xmlns = @XmlNs(prefix = "regType", namespaceURI = "urn:ietf:params:xml:ns:regtype-0.2"), + elementFormDefault = XmlNsForm.QUALIFIED) +@XmlAccessorType(XmlAccessType.FIELD) + +package google.registry.model.domain.regtype; + +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; diff --git a/java/google/registry/model/eppcommon/ProtocolDefinition.java b/java/google/registry/model/eppcommon/ProtocolDefinition.java index a905b8cba..21587ec05 100644 --- a/java/google/registry/model/eppcommon/ProtocolDefinition.java +++ b/java/google/registry/model/eppcommon/ProtocolDefinition.java @@ -26,6 +26,7 @@ import google.registry.model.domain.allocate.AllocateCreateExtension; import google.registry.model.domain.fee.FeeCheckExtension; import google.registry.model.domain.launch.LaunchCreateExtension; import google.registry.model.domain.metadata.MetadataExtension; +import google.registry.model.domain.regtype.RegTypeCreateExtension; import google.registry.model.domain.rgp.RgpUpdateExtension; import google.registry.model.domain.secdns.SecDnsCreateExtension; import google.registry.model.eppinput.EppInput.CommandExtension; @@ -53,7 +54,8 @@ public class ProtocolDefinition { SECURE_DNS_1_1(SecDnsCreateExtension.class, true), FEE_0_6(FeeCheckExtension.class, true), ALLOCATE_1_0(AllocateCreateExtension.class, false), - METADATA_1_0(MetadataExtension.class, false); + METADATA_1_0(MetadataExtension.class, false), + REGTYPE_0_2(RegTypeCreateExtension.class, true); private String uri; private boolean visible; diff --git a/java/google/registry/model/eppinput/EppInput.java b/java/google/registry/model/eppinput/EppInput.java index 61a8b160f..2327f27ac 100644 --- a/java/google/registry/model/eppinput/EppInput.java +++ b/java/google/registry/model/eppinput/EppInput.java @@ -37,6 +37,7 @@ import google.registry.model.domain.launch.LaunchDeleteExtension; import google.registry.model.domain.launch.LaunchInfoExtension; import google.registry.model.domain.launch.LaunchUpdateExtension; import google.registry.model.domain.metadata.MetadataExtension; +import google.registry.model.domain.regtype.RegTypeCreateExtension; import google.registry.model.domain.rgp.RgpUpdateExtension; import google.registry.model.domain.secdns.SecDnsCreateExtension; import google.registry.model.domain.secdns.SecDnsUpdateExtension; @@ -276,6 +277,7 @@ public class EppInput extends ImmutableObject { @XmlElementRef(type = LaunchInfoExtension.class), @XmlElementRef(type = LaunchUpdateExtension.class), @XmlElementRef(type = MetadataExtension.class), + @XmlElementRef(type = RegTypeCreateExtension.class), @XmlElementRef(type = RgpUpdateExtension.class), @XmlElementRef(type = SecDnsCreateExtension.class), @XmlElementRef(type = SecDnsUpdateExtension.class) }) diff --git a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java index 421ba0558..2ad1166af 100644 --- a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java @@ -1274,4 +1274,11 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase + + + + example.tld + 2 + + ns1.example.net + ns2.example.net + + jd1234 + sh8013 + sh8013 + + 2fooBAR + + + + + + foobar + + + ABC-12345 + + diff --git a/javatests/google/registry/flows/session/testdata/greeting_crr.xml b/javatests/google/registry/flows/session/testdata/greeting_crr.xml index cfa3b3ad8..00656f0ba 100644 --- a/javatests/google/registry/flows/session/testdata/greeting_crr.xml +++ b/javatests/google/registry/flows/session/testdata/greeting_crr.xml @@ -13,6 +13,7 @@ urn:ietf:params:xml:ns:rgp-1.0 urn:ietf:params:xml:ns:secDNS-1.1 urn:ietf:params:xml:ns:fee-0.6 + urn:ietf:params:xml:ns:regtype-0.2 diff --git a/javatests/google/registry/flows/testdata/greeting_crr.xml b/javatests/google/registry/flows/testdata/greeting_crr.xml index cfa3b3ad8..00656f0ba 100644 --- a/javatests/google/registry/flows/testdata/greeting_crr.xml +++ b/javatests/google/registry/flows/testdata/greeting_crr.xml @@ -13,6 +13,7 @@ urn:ietf:params:xml:ns:rgp-1.0 urn:ietf:params:xml:ns:secDNS-1.1 urn:ietf:params:xml:ns:fee-0.6 + urn:ietf:params:xml:ns:regtype-0.2