diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2018-04-13 13:38:16 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2018-08-17 10:16:40 +0000 |
commit | 2be001c5014010698ed930236496bb939df89cde (patch) | |
tree | 7fcd07f050de2b3380b15d94683a46f676f814ca /infra/data-api/src/main/java/io | |
parent | 3278424a38c8dbb2c78efd172d89d44b4e74f283 (diff) |
HONEYCOMB-431: make DataModification.validate idempotent
This patch modifies contract of DataModification.validate
to make it idempotent.
ModifiableDataTreeManager.validate now invokes dataTree.validate
on a copy of DataTreeModification.
ModifiableDataTreeManager.validateCandidate was introduced
to allow additional validation.
Change-Id: I86fc101faff9b04afde2f3eb16fff4d4df2867ad
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'infra/data-api/src/main/java/io')
-rw-r--r-- | infra/data-api/src/main/java/io/fd/honeycomb/data/DataModification.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/infra/data-api/src/main/java/io/fd/honeycomb/data/DataModification.java b/infra/data-api/src/main/java/io/fd/honeycomb/data/DataModification.java index 22fba0f53..a87983cdb 100644 --- a/infra/data-api/src/main/java/io/fd/honeycomb/data/DataModification.java +++ b/infra/data-api/src/main/java/io/fd/honeycomb/data/DataModification.java @@ -18,9 +18,9 @@ package io.fd.honeycomb.data; import com.google.common.annotations.Beta; import io.fd.honeycomb.translate.TranslationException; +import io.fd.honeycomb.translate.ValidationFailedException; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException; /** * Modification of a {@link ModifiableDataManager}. @@ -55,18 +55,21 @@ public interface DataModification extends ReadableDataManager, AutoCloseable { /** * Alters data tree using this modification. * - * @throws DataValidationFailedException if modification data is not valid - * @throws TranslationException if failed while updating data tree state + * @throws TranslationException if commit failed while updating data tree state */ - void commit() throws DataValidationFailedException, TranslationException; + void commit() throws TranslationException; /** - * Validate and prepare modification before commit. Besides commit, no further operation is expected after validate - * and the behaviour is undefined. + * Validates state of the {@link DataModification}. * - * @throws DataValidationFailedException if modification data is not valid + * <p>The operation does not have any side-effects on the modification state. + * + * <p>It can be executed many times, providing the same results + * if the state of the modification has not been changed. + * + * @throws ValidationFailedException if modification data is not valid */ - void validate() throws DataValidationFailedException; + void validate() throws ValidationFailedException; /** * Perform cleanup if necessary. @@ -75,4 +78,5 @@ public interface DataModification extends ReadableDataManager, AutoCloseable { default void close() { // by default, no cleanup is required } + } |