Hi all,
I am trying to generate a report with Mib file name, Mib name and
organization name.
Could you please tell me how I retrieve organization name from MIB file.
I found an alternative a way but it is bit lengthy. I am sure there
might be better way.
The way I am retrieving organization name is as follows.
public void setOrganization(){
ObjectIdentifierValue root = null;
MibSymbol symbol;
MibValue value;
Iterator iter = mibObj.getAllSymbols().iterator();
String org = null;
while ( iter.hasNext()) {
symbol = (MibSymbol) iter.next();
if (symbol instanceof MibValueSymbol) {
value = ((MibValueSymbol) symbol).getValue();
if (value instanceof ObjectIdentifierValue) {
root = (ObjectIdentifierValue) value;
String str = symbol.toString();
if (str.contains("MODULE-IDENTITY")){
System.out.println("String :"+ symbol.toString());
String temp1[] = str.split("\\n");
for (int x = 0; x<=temp1.length; x++){
if(temp1[x].trim().startsWith("Organization")){
String temp2[] = temp1[x].split(":");
try{
//System.out.println("Organization
:"+ temp2[1]);
org = new String(temp2[1]);
} catch (ArrayIndexOutOfBoundsException e) {
org = new String("Not Found");
}
break;
}
}
break;
}
}
}
}
if (null == org)
org = new String("Not Found");
this.organization = new String(org);
}//end of setOrganization
------------------------------------------------------------------------
_______________________________________________
Mibble-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/mibble-users