*
* @param loader the MIB loader
*/
private static void printOidTree(MibLoader loader) {
Mib mib;
ObjectIdentifierValue root = null;
Iterator iter;
MibSymbol symbol;
MibValue value;
if (loader.getAllMibs().length <= 0) {
printError("no MIB modules have been loaded");
return;
}
mib = loader.getAllMibs()[0];
iter = mib.getAllSymbols().iterator();
while (root == null && iter.hasNext()) {
symbol = (MibSymbol) iter.next();
if (symbol instanceof MibValueSymbol) {
value = ((MibValueSymbol) symbol).getValue();
if (value instanceof ObjectIdentifierValue) {
root = (ObjectIdentifierValue) value;
}
}
}
if (root == null) {
printError("no OID value could be found in " + mib.getName());
} else {
while (root.getParent() != null) {
root = root.getParent();
}
printOid(root);
}
}