- 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>
TheDefaultMOFactoryis 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 Modifier Constructor Description protectedDefaultMOFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddSNMPv2TCs(MOFactory factory)Adds support for SNMPv2TC textual conventions to the supplied ManagedObject factory.voidaddTextualConvention(TextualConvention<?> tc)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.DefaultMOMutableRow2PCcreateRow(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] values)Creates a newMOTableRowrow instance and returns it.voidfreeRow(DefaultMOMutableRow2PC row)Frees resources associated with the supplied row which is to be deleted.static MOFactorygetInstance()Returns the factory singleton with default support for SNMPv2-TC textual conventions.ObjectgetLink(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<?>>>getTextualConventions()protected voidinitLinkMap()voidremoveTextualConvention(TextualConvention<?> tc)Removes the supplied textual convention from the supported TCs by this ManagedObject factory.static voidsetInstance(MOFactory factory)Sets the singleton factory.voidsetLink(org.snmp4j.smi.OID oid, Object instrumentationHelperObject)Set 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 interface org.snmp4j.agent.mo.MOFactory
createAccess, createColumn, createColumn, createColumn, createColumn, createIndex, createIndex, createScalar, createScalar, createSubIndex, createSubIndex, createTable, createTable, createTableModel, createTableRelation, getSysUpTime
-
-
-
-
Method Detail
-
getInstance
public static MOFactory getInstance()
Returns the factory singleton with default support for SNMPv2-TC textual conventions.- Returns:
- a MOFactory instance.
-
setInstance
public static void setInstance(MOFactory factory)
Sets the singleton factory.- Parameters:
factory- a MOFactory instance.
-
addSNMPv2TCs
public static void addSNMPv2TCs(MOFactory factory)
Adds support for SNMPv2TC textual conventions to the supplied ManagedObject factory.- Parameters:
factory- a MOFactory instance.
-
getTextualConventions
protected Map<? extends String,? extends Map<String,TextualConvention<?>>> getTextualConventions()
-
addTextualConvention
public void addTextualConvention(TextualConvention<?> tc)
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
public void removeTextualConvention(TextualConvention<?> tc)
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
public void freeRow(DefaultMOMutableRow2PC row)
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
public void setLink(org.snmp4j.smi.OID oid, Object instrumentationHelperObject)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:
LinkedMOFactory.getLink(OID oid)
-
getLink
public Object getLink(org.snmp4j.smi.OID oid)
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()
-
-