java.lang.Object
org.snmp4j.agent.mo.DefaultMOFactory
- All Implemented Interfaces:
LinkedMOFactory,MOFactory,MOTableRowFactory<DefaultMOMutableRow2PC>
- Direct Known Subclasses:
SimMOFactory
public class DefaultMOFactory
extends Object
implements MOFactory, LinkedMOFactory, MOTableRowFactory<DefaultMOMutableRow2PC>
The
DefaultMOFactory is the default factory for creating ManagedObjects. The default factory creates
columnar and scalar objects based on SNMPv2-TC textual conventions with appropriate constraints. Other textual
conventions can be added too.- Version:
- 2.3.0
- Author:
- Frank Fock
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddSNMPv2TCs(MOFactory factory) Adds support for SNMPv2TC textual conventions to the supplied ManagedObject factory.voidAdds a textual convention to this factory which can then be used by the factory to create appropriate value constraints for columnar and scalar managed objects.createRow(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] values) Creates a newMOTableRowrow instance and returns it.voidFrees resources associated with the supplied row which is to be deleted.static MOFactoryReturns the factory singleton with default support for SNMPv2-TC textual conventions.getLink(org.snmp4j.smi.OID oid) Gets the link for the given object ID or any sub-OID prefix thereof.<V extends org.snmp4j.smi.Variable>
TextualConvention<V>getTextualConvention(String moduleName, String name) Gets the textual convention described by the TC's name and the MIB module name of the MIB module specifying the TC.protected Map<? extends String,? extends Map<String, TextualConvention<?>>> protected voidvoidRemoves the supplied textual convention from the supported TCs by this ManagedObject factory.static voidsetInstance(MOFactory factory) Sets the singleton factory.voidSet a link between the supplied object ID of a managed object class (or a set of managed object classes if the OID refers to a MIB sub-tree) to the given helper object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.snmp4j.agent.mo.MOFactory
createAccess, createColumn, createColumn, createColumn, createColumn, createIndex, createIndex, createScalar, createScalar, createSubIndex, createSubIndex, createTable, createTable, createTableModel, createTableRelation, getSysUpTime
-
Constructor Details
-
DefaultMOFactory
protected DefaultMOFactory()
-
-
Method Details
-
getInstance
Returns the factory singleton with default support for SNMPv2-TC textual conventions.- Returns:
- a MOFactory instance.
-
setInstance
Sets the singleton factory.- Parameters:
factory- a MOFactory instance.
-
addSNMPv2TCs
Adds support for SNMPv2TC textual conventions to the supplied ManagedObject factory.- Parameters:
factory- a MOFactory instance.
-
getTextualConventions
-
addTextualConvention
Adds a textual convention to this factory which can then be used by the factory to create appropriate value constraints for columnar and scalar managed objects.- Specified by:
addTextualConventionin interfaceMOFactory- Parameters:
tc- a TextualConvention instance.
-
removeTextualConvention
Description copied from interface:MOFactoryRemoves the supplied textual convention from the supported TCs by this ManagedObject factory.- Specified by:
removeTextualConventionin interfaceMOFactory- Parameters:
tc- a TextualConvention instance.
-
getTextualConvention
public <V extends org.snmp4j.smi.Variable> TextualConvention<V> getTextualConvention(String moduleName, String name) Description copied from interface:MOFactoryGets the textual convention described by the TC's name and the MIB module name of the MIB module specifying the TC.- Specified by:
getTextualConventionin interfaceMOFactory- Type Parameters:
V- theVariabletype that is the base type of the returned textual convention.- Parameters:
moduleName- the name of the MIB module that defines the TC.name- the object name of the TC.- Returns:
- the
TextualConventionthat matches the given values, ornullif such a TC is not registered with this factory.
-
createRow
public DefaultMOMutableRow2PC createRow(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] values) throws UnsupportedOperationException Description copied from interface:MOTableRowFactoryCreates a newMOTableRowrow instance and returns it.- Specified by:
createRowin interfaceMOTableRowFactory<DefaultMOMutableRow2PC>- Parameters:
index- the index OID for the new row.values- the values to be contained in the new row.- Returns:
- the created
MOTableRow. - Throws:
UnsupportedOperationException- if the specified row cannot be created.
-
freeRow
Description copied from interface:MOTableRowFactoryFrees resources associated with the supplied row which is to be deleted.- Specified by:
freeRowin interfaceMOTableRowFactory<DefaultMOMutableRow2PC>- Parameters:
row- a MOTableRow that has been created using this factory and is now to be deleted (removed from the associated table).
-
setLink
Description copied from interface:LinkedMOFactorySet a link between the supplied object ID of a managed object class (or a set of managed object classes if the OID refers to a MIB sub-tree) to the given helper object.- Specified by:
setLinkin interfaceLinkedMOFactory- Parameters:
oid- an OID of a managed object class or sub-tree.instrumentationHelperObject- an object that helps the factory or the objects created on its behalf to instrument the those objects.- See Also:
-
getLink
Description copied from interface:LinkedMOFactoryGets the link for the given object ID or any sub-OID prefix thereof.- Specified by:
getLinkin interfaceLinkedMOFactory- Parameters:
oid- the oid of the managed object class (prefix) for which to returned the linked instrumentation helper class.- Returns:
- an instrumentation helper object (for example an URI) or
nullif no such link exists.
-
initLinkMap
protected void initLinkMap()
-