Class DefaultMOFactory

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 Details

    • DefaultMOFactory

      protected DefaultMOFactory()
  • Method Details

    • 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:
      addTextualConvention in interface MOFactory
      Parameters:
      tc - a TextualConvention instance.
    • removeTextualConvention

      public void removeTextualConvention(TextualConvention<?> tc)
      Description copied from interface: MOFactory
      Removes the supplied textual convention from the supported TCs by this ManagedObject factory.
      Specified by:
      removeTextualConvention in interface MOFactory
      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 interface MOFactory
      Type Parameters:
      V - the Variable 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, or null 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 new MOTableRow row instance and returns it.
      Specified by:
      createRow in interface MOTableRowFactory<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: MOTableRowFactory
      Frees resources associated with the supplied row which is to be deleted.
      Specified by:
      freeRow in interface MOTableRowFactory<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: 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 interface LinkedMOFactory
      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

      public Object getLink(org.snmp4j.smi.OID oid)
      Description copied from interface: LinkedMOFactory
      Gets the link for the given object ID or any sub-OID prefix thereof.
      Specified by:
      getLink in interface LinkedMOFactory
      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()