X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=dom%2Fmdsal-dom-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fmdsal%2Fdom%2Fapi%2FDOMDataTreeCommitCohort.java;h=b7f202f88a8950eab33e3af9cf00a702e151d379;hb=7e9012b9820ed399a93d1f302dfa5c0e05583493;hp=cbe61124886a12cda4b506384e5042c30c7ae822;hpb=94d4f50d34d5b7c690d7fa92b33e7db7965f455c;p=mdsal.git diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCommitCohort.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCommitCohort.java index cbe6112488..b7f202f88a 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCommitCohort.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCommitCohort.java @@ -15,52 +15,50 @@ import java.util.Collection; import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.mdsal.common.api.DataValidationFailedException; import org.opendaylight.mdsal.common.api.PostCanCommitStep; +import org.opendaylight.mdsal.common.api.PostPreCommitStep; +import org.opendaylight.mdsal.dom.api.DOMDataBroker.CommitCohortExtension; import org.opendaylight.yangtools.util.concurrent.ExceptionMapper; import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; /** - * Commit cohort participating in commit of data modification, which can validate data tree - * modifications, with option to reject supplied modification, and with callbacks describing state - * of commit. + * Commit cohort participating in commit of data modification, which can validate data tree modifications, with option + * to reject supplied modification, and with callbacks describing state of commit. * *

Performance implications

- * {@link DOMDataTreeCommitCohort}s are hooked up into commit of data tree changes and MAY - * negatively affect performance of data broker / store. - * Implementations of this interface are discouraged, unless you really need ability to veto data - * tree changes, or to provide external state change in sync with visibility of committed data. + * {@link DOMDataTreeCommitCohort}s are hooked up into commit of data tree changes and MAY negatively affect performance + * of data broker / store. Implementations of this interface are discouraged, unless you really need ability to veto + * data tree changes, or to provide external state change in sync with visibility of committed data. * *

Implementation requirements

- *

Correctness assumptions

Implementation SHOULD use only the {@link DOMDataTreeCandidate} instances and - * provided {@link EffectiveModelContext} for validation purposes. - * Use of any other external mutable state is discouraged, implementation MUST NOT use any - * transaction related APIs on same data broker / data store instance during invocation of - * callbacks, except ones provided as argument. Note that this MAY BE enforced by some - * implementations of {@link DOMDataBroker} or DOMDataCommitCoordinator - * Note that this may be enforced by some implementations of {@link DOMDataTreeCommitCohortRegistry} - * and such calls may fail. - *

Correct model usage

If implementation is performing YANG-model driven validation - * implementation SHOULD use provided schema context. - * Any other instance of {@link EffectiveModelContext} obtained by other means, may not be valid for the - * associated DOMDataTreeCandidates and it may lead to incorrect validation or processing of provided - * data. - *

DataTreeCandidate assumptions

Implementation SHOULD NOT make any assumptions on a - * {@link DOMDataTreeCandidate} being successfully committed until associated - * {@link PostCanCommitStep#preCommit()} and - * {@link org.opendaylight.mdsal.common.api.PostPreCommitStep#commit()} callback was invoked. + *

Correctness assumptions

+ * Implementation SHOULD use only the {@link DOMDataTreeCandidate} instances and provided {@link EffectiveModelContext} + * for validation purposes. + * + *

+ * Use of any other external mutable state is discouraged, implementation MUST NOT use any transaction related APIs on + * the same data broker / data store instance during invocation of callbacks, except ones provided as argument. Note + * that this MAY BE enforced by some implementations of {@link DOMDataBroker} or {@link CommitCohortExtension}, + * potentially enforced through the extension and such calls may fail. + * + *

Correct model usage

+ * If implementation is performing YANG-model driven validation implementation SHOULD use provided schema context. Any + * other instance of {@link EffectiveModelContext} obtained by other means, may not be valid for the associated + * {@link DOMDataTreeCandidate}s and it may lead to incorrect validation or processing of provided data. + * + *

DataTreeCandidate assumptions

+ * Implementation SHOULD NOT make any assumptions on a {@link DOMDataTreeCandidate} being successfully committed until + * the associated {@link PostCanCommitStep#preCommit()} and {@link PostPreCommitStep#commit()} callback was invoked. + * *

Usage patterns

*

Data Tree Validator

- * Validator is implementation, which only validates {@link DOMDataTreeCandidate} instances and does not - * retain any state derived from edited data - does not care if a {@link DOMDataTreeCandidate} was - * rejected afterwards or transaction was cancelled. - * Implementation may opt-out from receiving {@code preCommit()}, {@code commit()}, {@code abort()} - * callbacks by returning {@link PostCanCommitStep#NOOP}. - * - * @author Tony Tkacik + * Validator is implementation, which only validates {@link DOMDataTreeCandidate} instances and does not retain any + * state derived from edited data - does not care if a {@link DOMDataTreeCandidate} was rejected afterwards or + * the transaction was cancelled. Implementation may opt-out from receiving {@code preCommit()}, {@code commit()}, + * {@code abort()} callbacks by returning {@link PostCanCommitStep#NOOP}. */ // TODO: Provide example and describe more usage patterns @Beta public interface DOMDataTreeCommitCohort { - /** * Validates the supplied data tree modifications and associates the cohort-specific steps with data broker * transaction. @@ -73,7 +71,7 @@ public interface DOMDataTreeCommitCohort { * Note the implementations are expected to do validation and processing asynchronous. Implementations SHOULD do * processing fast, and are discouraged from blocking on any external resources. Implementation MUST NOT access * any data transaction related APIs during invocation of the callback. Note that this may be enforced by some - * implementations of {@link DOMDataTreeCommitCohortRegistry} and such calls may fail. + * implementations of {@link CommitCohortExtension} and such calls may fail. * *

* Implementation MAY opt-out from implementing other steps by returning