mirror of
https://github.com/google/nomulus.git
synced 2025-05-16 09:27:16 +02:00
Support multiple versions of the EPP Fee Extension
We want to support multiple versions of the fee extension, to allow new features while maintaining backward compatibility. This CL extends the framework and adds one new version, 0.11 (spec version 7), to the existing version 0.6 (spec version 3). A follow-on CL will add version 0.12 (spec version 8). ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=127849044
This commit is contained in:
parent
f75bb65fd3
commit
8443da5c5c
170 changed files with 4376 additions and 586 deletions
|
@ -13,6 +13,8 @@ FIELD_EXPOSERS = [
|
|||
"domain/FieldExposer.java",
|
||||
"domain/allocate/FieldExposer.java",
|
||||
"domain/fee/FieldExposer.java",
|
||||
"domain/fee06/FieldExposer.java",
|
||||
"domain/fee11/FieldExposer.java",
|
||||
"domain/launch/FieldExposer.java",
|
||||
"domain/rgp/FieldExposer.java",
|
||||
"domain/secdns/FieldExposer.java",
|
||||
|
|
35
java/google/registry/model/domain/DomainObjectSpec.java
Normal file
35
java/google/registry/model/domain/DomainObjectSpec.java
Normal 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 google.registry.model.domain;
|
||||
|
||||
import google.registry.model.ImmutableObject;
|
||||
|
||||
/**
|
||||
* Specification of a domain by name, as used in version 0.11 fee check response items and version
|
||||
* 0.12 fee check commands. This class is used by JAXB, although it turns out that no JAXB-specific
|
||||
* annotations are necessary.
|
||||
*/
|
||||
public class DomainObjectSpec extends ImmutableObject {
|
||||
|
||||
final String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public DomainObjectSpec(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
|
@ -16,6 +16,19 @@ package google.registry.model.domain.fee;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.domain.fee06.FeeCheckCommandExtensionV06;
|
||||
import google.registry.model.domain.fee06.FeeCreateCommandExtensionV06;
|
||||
import google.registry.model.domain.fee06.FeeRenewCommandExtensionV06;
|
||||
import google.registry.model.domain.fee06.FeeTransferCommandExtensionV06;
|
||||
import google.registry.model.domain.fee06.FeeUpdateCommandExtensionV06;
|
||||
import google.registry.model.domain.fee11.FeeCheckCommandExtensionV11;
|
||||
import google.registry.model.domain.fee11.FeeCreateCommandExtensionV11;
|
||||
import google.registry.model.domain.fee11.FeeRenewCommandExtensionV11;
|
||||
import google.registry.model.domain.fee11.FeeTransferCommandExtensionV11;
|
||||
import google.registry.model.domain.fee11.FeeUpdateCommandExtensionV11;
|
||||
import google.registry.model.eppcommon.ProtocolDefinition.ServiceExtension;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/** A fee, in currency units specified elsewhere in the xml, and with an optional description. */
|
||||
|
@ -26,4 +39,45 @@ public class Fee extends BaseFee {
|
|||
instance.description = description;
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static final ImmutableList<
|
||||
Class<? extends FeeCheckCommandExtension<
|
||||
? extends FeeCheckCommandExtensionItem, ? extends FeeCheckResponseExtension<?>>>>
|
||||
FEE_CHECK_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER =
|
||||
ImmutableList.<
|
||||
Class<? extends FeeCheckCommandExtension<
|
||||
? extends FeeCheckCommandExtensionItem,
|
||||
? extends FeeCheckResponseExtension<?>>>>of(
|
||||
FeeCheckCommandExtensionV11.class,
|
||||
FeeCheckCommandExtensionV06.class);
|
||||
|
||||
public static final ImmutableList<Class<? extends FeeTransformCommandExtension>>
|
||||
FEE_CREATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER =
|
||||
ImmutableList.<Class<? extends FeeTransformCommandExtension>>of(
|
||||
FeeCreateCommandExtensionV11.class,
|
||||
FeeCreateCommandExtensionV06.class);
|
||||
|
||||
public static final ImmutableList<Class<? extends FeeTransformCommandExtension>>
|
||||
FEE_RENEW_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER =
|
||||
ImmutableList.<Class<? extends FeeTransformCommandExtension>>of(
|
||||
FeeRenewCommandExtensionV11.class,
|
||||
FeeRenewCommandExtensionV06.class);
|
||||
|
||||
public static final ImmutableList<Class<? extends FeeTransformCommandExtension>>
|
||||
FEE_TRANSFER_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER =
|
||||
ImmutableList.<Class<? extends FeeTransformCommandExtension>>of(
|
||||
FeeTransferCommandExtensionV11.class,
|
||||
FeeTransferCommandExtensionV06.class);
|
||||
|
||||
public static final ImmutableList<Class<? extends FeeTransformCommandExtension>>
|
||||
FEE_UPDATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER =
|
||||
ImmutableList.<Class<? extends FeeTransformCommandExtension>>of(
|
||||
FeeUpdateCommandExtensionV11.class,
|
||||
FeeUpdateCommandExtensionV06.class);
|
||||
|
||||
public static final ImmutableSet<String>
|
||||
FEE_EXTENSION_URIS =
|
||||
ImmutableSet.<String>of(
|
||||
ServiceExtension.FEE_0_11.getUri(),
|
||||
ServiceExtension.FEE_0_6.getUri());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
// 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.fee;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.eppinput.EppInput.CommandExtension;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/**
|
||||
* Interface for domain check command fee extensions. The check extension will contain some number
|
||||
* of items requesting the fees for particular commands and domains. For some versions of the fee
|
||||
* extension, the currency is also specified here; for other versions it is contained in the
|
||||
* individual items.
|
||||
*
|
||||
* @type C the type of extension item used by this command (e.g. v6 items for a v6 extension)
|
||||
* @type R the type of response returned for for this command (e.g. v6 responses for a v6 extension)
|
||||
*/
|
||||
public interface FeeCheckCommandExtension<
|
||||
C extends FeeCheckCommandExtensionItem,
|
||||
R extends FeeCheckResponseExtension<?>>
|
||||
extends CommandExtension {
|
||||
|
||||
/** True if this version of the fee extension specifies the currency at the top level. */
|
||||
public boolean isCurrencySupported();
|
||||
|
||||
/** Three-character currency code; throws an exception if currency is not supported. */
|
||||
public CurrencyUnit getCurrency() throws UnsupportedOperationException;
|
||||
|
||||
public ImmutableSet<C> getItems();
|
||||
|
||||
public R createResponse(ImmutableList<? extends FeeCheckResponseExtensionItem> items);
|
||||
}
|
|
@ -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 google.registry.model.domain.fee;
|
||||
|
||||
/**
|
||||
* Interface for individual fee extension items in Check commands. These are derived from the more
|
||||
* general query items (which cover Info commands as well), but may also contain a domain name,
|
||||
* depending on the version of the fee extension.
|
||||
*/
|
||||
public interface FeeCheckCommandExtensionItem extends FeeQueryCommandExtensionItem {
|
||||
|
||||
/** True if this version of the fee extension supports domain names in Check items. */
|
||||
public boolean isDomainNameSupported();
|
||||
|
||||
/** The domain name being checked; throws an exception if domain names are not supported. */
|
||||
public String getDomainName() throws UnsupportedOperationException;
|
||||
|
||||
/** Create a builder for a matching fee check response item. */
|
||||
public FeeCheckResponseExtensionItem.Builder createResponseBuilder();
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
// 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.fee;
|
||||
|
||||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.domain.Period;
|
||||
import google.registry.model.eppinput.EppInput.CommandExtension;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/** A fee extension that may be present on domain check commands. */
|
||||
@XmlRootElement(name = "check")
|
||||
public class FeeCheckExtension extends ImmutableObject implements CommandExtension {
|
||||
|
||||
/** The default validity period (if not specified) is 1 year for all operations. */
|
||||
static final Period DEFAULT_PERIOD = Period.create(1, Period.Unit.YEARS);
|
||||
|
||||
@XmlElement(name = "domain")
|
||||
Set<DomainCheck> domains;
|
||||
|
||||
public ImmutableSet<DomainCheck> getDomains() {
|
||||
return nullToEmptyImmutableCopy(domains);
|
||||
}
|
||||
|
||||
/** A check request for the fee to perform a given command on a given domain. */
|
||||
@XmlType(propOrder = {"name", "currency", "command", "period"})
|
||||
public static class DomainCheck extends BaseFeeRequest {
|
||||
/** The fully qualified domain name being checked. */
|
||||
String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,48 +14,24 @@
|
|||
|
||||
package google.registry.model.domain.fee;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/**
|
||||
* An XML data object that represents a fee extension that may be present on the response to EPP
|
||||
* domain check commands.
|
||||
* Interface for domain check response fee extensions. The check extension will contain some number
|
||||
* of items requesting the fees for particular commands and domains. For some versions of the fee
|
||||
* extension, the currency is also specified here; for other versions it is contained in the
|
||||
* individual items.
|
||||
*/
|
||||
@XmlRootElement(name = "chkData")
|
||||
public class FeeCheckResponseExtension extends ImmutableObject implements ResponseExtension {
|
||||
public interface FeeCheckResponseExtension<F extends FeeCheckResponseExtensionItem>
|
||||
extends ResponseExtension {
|
||||
|
||||
/** Check responses. */
|
||||
@XmlElement(name = "cd")
|
||||
ImmutableList<FeeCheck> feeChecks;
|
||||
|
||||
@VisibleForTesting
|
||||
public ImmutableList<FeeCheck> getChecks() {
|
||||
return feeChecks;
|
||||
}
|
||||
|
||||
public static FeeCheckResponseExtension create(ImmutableList<FeeCheck> feeChecks) {
|
||||
FeeCheckResponseExtension instance = new FeeCheckResponseExtension();
|
||||
instance.feeChecks = feeChecks;
|
||||
return instance;
|
||||
}
|
||||
|
||||
/** The response for a check on a single resource. */
|
||||
@XmlType(propOrder = {"name", "currency", "command", "period", "fee", "feeClass"})
|
||||
public static class FeeCheck extends BaseFeeResponse {
|
||||
/** The name of the domain that was checked, with an attribute indicating if it is premium. */
|
||||
String name;
|
||||
|
||||
/** A builder for {@link FeeCheck}. */
|
||||
public static class Builder extends BaseFeeResponse.Builder<FeeCheck, Builder> {
|
||||
public Builder setName(String name) {
|
||||
getInstance().name = name;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* If currency is not supported at the top level of Check responses for this version of the fee
|
||||
* extension, this function has not effect.
|
||||
*/
|
||||
public void setCurrencyIfSupported(CurrencyUnit currency);
|
||||
|
||||
public ImmutableList<F> getItems();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
// 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.fee;
|
||||
|
||||
/**
|
||||
* Interface for individual fee extension items in Check responses. These are derived from the more
|
||||
* general query items (which cover Info responses as well), but may also contain a domain name,
|
||||
* depending on the version of the fee extension.
|
||||
*/
|
||||
public interface FeeCheckResponseExtensionItem extends FeeQueryResponseExtensionItem {
|
||||
|
||||
/** Builder for {@link FeeCheckResponseExtensionItem}. */
|
||||
public interface Builder extends FeeQueryResponseExtensionItem.Builder {
|
||||
|
||||
/** The name associated with the item. Has no effect if domain names are not supported. */
|
||||
public Builder setDomainNameIfSupported(String name);
|
||||
|
||||
public FeeCheckResponseExtensionItem build();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
// 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.fee;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.model.Buildable.GenericBuilder;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/**
|
||||
* An XML data object that represents a fee extension that may be present on the response to EPP
|
||||
* domain create commands.
|
||||
*/
|
||||
@XmlRootElement(name = "delData")
|
||||
public class FeeDeleteResponseExtension extends ImmutableObject implements ResponseExtension {
|
||||
|
||||
/** The currency of the credit(s). */
|
||||
CurrencyUnit currency;
|
||||
|
||||
/**
|
||||
* The magnitude of the credit(s), in the specified units, with an optional description.
|
||||
*
|
||||
* <p>This is a list because a single delete can receive multiple credits.
|
||||
*/
|
||||
@XmlElement(name = "credit")
|
||||
List<Credit> credits;
|
||||
|
||||
/** Builder for {@link FeeDeleteResponseExtension}. */
|
||||
public static class Builder extends GenericBuilder<FeeDeleteResponseExtension, Builder> {
|
||||
public Builder setCurrency(CurrencyUnit currency) {
|
||||
getInstance().currency = currency;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
public Builder setCredits(ImmutableList<Credit> credits) {
|
||||
getInstance().credits = credits;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,20 +17,12 @@ package google.registry.model.domain.fee;
|
|||
import com.google.common.base.Ascii;
|
||||
import com.google.common.base.CharMatcher;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlValue;
|
||||
|
||||
/** A command name along with the launch phase and subphase it is to be executed in. */
|
||||
public class FeeCommandDescriptor extends ImmutableObject {
|
||||
|
||||
/** The name of a command that might have an associated fee. */
|
||||
public enum CommandName {
|
||||
CREATE,
|
||||
RENEW,
|
||||
TRANSFER,
|
||||
RESTORE,
|
||||
UNKNOWN
|
||||
}
|
||||
public class FeeExtensionCommandDescriptor extends ImmutableObject {
|
||||
|
||||
@XmlAttribute
|
||||
String phase;
|
||||
|
@ -64,4 +56,13 @@ public class FeeCommandDescriptor extends ImmutableObject {
|
|||
}
|
||||
return CommandName.UNKNOWN;
|
||||
}
|
||||
|
||||
public static FeeExtensionCommandDescriptor
|
||||
create(CommandName commandName, String phase, String subphase) {
|
||||
FeeExtensionCommandDescriptor commandDescriptor = new FeeExtensionCommandDescriptor();
|
||||
commandDescriptor.command = Ascii.toLowerCase(commandName.name());
|
||||
commandDescriptor.phase = phase;
|
||||
commandDescriptor.subphase = subphase;
|
||||
return commandDescriptor;
|
||||
}
|
||||
}
|
|
@ -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 google.registry.model.domain.fee;
|
||||
|
||||
import google.registry.model.domain.Period;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/**
|
||||
* Interface for individual query items in Check and Info commands. Each item indicates the command
|
||||
* to be checked, and the number of years for which the prices is requested. It may also contain the
|
||||
* currency, but some versions of the fee extension specify the currency at the top level of the
|
||||
* extension.
|
||||
*/
|
||||
public interface FeeQueryCommandExtensionItem {
|
||||
|
||||
/** The name of a command that might have an associated fee. */
|
||||
public enum CommandName {
|
||||
UNKNOWN,
|
||||
CREATE,
|
||||
RENEW,
|
||||
TRANSFER,
|
||||
RESTORE,
|
||||
UPDATE
|
||||
}
|
||||
|
||||
/** True if this version of fee extension includes a currency in this type of query item. */
|
||||
public boolean isCurrencySupported();
|
||||
|
||||
/** A three-character ISO4217 currency code; throws an exception if currency is not supported. */
|
||||
public CurrencyUnit getCurrency() throws UnsupportedOperationException;
|
||||
|
||||
/** The name of the command being checked. */
|
||||
public CommandName getCommandName();
|
||||
|
||||
/** The unparse name of the command being checked, for use in error strings. */
|
||||
public String getUnparsedCommandName();
|
||||
|
||||
/** The phase of the command being checked. */
|
||||
public String getPhase();
|
||||
|
||||
/** The subphase of the command being checked. */
|
||||
public String getSubphase();
|
||||
|
||||
/** The period for the command being checked. */
|
||||
public Period getPeriod();
|
||||
}
|
|
@ -18,32 +18,50 @@ import com.google.common.base.Optional;
|
|||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.domain.Period;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/** Base class for the fee requests on check and info. */
|
||||
/**
|
||||
* Abstract base class for the fee request query items used in Check and Info commands. It handles
|
||||
* command and period, which are always present. Derived classes must handle currency, which may or
|
||||
* may not be present, depending on the version of the extension being used.
|
||||
*/
|
||||
@XmlTransient
|
||||
public class BaseFeeRequest extends ImmutableObject {
|
||||
public abstract class FeeQueryCommandExtensionItemImpl
|
||||
extends ImmutableObject implements FeeQueryCommandExtensionItem {
|
||||
|
||||
/** The default validity period (if not specified) is 1 year for all operations. */
|
||||
static final Period DEFAULT_PERIOD = Period.create(1, Period.Unit.YEARS);
|
||||
|
||||
/** A three-character ISO4217 currency code. */
|
||||
CurrencyUnit currency;
|
||||
|
||||
/** The command being checked. */
|
||||
FeeCommandDescriptor command;
|
||||
FeeExtensionCommandDescriptor command;
|
||||
|
||||
/** The period for the command being checked. */
|
||||
Period period;
|
||||
|
||||
public CurrencyUnit getCurrency() {
|
||||
return currency;
|
||||
/** The name of the command being checked. */
|
||||
@Override
|
||||
public CommandName getCommandName() {
|
||||
return command.getCommand();
|
||||
}
|
||||
|
||||
/** The command name before being parsed into an enum, for use in error strings. */
|
||||
@Override
|
||||
public String getUnparsedCommandName() {
|
||||
return command.getUnparsedCommandName();
|
||||
}
|
||||
|
||||
/** The phase of the command being checked. */
|
||||
@Override
|
||||
public String getPhase() {
|
||||
return command.getPhase();
|
||||
}
|
||||
|
||||
public FeeCommandDescriptor getCommand() {
|
||||
return command;
|
||||
/** The subphase of the command being checked. */
|
||||
@Override
|
||||
public String getSubphase() {
|
||||
return command.getSubphase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Period getPeriod() {
|
||||
return Optional.fromNullable(period).or(DEFAULT_PERIOD);
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
// 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.fee;
|
||||
|
||||
import google.registry.model.domain.Period;
|
||||
import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName;
|
||||
import java.util.List;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/**
|
||||
* Interface for individual query items in Check and Info response. Each item indicates the fees and
|
||||
* class associated with a particular command and period. The currency may also be listed, but some
|
||||
* versions of the fee extension specify the currency at the top level of the extension.
|
||||
*/
|
||||
|
||||
public interface FeeQueryResponseExtensionItem {
|
||||
|
||||
/**
|
||||
* The type of the fee. We will use "premium" for fees on premium names, and omit the field
|
||||
* otherwise.
|
||||
*/
|
||||
public String getFeeClass();
|
||||
|
||||
/** Builder for {@link FeeCheckResponseExtensionItem}. */
|
||||
public interface Builder {
|
||||
|
||||
/**
|
||||
* If currency is not supported in this type of query response item for this version of the fee
|
||||
* extension, this function has no effect.
|
||||
*/
|
||||
public Builder setCurrencyIfSupported(CurrencyUnit currency);
|
||||
|
||||
/** Whether this check item can be calculated. If so, reason should be null. If not, fees
|
||||
* should not be set.
|
||||
*/
|
||||
public Builder setAvailIfSupported(boolean avail);
|
||||
|
||||
/** The reason that the check item cannot be calculated. */
|
||||
public Builder setReasonIfSupported(String reason);
|
||||
|
||||
public Builder setCommand(CommandName commandName, String phase, String subphase);
|
||||
|
||||
public Builder setPeriod(Period period);
|
||||
|
||||
public Builder setFees(List<Fee> fees);
|
||||
|
||||
public Builder setClass(String feeClass);
|
||||
}
|
||||
}
|
||||
|
|
@ -20,19 +20,22 @@ import com.google.common.collect.ImmutableList;
|
|||
import google.registry.model.Buildable.GenericBuilder;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.domain.Period;
|
||||
import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/** Base class for the fee responses on check and info. */
|
||||
/**
|
||||
* Abstract base class for the fee request query items used in Check and Info responses. It handles
|
||||
* command, period, fees and class, which are always present. Derived classes must handle currency,
|
||||
* which may or may not be present, depending on the version of the extension being used.
|
||||
*/
|
||||
@XmlTransient
|
||||
public class BaseFeeResponse extends ImmutableObject {
|
||||
/** The currency of the fee. */
|
||||
CurrencyUnit currency;
|
||||
public class FeeQueryResponseExtensionItemImpl
|
||||
extends ImmutableObject implements FeeQueryResponseExtensionItem {
|
||||
|
||||
/** The command that was checked. */
|
||||
FeeCommandDescriptor command;
|
||||
FeeExtensionCommandDescriptor command;
|
||||
|
||||
/** The period that was checked. */
|
||||
Period period;
|
||||
|
@ -52,38 +55,44 @@ public class BaseFeeResponse extends ImmutableObject {
|
|||
@XmlElement(name = "class")
|
||||
String feeClass;
|
||||
|
||||
@Override
|
||||
public String getFeeClass() {
|
||||
return feeClass;
|
||||
}
|
||||
|
||||
/** Abstract builder for {@link BaseFeeResponse}. */
|
||||
public abstract static class Builder<T extends BaseFeeResponse, B extends Builder<?, ?>>
|
||||
extends GenericBuilder<T, B> {
|
||||
public B setCurrency(CurrencyUnit currency) {
|
||||
getInstance().currency = currency;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
public B setCommand(FeeCommandDescriptor command) {
|
||||
getInstance().command = command;
|
||||
/** Abstract builder for {@link FeeQueryResponseExtensionItemImpl}. */
|
||||
public abstract static class
|
||||
Builder<T extends FeeQueryResponseExtensionItemImpl, B extends Builder<?, ?>>
|
||||
extends GenericBuilder<T, B> implements FeeQueryResponseExtensionItem.Builder {
|
||||
|
||||
@Override
|
||||
public B setCommand(CommandName commandName, String phase, String subphase) {
|
||||
getInstance().command = FeeExtensionCommandDescriptor.create(commandName, phase, subphase);
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
@Override
|
||||
public B setPeriod(Period period) {
|
||||
getInstance().period = period;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
@Override
|
||||
public B setFees(List<Fee> fees) {
|
||||
// If there are no fees, set the field to null to suppress the 'fee' section in the xml.
|
||||
getInstance().fee = forceEmptyToNull(ImmutableList.copyOf(fees));
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
public B setFee(List<Fee> fees) {
|
||||
getInstance().fee = forceEmptyToNull(ImmutableList.copyOf(fees));
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
@Override
|
||||
public B setClass(String feeClass) {
|
||||
getInstance().feeClass = feeClass;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -15,10 +15,13 @@
|
|||
package google.registry.model.domain.fee;
|
||||
|
||||
import google.registry.model.eppinput.EppInput.CommandExtension;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import java.util.List;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/** A fee extension that may be present on domain transfer requests. */
|
||||
@XmlRootElement(name = "transfer")
|
||||
@XmlType(propOrder = {"currency", "fees"})
|
||||
public class FeeTransferExtension extends BaseFeeCommand implements CommandExtension {}
|
||||
/** Interface for fee extensions in Create, Renew, Transfer and Update commands. */
|
||||
public interface FeeTransformCommandExtension extends CommandExtension {
|
||||
CurrencyUnit getCurrency();
|
||||
List<Fee> getFees();
|
||||
List<Credit> getCredits();
|
||||
FeeTransformResponseExtension.Builder createResponseBuilder();
|
||||
}
|
|
@ -22,7 +22,8 @@ import org.joda.money.CurrencyUnit;
|
|||
|
||||
/** Base class for general transform commands with fees (create, renew, update, transfer). */
|
||||
@XmlTransient
|
||||
public class BaseFeeCommand extends ImmutableObject {
|
||||
public abstract class FeeTransformCommandExtensionImpl
|
||||
extends ImmutableObject implements FeeTransformCommandExtension {
|
||||
|
||||
/** The currency of the fee. */
|
||||
CurrencyUnit currency;
|
||||
|
@ -35,11 +36,21 @@ public class BaseFeeCommand extends ImmutableObject {
|
|||
@XmlElement(name = "fee")
|
||||
List<Fee> fees;
|
||||
|
||||
@XmlElement(name = "credit")
|
||||
List<Credit> credits;
|
||||
|
||||
@Override
|
||||
public CurrencyUnit getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Fee> getFees() {
|
||||
return fees;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Credit> getCredits() {
|
||||
return credits;
|
||||
}
|
||||
}
|
|
@ -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 google.registry.model.domain.fee;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/**
|
||||
* Base class for general transform commands with fees (create, renew, update, transfer). This
|
||||
* version of the class is for fee extensions that do not support credits (certain older versions
|
||||
* allow credits only for some commands).
|
||||
*/
|
||||
@XmlTransient
|
||||
public abstract class FeeTransformCommandExtensionImplNoCredits
|
||||
extends ImmutableObject implements FeeTransformCommandExtension {
|
||||
|
||||
/** The currency of the fee. */
|
||||
CurrencyUnit currency;
|
||||
|
||||
/**
|
||||
* The magnitude of the fee, in the specified units, with an optional description.
|
||||
*
|
||||
* <p>This is a list because a single operation can involve multiple fees.
|
||||
*/
|
||||
@XmlElement(name = "fee")
|
||||
List<Fee> fees;
|
||||
|
||||
@Override
|
||||
public CurrencyUnit getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Fee> getFees() {
|
||||
return fees;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Credit> getCredits() {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
|
@ -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.
|
||||
|
||||
package google.registry.model.domain.fee;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/** Interface for fee extensions in Create, Renew, Transfer and Update responses. */
|
||||
public interface FeeTransformResponseExtension extends ResponseExtension {
|
||||
|
||||
/** Builder for {@link FeeTransformResponseExtension}. */
|
||||
public interface Builder {
|
||||
Builder setCurrency(CurrencyUnit currency);
|
||||
Builder setFees(ImmutableList<Fee> fees);
|
||||
Builder setCredits(ImmutableList<Credit> credits);
|
||||
FeeTransformResponseExtension build();
|
||||
}
|
||||
}
|
|
@ -18,12 +18,14 @@ import com.google.common.collect.ImmutableList;
|
|||
import google.registry.model.Buildable.GenericBuilder;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/** Base class for fee responses on general transform commands (create, update, renew, transfer). */
|
||||
@XmlTransient
|
||||
public class BaseFeeCommandResponse extends ImmutableObject {
|
||||
public class FeeTransformResponseExtensionImpl extends ImmutableObject
|
||||
implements FeeTransformResponseExtension {
|
||||
|
||||
/** The currency of the fee. */
|
||||
CurrencyUnit currency;
|
||||
|
@ -33,18 +35,32 @@ public class BaseFeeCommandResponse extends ImmutableObject {
|
|||
*
|
||||
* <p>This is a list because a single operation can involve multiple fees.
|
||||
*/
|
||||
List<Fee> fee;
|
||||
@XmlElement(name = "fee")
|
||||
List<Fee> fees;
|
||||
|
||||
@XmlElement(name = "credit")
|
||||
List<Credit> credits;
|
||||
|
||||
/** Abstract builder for {@link BaseFeeCommandResponse}. */
|
||||
public abstract static class Builder<T extends BaseFeeCommandResponse, B extends Builder<?, ?>>
|
||||
extends GenericBuilder<T, B> {
|
||||
/** Abstract builder for {@link FeeTransformResponseExtensionImpl}. */
|
||||
public abstract static class
|
||||
Builder<T extends FeeTransformResponseExtensionImpl, B extends Builder<?, ?>>
|
||||
extends GenericBuilder<T, B> implements FeeTransformResponseExtension.Builder {
|
||||
|
||||
@Override
|
||||
public B setCurrency(CurrencyUnit currency) {
|
||||
getInstance().currency = currency;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
public B setFee(ImmutableList<Fee> fee) {
|
||||
getInstance().fee = fee;
|
||||
@Override
|
||||
public B setFees(ImmutableList<Fee> fees) {
|
||||
getInstance().fees = fees;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
@Override
|
||||
public B setCredits(ImmutableList<Credit> credits) {
|
||||
getInstance().credits = credits;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
// 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.fee;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.model.Buildable.GenericBuilder;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/**
|
||||
* Base class for fee responses on general transform commands (create, update, renew, transfer).
|
||||
* This version of the class is for fee extensions that do not support credits (certain older
|
||||
* versions allow credits only for some commands).
|
||||
*/
|
||||
@XmlTransient
|
||||
public class FeeTransformResponseExtensionImplNoCredits extends ImmutableObject
|
||||
implements FeeTransformResponseExtension {
|
||||
|
||||
/** The currency of the fee. */
|
||||
CurrencyUnit currency;
|
||||
|
||||
/**
|
||||
* The magnitude of the fee, in the specified units, with an optional description.
|
||||
*
|
||||
* <p>This is a list because a single operation can involve multiple fees.
|
||||
*/
|
||||
@XmlElement(name = "fee")
|
||||
List<Fee> fees;
|
||||
|
||||
/** Abstract builder for {@link FeeTransformResponseExtensionImplNoCredits}. */
|
||||
public abstract static class
|
||||
Builder<T extends FeeTransformResponseExtensionImplNoCredits, B extends Builder<?, ?>>
|
||||
extends GenericBuilder<T, B> implements FeeTransformResponseExtension.Builder {
|
||||
|
||||
@Override
|
||||
public B setCurrency(CurrencyUnit currency) {
|
||||
getInstance().currency = currency;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
@Override
|
||||
public B setFees(ImmutableList<Fee> fees) {
|
||||
getInstance().fees = fees;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
@Override
|
||||
public B setCredits(ImmutableList<Credit> credits) {
|
||||
return thisCastToDerived();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
// 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.fee06;
|
||||
|
||||
import google.registry.model.domain.fee.FeeCheckCommandExtensionItem;
|
||||
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem;
|
||||
import google.registry.model.domain.fee.FeeQueryCommandExtensionItemImpl;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/** An individual price check item in version 0.6 of the fee extension on Check commands. */
|
||||
@XmlType(propOrder = {"name", "currency", "command", "period"})
|
||||
public class FeeCheckCommandExtensionItemV06
|
||||
extends FeeQueryCommandExtensionItemImpl implements FeeCheckCommandExtensionItem {
|
||||
|
||||
/** The fully qualified domain name being checked. */
|
||||
String name;
|
||||
|
||||
CurrencyUnit currency;
|
||||
|
||||
@Override
|
||||
public boolean isDomainNameSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDomainName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCurrencySupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurrencyUnit getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeeCheckResponseExtensionItem.Builder createResponseBuilder() {
|
||||
return new FeeCheckResponseExtensionItemV06.Builder();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
// 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.fee06;
|
||||
|
||||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.domain.fee.FeeCheckCommandExtension;
|
||||
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/** Version 0.6 of the fee extension that may be present on domain check commands. */
|
||||
@XmlRootElement(name = "check")
|
||||
public class FeeCheckCommandExtensionV06 extends ImmutableObject
|
||||
implements FeeCheckCommandExtension<
|
||||
FeeCheckCommandExtensionItemV06,
|
||||
FeeCheckResponseExtensionV06> {
|
||||
|
||||
@XmlElement(name = "domain")
|
||||
Set<FeeCheckCommandExtensionItemV06> items;
|
||||
|
||||
@Override
|
||||
public boolean isCurrencySupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurrencyUnit getCurrency() {
|
||||
throw new UnsupportedOperationException("Currency not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<FeeCheckCommandExtensionItemV06> getItems() {
|
||||
return nullToEmptyImmutableCopy(items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeeCheckResponseExtensionV06 createResponse(
|
||||
ImmutableList<? extends FeeCheckResponseExtensionItem> items) {
|
||||
ImmutableList.Builder<FeeCheckResponseExtensionItemV06> builder = new ImmutableList.Builder<>();
|
||||
for (FeeCheckResponseExtensionItem item : items) {
|
||||
if (item instanceof FeeCheckResponseExtensionItemV06) {
|
||||
builder.add((FeeCheckResponseExtensionItemV06) item);
|
||||
}
|
||||
}
|
||||
return FeeCheckResponseExtensionV06.create(builder.build());
|
||||
}
|
||||
}
|
|
@ -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 google.registry.model.domain.fee06;
|
||||
|
||||
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem;
|
||||
import google.registry.model.domain.fee.FeeQueryResponseExtensionItemImpl;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/** The version 0.6 response for a domain check on a single resource. */
|
||||
@XmlType(propOrder = {"name", "currency", "command", "period", "fee", "feeClass"})
|
||||
public class FeeCheckResponseExtensionItemV06
|
||||
extends FeeQueryResponseExtensionItemImpl implements FeeCheckResponseExtensionItem {
|
||||
/** The name of the domain that was checked, with an attribute indicating if it is premium. */
|
||||
String name;
|
||||
|
||||
CurrencyUnit currency;
|
||||
|
||||
/** Builder for {@link FeeCheckResponseExtensionItemV06}. */
|
||||
public static class Builder
|
||||
extends FeeQueryResponseExtensionItemImpl.Builder<FeeCheckResponseExtensionItemV06, Builder>
|
||||
implements FeeCheckResponseExtensionItem.Builder {
|
||||
|
||||
@Override
|
||||
public Builder setDomainNameIfSupported(String name) {
|
||||
getInstance().name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder setCurrencyIfSupported(CurrencyUnit currency) {
|
||||
getInstance().currency = currency;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder setAvailIfSupported(boolean avail) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder setReasonIfSupported(String reason) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
// 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.fee06;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.domain.fee.FeeCheckResponseExtension;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/**
|
||||
* An XML data object that represents version 0.6 of the fee extension that may be present on the
|
||||
* response to EPP domain check commands.
|
||||
*/
|
||||
@XmlRootElement(name = "chkData")
|
||||
public class FeeCheckResponseExtensionV06
|
||||
extends ImmutableObject implements FeeCheckResponseExtension<FeeCheckResponseExtensionItemV06> {
|
||||
|
||||
/** Check responses. */
|
||||
@XmlElement(name = "cd")
|
||||
ImmutableList<FeeCheckResponseExtensionItemV06> items;
|
||||
|
||||
@Override
|
||||
public void setCurrencyIfSupported(CurrencyUnit currency) {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@Override
|
||||
public ImmutableList<FeeCheckResponseExtensionItemV06> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
static FeeCheckResponseExtensionV06
|
||||
create(ImmutableList<FeeCheckResponseExtensionItemV06> items) {
|
||||
FeeCheckResponseExtensionV06 instance = new FeeCheckResponseExtensionV06();
|
||||
instance.items = items;
|
||||
return instance;
|
||||
}
|
||||
}
|
|
@ -12,13 +12,22 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.model.domain.fee;
|
||||
package google.registry.model.domain.fee06;
|
||||
|
||||
import google.registry.model.eppinput.EppInput.CommandExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformCommandExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformCommandExtensionImplNoCredits;
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtension;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/** A fee extension that may be present on domain create commands. */
|
||||
@XmlRootElement(name = "create")
|
||||
@XmlType(propOrder = {"currency", "fees"})
|
||||
public class FeeCreateExtension extends BaseFeeCommand implements CommandExtension {}
|
||||
public class FeeCreateCommandExtensionV06
|
||||
extends FeeTransformCommandExtensionImplNoCredits implements FeeTransformCommandExtension {
|
||||
|
||||
@Override
|
||||
public FeeTransformResponseExtension.Builder createResponseBuilder() {
|
||||
return new FeeCreateResponseExtensionV06.Builder();
|
||||
}
|
||||
}
|
|
@ -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.
|
||||
|
||||
package google.registry.model.domain.fee06;
|
||||
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtensionImplNoCredits;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/**
|
||||
* An XML data object that represents a fee extension that may be present on the response to EPP
|
||||
* domain create commands.
|
||||
*/
|
||||
@XmlRootElement(name = "creData")
|
||||
@XmlType(propOrder = {"currency", "fees"})
|
||||
public class FeeCreateResponseExtensionV06 extends FeeTransformResponseExtensionImplNoCredits {
|
||||
/** A builder for {@link FeeCreateResponseExtensionV06}. */
|
||||
public static class Builder extends
|
||||
FeeTransformResponseExtensionImplNoCredits.Builder<FeeCreateResponseExtensionV06, Builder> {}
|
||||
}
|
|
@ -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 google.registry.model.domain.fee06;
|
||||
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtensionImpl;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/**
|
||||
* An XML data object that represents a fee extension that may be present on the response to EPP
|
||||
* domain create commands.
|
||||
*/
|
||||
@XmlRootElement(name = "delData")
|
||||
@XmlType(propOrder = {"currency", "fees", "credits"})
|
||||
public class FeeDeleteResponseExtensionV06 extends FeeTransformResponseExtensionImpl {
|
||||
|
||||
/** Builder for {@link FeeDeleteResponseExtensionV06}. */
|
||||
public static class Builder
|
||||
extends FeeTransformResponseExtensionImpl.Builder<FeeDeleteResponseExtensionV06, Builder> {}
|
||||
}
|
|
@ -12,13 +12,31 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.model.domain.fee;
|
||||
package google.registry.model.domain.fee06;
|
||||
|
||||
import google.registry.model.domain.fee.FeeQueryCommandExtensionItemImpl;
|
||||
import google.registry.model.eppinput.EppInput.CommandExtension;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/** A fee extension that may be present on domain info commands. */
|
||||
@XmlRootElement(name = "info")
|
||||
@XmlType(propOrder = {"currency", "command", "period"})
|
||||
public class FeeInfoExtension extends BaseFeeRequest implements CommandExtension {}
|
||||
public class FeeInfoCommandExtensionV06
|
||||
extends FeeQueryCommandExtensionItemImpl implements CommandExtension {
|
||||
|
||||
/** A three-character ISO4217 currency code. */
|
||||
CurrencyUnit currency;
|
||||
|
||||
@Override
|
||||
public boolean isCurrencySupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurrencyUnit getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
// 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.fee06;
|
||||
|
||||
import google.registry.model.domain.fee.FeeQueryResponseExtensionItem;
|
||||
import google.registry.model.domain.fee.FeeQueryResponseExtensionItemImpl;
|
||||
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/**
|
||||
* An XML data object that represents a fee extension that may be present on the response to EPP
|
||||
* domain info commands.
|
||||
*/
|
||||
@XmlRootElement(name = "infData")
|
||||
@XmlType(propOrder = {"currency", "command", "period", "fee", "feeClass"})
|
||||
public class FeeInfoResponseExtensionV06
|
||||
extends FeeQueryResponseExtensionItemImpl implements ResponseExtension {
|
||||
|
||||
CurrencyUnit currency;
|
||||
|
||||
/** Builder for {@link FeeInfoResponseExtensionV06}. */
|
||||
public static class Builder
|
||||
extends FeeQueryResponseExtensionItemImpl.Builder<FeeInfoResponseExtensionV06, Builder> {
|
||||
|
||||
@Override
|
||||
public Builder setAvailIfSupported(boolean avail) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder setReasonIfSupported(String reason) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeeQueryResponseExtensionItem.Builder
|
||||
setCurrencyIfSupported(CurrencyUnit currency) {
|
||||
getInstance().currency = currency;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,13 +12,22 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.model.domain.fee;
|
||||
package google.registry.model.domain.fee06;
|
||||
|
||||
import google.registry.model.eppinput.EppInput.CommandExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformCommandExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformCommandExtensionImplNoCredits;
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtension;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/** A fee extension that may be present on domain renew commands. */
|
||||
@XmlRootElement(name = "renew")
|
||||
@XmlType(propOrder = {"currency", "fees"})
|
||||
public class FeeRenewExtension extends BaseFeeCommand implements CommandExtension {}
|
||||
public class FeeRenewCommandExtensionV06
|
||||
extends FeeTransformCommandExtensionImplNoCredits implements FeeTransformCommandExtension {
|
||||
|
||||
@Override
|
||||
public FeeTransformResponseExtension.Builder createResponseBuilder() {
|
||||
return new FeeRenewResponseExtensionV06.Builder();
|
||||
}
|
||||
}
|
|
@ -12,19 +12,20 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.model.domain.fee;
|
||||
package google.registry.model.domain.fee06;
|
||||
|
||||
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtensionImplNoCredits;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/**
|
||||
* An XML data object that represents a fee extension that may be present on the response to EPP
|
||||
* domain info commands.
|
||||
* domain renew commands.
|
||||
*/
|
||||
@XmlRootElement(name = "infData")
|
||||
@XmlType(propOrder = {"currency", "command", "period", "fee", "feeClass"})
|
||||
public class FeeInfoResponseExtension extends BaseFeeResponse implements ResponseExtension {
|
||||
/** A builder for {@link FeeInfoResponseExtension}. */
|
||||
public static class Builder extends BaseFeeResponse.Builder<FeeInfoResponseExtension, Builder> {}
|
||||
@XmlRootElement(name = "renData")
|
||||
@XmlType(propOrder = {"currency", "fees"})
|
||||
public class FeeRenewResponseExtensionV06 extends FeeTransformResponseExtensionImplNoCredits {
|
||||
/** A builder for {@link FeeRenewResponseExtensionV06}. */
|
||||
public static class Builder extends
|
||||
FeeTransformResponseExtensionImplNoCredits.Builder<FeeRenewResponseExtensionV06, Builder> {}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
// 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.fee06;
|
||||
|
||||
import google.registry.model.domain.fee.FeeTransformCommandExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformCommandExtensionImplNoCredits;
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtension;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/** A fee extension that may be present on domain transfer requests. */
|
||||
@XmlRootElement(name = "transfer")
|
||||
@XmlType(propOrder = {"currency", "fees"})
|
||||
public class FeeTransferCommandExtensionV06
|
||||
extends FeeTransformCommandExtensionImplNoCredits implements FeeTransformCommandExtension {
|
||||
|
||||
@Override
|
||||
public FeeTransformResponseExtension.Builder createResponseBuilder() {
|
||||
return new FeeTransferResponseExtensionV06.Builder();
|
||||
}
|
||||
}
|
|
@ -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 google.registry.model.domain.fee06;
|
||||
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtensionImplNoCredits;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/**
|
||||
* An XML data object that represents a fee extension that may be present on the response to EPP
|
||||
* domain transfer requests.
|
||||
*/
|
||||
@XmlRootElement(name = "trnData")
|
||||
@XmlType(propOrder = {"currency", "fees"})
|
||||
public class FeeTransferResponseExtensionV06 extends FeeTransformResponseExtensionImplNoCredits {
|
||||
/** A builder for {@link FeeTransferResponseExtensionV06}. */
|
||||
public static class Builder
|
||||
extends FeeTransformResponseExtensionImplNoCredits
|
||||
.Builder<FeeTransferResponseExtensionV06, Builder> {}
|
||||
}
|
|
@ -12,13 +12,22 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.model.domain.fee;
|
||||
package google.registry.model.domain.fee06;
|
||||
|
||||
import google.registry.model.eppinput.EppInput.CommandExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformCommandExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformCommandExtensionImplNoCredits;
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtension;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/** A fee extension that may be present on domain update commands. */
|
||||
@XmlRootElement(name = "update")
|
||||
@XmlType(propOrder = {"currency", "fees"})
|
||||
public class FeeUpdateExtension extends BaseFeeCommand implements CommandExtension {}
|
||||
public class FeeUpdateCommandExtensionV06
|
||||
extends FeeTransformCommandExtensionImplNoCredits implements FeeTransformCommandExtension {
|
||||
|
||||
@Override
|
||||
public FeeTransformResponseExtension.Builder createResponseBuilder() {
|
||||
return new FeeUpdateResponseExtensionV06.Builder();
|
||||
}
|
||||
}
|
|
@ -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 google.registry.model.domain.fee06;
|
||||
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtensionImplNoCredits;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/**
|
||||
* An XML data object that represents a fee extension that may be present on the response to EPP
|
||||
* domain update commands.
|
||||
*/
|
||||
@XmlRootElement(name = "updData")
|
||||
@XmlType(propOrder = {"currency", "fees"})
|
||||
public class FeeUpdateResponseExtensionV06 extends FeeTransformResponseExtensionImplNoCredits {
|
||||
/** A builder for {@link FeeUpdateResponseExtensionV06}. */
|
||||
public static class Builder
|
||||
extends FeeTransformResponseExtensionImplNoCredits
|
||||
.Builder<FeeUpdateResponseExtensionV06, Builder> {}
|
||||
}
|
|
@ -18,7 +18,7 @@
|
|||
elementFormDefault = XmlNsForm.QUALIFIED)
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlJavaTypeAdapter(CurrencyUnitAdapter.class)
|
||||
package google.registry.model.domain.fee;
|
||||
package google.registry.model.domain.fee06;
|
||||
|
||||
import google.registry.model.translators.CurrencyUnitAdapter;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
@ -0,0 +1,148 @@
|
|||
// 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.fee11;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.domain.Period;
|
||||
import google.registry.model.domain.fee.FeeCheckCommandExtension;
|
||||
import google.registry.model.domain.fee.FeeCheckCommandExtensionItem;
|
||||
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem;
|
||||
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem.Builder;
|
||||
import google.registry.model.domain.fee.FeeExtensionCommandDescriptor;
|
||||
import google.registry.model.domain.fee11.FeeCheckCommandExtensionV11.FeeCheckCommandExtensionItemV11;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/**
|
||||
* Version 0.11 of the fee extension that may be present on domain check commands. Unlike other
|
||||
* versions, there is only one check item; things are nested one level less. However, the response
|
||||
* will have multiple items, one for each domain in the check command.
|
||||
*/
|
||||
@XmlRootElement(name = "check")
|
||||
@XmlType(propOrder = {"command", "currency", "period", "feeClass"})
|
||||
public class FeeCheckCommandExtensionV11 extends ImmutableObject
|
||||
implements FeeCheckCommandExtension<
|
||||
FeeCheckCommandExtensionItemV11,
|
||||
FeeCheckResponseExtensionV11> {
|
||||
|
||||
/** The default validity period (if not specified) is 1 year for all operations. */
|
||||
static final Period DEFAULT_PERIOD = Period.create(1, Period.Unit.YEARS);
|
||||
|
||||
/** The command to check. */
|
||||
FeeExtensionCommandDescriptor command;
|
||||
|
||||
/** Three-letter currency code in which results should be returned. */
|
||||
CurrencyUnit currency;
|
||||
|
||||
/** The period to check. */
|
||||
Period period;
|
||||
|
||||
/** The class to check. */
|
||||
@XmlElement(name = "class")
|
||||
String feeClass;
|
||||
|
||||
@Override
|
||||
public boolean isCurrencySupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurrencyUnit getCurrency() {
|
||||
throw new UnsupportedOperationException("Currency not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<FeeCheckCommandExtensionItemV11> getItems() {
|
||||
return ImmutableSet.of(new FeeCheckCommandExtensionItemV11());
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeeCheckResponseExtensionV11 createResponse(
|
||||
ImmutableList<? extends FeeCheckResponseExtensionItem> items) {
|
||||
ImmutableList.Builder<FeeCheckResponseExtensionItemV11> builder = new ImmutableList.Builder<>();
|
||||
for (FeeCheckResponseExtensionItem item : items) {
|
||||
checkState(
|
||||
item instanceof FeeCheckResponseExtensionItemV11,
|
||||
"Fee extension response item is not V11");
|
||||
builder.add((FeeCheckResponseExtensionItemV11) item);
|
||||
}
|
||||
return FeeCheckResponseExtensionV11.create(builder.build());
|
||||
}
|
||||
|
||||
/** Implementation of the item interface, returning values of the single "item". */
|
||||
class FeeCheckCommandExtensionItemV11 implements FeeCheckCommandExtensionItem {
|
||||
|
||||
/** The name of the command being checked. */
|
||||
@Override
|
||||
public CommandName getCommandName() {
|
||||
return command.getCommand();
|
||||
}
|
||||
|
||||
/** The command name before being parsed into an enum, for use in error strings. */
|
||||
@Override
|
||||
public String getUnparsedCommandName() {
|
||||
return command.getUnparsedCommandName();
|
||||
}
|
||||
|
||||
/** The phase of the command being checked. */
|
||||
@Override
|
||||
public String getPhase() {
|
||||
return command.getPhase();
|
||||
}
|
||||
|
||||
/** The subphase of the command being checked. */
|
||||
@Override
|
||||
public String getSubphase() {
|
||||
return command.getSubphase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Period getPeriod() {
|
||||
return Optional.fromNullable(period).or(DEFAULT_PERIOD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDomainNameSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDomainName() {
|
||||
throw new UnsupportedOperationException("Domain not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCurrencySupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurrencyUnit getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder createResponseBuilder() {
|
||||
return new FeeCheckResponseExtensionItemV11.Builder();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
// 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.fee11;
|
||||
|
||||
import google.registry.model.domain.DomainObjectSpec;
|
||||
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem;
|
||||
import google.registry.model.domain.fee.FeeQueryResponseExtensionItemImpl;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/** The version 0.11 response for a domain check on a single resource. */
|
||||
@XmlType(propOrder = {"object", "command", "currency", "period", "fee", "feeClass", "reason"})
|
||||
public class FeeCheckResponseExtensionItemV11
|
||||
extends FeeQueryResponseExtensionItemImpl implements FeeCheckResponseExtensionItem {
|
||||
|
||||
/** Whether the domain is available. */
|
||||
@XmlAttribute
|
||||
boolean avail;
|
||||
|
||||
/** The domain that was checked. */
|
||||
DomainObjectSpec object;
|
||||
|
||||
CurrencyUnit currency;
|
||||
|
||||
/** The reason that the check item cannot be calculated. */
|
||||
String reason;
|
||||
|
||||
/** Builder for {@link FeeCheckResponseExtensionItemV11}. */
|
||||
public static class Builder
|
||||
extends FeeQueryResponseExtensionItemImpl.Builder<FeeCheckResponseExtensionItemV11, Builder>
|
||||
implements FeeCheckResponseExtensionItem.Builder {
|
||||
|
||||
@Override
|
||||
public Builder setDomainNameIfSupported(String name) {
|
||||
getInstance().object = new DomainObjectSpec(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder setCurrencyIfSupported(CurrencyUnit currency) {
|
||||
getInstance().currency = currency;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder setAvailIfSupported(boolean avail) {
|
||||
getInstance().avail = avail;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder setReasonIfSupported(String reason) {
|
||||
getInstance().reason = reason;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
// 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.fee11;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.domain.fee.FeeCheckResponseExtension;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/**
|
||||
* An XML data object that represents version 0.11 of the fee extension that may be present on the
|
||||
* response to EPP domain check commands.
|
||||
*/
|
||||
@XmlRootElement(name = "chkData")
|
||||
public class FeeCheckResponseExtensionV11
|
||||
extends ImmutableObject implements FeeCheckResponseExtension<FeeCheckResponseExtensionItemV11> {
|
||||
|
||||
/** Check responses. */
|
||||
@XmlElement(name = "cd")
|
||||
ImmutableList<FeeCheckResponseExtensionItemV11> items;
|
||||
|
||||
|
||||
@Override
|
||||
public void setCurrencyIfSupported(CurrencyUnit currency) {}
|
||||
|
||||
@VisibleForTesting
|
||||
@Override
|
||||
public ImmutableList<FeeCheckResponseExtensionItemV11> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
static FeeCheckResponseExtensionV11
|
||||
create(ImmutableList<FeeCheckResponseExtensionItemV11> items) {
|
||||
FeeCheckResponseExtensionV11 instance = new FeeCheckResponseExtensionV11();
|
||||
instance.items = items;
|
||||
return instance;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
// 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.fee11;
|
||||
|
||||
import google.registry.model.domain.fee.FeeTransformCommandExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtension;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/** A fee extension that may be present on domain create commands. */
|
||||
@XmlRootElement(name = "create")
|
||||
@XmlType(propOrder = {"currency", "fees", "credits"})
|
||||
public class FeeCreateCommandExtensionV11
|
||||
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
|
||||
|
||||
@Override
|
||||
public FeeTransformResponseExtension.Builder createResponseBuilder() {
|
||||
return new FeeCreateResponseExtensionV11.Builder();
|
||||
}
|
||||
}
|
|
@ -12,9 +12,9 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.model.domain.fee;
|
||||
package google.registry.model.domain.fee11;
|
||||
|
||||
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtensionImpl;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
@ -23,10 +23,9 @@ import javax.xml.bind.annotation.XmlType;
|
|||
* domain create commands.
|
||||
*/
|
||||
@XmlRootElement(name = "creData")
|
||||
@XmlType(propOrder = {"currency", "fee"})
|
||||
public class FeeCreateResponseExtension extends BaseFeeCommandResponse
|
||||
implements ResponseExtension {
|
||||
/** A builder for {@link FeeCreateResponseExtension}. */
|
||||
@XmlType(propOrder = {"currency", "fees", "credits"})
|
||||
public class FeeCreateResponseExtensionV11 extends FeeTransformResponseExtensionImpl {
|
||||
/** A builder for {@link FeeCreateResponseExtensionV11}. */
|
||||
public static class Builder
|
||||
extends BaseFeeCommandResponse.Builder<FeeCreateResponseExtension, Builder> {}
|
||||
extends FeeTransformResponseExtensionImpl.Builder<FeeCreateResponseExtensionV11, Builder> {}
|
||||
}
|
|
@ -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 google.registry.model.domain.fee11;
|
||||
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtensionImpl;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/**
|
||||
* An XML data object that represents a fee extension that may be present on the response to EPP
|
||||
* domain create commands.
|
||||
*/
|
||||
@XmlRootElement(name = "delData")
|
||||
@XmlType(propOrder = {"currency", "fees", "credits"})
|
||||
public class FeeDeleteResponseExtensionV11 extends FeeTransformResponseExtensionImpl {
|
||||
|
||||
/** Builder for {@link FeeDeleteResponseExtensionV11}. */
|
||||
public static class Builder
|
||||
extends FeeTransformResponseExtensionImpl.Builder<FeeDeleteResponseExtensionV11, Builder> {}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
// 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.fee11;
|
||||
|
||||
import google.registry.model.domain.fee.FeeTransformCommandExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtension;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/** A fee extension that may be present on domain renew commands. */
|
||||
@XmlRootElement(name = "renew")
|
||||
@XmlType(propOrder = {"currency", "fees", "credits"})
|
||||
public class FeeRenewCommandExtensionV11
|
||||
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
|
||||
|
||||
@Override
|
||||
public FeeTransformResponseExtension.Builder createResponseBuilder() {
|
||||
return new FeeRenewResponseExtensionV11.Builder();
|
||||
}
|
||||
}
|
|
@ -12,21 +12,20 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.model.domain.fee;
|
||||
package google.registry.model.domain.fee11;
|
||||
|
||||
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtensionImpl;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/**
|
||||
* An XML data object that represents a fee extension that may be present on the response to EPP
|
||||
* domain create commands.
|
||||
* domain renew commands.
|
||||
*/
|
||||
@XmlRootElement(name = "renData")
|
||||
@XmlType(propOrder = {"currency", "fee"})
|
||||
public class FeeRenewResponseExtension extends BaseFeeCommandResponse
|
||||
implements ResponseExtension {
|
||||
/** A builder for {@link FeeRenewResponseExtension}. */
|
||||
@XmlType(propOrder = {"currency", "fees", "credits"})
|
||||
public class FeeRenewResponseExtensionV11 extends FeeTransformResponseExtensionImpl {
|
||||
/** A builder for {@link FeeRenewResponseExtensionV11}. */
|
||||
public static class Builder
|
||||
extends BaseFeeCommandResponse.Builder<FeeRenewResponseExtension, Builder> {}
|
||||
extends FeeTransformResponseExtensionImpl.Builder<FeeRenewResponseExtensionV11, Builder> {}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
// 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.fee11;
|
||||
|
||||
import google.registry.model.domain.fee.FeeTransformCommandExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtension;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/** A fee extension that may be present on domain transfer requests. */
|
||||
@XmlRootElement(name = "transfer")
|
||||
@XmlType(propOrder = {"currency", "fees", "credits"})
|
||||
public class FeeTransferCommandExtensionV11
|
||||
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
|
||||
|
||||
@Override
|
||||
public FeeTransformResponseExtension.Builder createResponseBuilder() {
|
||||
return new FeeTransferResponseExtensionV11.Builder();
|
||||
}
|
||||
}
|
|
@ -12,9 +12,9 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.model.domain.fee;
|
||||
package google.registry.model.domain.fee11;
|
||||
|
||||
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtensionImpl;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
@ -23,10 +23,9 @@ import javax.xml.bind.annotation.XmlType;
|
|||
* domain transfer requests.
|
||||
*/
|
||||
@XmlRootElement(name = "trnData")
|
||||
@XmlType(propOrder = {"currency", "fee"})
|
||||
public class FeeTransferResponseExtension extends BaseFeeCommandResponse
|
||||
implements ResponseExtension {
|
||||
/** A builder for {@link FeeTransferResponseExtension}. */
|
||||
@XmlType(propOrder = {"currency", "fees", "credits"})
|
||||
public class FeeTransferResponseExtensionV11 extends FeeTransformResponseExtensionImpl {
|
||||
/** A builder for {@link FeeTransferResponseExtensionV11}. */
|
||||
public static class Builder
|
||||
extends BaseFeeCommandResponse.Builder<FeeTransferResponseExtension, Builder> {}
|
||||
extends FeeTransformResponseExtensionImpl.Builder<FeeTransferResponseExtensionV11, Builder> {}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
// 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.fee11;
|
||||
|
||||
import google.registry.model.domain.fee.FeeTransformCommandExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtension;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/** A fee extension that may be present on domain update commands. */
|
||||
@XmlRootElement(name = "update")
|
||||
@XmlType(propOrder = {"currency", "fees", "credits"})
|
||||
public class FeeUpdateCommandExtensionV11
|
||||
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
|
||||
|
||||
@Override
|
||||
public FeeTransformResponseExtension.Builder createResponseBuilder() {
|
||||
return new FeeUpdateResponseExtensionV11.Builder();
|
||||
}
|
||||
}
|
|
@ -12,9 +12,9 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.model.domain.fee;
|
||||
package google.registry.model.domain.fee11;
|
||||
|
||||
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtensionImpl;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
@ -23,10 +23,9 @@ import javax.xml.bind.annotation.XmlType;
|
|||
* domain update commands.
|
||||
*/
|
||||
@XmlRootElement(name = "updData")
|
||||
@XmlType(propOrder = {"currency", "fee"})
|
||||
public class FeeUpdateResponseExtension extends BaseFeeCommandResponse
|
||||
implements ResponseExtension {
|
||||
/** A builder for {@link FeeUpdateResponseExtension}. */
|
||||
@XmlType(propOrder = {"currency", "fees", "credits"})
|
||||
public class FeeUpdateResponseExtensionV11 extends FeeTransformResponseExtensionImpl {
|
||||
/** A builder for {@link FeeUpdateResponseExtensionV11}. */
|
||||
public static class Builder
|
||||
extends BaseFeeCommandResponse.Builder<FeeUpdateResponseExtension, Builder> {}
|
||||
extends FeeTransformResponseExtensionImpl.Builder<FeeUpdateResponseExtensionV11, Builder> {}
|
||||
}
|
30
java/google/registry/model/domain/fee11/package-info.java
Normal file
30
java/google/registry/model/domain/fee11/package-info.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
// 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:fee-0.11",
|
||||
xmlns = @XmlNs(prefix = "fee11", namespaceURI = "urn:ietf:params:xml:ns:fee-0.11"),
|
||||
elementFormDefault = XmlNsForm.QUALIFIED)
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlJavaTypeAdapter(CurrencyUnitAdapter.class)
|
||||
package google.registry.model.domain.fee11;
|
||||
|
||||
import google.registry.model.translators.CurrencyUnitAdapter;
|
||||
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;
|
||||
|
|
@ -22,12 +22,16 @@ import com.google.common.collect.FluentIterable;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.domain.allocate.AllocateCreateExtension;
|
||||
import google.registry.model.domain.fee.FeeCheckExtension;
|
||||
import google.registry.model.domain.fee06.FeeCheckCommandExtensionV06;
|
||||
import google.registry.model.domain.fee06.FeeCheckResponseExtensionV06;
|
||||
import google.registry.model.domain.fee11.FeeCheckCommandExtensionV11;
|
||||
import google.registry.model.domain.fee11.FeeCheckResponseExtensionV11;
|
||||
import google.registry.model.domain.launch.LaunchCreateExtension;
|
||||
import google.registry.model.domain.metadata.MetadataExtension;
|
||||
import google.registry.model.domain.rgp.RgpUpdateExtension;
|
||||
import google.registry.model.domain.secdns.SecDnsCreateExtension;
|
||||
import google.registry.model.eppinput.EppInput.CommandExtension;
|
||||
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlSchema;
|
||||
|
@ -45,21 +49,37 @@ public class ProtocolDefinition {
|
|||
|
||||
/** Enums repesenting valid service extensions that are recognized by the server. */
|
||||
public enum ServiceExtension {
|
||||
LAUNCH_EXTENSION_1_0(LaunchCreateExtension.class, true),
|
||||
REDEMPTION_GRACE_PERIOD_1_0(RgpUpdateExtension.class, true),
|
||||
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);
|
||||
LAUNCH_EXTENSION_1_0(LaunchCreateExtension.class, null, true),
|
||||
REDEMPTION_GRACE_PERIOD_1_0(RgpUpdateExtension.class, null, true),
|
||||
SECURE_DNS_1_1(SecDnsCreateExtension.class, null, true),
|
||||
FEE_0_6(FeeCheckCommandExtensionV06.class, FeeCheckResponseExtensionV06.class, true),
|
||||
FEE_0_11(FeeCheckCommandExtensionV11.class, FeeCheckResponseExtensionV11.class, true),
|
||||
ALLOCATE_1_0(AllocateCreateExtension.class, null, false),
|
||||
METADATA_1_0(MetadataExtension.class, null, false);
|
||||
|
||||
private final Class<? extends CommandExtension> commandExtensionClass;
|
||||
private final Class<? extends ResponseExtension> responseExtensionClass;
|
||||
private String uri;
|
||||
private boolean visible;
|
||||
|
||||
ServiceExtension(Class<? extends CommandExtension> clazz, boolean visible) {
|
||||
this.uri = getCommandExtensionUri(clazz);
|
||||
ServiceExtension(
|
||||
Class<? extends CommandExtension> commandExtensionClass,
|
||||
Class<? extends ResponseExtension> responseExtensionClass,
|
||||
boolean visible) {
|
||||
this.commandExtensionClass = commandExtensionClass;
|
||||
this.responseExtensionClass = responseExtensionClass;
|
||||
this.uri = getCommandExtensionUri(commandExtensionClass);
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
public Class<? extends CommandExtension> getCommandExtensionClass() {
|
||||
return commandExtensionClass;
|
||||
}
|
||||
|
||||
public Class<? extends ResponseExtension> getResponseExtensionClass() {
|
||||
return responseExtensionClass;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ package google.registry.model.eppinput;
|
|||
import static google.registry.util.CollectionUtils.nullSafeImmutableCopy;
|
||||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
@ -24,12 +25,17 @@ import google.registry.model.ImmutableObject;
|
|||
import google.registry.model.contact.ContactCommand;
|
||||
import google.registry.model.domain.DomainCommand;
|
||||
import google.registry.model.domain.allocate.AllocateCreateExtension;
|
||||
import google.registry.model.domain.fee.FeeCheckExtension;
|
||||
import google.registry.model.domain.fee.FeeCreateExtension;
|
||||
import google.registry.model.domain.fee.FeeInfoExtension;
|
||||
import google.registry.model.domain.fee.FeeRenewExtension;
|
||||
import google.registry.model.domain.fee.FeeTransferExtension;
|
||||
import google.registry.model.domain.fee.FeeUpdateExtension;
|
||||
import google.registry.model.domain.fee06.FeeCheckCommandExtensionV06;
|
||||
import google.registry.model.domain.fee06.FeeCreateCommandExtensionV06;
|
||||
import google.registry.model.domain.fee06.FeeInfoCommandExtensionV06;
|
||||
import google.registry.model.domain.fee06.FeeRenewCommandExtensionV06;
|
||||
import google.registry.model.domain.fee06.FeeTransferCommandExtensionV06;
|
||||
import google.registry.model.domain.fee06.FeeUpdateCommandExtensionV06;
|
||||
import google.registry.model.domain.fee11.FeeCheckCommandExtensionV11;
|
||||
import google.registry.model.domain.fee11.FeeCreateCommandExtensionV11;
|
||||
import google.registry.model.domain.fee11.FeeRenewCommandExtensionV11;
|
||||
import google.registry.model.domain.fee11.FeeTransferCommandExtensionV11;
|
||||
import google.registry.model.domain.fee11.FeeUpdateCommandExtensionV11;
|
||||
import google.registry.model.domain.launch.LaunchCheckExtension;
|
||||
import google.registry.model.domain.launch.LaunchCreateExtension;
|
||||
import google.registry.model.domain.launch.LaunchDeleteExtension;
|
||||
|
@ -44,6 +50,7 @@ import google.registry.model.eppinput.ResourceCommand.SingleResourceCommand;
|
|||
import google.registry.model.host.HostCommand;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementRef;
|
||||
|
@ -90,10 +97,39 @@ public class EppInput extends ImmutableObject {
|
|||
}
|
||||
|
||||
/** Get the extension based on type, or null. If there are multiple, it chooses the first. */
|
||||
@Nullable
|
||||
public <E extends CommandExtension> E getSingleExtension(Class<E> clazz) {
|
||||
return FluentIterable.from(getCommandWrapper().getExtensions()).filter(clazz).first().orNull();
|
||||
}
|
||||
|
||||
/** Get the extension based on type, or null, chosen from a list of possible extension classes.
|
||||
* If there are extensions matching multiple classes, the first class listed is chosen. If there
|
||||
* are multiple extensions of the same class, the first extension of that class is chosen
|
||||
* (assuming that an extension matching a preceding class was not already chosen). This method is
|
||||
* used to support multiple versions of an extension. Specify all supported versions, starting
|
||||
* with the latest. The first-occurring extension of the latest version will be chosen, or failing
|
||||
* that the first-occurring extension of the previous version, and so on.
|
||||
*/
|
||||
@Nullable
|
||||
public <E extends CommandExtension>
|
||||
E getFirstExtensionOfClasses(ImmutableList<Class<? extends E>> classes) {
|
||||
for (Class<? extends E> clazz : classes) {
|
||||
Optional<? extends E> extension = FluentIterable.from(
|
||||
getCommandWrapper().getExtensions()).filter(clazz).first();
|
||||
if (extension.isPresent()) {
|
||||
return extension.get();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
@Nullable
|
||||
public final <E extends CommandExtension>
|
||||
E getFirstExtensionOfClasses(Class<? extends E>... classes) {
|
||||
return getFirstExtensionOfClasses(ImmutableList.copyOf(classes));
|
||||
}
|
||||
|
||||
/** A tag that goes inside of an EPP {@literal <command>}. */
|
||||
public static class InnerCommand extends ImmutableObject {}
|
||||
|
||||
|
@ -260,13 +296,22 @@ public class EppInput extends ImmutableObject {
|
|||
|
||||
/** Zero or more command extensions. */
|
||||
@XmlElementRefs({
|
||||
// allocate create extension
|
||||
@XmlElementRef(type = AllocateCreateExtension.class),
|
||||
@XmlElementRef(type = FeeCheckExtension.class),
|
||||
@XmlElementRef(type = FeeCreateExtension.class),
|
||||
@XmlElementRef(type = FeeInfoExtension.class),
|
||||
@XmlElementRef(type = FeeRenewExtension.class),
|
||||
@XmlElementRef(type = FeeTransferExtension.class),
|
||||
@XmlElementRef(type = FeeUpdateExtension.class),
|
||||
// fee extension version 0.6
|
||||
@XmlElementRef(type = FeeCheckCommandExtensionV06.class),
|
||||
@XmlElementRef(type = FeeInfoCommandExtensionV06.class),
|
||||
@XmlElementRef(type = FeeCreateCommandExtensionV06.class),
|
||||
@XmlElementRef(type = FeeRenewCommandExtensionV06.class),
|
||||
@XmlElementRef(type = FeeTransferCommandExtensionV06.class),
|
||||
@XmlElementRef(type = FeeUpdateCommandExtensionV06.class),
|
||||
// fee extension version 0.11
|
||||
@XmlElementRef(type = FeeCheckCommandExtensionV11.class),
|
||||
@XmlElementRef(type = FeeCreateCommandExtensionV11.class),
|
||||
@XmlElementRef(type = FeeRenewCommandExtensionV11.class),
|
||||
@XmlElementRef(type = FeeTransferCommandExtensionV11.class),
|
||||
@XmlElementRef(type = FeeUpdateCommandExtensionV11.class),
|
||||
// other extensions
|
||||
@XmlElementRef(type = LaunchCheckExtension.class),
|
||||
@XmlElementRef(type = LaunchCreateExtension.class),
|
||||
@XmlElementRef(type = LaunchDeleteExtension.class),
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
package google.registry.model.eppoutput;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.model.Buildable;
|
||||
import google.registry.model.ImmutableObject;
|
||||
|
@ -21,13 +22,19 @@ import google.registry.model.contact.ContactResource;
|
|||
import google.registry.model.domain.DomainApplication;
|
||||
import google.registry.model.domain.DomainRenewData;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.fee.FeeCheckResponseExtension;
|
||||
import google.registry.model.domain.fee.FeeCreateResponseExtension;
|
||||
import google.registry.model.domain.fee.FeeDeleteResponseExtension;
|
||||
import google.registry.model.domain.fee.FeeInfoResponseExtension;
|
||||
import google.registry.model.domain.fee.FeeRenewResponseExtension;
|
||||
import google.registry.model.domain.fee.FeeTransferResponseExtension;
|
||||
import google.registry.model.domain.fee.FeeUpdateResponseExtension;
|
||||
import google.registry.model.domain.fee06.FeeCheckResponseExtensionV06;
|
||||
import google.registry.model.domain.fee06.FeeCreateResponseExtensionV06;
|
||||
import google.registry.model.domain.fee06.FeeDeleteResponseExtensionV06;
|
||||
import google.registry.model.domain.fee06.FeeInfoResponseExtensionV06;
|
||||
import google.registry.model.domain.fee06.FeeRenewResponseExtensionV06;
|
||||
import google.registry.model.domain.fee06.FeeTransferResponseExtensionV06;
|
||||
import google.registry.model.domain.fee06.FeeUpdateResponseExtensionV06;
|
||||
import google.registry.model.domain.fee11.FeeCheckResponseExtensionV11;
|
||||
import google.registry.model.domain.fee11.FeeCreateResponseExtensionV11;
|
||||
import google.registry.model.domain.fee11.FeeDeleteResponseExtensionV11;
|
||||
import google.registry.model.domain.fee11.FeeRenewResponseExtensionV11;
|
||||
import google.registry.model.domain.fee11.FeeTransferResponseExtensionV11;
|
||||
import google.registry.model.domain.fee11.FeeUpdateResponseExtensionV11;
|
||||
import google.registry.model.domain.launch.LaunchCheckResponseExtension;
|
||||
import google.registry.model.domain.launch.LaunchCreateResponseExtension;
|
||||
import google.registry.model.domain.launch.LaunchInfoResponseExtension;
|
||||
|
@ -120,13 +127,19 @@ public class EppResponse extends ImmutableObject implements ResponseOrGreeting {
|
|||
|
||||
/** Zero or more response extensions. */
|
||||
@XmlElementRefs({
|
||||
@XmlElementRef(type = FeeCheckResponseExtension.class),
|
||||
@XmlElementRef(type = FeeCreateResponseExtension.class),
|
||||
@XmlElementRef(type = FeeDeleteResponseExtension.class),
|
||||
@XmlElementRef(type = FeeInfoResponseExtension.class),
|
||||
@XmlElementRef(type = FeeRenewResponseExtension.class),
|
||||
@XmlElementRef(type = FeeTransferResponseExtension.class),
|
||||
@XmlElementRef(type = FeeUpdateResponseExtension.class),
|
||||
@XmlElementRef(type = FeeCheckResponseExtensionV06.class),
|
||||
@XmlElementRef(type = FeeInfoResponseExtensionV06.class),
|
||||
@XmlElementRef(type = FeeCreateResponseExtensionV06.class),
|
||||
@XmlElementRef(type = FeeDeleteResponseExtensionV06.class),
|
||||
@XmlElementRef(type = FeeRenewResponseExtensionV06.class),
|
||||
@XmlElementRef(type = FeeTransferResponseExtensionV06.class),
|
||||
@XmlElementRef(type = FeeUpdateResponseExtensionV06.class),
|
||||
@XmlElementRef(type = FeeCheckResponseExtensionV11.class),
|
||||
@XmlElementRef(type = FeeCreateResponseExtensionV11.class),
|
||||
@XmlElementRef(type = FeeDeleteResponseExtensionV11.class),
|
||||
@XmlElementRef(type = FeeRenewResponseExtensionV11.class),
|
||||
@XmlElementRef(type = FeeTransferResponseExtensionV11.class),
|
||||
@XmlElementRef(type = FeeUpdateResponseExtensionV11.class),
|
||||
@XmlElementRef(type = LaunchCheckResponseExtension.class),
|
||||
@XmlElementRef(type = LaunchCreateResponseExtension.class),
|
||||
@XmlElementRef(type = LaunchInfoResponseExtension.class),
|
||||
|
@ -150,7 +163,31 @@ public class EppResponse extends ImmutableObject implements ResponseOrGreeting {
|
|||
public ImmutableList<? extends ResponseExtension> getExtensions() {
|
||||
return extensions;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ResponseExtension getFirstExtensionOfType(Class<? extends ResponseExtension> clazz) {
|
||||
return FluentIterable.from(extensions).filter(clazz).first().orNull();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ResponseExtension
|
||||
getFirstExtensionOfType(ImmutableList<Class<? extends ResponseExtension>> classes) {
|
||||
for (Class<? extends ResponseExtension> clazz : classes) {
|
||||
ResponseExtension extension = getFirstExtensionOfType(clazz);
|
||||
if (extension != null) {
|
||||
return extension;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
@Nullable
|
||||
public final ResponseExtension
|
||||
getFirstExtensionOfType(Class<? extends ResponseExtension>... classes) {
|
||||
return getFirstExtensionOfType(ImmutableList.copyOf(classes));
|
||||
}
|
||||
|
||||
public Result getResult() {
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue