2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.md.sal.dom.store.impl;
10 import org.opendaylight.controller.md.sal.dom.store.impl.tree.NodeModification;
11 import org.opendaylight.controller.md.sal.dom.store.impl.tree.StoreMetadataNode;
12 import org.opendaylight.controller.md.sal.dom.store.impl.tree.StoreTreeNode;
13 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
15 import com.google.common.base.Optional;
19 * Operation responsible for applying {@link NodeModification} on tree.
21 * Operation is composite - operation on top level node consists of
22 * suboperations on child nodes. This allows to walk operation hierarchy and
23 * invoke suboperations independently.
25 * <b>Implementation notes</b>
28 * Implementations MUST expose all nested suboperations which operates on child
29 * nodes expose via {@link #getChild(PathArgument)} method.
30 * <li>Same suboperations SHOULD be used when invoked via
31 * {@link #apply(NodeModification, Optional)} if applicable.
34 * Hierarchical composite operation which is responsible for applying
35 * modification on particular subtree and creating updated subtree
39 public interface ModificationApplyOperation extends StoreTreeNode<ModificationApplyOperation> {
43 * Implementation of this operation must be stateless and must not change
44 * state of this object.
47 * NodeModification to be applied
49 * Store Metadata Node on which NodeModification should be
51 * @throws IllegalArgumentException
52 * If it is not possible to apply Operation on provided Metadata
54 * @return new {@link StoreMetadataNode} if operation resulted in updating
55 * node, {@link Optional#absent()} if {@link NodeModification}
56 * resulted in deletion of this node.
58 Optional<StoreMetadataNode> apply(NodeModification modification, Optional<StoreMetadataNode> storeMeta);
61 * Returns a suboperation for specified tree node
63 * @return Reference to suboperation for specified tree node, {@link Optional#absent()}
64 * if suboperation is not supported for specified tree node.
67 public Optional<ModificationApplyOperation> getChild(PathArgument child);