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.api.schema.tree;
10 import com.google.common.annotations.Beta;
11 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
12 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
13 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
16 * Factory interface for creating data trees.
18 public interface DataTreeFactory {
20 * Create a new data tree.
23 * @return A data tree instance.
25 * @deprecated Use {@link #create(DataTreeConfiguration)} instead.
28 DataTree create(TreeType type);
31 * Create a new data tree rooted at a particular node.
36 * @return A data tree instance.
38 * @deprecated Use {@link #create(DataTreeConfiguration)} instead.
41 DataTree create(TreeType treeType, YangInstanceIdentifier rootPath);
44 * Create a new data tree based on specified configuration, with a best-guess root. Use this method only if you
45 * do not have a corresponding SchemaContext handy. Mandatory nodes whose enforcement point is the root node will
46 * not be enforced even if some are present in the SchemaContext and validation is requested in configuration.
50 * @return A data tree instance.
51 * @throws NullPointerException if treeConfig is null
53 DataTree create(DataTreeConfiguration treeConfig);
56 * Create a new data tree based on specified configuration, with a root node derived from the schema context lookup
57 * of the configuration. Mandatory nodes whose enforcement point is the root node will not be enforced even if some
58 * are present in the SchemaContext and validation is requested in configuration.
62 * @return A data tree instance.
63 * @throws NullPointerException if any of the arguments are null
64 * @throws IllegalArgumentException if tree configuration does not match the SchemaContext, for example by root path
65 * referring to a node which does not exist in the SchemaContext
68 DataTree create(DataTreeConfiguration treeConfig, SchemaContext initialSchemaContext);
71 * Create a new data tree based on specified configuration, with the specified node.
75 * @return A data tree instance.
76 * @throws DataValidationFailedException if initial root is not valid according to the schema context
77 * @throws NullPointerException if any of the arguments are null
78 * @throws IllegalArgumentException if a mismatch between the arguments is detected
81 DataTree create(DataTreeConfiguration treeConfig, SchemaContext initialSchemaContext,
82 NormalizedNodeContainer<?, ?, ?> initialRoot) throws DataValidationFailedException;