*/
package org.opendaylight.yangtools.yang.data.api.schema.tree;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
/**
*
* @param newSchemaContext new SchemaContext
* @throws IllegalArgumentException if the new context is incompatible
+ * @throws NullPointerException if newSchemaContext is null
+ * @deprecated Prefer {@link #setEffectiveModelContext(EffectiveModelContext)}.
*/
+ @Deprecated
void setSchemaContext(SchemaContext newSchemaContext);
+ /**
+ * Make the data tree use a new schema context. The context will be used
+ * only by subsequent operations.
+ *
+ * @param newModelContext new EffectiveModelContext
+ * @throws IllegalArgumentException if the new context is incompatible
+ * @throws NullPointerException if newModelContext is null
+ */
+ void setEffectiveModelContext(EffectiveModelContext newModelContext);
+
/**
* Commit a data tree candidate.
*
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.slf4j.Logger;
private volatile DataTreeState state;
InMemoryDataTree(final TreeNode rootNode, final DataTreeConfiguration treeConfig,
- final SchemaContext schemaContext) {
+ final SchemaContext schemaContext) {
this.treeConfig = requireNonNull(treeConfig, "treeConfig");
maskMandatory = true;
state = DataTreeState.createInitial(rootNode);
return SchemaAwareApplyOperation.from(rootSchemaNode, treeConfig);
}
+ @Deprecated
+ @Override
+ public void setSchemaContext(final SchemaContext newSchemaContext) {
+ internalSetSchemaContext(newSchemaContext);
+ }
+
+ @Override
+ public void setEffectiveModelContext(final EffectiveModelContext newModelContext) {
+ internalSetSchemaContext(newModelContext);
+ }
+
/*
* This method is synchronized to guard against user attempting to install
* multiple contexts. Otherwise it runs in a lock-free manner.
*/
- @Override
- public synchronized void setSchemaContext(final SchemaContext newSchemaContext) {
+ private synchronized void internalSetSchemaContext(final SchemaContext newSchemaContext) {
requireNonNull(newSchemaContext);
LOG.debug("Following schema contexts will be attempted {}", newSchemaContext);