- java.lang.Object
-
- org.snmp4j.agent.mo.MOTableIndex
-
- All Implemented Interfaces:
MOTableIndexValidator
public class MOTableIndex extends Object implements MOTableIndexValidator
TheMOTableIndexclass represents a index definition of a conceptual table. An index always has to implement also theMOTableIndexValidatorinterface for validation of index values for newly created rows.- Version:
- 1.0
- Author:
- Frank Fock
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_INDEX_OID_LENGTH
-
Constructor Summary
Constructors Constructor Description MOTableIndex(MOTableSubIndex[] subIndexes)Creates a index definition from an array of sub-index definitions.MOTableIndex(MOTableSubIndex[] subIndexes, boolean impliedLength)Creates a index definition from an array of sub-index definitions where the last sub-index may have an implied length.MOTableIndex(MOTableSubIndex[] subIndexes, boolean impliedLength, MOTableIndexValidator validator)Creates a index definition from an array of sub-index definitions where the last sub-index may have an implied length.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MOTableSubIndexgetIndex(int index)Gets the sub-index definition at the specified index.org.snmp4j.smi.OIDgetIndexOID(org.snmp4j.smi.Variable[] indexValues)Gets the index OID from an array of index values.org.snmp4j.smi.OID[]getIndexOIDs(org.snmp4j.smi.OID index)Split a table index into an array of object IDs each representing the value of its corresponding index object.org.snmp4j.smi.Variable[]getIndexValues(org.snmp4j.smi.OID index)Gets the index values contained in an index OID.MOTableIndexValidatorgetValidator()Gets the index validator (if present).booleanisImpliedLength()booleanisValidIndex(org.snmp4j.smi.OID index)Checks whether an index OID is a valid index for this index definition or not.voidsetValidator(MOTableIndexValidator validator)Sets the index validator associated with this index definition.intsize()Gets the number of sub-index definitions in this index definition.StringtoString()
-
-
-
Field Detail
-
MAX_INDEX_OID_LENGTH
public static final int MAX_INDEX_OID_LENGTH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MOTableIndex
public MOTableIndex(MOTableSubIndex[] subIndexes)
Creates a index definition from an array of sub-index definitions.- Parameters:
subIndexes- an array of sub-index definitions with at least one element.
-
MOTableIndex
public MOTableIndex(MOTableSubIndex[] subIndexes, boolean impliedLength)
Creates a index definition from an array of sub-index definitions where the last sub-index may have an implied length.- Parameters:
subIndexes- an array of sub-index definitions with at least one element.impliedLength- iftruethe last sub-index has an implied length if at has a variable length at all.
-
MOTableIndex
public MOTableIndex(MOTableSubIndex[] subIndexes, boolean impliedLength, MOTableIndexValidator validator)
Creates a index definition from an array of sub-index definitions where the last sub-index may have an implied length.- Parameters:
subIndexes- an array of sub-index definitions with at least one element.impliedLength- iftruethe last sub-index has an implied length if at has a variable length at all.validator- an index validator that is called whenever a new index value needs to validated.
-
-
Method Detail
-
getIndex
public MOTableSubIndex getIndex(int index)
Gets the sub-index definition at the specified index.- Parameters:
index- a valid sub-index index (zero-based).- Returns:
- the
MOTableSubIndex.
-
isImpliedLength
public boolean isImpliedLength()
-
getValidator
public MOTableIndexValidator getValidator()
Gets the index validator (if present).- Returns:
- the
MOTableIndexValidatorassociated with this index ornull.
-
setValidator
public void setValidator(MOTableIndexValidator validator)
Sets the index validator associated with this index definition.- Parameters:
validator- aMOTableIndexValidatorinstance.
-
size
public int size()
Gets the number of sub-index definitions in this index definition.- Returns:
- the sub-index count.
-
isValidIndex
public boolean isValidIndex(org.snmp4j.smi.OID index)
Checks whether an index OID is a valid index for this index definition or not.- Specified by:
isValidIndexin interfaceMOTableIndexValidator- Parameters:
index- an OID (possibly zero length).- Returns:
trueif the index is valid orfalseotherwise.
-
getIndexOIDs
public org.snmp4j.smi.OID[] getIndexOIDs(org.snmp4j.smi.OID index)
Split a table index into an array of object IDs each representing the value of its corresponding index object. For example if a table's index would be defined as INDEX { ifIndex, ipAddress } and the index given would be "1.127.0.0.1" the resulting array would be { "1", "127.0.0.1" }- Parameters:
index- an OID denoting a table's index value.- Returns:
- an array of OID instances with the same size as returned by
size(). If the given index is not a valid object IDnullis returned.
-
getIndexValues
public org.snmp4j.smi.Variable[] getIndexValues(org.snmp4j.smi.OID index)
Gets the index values contained in an index OID.- Parameters:
index- the index OID.- Returns:
- an array of values representing the index.
- See Also:
getIndexOID(org.snmp4j.smi.Variable[])
-
getIndexOID
public org.snmp4j.smi.OID getIndexOID(org.snmp4j.smi.Variable[] indexValues)
Gets the index OID from an array of index values.- Parameters:
indexValues- an array of Variable instances that has to match the number and type of sub-indexes in this index.- Returns:
- the corresponding index OID.
- See Also:
getIndexValues(org.snmp4j.smi.OID)
-
-