X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-common-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fcommon%2Fapi%2Fdata%2FDataCommitHandler.java;fp=opendaylight%2Fmd-sal%2Fsal-dom-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcore%2Fapi%2Fdata%2FDataCommitHandler.java;h=85e3d8f57ca4a6a2de3913b4363ba5e1fb0af651;hb=a251833f27fd00040904e2df316cd707c8129d1e;hp=fc1894a3d9100f2895048da54b9e9d4c927e4a71;hpb=3e5a15bd17299cc88ea253514db40661e11f5bb7;p=controller.git diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataCommitHandler.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataCommitHandler.java similarity index 60% rename from opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataCommitHandler.java rename to opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataCommitHandler.java index fc1894a3d9..85e3d8f57c 100644 --- a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataCommitHandler.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataCommitHandler.java @@ -5,15 +5,12 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.sal.core.api.data; - -import java.util.Set; +package org.opendaylight.controller.md.sal.common.api.data; import org.opendaylight.controller.sal.common.DataStoreIdentifier; -import org.opendaylight.controller.sal.core.api.Provider; +// FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments. +// import org.opendaylight.yangtools.concepts.Path; import org.opendaylight.yangtools.yang.common.RpcResult; - - /** * Two phase commit handler (cohort) of the two-phase commit protocol of data. * @@ -37,7 +34,7 @@ import org.opendaylight.yangtools.yang.common.RpcResult; * *
    *
  1. Consumer edits data by invocation of - * DataBrokerService.editCandidateData(DataStoreIdentifier, CompositeNodeModification) + * DataBrokerService.editCandidateData(DataStoreIdentifier, DataRoot) *
  2. Consumer starts a commit by invoking * DataBrokerService.commit(DataStoreIdentifier) *
  3. Broker retrieves a list of all registered @@ -74,77 +71,35 @@ import org.opendaylight.yangtools.yang.common.RpcResult; *
* *

Commit Rollback Phase

- *
  • For each CommitTransaction from Commit Request phase + *
  • For each DataCommitTransaction from Commit Request phase *
      *
    1. Broker - * - * broker invokes a {@link CommitTransaction#finish()} + * broker invokes a {@link DataCommitTransaction#finish()} *
    2. The provider rollbacks a commit and returns an {@link RpcResult} of * rollback.
    *
  • Broker returns a error result to the consumer. * - * - *

    Registration of functionality

    - * The registration could be done by : - * - * - * + * @param

    Class representing a path + * @param Superclass from which all data objects are derived from. */ -public interface DataCommitHandler extends Provider.ProviderFunctionality { +public interface DataCommitHandler

    */,D> { - /** - * A set of Data Stores supported by implementation. - * - * The set of {@link DataStoreIdentifier}s which identifies target data - * stores which are supported by this commit handler. This set is used, when - * {@link Provider} is registered to the SAL, to register and expose the - * commit handler functionality to affected data stores. - * - * @return Set of Data Store identifiers - */ - Set getSupportedDataStores(); - /** - * The provider (commit handler) starts a commit transaction. - * - *

    - * The commit handler (provider) prepares an commit scenario, rollback - * scenario and validates data. - * - *

    - * If the provider is aware that at this point the commit would not be - * successful, the transaction is not created, but list of errors which - * prevented the start of transaction are returned. - * - * @param store - * @return Transaction object representing this commit, errors otherwise. - */ - RpcResult requestCommit(DataStoreIdentifier store); + DataCommitTransaction requestCommit(DataModification modification); - public interface CommitTransaction { - /** - * - * @return Data store affected by the transaction - */ - DataStoreIdentifier getDataStore(); + public interface DataCommitTransaction

    */,D> { - /** - * Returns the handler associated with this transaction. - * - * @return Handler - */ - DataCommitHandler getHandler(); + DataModification getModification(); /** * * Finishes a commit. * + * This callback is invoked by commit coordinator to finish commit action. + * + * The implementation is required to finish transaction or return unsuccessful + * rpc result if something went wrong. + * * The provider (commit handler) should apply all changes to its state * which are a result of data change- * @@ -155,10 +110,16 @@ public interface DataCommitHandler extends Provider.ProviderFunctionality { /** * Rollbacks a commit. * + * This callback is invoked by commit coordinator to finish commit action. + * + * The provider (commit handler) should rollback all changes to its state + * which were a result of previous request commit. + * * @return * @throws IllegalStateException * If the method is invoked after {@link #finish()} */ RpcResult rollback() throws IllegalStateException; } + }