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
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addSNMPv2TCs
(MOFactory factory) Adds support for SNMPv2TC textual conventions to the supplied ManagedObject factory.void
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.createRow
(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] values) Creates a newMOTableRow
row instance and returns it.void
Frees resources associated with the supplied row which is to be deleted.static MOFactory
Returns 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 void
void
Removes the supplied textual convention from the supported TCs by this ManagedObject factory.static void
setInstance
(MOFactory factory) Sets the singleton factory.void
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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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
-
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:
addTextualConvention
in interfaceMOFactory
- Parameters:
tc
- a TextualConvention instance.
-
removeTextualConvention
Description copied from interface:MOFactory
Removes the supplied textual convention from the supported TCs by this ManagedObject factory.- Specified by:
removeTextualConvention
in 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:MOFactory
Gets the textual convention described by the TC's name and the MIB module name of the MIB module specifying the TC.- Specified by:
getTextualConvention
in interfaceMOFactory
- Type Parameters:
V
- theVariable
type 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
TextualConvention
that matches the given values, ornull
if 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:MOTableRowFactory
Creates a newMOTableRow
row instance and returns it.- Specified by:
createRow
in 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:MOTableRowFactory
Frees resources associated with the supplied row which is to be deleted.- Specified by:
freeRow
in 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:LinkedMOFactory
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.- Specified by:
setLink
in 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:LinkedMOFactory
Gets the link for the given object ID or any sub-OID prefix thereof.- Specified by:
getLink
in 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
null
if no such link exists.
-
initLinkMap
protected void initLinkMap()
-