public class DefaultMOFactory extends Object implements MOFactory, LinkedMOFactory
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.| Modifier | Constructor and Description |
|---|---|
protected |
DefaultMOFactory() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addSNMPv2TCs(MOFactory factory)
Adds support for SNMPv2TC textual conventions to the supplied ManagedObject
factory.
|
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.
|
MOAccess |
createAccess(int moAccess)
Creates an MOAccess instance from an access specification constant that is
the result of a bitwise OR of any of the constants defined by
MOAccess. |
MOColumn |
createColumn(int columnID,
int syntax,
MOAccess access)
Creates a columnar object by supplying column ID, syntax, and maximum
access.
|
MOColumn |
createColumn(int columnID,
int syntax,
MOAccess access,
String tcModuleName,
String textualConvention)
Creates a columnar object by supplying column ID, syntax, and maximum
access.
|
MOColumn |
createColumn(int columnID,
int syntax,
MOAccess access,
org.snmp4j.smi.Variable defaultValue,
boolean mutableInService)
Creates a columnar object by supplying column ID, syntax, and maximum
access.
|
MOColumn |
createColumn(int columnID,
int syntax,
MOAccess access,
org.snmp4j.smi.Variable defaultValue,
boolean mutableInService,
String tcModuleName,
String textualConvention)
Creates a columnar object by supplying column ID, syntax, and maximum
access.
|
MOTableIndex |
createIndex(MOTableSubIndex[] subIndexes,
boolean impliedLength)
Creates an index definition from the supplied sub-index definitions without
index validation.
|
MOTableIndex |
createIndex(MOTableSubIndex[] subIndexes,
boolean impliedLength,
MOTableIndexValidator validator)
Creates an index definition from the supplied sub-index definitions with
index validation according to the supplied validator.
|
MOTableRow |
createRow(org.snmp4j.smi.OID index,
org.snmp4j.smi.Variable[] values)
Creates a new
MOTableRow row instance and returns it. |
MOScalar |
createScalar(org.snmp4j.smi.OID id,
MOAccess access,
org.snmp4j.smi.Variable value)
Creates a scalar object from a OID, maximum access, and value.
|
MOScalar |
createScalar(org.snmp4j.smi.OID id,
MOAccess access,
org.snmp4j.smi.Variable value,
String tcModuleName,
String textualConvention)
Creates a scalar object from a OID, maximum access, and value.
|
MOTableSubIndex |
createSubIndex(int smiSyntax) |
MOTableSubIndex |
createSubIndex(int smiSyntax,
int minLength,
int maxLength) |
MOTableSubIndex |
createSubIndex(org.snmp4j.smi.OID oid,
int smiSyntax)
Creates a sub-index definition.
|
MOTableSubIndex |
createSubIndex(org.snmp4j.smi.OID oid,
int smiSyntax,
int minLength,
int maxLength)
Creates a sub-index definition.
|
MOTable |
createTable(org.snmp4j.smi.OID oid,
MOTableIndex indexDef,
MOColumn[] columns)
Creates a MOTable instance for the supplied OID, index definition, and
columns with the
DefaultMOMutableTableModel as table model. |
MOTable |
createTable(org.snmp4j.smi.OID oid,
MOTableIndex indexDef,
MOColumn[] columns,
MOTableModel model)
Creates a MOTable instance for the supplied OID, index definition,
columns, and table model.
|
MOTableModel |
createTableModel(org.snmp4j.smi.OID tableOID,
MOTableIndex indexDef,
MOColumn[] columns)
Creates a table model (by default a
DefaultMOMutableTableModel). |
MOTableRelation |
createTableRelation(MOTable baseTable,
MOTable dependentTable)
Creates a relation between two tables.
|
void |
freeRow(MOTableRow row)
Frees resources associated with the supplied row which is to be deleted.
|
static MOFactory |
getInstance()
Returns the factory singleton with default support for SNMPv2-TC textual
conventions.
|
Object |
getLink(org.snmp4j.smi.OID oid)
Gets the link for the given object ID or any sub-OID prefix thereof.
|
TextualConvention |
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 void |
initLinkMap() |
void |
removeTextualConvention(TextualConvention tc)
Removes the supplied textual convention from the supported TCs by this
ManagedObject factory.
|
static void |
setInstance(MOFactory factory)
Sets the singleton factory.
|
void |
setLink(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.
|
public static MOFactory getInstance()
public static void setInstance(MOFactory factory)
factory - a MOFactory instance.public static void addSNMPv2TCs(MOFactory factory)
factory - a MOFactory instance.protected Map<? extends String,? extends Map<String,TextualConvention>> getTextualConventions()
public void addTextualConvention(TextualConvention tc)
addTextualConvention in interface MOFactorytc - a TextualConvention instance.public void removeTextualConvention(TextualConvention tc)
MOFactoryremoveTextualConvention in interface MOFactorytc - a TextualConvention instance.public TextualConvention getTextualConvention(String moduleName, String name)
MOFactorygetTextualConvention in interface MOFactorymoduleName - the name of the MIB module that defines the TC.name - the object name of the TC.TextualConvention that matches the given values, or
null if such a TC is not registered with this factory.public MOColumn createColumn(int columnID, int syntax, MOAccess access)
MOFactorycreateColumn in interface MOFactorycolumnID - the column ID of the column. The column ID is the last sub-identifier
of a column definition. It is NOT the index of the column.syntax - the SMI syntax of the column as defined by SMIConstants.access - the maximum access supported by this column.MOColumn instance.public MOColumn createColumn(int columnID, int syntax, MOAccess access, org.snmp4j.smi.Variable defaultValue, boolean mutableInService)
MOFactorycreateColumn in interface MOFactorycolumnID - the column ID of the column. The column ID is the last sub-identifier
of a column definition. It is NOT the index of the column.syntax - the (effective) SMI syntax of the column as defined by
SMIConstants.access - the maximum access supported by this column.defaultValue - the default value defined by the DEFVAL clause for this column.mutableInService - if true this object may be changed while it is active
(inService), otherwise such an attempt will be rejected with a
inconsistentValue error.MOColumn instance.public MOTableRelation createTableRelation(MOTable baseTable, MOTable dependentTable)
MOFactorycreateTableRelation in interface MOFactorybaseTable - the base table.dependentTable - the dependent or augmenting table.MOTableRelation instance relating the supplied tables.public MOTableRow createRow(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] values) throws UnsupportedOperationException
MOTableRowFactoryMOTableRow row instance and returns it.createRow in interface MOTableRowFactoryindex - the index OID for the new row.values - the values to be contained in the new row.MOTableRow.UnsupportedOperationException - if the specified row cannot be created.public MOScalar createScalar(org.snmp4j.smi.OID id, MOAccess access, org.snmp4j.smi.Variable value)
MOFactorycreateScalar in interface MOFactoryid - the OID of the scalar (including the .0 suffix).access - the maximum access supported by this scalar.value - the (initial) value of the scalar.MOScalar instance.public MOTable createTable(org.snmp4j.smi.OID oid, MOTableIndex indexDef, MOColumn[] columns)
MOFactoryDefaultMOMutableTableModel as table model.createTable in interface MOFactoryoid - the OID of the table entry (thus table OID + ".1").indexDef - the index defintion of the table.columns - the columns for the new table as an array of MOColumn
instances.public MOTable createTable(org.snmp4j.smi.OID oid, MOTableIndex indexDef, MOColumn[] columns, MOTableModel model)
MOFactorycreateTable in interface MOFactoryoid - the OID of the table entry (thus table OID + ".1").indexDef - the index defintion of the table.columns - the columns for the new table as an array of MOColumn
instances.model - the table model to use for the table.public MOTableModel createTableModel(org.snmp4j.smi.OID tableOID, MOTableIndex indexDef, MOColumn[] columns)
MOFactoryDefaultMOMutableTableModel).createTableModel in interface MOFactorytableOID - the table's OID for which this model is created.indexDef - the index definition for the table.columns - the columns defined for the table.MOTableModel instance.public void freeRow(MOTableRow row)
MOTableRowFactoryfreeRow in interface MOTableRowFactoryrow - a MOTableRow that has been created using this factory and is now to
be deleted (removed from the associated table).public MOTableIndex createIndex(MOTableSubIndex[] subIndexes, boolean impliedLength)
MOFactorycreateIndex in interface MOFactorysubIndexes - an array of MOTableSubIndex instances defining the sub-
index values of this index.impliedLength - indicates whether the last variable length sub-index value has an
implied length or not (default is false).MOTableIndex instance.public MOTableSubIndex createSubIndex(int smiSyntax)
public MOTableSubIndex createSubIndex(org.snmp4j.smi.OID oid, int smiSyntax)
MOFactorycreateSubIndex in interface MOFactoryoid - the object identifier of the OBJECT-TYPE that defines this sub-index
or null if that information is not available. An non
null is required for AgentX shared tables.smiSyntax - the SMI syntax as defined by SMIConstants.MOTableSubIndex instance.public MOTableSubIndex createSubIndex(int smiSyntax, int minLength, int maxLength)
public MOTableSubIndex createSubIndex(org.snmp4j.smi.OID oid, int smiSyntax, int minLength, int maxLength)
MOFactorycreateSubIndex in interface MOFactoryoid - the object identifier of the OBJECT-TYPE that defines this sub-index
or null if that information is not available. An non
null is required for AgentX shared tables.smiSyntax - the SMI syntax as defined by SMIConstants.minLength - the minimum length in sub-identifiers (without length sub-id) of the
sub-index.maxLength - the maximum length in sub-identifiers (without length sub-id) of the
sub-index.MOTableSubIndex instance.public MOTableIndex createIndex(MOTableSubIndex[] subIndexes, boolean impliedLength, MOTableIndexValidator validator)
MOFactorycreateIndex in interface MOFactorysubIndexes - an array of MOTableSubIndex instances defining the sub-
index values of this index.impliedLength - indicates whether the last variable length sub-index value has an
implied length or not (default is false).validator - an index validator to check index values.MOTableIndex instance.public MOColumn createColumn(int columnID, int syntax, MOAccess access, String tcModuleName, String textualConvention)
MOFactorycreateColumn in interface MOFactorycolumnID - the column ID of the column. The column ID is the last sub-identifier
of a column definition. It is NOT the index of the column.syntax - the (effective) SMI syntax of the column as defined by
SMIConstants.access - the maximum access supported by this column.tcModuleName - the MIB module name that defines the textual conventions.textualConvention - the object name of the textual convention on which this column is based.MOColumn instance.public MOColumn createColumn(int columnID, int syntax, MOAccess access, org.snmp4j.smi.Variable defaultValue, boolean mutableInService, String tcModuleName, String textualConvention)
MOFactorycreateColumn in interface MOFactorycolumnID - the column ID of the column. The column ID is the last sub-identifier
of a column definition. It is NOT the index of the column.syntax - the (effective) SMI syntax of the column as defined by
SMIConstants.access - the maximum access supported by this column.defaultValue - the default value defined by the DEFVAL clause for this column.mutableInService - if true this object may be changed while it is active
(inService), otherwise such an attempt will be rejected with a
inconsistentValue error.tcModuleName - the MIB module name that defines the textual conventions.textualConvention - the object name of the textual convention on which this column is based.MOColumn instance.public MOScalar createScalar(org.snmp4j.smi.OID id, MOAccess access, org.snmp4j.smi.Variable value, String tcModuleName, String textualConvention)
MOFactorycreateScalar in interface MOFactoryid - the OID of the scalar (including the .0 suffix).access - the maximum access supported by this scalar.value - the (initial) value of the scalar.tcModuleName - the MIB module name that defines the textual conventions.textualConvention - the object name of the textual convention on which this scalar is based.MOScalar instance.public MOAccess createAccess(int moAccess)
MOFactoryMOAccess.createAccess in interface MOFactorymoAccess - any bitwise OR combined constant from MOAccess.public void setLink(org.snmp4j.smi.OID oid,
Object instrumentationHelperObject)
LinkedMOFactorysetLink in interface LinkedMOFactoryoid - 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.LinkedMOFactory.getLink(OID oid)public Object getLink(org.snmp4j.smi.OID oid)
LinkedMOFactorygetLink in interface LinkedMOFactoryoid - the oid of the managed object class (prefix) for which to returned the
linked instrumentation helper class.null if no such link exists.protected void initLinkMap()
Copyright © 2014 SNMP4J.org. All Rights Reserved.