gpt4 book ai didi

org.onosproject.yang.compiler.datamodel.YangReferenceResolver类的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 07:51:31 27 4
gpt4 key购买 nike

本文整理了Java中org.onosproject.yang.compiler.datamodel.YangReferenceResolver类的一些代码示例,展示了YangReferenceResolver类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangReferenceResolver类的具体详情如下:
包路径:org.onosproject.yang.compiler.datamodel.YangReferenceResolver
类名称:YangReferenceResolver

YangReferenceResolver介绍

[英]Abstraction of YANG dependency resolution information. Abstracted to obtain the resolution information.
[中]杨依赖解析信息的抽象。提取以获取分辨率信息。

代码示例

代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel

root.addToResolutionList(resInfo, YANG_DERIVED_DATA_TYPE);
} else if (en instanceof YangUses) {
  root.addToResolutionList(resInfo, YANG_USES);
} else if (en instanceof YangAugment) {
  if (entity.getHolderOfEntityToResolve() instanceof YangUses) {
    root.addToResolutionList(resInfo, YANG_USES_AUGMENT);
  } else {
    root.addToResolutionList(resInfo, YANG_AUGMENT);
  root.addToResolutionList(resInfo, YANG_IF_FEATURE);
} else if (en instanceof YangLeafRef) {
  root.addToResolutionList(resInfo, YANG_LEAFREF);
} else if (en instanceof YangBase) {
  root.addToResolutionList(resInfo, YANG_BASE);
} else if (en instanceof YangIdentityRef) {
  root.addToResolutionList(resInfo, YANG_IDENTITYREF);
} else if (en instanceof YangCompilerAnnotation) {
  root.addToResolutionList(resInfo, YANG_COMPILER_ANNOTATION);
} else if (en instanceof YangDeviation) {
  root.addToResolutionList(resInfo, YANG_DEVIATION);

代码示例来源:origin: org.onosproject/onos-yang-compiler-linker

/**
 * Checks if the reference in self file or in external file.
 *
 * @return true if self file reference, false otherwise
 * @throws DataModelException a violation of data model rules
 */
private boolean isCandidateForSelfFileReference()
    throws DataModelException {
  String prefix = getRefPrefix();
  return prefix == null || prefix.contentEquals(curRefResolver.getPrefix());
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-parser

/**
 * Adds the unique holder to the module or sub-module node.
 *
 * @param holder unique holder
 */
public static void addUniqueHolderToRoot(YangUniqueHolder holder) {
  List<List<YangAtomicPath>> uniques = holder.getPathList();
  if (uniques != null && !uniques.isEmpty()) {
    YangReferenceResolver root = (YangReferenceResolver) getRootNode(
        (YangNode) holder);
    root.addToUniqueHolderList(holder);
  }
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-linker

int curNodePriority = yangNode.getPriority();
if (yangNode instanceof YangReferenceResolver) {
  List<YangImport> yangImportList = ((YangReferenceResolver) yangNode).getImportList();
  Iterator<YangImport> importInfoIterator = yangImportList.iterator();
  List<YangInclude> yangIncludeList = ((YangReferenceResolver) yangNode).getIncludeList();
  Iterator<YangInclude> includeInfoIterator = yangIncludeList.iterator();

代码示例来源:origin: org.onosproject/onos-yang-compiler-linker

/**
 * Adds resolvable type (leaf-ref) info to resolution list.
 *
 * @param extType resolvable type
 * @param type    YANG type
 * @param holder  holder node
 * @throws DataModelException if there is a data model error
 */
private void addRefTypeInfo(T extType, YangType<T> type, YangNode holder)
    throws DataModelException {
  type.resetYangType();
  type.setResolvableStatus(RESOLVED);
  type.setDataType(YangDataTypes.LEAFREF);
  type.setDataTypeName(LEAFREF);
  type.setDataTypeExtendedInfo(extType);
  YangLeafRef leafRef = (YangLeafRef) extType;
  (leafRef).setResolvableStatus(UNRESOLVED);
  leafRef.setParentNode(holder);
  YangResolutionInfoImpl info = new YangResolutionInfoImpl<>(
      leafRef, holder, getLineNumber(), getCharPosition());
  curRefResolver.addToResolutionList(info, YANG_LEAFREF);
  curRefResolver.resolveSelfFileLinking(YANG_LEAFREF);
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-parser

.getParsedDataStack().peek();
try {
  resolver.resolveSelfFileLinking(YANG_IF_FEATURE);
  resolver.resolveSelfFileLinking(YANG_USES);
  resolver.resolveSelfFileLinking(YANG_DERIVED_DATA_TYPE);
  resolver.resolveSelfFileLinking(YANG_LEAFREF);
  resolver.resolveSelfFileLinking(YANG_BASE);
  resolver.resolveSelfFileLinking(YANG_IDENTITYREF);
} catch (DataModelException e) {
  LinkerException linkerException = new LinkerException(e.getMessage(), e);

代码示例来源:origin: org.onosproject/onos-yang-compiler-linker

/**
 * Returns the referred node, by finding in the list of included nodes,
 * inside the given node.
 *
 * @param node YANG node
 * @return referred node inside included node
 */
private YangNode getFromIncludeList(YangNode node) {
  List<YangInclude> incList = ((YangReferenceResolver) node)
      .getIncludeList();
  YangNode refNode = null;
  if (incList != null && !incList.isEmpty()) {
    for (YangInclude inc : incList) {
      refNode = getLinkedNode(inc.getIncludedNode());
      if (refNode != null) {
        break;
      }
    }
  }
  return refNode;
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel

YangReferenceResolver node) throws DataModelException {
List<YangResolutionInfo> deviationList = node
    .getUnresolvedResolutionList(YANG_DEVIATION);
String prefix = null;
if (!deviationList.isEmpty()) {

代码示例来源:origin: org.onosproject/onos-yang-compiler-linker

for (YangImport yangImport : curRefResolver.getImportList()) {

代码示例来源:origin: org.onosproject/onos-yang-compiler-linker

/**
 * Adds included node information to the include list.
 *
 * @param yangNodeSet set of YANG files info
 * @throws LinkerException fails to find included sub-module
 */
public void addRefToYangFilesIncludeList(Set<YangNode> yangNodeSet)
    throws LinkerException {
  for (YangNode yangNode : yangNodeSet) {
    if (yangNode instanceof YangReferenceResolver) {
      try {
        ((YangReferenceResolver) yangNode).addReferencesToIncludeList(getYangNodeSet());
      } catch (DataModelException e) {
        String errorInfo = "Error in file: " + yangNode.getName() + " in " +
            yangNode.getFileName() + " at " +
            "line: " + e.getLineNumber() + " at position: " + e.getCharPositionInLine() + NEW_LINE
            + e.getLocalizedMessage();
        throw new LinkerException(errorInfo, e);
        // TODO add file path in exception message in util manager.
      }
    }
  }
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-linker

/**
 * Adds imported node information to the import list.
 *
 * @param yangNodeSet set of YANG files info
 * @throws LinkerException fails to find imported module
 */
public void addRefToYangFilesImportList(Set<YangNode> yangNodeSet)
    throws LinkerException {
  for (YangNode yangNode : yangNodeSet) {
    if (yangNode instanceof YangReferenceResolver) {
      try {
        ((YangReferenceResolver) yangNode).addReferencesToImportList(getYangNodeSet());
      } catch (DataModelException e) {
        String errorInfo = "Error in file: " + yangNode.getName() + " in " +
            yangNode.getFileName() + " at " +
            "line: " + e.getLineNumber() + " at position: " + e.getCharPositionInLine() + NEW_LINE
            + e.getLocalizedMessage();
        throw new LinkerException(errorInfo, e);
        // TODO add file path in exception message in util manager.
      }
    }
  }
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-parser

.resolveSelfFileLinking(ResolvableType.YANG_IF_FEATURE);
  ((YangReferenceResolver) listener.getParsedDataStack().peek())
      .resolveSelfFileLinking(ResolvableType.YANG_USES);
  ((YangReferenceResolver) listener.getParsedDataStack().peek())
      .resolveSelfFileLinking(ResolvableType.YANG_DERIVED_DATA_TYPE);
  ((YangReferenceResolver) listener.getParsedDataStack().peek())
      .resolveSelfFileLinking(ResolvableType.YANG_LEAFREF);
  ((YangReferenceResolver) listener.getParsedDataStack().peek())
      .resolveSelfFileLinking(ResolvableType.YANG_BASE);
  ((YangReferenceResolver) listener.getParsedDataStack().peek())
      .resolveSelfFileLinking(ResolvableType.YANG_IDENTITYREF);
} catch (DataModelException e) {
  LinkerException linkerException = new LinkerException(e.getMessage(), e);

代码示例来源:origin: org.onosproject/onos-yang-compiler-linker

/**
 * Finds and resolves with include list.
 *
 * @return true if resolved, false otherwise
 * @throws DataModelException a violation in data model rule
 */
private boolean resolveWithInclude() throws DataModelException {
  /*
   * Run through all the nodes in include list and search for referred
   * typedef/grouping at the root level.
   */
  for (YangInclude yangInclude : curRefResolver.getIncludeList()) {
    YangNode inc = yangInclude.getIncludedNode();
    YangNode linkedNode = getLinkedNode(inc);
    if (linkedNode == null) {
      linkedNode = getFromIncludeList(inc);
    }
    if (linkedNode != null) {
      return addUnResolvedRefToStack(linkedNode);
    }
  }
  // If referred node can't be found return false.
  return false;
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-tool

try {
  ((YangReferenceResolver) yangNode)
      .resolveSelfFileLinking(YANG_DERIVED_DATA_TYPE);
  ((YangReferenceResolver) yangNode)
      .resolveSelfFileLinking(YANG_IDENTITYREF);
} catch (DataModelException e) {
  printLog(e.getFileName(), e.getLineNumber(), e

代码示例来源:origin: org.onosproject/onos-yang-compiler-parser

prefix.equals(((YangReferenceResolver) root).getPrefix())) {
prefixMap.put(prefix, root.getName());
return;

代码示例来源:origin: org.onosproject/onos-yang-compiler-linker

.contentEquals(curRefResolver.getPrefix())) {
((Resolvable) entity).setResolvableStatus(INTRA_FILE_RESOLVED);

代码示例来源:origin: org.onosproject/onos-yang-compiler-linker

.contentEquals(curRefResolver.getPrefix())) {
((Resolvable) getCurEntityToResolveFromStack())
    .setResolvableStatus(INTRA_FILE_RESOLVED);

代码示例来源:origin: org.onosproject/onos-yang-compiler-linker

getRefPrefix().contentEquals(curRefResolver.getPrefix())) {
((Resolvable) entity).setResolvableStatus(INTRA_FILE_RESOLVED);

代码示例来源:origin: org.onosproject/onos-yang-compiler-linker

.contentEquals(curRefResolver.getPrefix())) {
if (resolveWithImport()) {
  return;

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com