Merge "Fixed incorrect test location."
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / tree / AlwaysFailOperation.java
1 package org.opendaylight.yangtools.yang.data.impl.schema.tree;
2
3
4 import com.google.common.base.Optional;
5 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
6 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
7 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNode;
8 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.Version;
9
10 /**
11  * An implementation of apply operation which fails to do anything,
12  * consistently. An instance of this class is used by the data tree
13  * if it does not have a SchemaContext attached and hence cannot
14  * perform anything meaningful.
15  */
16 final class AlwaysFailOperation implements ModificationApplyOperation {
17     @Override
18     public Optional<TreeNode> apply(final ModifiedNode modification,
19             final Optional<TreeNode> storeMeta, final Version version) {
20         throw new IllegalStateException("Schema Context is not available.");
21     }
22
23     @Override
24     public void checkApplicable(final YangInstanceIdentifier path,final NodeModification modification, final Optional<TreeNode> storeMetadata) {
25         throw new IllegalStateException("Schema Context is not available.");
26     }
27
28     @Override
29     public Optional<ModificationApplyOperation> getChild(final PathArgument child) {
30         throw new IllegalStateException("Schema Context is not available.");
31     }
32
33     @Override
34     public void verifyStructure(final ModifiedNode modification) {
35         throw new IllegalStateException("Schema Context is not available.");
36     }
37 }