FileDocCategorySizeDatePackage
SnmpOidDatabaseSupport.javaAPI DocJava SE 5 API4997Fri Aug 26 14:55:04 BST 2005com.sun.jmx.snmp

SnmpOidDatabaseSupport

public class SnmpOidDatabaseSupport extends Object implements SnmpOidDatabase
Defines a set of SnmpOidTable objects containing metadata definitions for MIB variables. Each SnmpOidTable should contain information on variables of one MIB. It provides resolution of all MIB variables contained in the SnmpOidTable objects.

This API is a Sun Microsystems internal API and is subject to change without notice.

Fields Summary
private Vector
tables
Constructors Summary
public SnmpOidDatabaseSupport()
Creates an empty SnmpOidDatabaseSupport.

        tables=new Vector();
    
public SnmpOidDatabaseSupport(com.sun.jmx.snmp.SnmpOidTable table)
Creates an SnmpOidDatabaseSupport containing the specified SnmpOidTable object.

param
table The SnmpOidTable object used to initialize this SnmpOidDatabaseSupport.

        tables=new Vector();
        tables.addElement(table);
    
Methods Summary
public voidadd(com.sun.jmx.snmp.SnmpOidTable table)
Adds a SnmpOidTable object in this SnmpOidDatabase.

param
table The table to add.

        if (!tables.contains(table)) {
            tables.addElement(table);
        }
    
public java.util.VectorgetAllEntries()
Returns a list that can be used to traverse all the entries of the SnmpOidTable objects of this SnmpOidDatabase.

return
A vector of SnmpOidTable objects containing all the elements of this SnmpOidDatabase.

        Vector res = new Vector();
        for (int i=0;i<tables.size();i++) {
	    Vector tmp = ((SnmpOidTable)tables.elementAt(i)).getAllEntries();
	    if (tmp != null) {
		for(int ii=0; ii<tmp.size(); ii++) {
			res.addElement(tmp.elementAt(ii));
		}
	    }
	}
//	res.addAll(((SnmpOidTable)tables.elementAt(i)).getAllEntries());
        return res;
    
public voidremove(com.sun.jmx.snmp.SnmpOidTable table)
Removes a SnmpOidTable object from this SnmpOidDatabase.

param
table The table to be removed.
exception
SnmpStatusException The specified SnmpOidTable does not exist in this SnmpOidDatabase.

        if (!tables.contains(table)) {
            throw new SnmpStatusException("The specified SnmpOidTable does not exist in this SnmpOidDatabase");
        }
        tables.removeElement(table);    
    
public voidremoveAll()
Removes all SnmpOidTable objects from this SnmpOidDatabase.

        tables.removeAllElements() ;
    
public com.sun.jmx.snmp.SnmpOidRecordresolveVarName(java.lang.String name)
Searches for a MIB variable given its logical name and returns an SnmpOidRecord object containing information on the variable.

param
name The name of the MIB variable.
return
The SnmpOidRecord object containing information on the variable.
exception
SnmpStatusException The specified name does not exist in this SnmpOidDatabase

        for (int i=0;i<tables.size();i++) {
            try {
                return (((SnmpOidTable)tables.elementAt(i)).resolveVarName(name));
            }
            catch (SnmpStatusException e) {
                if (i==tables.size()-1) {
                    throw new SnmpStatusException(e.getMessage());		    
                }
            }
        }
        return null;
    
public com.sun.jmx.snmp.SnmpOidRecordresolveVarOid(java.lang.String oid)
Searches for a MIB variable given its OID and returns an SnmpOidRecord object containing information on the variable.

param
oid The OID of the MIB variable.
return
The SnmpOidRecord object containing information on the variable.
exception
SnmpStatusException The specified oid does not exist in this SnmpOidDatabase.

        for (int i=0;i<tables.size();i++) {
            try {
                return (((SnmpOidTable)tables.elementAt(i)).resolveVarOid(oid));
            }
            catch (SnmpStatusException e) {
                if (i==tables.size()-1) {
                    throw new SnmpStatusException(e.getMessage());
                }
            }
        }
        return null;