diff --git a/java/google/registry/flows/exceptions/AddRemoveSameValueEppException.java b/java/google/registry/flows/exceptions/AddRemoveSameValueEppException.java new file mode 100644 index 000000000..63ee173e4 --- /dev/null +++ b/java/google/registry/flows/exceptions/AddRemoveSameValueEppException.java @@ -0,0 +1,24 @@ +// 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.flows.exceptions; + +import google.registry.flows.EppException.ParameterValuePolicyErrorException; + +/** Cannot add and remove the same value. */ +public class AddRemoveSameValueEppException extends ParameterValuePolicyErrorException { + public AddRemoveSameValueEppException() { + super("Cannot add and remove the same value"); + } +} diff --git a/java/google/registry/flows/exceptions/AlreadyPendingTransferException.java b/java/google/registry/flows/exceptions/AlreadyPendingTransferException.java new file mode 100644 index 000000000..45aa3ff34 --- /dev/null +++ b/java/google/registry/flows/exceptions/AlreadyPendingTransferException.java @@ -0,0 +1,24 @@ +// 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.flows.exceptions; + +import google.registry.flows.EppException.ObjectPendingTransferException; + +/** The resource is already pending transfer. */ +public class AlreadyPendingTransferException extends ObjectPendingTransferException { + public AlreadyPendingTransferException(String targetId) { + super(targetId); + } +} diff --git a/java/google/registry/flows/exceptions/BadCommandForRegistryPhaseException.java b/java/google/registry/flows/exceptions/BadCommandForRegistryPhaseException.java new file mode 100644 index 000000000..944d4b332 --- /dev/null +++ b/java/google/registry/flows/exceptions/BadCommandForRegistryPhaseException.java @@ -0,0 +1,24 @@ +// 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.flows.exceptions; + +import google.registry.flows.EppException.CommandUseErrorException; + +/** Command is not allowed in the current registry phase. */ +public class BadCommandForRegistryPhaseException extends CommandUseErrorException { + public BadCommandForRegistryPhaseException() { + super("Command is not allowed in the current registry phase"); + } +} diff --git a/java/google/registry/flows/exceptions/MissingTransferRequestAuthInfoException.java b/java/google/registry/flows/exceptions/MissingTransferRequestAuthInfoException.java new file mode 100644 index 000000000..562d7b922 --- /dev/null +++ b/java/google/registry/flows/exceptions/MissingTransferRequestAuthInfoException.java @@ -0,0 +1,24 @@ +// 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.flows.exceptions; + +import google.registry.flows.EppException.AuthorizationErrorException; + +/** Authorization info is required to request a transfer. */ +public class MissingTransferRequestAuthInfoException extends AuthorizationErrorException { + public MissingTransferRequestAuthInfoException() { + super("Authorization info is required to request a transfer"); + } +} diff --git a/java/google/registry/flows/exceptions/NoTransferHistoryToQueryException.java b/java/google/registry/flows/exceptions/NoTransferHistoryToQueryException.java new file mode 100644 index 000000000..60fea0177 --- /dev/null +++ b/java/google/registry/flows/exceptions/NoTransferHistoryToQueryException.java @@ -0,0 +1,24 @@ +// 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.flows.exceptions; + +import google.registry.flows.EppException.CommandUseErrorException; + +/** Object has no transfer history. */ +public class NoTransferHistoryToQueryException extends CommandUseErrorException { + public NoTransferHistoryToQueryException() { + super("Object has no transfer history"); + } +} diff --git a/java/google/registry/flows/exceptions/NotAuthorizedToViewTransferException.java b/java/google/registry/flows/exceptions/NotAuthorizedToViewTransferException.java new file mode 100644 index 000000000..65457405d --- /dev/null +++ b/java/google/registry/flows/exceptions/NotAuthorizedToViewTransferException.java @@ -0,0 +1,24 @@ +// 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.flows.exceptions; + +import google.registry.flows.EppException.AuthorizationErrorException; + +/** Registrar is not authorized to view transfer status. */ +public class NotAuthorizedToViewTransferException extends AuthorizationErrorException { + public NotAuthorizedToViewTransferException() { + super("Registrar is not authorized to view transfer status"); + } +} diff --git a/java/google/registry/flows/exceptions/NotPendingTransferException.java b/java/google/registry/flows/exceptions/NotPendingTransferException.java new file mode 100644 index 000000000..74381b03d --- /dev/null +++ b/java/google/registry/flows/exceptions/NotPendingTransferException.java @@ -0,0 +1,24 @@ +// 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.flows.exceptions; + +import google.registry.flows.EppException.ObjectNotPendingTransferException; + +/** The resource does not have a pending transfer. */ +public class NotPendingTransferException extends ObjectNotPendingTransferException { + public NotPendingTransferException(String objectId) { + super(objectId); + } +} diff --git a/java/google/registry/flows/exceptions/NotTransferInitiatorException.java b/java/google/registry/flows/exceptions/NotTransferInitiatorException.java new file mode 100644 index 000000000..5f049ed6e --- /dev/null +++ b/java/google/registry/flows/exceptions/NotTransferInitiatorException.java @@ -0,0 +1,24 @@ +// 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.flows.exceptions; + +import google.registry.flows.EppException.AuthorizationErrorException; + +/** Registrar is not the initiator of this transfer. */ +public class NotTransferInitiatorException extends AuthorizationErrorException { + public NotTransferInitiatorException() { + super("Registrar is not the initiator of this transfer"); + } +} diff --git a/java/google/registry/flows/exceptions/ObjectAlreadySponsoredException.java b/java/google/registry/flows/exceptions/ObjectAlreadySponsoredException.java new file mode 100644 index 000000000..345ccc9cb --- /dev/null +++ b/java/google/registry/flows/exceptions/ObjectAlreadySponsoredException.java @@ -0,0 +1,24 @@ +// 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.flows.exceptions; + +import google.registry.flows.EppException.CommandUseErrorException; + +/** Registrar already sponsors the object of this transfer request. */ +public class ObjectAlreadySponsoredException extends CommandUseErrorException { + public ObjectAlreadySponsoredException() { + super("Registrar already sponsors the object of this transfer request"); + } +} diff --git a/java/google/registry/flows/exceptions/OnlyToolCanPassMetadataException.java b/java/google/registry/flows/exceptions/OnlyToolCanPassMetadataException.java new file mode 100644 index 000000000..8d1e82b14 --- /dev/null +++ b/java/google/registry/flows/exceptions/OnlyToolCanPassMetadataException.java @@ -0,0 +1,24 @@ +// 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.flows.exceptions; + +import google.registry.flows.EppException.AuthorizationErrorException; + +/** Only a tool can pass a metadata extension. */ +public class OnlyToolCanPassMetadataException extends AuthorizationErrorException { + public OnlyToolCanPassMetadataException() { + super("Metadata extensions can only be passed by tools."); + } +} diff --git a/java/google/registry/flows/exceptions/ResourceAlreadyExistsException.java b/java/google/registry/flows/exceptions/ResourceAlreadyExistsException.java new file mode 100644 index 000000000..3f014ad29 --- /dev/null +++ b/java/google/registry/flows/exceptions/ResourceAlreadyExistsException.java @@ -0,0 +1,39 @@ +// 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.flows.exceptions; + +import com.google.common.annotations.VisibleForTesting; +import google.registry.flows.EppException.ObjectAlreadyExistsException; + +/** Resource with this id already exists. */ +public class ResourceAlreadyExistsException extends ObjectAlreadyExistsException { + + /** Whether this was thrown from a "failfast" context. Useful for testing. */ + final boolean failfast; + + public ResourceAlreadyExistsException(String resourceId, boolean failfast) { + super(String.format("Object with given ID (%s) already exists", resourceId)); + this.failfast = failfast; + } + + public ResourceAlreadyExistsException(String resourceId) { + this(resourceId, false); + } + + @VisibleForTesting + public boolean isFailfast() { + return failfast; + } +} diff --git a/java/google/registry/flows/exceptions/ResourceHasClientUpdateProhibitedException.java b/java/google/registry/flows/exceptions/ResourceHasClientUpdateProhibitedException.java new file mode 100644 index 000000000..e12c03b54 --- /dev/null +++ b/java/google/registry/flows/exceptions/ResourceHasClientUpdateProhibitedException.java @@ -0,0 +1,24 @@ +// 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.flows.exceptions; + +import google.registry.flows.EppException.StatusProhibitsOperationException; + +/** This resource has clientUpdateProhibited on it, and the update does not clear that status. */ +public class ResourceHasClientUpdateProhibitedException extends StatusProhibitsOperationException { + public ResourceHasClientUpdateProhibitedException() { + super("Operation disallowed by status: clientUpdateProhibited"); + } +} diff --git a/java/google/registry/flows/exceptions/ResourceStatusProhibitsOperationException.java b/java/google/registry/flows/exceptions/ResourceStatusProhibitsOperationException.java new file mode 100644 index 000000000..834ca9f94 --- /dev/null +++ b/java/google/registry/flows/exceptions/ResourceStatusProhibitsOperationException.java @@ -0,0 +1,28 @@ +// 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.flows.exceptions; + +import com.google.common.base.Joiner; +import google.registry.flows.EppException.StatusProhibitsOperationException; +import google.registry.model.eppcommon.StatusValue; +import java.util.Set; + +/** Resource status prohibits this operation. */ +public class ResourceStatusProhibitsOperationException + extends StatusProhibitsOperationException { + public ResourceStatusProhibitsOperationException(Set status) { + super("Operation disallowed by status: " + Joiner.on(", ").join(status)); + } +} diff --git a/java/google/registry/flows/exceptions/ResourceToDeleteIsReferencedException.java b/java/google/registry/flows/exceptions/ResourceToDeleteIsReferencedException.java new file mode 100644 index 000000000..cdc185947 --- /dev/null +++ b/java/google/registry/flows/exceptions/ResourceToDeleteIsReferencedException.java @@ -0,0 +1,24 @@ +// 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.flows.exceptions; + +import google.registry.flows.EppException.AssociationProhibitsOperationException; + +/** Resource to be deleted has active incoming references. */ +public class ResourceToDeleteIsReferencedException extends AssociationProhibitsOperationException { + public ResourceToDeleteIsReferencedException() { + super("Resource to be deleted has active incoming references"); + } +} diff --git a/java/google/registry/flows/exceptions/ResourceToMutateDoesNotExistException.java b/java/google/registry/flows/exceptions/ResourceToMutateDoesNotExistException.java new file mode 100644 index 000000000..f4df5ada8 --- /dev/null +++ b/java/google/registry/flows/exceptions/ResourceToMutateDoesNotExistException.java @@ -0,0 +1,24 @@ +// 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.flows.exceptions; + +import google.registry.flows.EppException.ObjectDoesNotExistException; + +/** Resource with this id does not exist. */ +public class ResourceToMutateDoesNotExistException extends ObjectDoesNotExistException { + public ResourceToMutateDoesNotExistException(Class type, String targetId) { + super(type, targetId); + } +} diff --git a/java/google/registry/flows/exceptions/ResourceToQueryDoesNotExistException.java b/java/google/registry/flows/exceptions/ResourceToQueryDoesNotExistException.java new file mode 100644 index 000000000..4aad6c2cb --- /dev/null +++ b/java/google/registry/flows/exceptions/ResourceToQueryDoesNotExistException.java @@ -0,0 +1,24 @@ +// 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.flows.exceptions; + +import google.registry.flows.EppException.ObjectDoesNotExistException; + +/** Resource with this id does not exist. */ +public class ResourceToQueryDoesNotExistException extends ObjectDoesNotExistException { + public ResourceToQueryDoesNotExistException(Class type, String targetId) { + super(type, targetId); + } +} diff --git a/java/google/registry/flows/exceptions/StatusNotClientSettableException.java b/java/google/registry/flows/exceptions/StatusNotClientSettableException.java new file mode 100644 index 000000000..218be3a9d --- /dev/null +++ b/java/google/registry/flows/exceptions/StatusNotClientSettableException.java @@ -0,0 +1,24 @@ +// 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.flows.exceptions; + +import google.registry.flows.EppException.ParameterValueRangeErrorException; + +/** The specified status value cannot be set by clients. */ +public class StatusNotClientSettableException extends ParameterValueRangeErrorException { + public StatusNotClientSettableException(String statusValue) { + super(String.format("Status value %s cannot be set by clients", statusValue)); + } +} diff --git a/java/google/registry/flows/exceptions/TooManyResourceChecksException.java b/java/google/registry/flows/exceptions/TooManyResourceChecksException.java new file mode 100644 index 000000000..686cf50cc --- /dev/null +++ b/java/google/registry/flows/exceptions/TooManyResourceChecksException.java @@ -0,0 +1,24 @@ +// 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.flows.exceptions; + +import google.registry.flows.EppException.ParameterValuePolicyErrorException; + +/** Too many resource checks requested in one check command. */ +public class TooManyResourceChecksException extends ParameterValuePolicyErrorException { + public TooManyResourceChecksException(int maxChecks) { + super(String.format("No more than %s resources may be checked at a time", maxChecks)); + } +}