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.yangtools.yang.data.impl.schema.tree;
11 import com.google.common.base.Optional;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
14 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNode;
15 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.Version;
18 * An implementation of apply operation which fails to do anything,
19 * consistently. An instance of this class is used by the data tree
20 * if it does not have a SchemaContext attached and hence cannot
21 * perform anything meaningful.
23 final class AlwaysFailOperation implements ModificationApplyOperation {
24 public static final ModificationApplyOperation INSTANCE = new AlwaysFailOperation();
26 private AlwaysFailOperation() {
31 public Optional<TreeNode> apply(final ModifiedNode modification,
32 final Optional<TreeNode> storeMeta, final Version version) {
33 throw new IllegalStateException("Schema Context is not available.");
37 public void checkApplicable(final YangInstanceIdentifier path,final NodeModification modification, final Optional<TreeNode> storeMetadata) {
38 throw new IllegalStateException("Schema Context is not available.");
42 public Optional<ModificationApplyOperation> getChild(final PathArgument child) {
43 throw new IllegalStateException("Schema Context is not available.");
47 public void verifyStructure(final ModifiedNode modification) {
48 throw new IllegalStateException("Schema Context is not available.");