mibble-users
[Top][All Lists]
Advanced

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

Re: [Mibble-users] Retrieving Organization name?


From: Per Cederberg
Subject: Re: [Mibble-users] Retrieving Organization name?
Date: Tue, 28 Aug 2007 22:36:30 +0200
User-agent: Thunderbird 2.0.0.6 (Macintosh/20070728)

Try this instead:

    ...
    if (symbol instanceof MibValueSymbol) {
        type = ((MibValueSymbol) symbol).getType();
        if (type instanceof SnmpModuleIdentity) {
            module = (SnmpModuleIdentity) type;
            this.organization = module.getOrganization();
        }
    }

Cheers,

/Per

BHASKER ALLENE wrote:
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




reply via email to

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