Exemplo n.º 1
0
 /**
  * Retrieves value of "prefix" node of the YANG module, which is identified by the given {@code
  * info}.
  *
  * @param info {@link ElementIndexInfo}, which identifies the quested module
  * @return value of "prefix" node, if it existed; an empty string otherwise.
  */
 public static String retrieveModulePrefix(ElementIndexInfo info) {
   String defaultPrefix = "";
   try {
     Module importedModule = YangCorePlugin.createYangFile(info.getPath()).getModule();
     SimpleNode<String> prefixNode = importedModule.getPrefix();
     if (prefixNode != null) {
       defaultPrefix = prefixNode.getValue();
     }
   } catch (YangModelException ex) {
     YangCorePlugin.log(ex, "Yang source file could not be loaded.");
   }
   return defaultPrefix;
 }