mibble-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mibble-users] Retrieving Organization name?


From: BHASKER ALLENE
Subject: [Mibble-users] Retrieving Organization name?
Date: Tue, 28 Aug 2007 08:23:43 +0000 (GMT)

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

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]