Update to MD-SAL APIs
[controller.git] / opendaylight / md-sal / sal-common-api / src / main / java / org / opendaylight / controller / md / sal / common / api / data / DataModification.java
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModification.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModification.java
new file mode 100644 (file)
index 0000000..1ab7c34
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.md.sal.common.api.data;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Future;
+
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+// 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;
+
+public interface DataModification<P/* extends Path<P> */, D> extends DataReader<P, D> {
+
+    /**
+     * Returns transaction identifier
+     * 
+     * @return Transaction identifier
+     */
+    Object getIdentifier();
+
+    TransactionStatus getStatus();
+
+    void putRuntimeData(P path, D data);
+
+    void putConfigurationData(P path, D data);
+
+    void removeRuntimeData(P path);
+
+    void removeConfigurationData(P path);
+
+    public Map<P, D> getUpdatedConfigurationData();
+
+    public Map<P, D> getUpdatedOperationalData();
+
+    public Set<P> getRemovedConfigurationData();
+
+    public Set<P> getRemovedOperationalData();
+
+    /**
+     * Initiates a two-phase commit of modification.
+     * 
+     * <p>
+     * The successful commit changes the state of the system and may affect
+     * several components.
+     * 
+     * <p>
+     * The effects of successful commit of data are described in the
+     * specifications and YANG models describing the Provider components of
+     * controller. It is assumed that Consumer has an understanding of this
+     * changes.
+     * 
+     * 
+     * @see DataCommitHandler for further information how two-phase commit is
+     *      processed.
+     * @param store
+     *            Identifier of the store, where commit should occur.
+     * @return Result of the Commit, containing success information or list of
+     *         encountered errors, if commit was not successful. The Future
+     *         blocks until {@link TransactionStatus#COMMITED} or
+     *         {@link TransactionStatus#FAILED} is reached.
+     */
+    Future<RpcResult<TransactionStatus>> commit();
+
+}