use of org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement in project yangtools by opendaylight.
the class SchemaInferenceStack method pushFirstSchema.
@NonNull
private SchemaTreeEffectiveStatement<?> pushFirstSchema(@NonNull final QName nodeIdentifier) {
final ModuleEffectiveStatement module = getModule(nodeIdentifier);
final SchemaTreeEffectiveStatement<?> ret = pushSchema(module, nodeIdentifier);
currentModule = module;
return ret;
}
use of org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement in project yangtools by opendaylight.
the class SchemaInferenceStack method pushFirstData.
@NonNull
private DataTreeEffectiveStatement<?> pushFirstData(@NonNull final QName nodeIdentifier) {
final ModuleEffectiveStatement module = getModule(nodeIdentifier);
final DataTreeEffectiveStatement<?> ret = pushData(module, nodeIdentifier);
currentModule = module;
return ret;
}
use of org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement in project yangtools by opendaylight.
the class SchemaInferenceStack method resolveDataTreeSteps.
private void resolveDataTreeSteps(@NonNull final QName nodeIdentifier) {
final EffectiveStatement<?, ?> parent = deque.peekFirst();
if (parent != null) {
verify(parent instanceof SchemaTreeAwareEffectiveStatement, "Unexpected parent %s", parent);
resolveDataTreeSteps((SchemaTreeAwareEffectiveStatement<?, ?>) parent, nodeIdentifier);
return;
}
final ModuleEffectiveStatement module = getModule(nodeIdentifier);
resolveDataTreeSteps(module, nodeIdentifier);
currentModule = module;
}
use of org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement in project yangtools by opendaylight.
the class SchemaInferenceStack method pushFirstGrouping.
@NonNull
private GroupingEffectiveStatement pushFirstGrouping(@NonNull final QName nodeIdentifier) {
final ModuleEffectiveStatement module = getModule(nodeIdentifier);
final GroupingEffectiveStatement ret = pushGrouping(module, nodeIdentifier);
currentModule = module;
return ret;
}
use of org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement in project yangtools by opendaylight.
the class SchemaInferenceStack method enterYangData.
/**
* Lookup a {@code rc:yang-data} by the module namespace where it is defined and its template name.
*
* @param namespace Module namespace in which to lookup the template
* @param name Template name
* @return Resolved yang-data
* @throws NullPointerException if any argument is null
* @throws IllegalArgumentException if the corresponding yang-data cannot be found
* @throws IllegalStateException if this stack is not empty
*/
@NonNull
public YangDataEffectiveStatement enterYangData(final QNameModule namespace, final String name) {
final EffectiveStatement<?, ?> parent = deque.peekFirst();
checkState(parent == null, "Cannot lookup yang-data in a non-empty stack");
final String templateName = requireNonNull(name);
final ModuleEffectiveStatement module = effectiveModel.getModuleStatements().get(requireNonNull(namespace));
checkArgument(module != null, "Module for %s not found", namespace);
final YangDataEffectiveStatement ret = module.streamEffectiveSubstatements(YangDataEffectiveStatement.class).filter(stmt -> templateName.equals(stmt.argument())).findFirst().orElseThrow(() -> new IllegalArgumentException("yang-data " + templateName + " not present in " + namespace));
deque.push(ret);
currentModule = module;
return ret;
}
Aggregations