import org.opendaylight.controller.md.sal.dom.store.impl.tree.DataTreeModification;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.DataTreeSnapshot;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.ListenerTree;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.ModificationApplyOperation;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.data.InMemoryDataTreeFactory;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.data.NodeModification;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.data.StoreMetadataNode;
import org.opendaylight.controller.sal.core.spi.data.DOMStore;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
import org.opendaylight.yangtools.concepts.Identifiable;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
-import com.google.common.primitives.UnsignedLong;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
public class InMemoryDOMDataStore implements DOMStore, Identifiable<String>, SchemaContextListener {
-
private static final Logger LOG = LoggerFactory.getLogger(InMemoryDOMDataStore.class);
- private static final InstanceIdentifier PUBLIC_ROOT_PATH = InstanceIdentifier.builder().build();
-
+ private final DataTree dataTree = InMemoryDataTreeFactory.getInstance().create();
+ private final ListenerTree listenerTree = ListenerTree.create();
+ private final AtomicLong txCounter = new AtomicLong(0);
private final ListeningExecutorService executor;
private final String name;
- private final AtomicLong txCounter = new AtomicLong(0);
- private final ListenerTree listenerTree = ListenerTree.create();
- private final DataTree dataTree = InMemoryDataTreeFactory.getInstance().create();
- private ModificationApplyOperation operationTree = new AlwaysFailOperation();
public InMemoryDOMDataStore(final String name, final ListeningExecutorService executor) {
this.name = Preconditions.checkNotNull(name);
@Override
public DOMStoreReadWriteTransaction newReadWriteTransaction() {
- return new SnapshotBackedReadWriteTransaction(nextIdentifier(), dataTree.takeSnapshot(), this, operationTree);
+ return new SnapshotBackedReadWriteTransaction(nextIdentifier(), dataTree.takeSnapshot(), this);
}
@Override
public DOMStoreWriteTransaction newWriteOnlyTransaction() {
- return new SnapshotBackedWriteTransaction(nextIdentifier(), dataTree.takeSnapshot(), this, operationTree);
+ return new SnapshotBackedWriteTransaction(nextIdentifier(), dataTree.takeSnapshot(), this);
}
@Override
public synchronized void onGlobalContextUpdated(final SchemaContext ctx) {
- /*
- * Order of operations is important: dataTree may reject the context
- * and creation of ModificationApplyOperation may fail. So pre-construct
- * the operation, then update the data tree and then move the operation
- * into view.
- */
- final ModificationApplyOperation newOperationTree = SchemaAwareApplyOperationRoot.from(ctx);
dataTree.setSchemaContext(ctx);
- operationTree = newOperationTree;
}
@Override
}
private static final class SnapshotBackedReadTransaction extends AbstractDOMStoreTransaction implements
- DOMStoreReadTransaction {
+ DOMStoreReadTransaction {
private DataTreeSnapshot stableSnapshot;
public SnapshotBackedReadTransaction(final Object identifier, final DataTreeSnapshot snapshot) {
}
private static class SnapshotBackedWriteTransaction extends AbstractDOMStoreTransaction implements
- DOMStoreWriteTransaction {
+ DOMStoreWriteTransaction {
private DataTreeModification mutableTree;
private InMemoryDOMDataStore store;
private boolean ready = false;
public SnapshotBackedWriteTransaction(final Object identifier, final DataTreeSnapshot snapshot,
- final InMemoryDOMDataStore store, final ModificationApplyOperation applyOper) {
+ final InMemoryDOMDataStore store) {
super(identifier);
- mutableTree = snapshot.newModification(applyOper);
+ mutableTree = snapshot.newModification();
this.store = store;
LOG.debug("Write Tx: {} allocated with snapshot {}", identifier, snapshot);
}
}
private static class SnapshotBackedReadWriteTransaction extends SnapshotBackedWriteTransaction implements
- DOMStoreReadWriteTransaction {
+ DOMStoreReadWriteTransaction {
protected SnapshotBackedReadWriteTransaction(final Object identifier, final DataTreeSnapshot snapshot,
- final InMemoryDOMDataStore store, final ModificationApplyOperation applyOper) {
- super(identifier, snapshot, store, applyOper);
+ final InMemoryDOMDataStore store) {
+ super(identifier, snapshot, store);
}
@Override
@Override
public Boolean call() {
try {
- dataTree.validate(modification);
+ dataTree.validate(modification);
LOG.debug("Store Transaction: {} can be committed", transaction.getIdentifier());
return true;
} catch (DataPreconditionFailedException e) {
return executor.submit(new Callable<Void>() {
@Override
public Void call() {
- candidate = dataTree.prepare(modification);
-
+ candidate = dataTree.prepare(modification);
listenerResolver = ResolveDataChangeEventsTask.create(candidate, listenerTree);
-
-// .setRootPath(PUBLIC_ROOT_PATH) //
-// .setBeforeRoot(Optional.of(metadataTree)) //
-// .setAfterRoot(proposedSubtree) //
-// .setModificationRoot(modification.getRootModification()) //
-// .setListenerRoot(listenerTree);
-
return null;
}
});
@Override
public ListenableFuture<Void> abort() {
- if (candidate != null) {
- candidate.close();
- candidate = null;
- }
+ if (candidate != null) {
+ candidate.close();
+ candidate = null;
+ }
return Futures.<Void> immediateFuture(null);
}
return Futures.<Void> immediateFuture(null);
}
}
-
- private static final class AlwaysFailOperation implements ModificationApplyOperation {
-
- @Override
- public Optional<StoreMetadataNode> apply(final NodeModification modification,
- final Optional<StoreMetadataNode> storeMeta, final UnsignedLong subtreeVersion) {
- throw new IllegalStateException("Schema Context is not available.");
- }
-
- @Override
- public void checkApplicable(final InstanceIdentifier path,final NodeModification modification, final Optional<StoreMetadataNode> storeMetadata) {
- throw new IllegalStateException("Schema Context is not available.");
- }
-
- @Override
- public Optional<ModificationApplyOperation> getChild(final PathArgument child) {
- throw new IllegalStateException("Schema Context is not available.");
- }
-
- @Override
- public void verifyStructure(final NodeModification modification) throws IllegalArgumentException {
- throw new IllegalStateException("Schema Context is not available.");
- }
-
- }
}
* visible through the snapshot.
*/
public interface DataTreeSnapshot {
- /**
- * Read a particular node from the snapshot.
- *
- * @param path Path of the node
- * @return Optional result encapsulating the presence and value of the node
- */
+ /**
+ * Read a particular node from the snapshot.
+ *
+ * @param path Path of the node
+ * @return Optional result encapsulating the presence and value of the node
+ */
Optional<NormalizedNode<?, ?>> readNode(InstanceIdentifier path);
/**
* @param strategy data modification strategy
* @return A new data tree modification
*/
- DataTreeModification newModification(ModificationApplyOperation applyOper);
+ DataTreeModification newModification();
}
--- /dev/null
+package org.opendaylight.controller.md.sal.dom.store.impl.tree.data;
+
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+
+import com.google.common.base.Optional;
+import com.google.common.primitives.UnsignedLong;
+
+final class AlwaysFailOperation implements ModificationApplyOperation {
+
+ @Override
+ public Optional<StoreMetadataNode> apply(final NodeModification modification,
+ final Optional<StoreMetadataNode> storeMeta, final UnsignedLong subtreeVersion) {
+ throw new IllegalStateException("Schema Context is not available.");
+ }
+
+ @Override
+ public void checkApplicable(final InstanceIdentifier path,final NodeModification modification, final Optional<StoreMetadataNode> storeMetadata) {
+ throw new IllegalStateException("Schema Context is not available.");
+ }
+
+ @Override
+ public Optional<ModificationApplyOperation> getChild(final PathArgument child) {
+ throw new IllegalStateException("Schema Context is not available.");
+ }
+
+ @Override
+ public void verifyStructure(final NodeModification modification) throws IllegalArgumentException {
+ throw new IllegalStateException("Schema Context is not available.");
+ }
+}
\ No newline at end of file
private static final InstanceIdentifier PUBLIC_ROOT_PATH = InstanceIdentifier.builder().build();
private final ReadWriteLock rwLock = new ReentrantReadWriteLock(true);
- private StoreMetadataNode rootNode;
+ private ModificationApplyOperation applyOper = new AlwaysFailOperation();
private SchemaContext currentSchemaContext;
+ private StoreMetadataNode rootNode;
public InMemoryDataTree(StoreMetadataNode rootNode, final SchemaContext schemaContext) {
this.rootNode = Preconditions.checkNotNull(rootNode);
- this.currentSchemaContext = schemaContext;
+
+ if (schemaContext != null) {
+ // Also sets applyOper
+ setSchemaContext(schemaContext);
+ }
}
@Override
- public synchronized void setSchemaContext(final SchemaContext newSchemaContext) {
+ public synchronized void setSchemaContext(final SchemaContext newSchemaContext) {
Preconditions.checkNotNull(newSchemaContext);
LOG.info("Attepting to install schema context {}", newSchemaContext);
* whether they are compatible here. Reject incompatible changes.
*/
+ // Instantiate new apply operation, this still may fail
+ final ModificationApplyOperation newApplyOper = SchemaAwareApplyOperation.from(newSchemaContext);
+
// Ready to change the context now, make sure no operations are running
rwLock.writeLock().lock();
try {
+ this.applyOper = newApplyOper;
this.currentSchemaContext = newSchemaContext;
} finally {
rwLock.writeLock().unlock();
}
@Override
- public InMemoryDataTreeSnapshot takeSnapshot() {
+ public InMemoryDataTreeSnapshot takeSnapshot() {
rwLock.readLock().lock();
try {
- return new InMemoryDataTreeSnapshot(currentSchemaContext, rootNode);
+ return new InMemoryDataTreeSnapshot(currentSchemaContext, rootNode, applyOper);
} finally {
rwLock.readLock().unlock();
}
}
- @Override
- public void validate(DataTreeModification modification) throws DataPreconditionFailedException {
- Preconditions.checkArgument(modification instanceof InMemoryDataTreeModification, "Invalid modification class %s", modification.getClass());
+ @Override
+ public void validate(DataTreeModification modification) throws DataPreconditionFailedException {
+ Preconditions.checkArgument(modification instanceof InMemoryDataTreeModification, "Invalid modification class %s", modification.getClass());
- final InMemoryDataTreeModification m = (InMemoryDataTreeModification)modification;
- m.getStrategy().checkApplicable(PUBLIC_ROOT_PATH, m.getRootModification(), Optional.of(rootNode));
- }
+ final InMemoryDataTreeModification m = (InMemoryDataTreeModification)modification;
+ m.getStrategy().checkApplicable(PUBLIC_ROOT_PATH, m.getRootModification(), Optional.of(rootNode));
+ }
- @Override
- public synchronized DataTreeCandidate prepare(DataTreeModification modification) {
- Preconditions.checkArgument(modification instanceof InMemoryDataTreeModification, "Invalid modification class %s", modification.getClass());
+ @Override
+ public synchronized DataTreeCandidate prepare(DataTreeModification modification) {
+ Preconditions.checkArgument(modification instanceof InMemoryDataTreeModification, "Invalid modification class %s", modification.getClass());
- final InMemoryDataTreeModification m = (InMemoryDataTreeModification)modification;
- final NodeModification root = m.getRootModification();
+ final InMemoryDataTreeModification m = (InMemoryDataTreeModification)modification;
+ final NodeModification root = m.getRootModification();
if (root.getModificationType() == ModificationType.UNMODIFIED) {
- return new NoopDataTreeCandidate(PUBLIC_ROOT_PATH, root);
+ return new NoopDataTreeCandidate(PUBLIC_ROOT_PATH, root);
}
rwLock.writeLock().lock();
try {
- // FIXME: rootNode needs to be a read-write snapshot here...
- final Optional<StoreMetadataNode> newRoot = m.getStrategy().apply(m.getRootModification(), Optional.of(rootNode), StoreUtils.increase(rootNode.getSubtreeVersion()));
- Preconditions.checkState(newRoot.isPresent(), "Apply strategy failed to produce root node");
- return new InMemoryDataTreeCandidate(PUBLIC_ROOT_PATH, root, rootNode, newRoot.get());
+ // FIXME: rootNode needs to be a read-write snapshot here...
+ final Optional<StoreMetadataNode> newRoot = m.getStrategy().apply(m.getRootModification(), Optional.of(rootNode), StoreUtils.increase(rootNode.getSubtreeVersion()));
+ Preconditions.checkState(newRoot.isPresent(), "Apply strategy failed to produce root node");
+ return new InMemoryDataTreeCandidate(PUBLIC_ROOT_PATH, root, rootNode, newRoot.get());
} finally {
- rwLock.writeLock().unlock();
+ rwLock.writeLock().unlock();
}
- }
+ }
- @Override
- public synchronized void commit(DataTreeCandidate candidate) {
- if (candidate instanceof NoopDataTreeCandidate) {
- return;
- }
+ @Override
+ public synchronized void commit(DataTreeCandidate candidate) {
+ if (candidate instanceof NoopDataTreeCandidate) {
+ return;
+ }
- Preconditions.checkArgument(candidate instanceof InMemoryDataTreeCandidate, "Invalid candidate class %s", candidate.getClass());
- final InMemoryDataTreeCandidate c = (InMemoryDataTreeCandidate)candidate;
+ Preconditions.checkArgument(candidate instanceof InMemoryDataTreeCandidate, "Invalid candidate class %s", candidate.getClass());
+ final InMemoryDataTreeCandidate c = (InMemoryDataTreeCandidate)candidate;
LOG.debug("Updating Store snapshot version: {} with version:{}", rootNode.getSubtreeVersion(), c.getAfterRoot().getSubtreeVersion());
} finally {
rwLock.writeLock().unlock();
}
- }
+ }
}
import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
-import org.opendaylight.controller.md.sal.dom.store.impl.OperationWithModification;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.DataTreeModification;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.ModificationApplyOperation;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.StoreUtils;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.TreeNodeUtils;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
return rootNode;
}
- ModificationApplyOperation getStrategy() {
- return strategyTree;
- }
+ ModificationApplyOperation getStrategy() {
+ return strategyTree;
+ }
@Override
- public void write(final InstanceIdentifier path, final NormalizedNode<?, ?> value) {
+ public void write(final InstanceIdentifier path, final NormalizedNode<?, ?> value) {
checkSealed();
resolveModificationFor(path).write(value);
}
@Override
- public void merge(final InstanceIdentifier path, final NormalizedNode<?, ?> data) {
+ public void merge(final InstanceIdentifier path, final NormalizedNode<?, ?> data) {
checkSealed();
mergeImpl(resolveModificationFor(path),data);
}
}
@Override
- public void delete(final InstanceIdentifier path) {
+ public void delete(final InstanceIdentifier path) {
checkSealed();
resolveModificationFor(path).delete();
}
@Override
- public Optional<NormalizedNode<?, ?>> readNode(final InstanceIdentifier path) {
+ public Optional<NormalizedNode<?, ?>> readNode(final InstanceIdentifier path) {
Entry<InstanceIdentifier, NodeModification> modification = TreeNodeUtils.findClosestsOrFirstMatch(rootNode, path, NodeModification.IS_TERMINAL_PREDICATE);
Optional<StoreMetadataNode> result = resolveSnapshot(modification);
}
@Override
- public void seal() {
+ public void seal() {
final boolean success = SEALED_UPDATER.compareAndSet(this, 0, 1);
Preconditions.checkState(success, "Attempted to seal an already-sealed Data Tree.");
rootNode.seal();
return "MutableDataTree [modification=" + rootNode + "]";
}
- @Override
- public DataTreeModification newModification(ModificationApplyOperation applyOper) {
- // FIXME: transaction chaining
- throw new UnsupportedOperationException("Implement this as part of transaction chaining");
- }
+ @Override
+ public DataTreeModification newModification() {
+ // FIXME: transaction chaining
+ throw new UnsupportedOperationException("Implement this as part of transaction chaining");
+ }
}
package org.opendaylight.controller.md.sal.dom.store.impl.tree.data;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.DataTreeSnapshot;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.ModificationApplyOperation;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeUtils;
import com.google.common.base.Preconditions;
final class InMemoryDataTreeSnapshot implements DataTreeSnapshot {
+ private final ModificationApplyOperation applyOper;
private final SchemaContext schemaContext;
private final StoreMetadataNode rootNode;
- InMemoryDataTreeSnapshot(final SchemaContext schemaContext, final StoreMetadataNode rootNode) {
+ InMemoryDataTreeSnapshot(final SchemaContext schemaContext, final StoreMetadataNode rootNode,
+ final ModificationApplyOperation applyOper) {
this.schemaContext = Preconditions.checkNotNull(schemaContext);
this.rootNode = Preconditions.checkNotNull(rootNode);
+ this.applyOper = Preconditions.checkNotNull(applyOper);
}
- StoreMetadataNode getRootNode() {
+ StoreMetadataNode getRootNode() {
return rootNode;
}
}
@Override
- public Optional<NormalizedNode<?, ?>> readNode(final InstanceIdentifier path) {
+ public Optional<NormalizedNode<?, ?>> readNode(final InstanceIdentifier path) {
return NormalizedNodeUtils.findNode(rootNode.getData(), path);
}
@Override
- public InMemoryDataTreeModification newModification(ModificationApplyOperation applyOper) {
- return new InMemoryDataTreeModification(this, applyOper);
- }
+ public InMemoryDataTreeModification newModification() {
+ return new InMemoryDataTreeModification(this, applyOper);
+ }
@Override
public String toString() {
* 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.dom.store.impl.tree;
+package org.opendaylight.controller.md.sal.dom.store.impl.tree.data;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.data.NodeModification;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.data.StoreMetadataNode;
+import org.opendaylight.controller.md.sal.dom.store.impl.tree.DataPreconditionFailedException;
+import org.opendaylight.controller.md.sal.dom.store.impl.tree.StoreTreeNode;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
*
*
*/
-public interface ModificationApplyOperation extends StoreTreeNode<ModificationApplyOperation> {
+interface ModificationApplyOperation extends StoreTreeNode<ModificationApplyOperation> {
/**
*
Optional<ModificationApplyOperation> getChild(PathArgument child);
/**
- *
- * Checks if provided node modification could be applied to current metadata node.
- *
- * @param modification Modification
- * @param current Metadata Node to which modification should be applied
- * @return true if modification is applicable
- * false if modification is no applicable
+ *
+ * Checks if provided node modification could be applied to current metadata node.
+ *
+ * @param modification Modification
+ * @param current Metadata Node to which modification should be applied
+ * @return true if modification is applicable
+ * false if modification is no applicable
* @throws DataPreconditionFailedException
- */
+ */
void checkApplicable(InstanceIdentifier path, NodeModification modification, Optional<StoreMetadataNode> current) throws DataPreconditionFailedException;
}
* and {@link StoreMetadataNode} which represents original state {@link #getOriginal()}.
*
*/
+// FIXME: hide this class
public class NodeModification implements StoreTreeNode<NodeModification>, Identifiable<PathArgument> {
public static final Predicate<NodeModification> IS_TERMINAL_PREDICATE = new Predicate<NodeModification>() {
* 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.dom.store.impl;
+package org.opendaylight.controller.md.sal.dom.store.impl.tree.data;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.ModificationApplyOperation;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.data.NodeModification;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.data.StoreMetadataNode;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import com.google.common.base.Optional;
import com.google.common.primitives.UnsignedLong;
-public class OperationWithModification {
+final class OperationWithModification {
private final NodeModification modification;
* 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.dom.store.impl;
+package org.opendaylight.controller.md.sal.dom.store.impl.tree.data;
import static com.google.common.base.Preconditions.checkArgument;
import java.util.concurrent.ExecutionException;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.DataPreconditionFailedException;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.ModificationApplyOperation;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.StoreUtils;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.data.ModificationType;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.data.NodeModification;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.data.StoreMetadataNode;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.data.StoreNodeCompositeBuilder;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.AugmentationIdentifier;
import com.google.common.collect.ImmutableMap;
import com.google.common.primitives.UnsignedLong;
-public abstract class SchemaAwareApplyOperation implements ModificationApplyOperation {
+abstract class SchemaAwareApplyOperation implements ModificationApplyOperation {
public static SchemaAwareApplyOperation from(final DataSchemaNode schemaNode) {
if (schemaNode instanceof ContainerSchemaNode) {
import com.google.common.base.Preconditions;
import com.google.common.primitives.UnsignedLong;
+// FIXME: this should not be public
public class StoreMetadataNode implements Immutable, Identifiable<PathArgument>, StoreTreeNode<StoreMetadataNode> {
private final UnsignedLong nodeVersion;
*
*/
@SuppressWarnings("rawtypes")
-public class StoreNodeCompositeBuilder {
+class StoreNodeCompositeBuilder {
private final StoreMetadataNode.Builder metadata;
import org.junit.Before;
import org.junit.Test;
-import org.opendaylight.controller.md.sal.dom.store.impl.SchemaAwareApplyOperationRoot;
import org.opendaylight.controller.md.sal.dom.store.impl.TestModel;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.DataTree;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.DataTreeModification;
.withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_ONE_NAME)) //
.withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME)) //
.build()) //
- .build();
+ .build();
private SchemaContext schemaContext;
+ private ModificationApplyOperation applyOper;
@Before
public void prepare() {
schemaContext = TestModel.createTestContext();
assertNotNull("Schema context must not be null.", schemaContext);
+ applyOper = SchemaAwareApplyOperation.from(schemaContext);
}
/**
.withNodeIdentifier(new NodeIdentifier(TEST_QNAME))
.withChild(
mapNodeBuilder(OUTER_LIST_QNAME)
- .withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID))
- .withChild(BAR_NODE).build()).build();
+ .withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID))
+ .withChild(BAR_NODE).build()).build();
}
@Test
public void basicReadWrites() {
DataTreeModification modificationTree = new InMemoryDataTreeModification(new InMemoryDataTreeSnapshot(schemaContext,
- StoreMetadataNode.createRecursively(createDocumentOne(), UnsignedLong.valueOf(5))),
+ StoreMetadataNode.createRecursively(createDocumentOne(), UnsignedLong.valueOf(5)), applyOper),
new SchemaAwareApplyOperationRoot(schemaContext));
Optional<NormalizedNode<?, ?>> originalBarNode = modificationTree.readNode(OUTER_LIST_2_PATH);
assertTrue(originalBarNode.isPresent());
* context.
*
*/
- return t.takeSnapshot().newModification(new SchemaAwareApplyOperationRoot(schemaContext));
+ return t.takeSnapshot().newModification();
}
@Test
* 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.dom.store.impl;
+package org.opendaylight.controller.md.sal.dom.store.impl.tree.data;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;