[SNMP4J] Validators generated by agentpp

Frank Fock fock at agentpp.com
Thu Jan 18 09:51:08 CET 2007


Hi Rick,

Since you have confirmed to use the latest version
of AgenPro I understand that this might be a simple
misunderstanding:

As you can see from the Snmp4jHeartbeatMib example,
the validation listeners created by AgenPro are now
instances of ValueConstraint which can be adapted
as MOValueValidationListener through
ValueConstraintValidator:

   ValueConstraint snmp4jAgentHBCtrlStorageTypeVC =
     new EnumerationConstraint(
         new int[] {Snmp4jAgentHBCtrlStorageTypeEnum.other,
         Snmp4jAgentHBCtrlStorageTypeEnum._volatile,
         Snmp4jAgentHBCtrlStorageTypeEnum.nonVolatile,
         Snmp4jAgentHBCtrlStorageTypeEnum.permanent,
         Snmp4jAgentHBCtrlStorageTypeEnum.readOnly});
   ((MOMutableColumn)
    snmp4jAgentHBCtrlEntryColumns[idxSnmp4jAgentHBCtrlStorageType]).
       addMOValueValidationListener(new
         ValueConstraintValidator(snmp4jAgentHBCtrlStorageTypeVC));

Each MO instance can have more than one validation
listener. When AgenPro generates an additional value
validation listener for your custom validation, then this
listener is registered after the value range listener.

If you need to change, for example, the enumeration
validation then you can either remove the generated listener
and replace it by your custom checking or you can define
an AGENT-CAPABILITIES module and modify WRITE-SYNTAX of
the object to reflect your needs (for example "not all
enums of the original MIB definition should be supported").

Best regards,
Frank

Rick Keiner wrote:
> Hi,
> When the validators are generated they do not check the value to be in the
> range of the enum for that OID. Why is that? Do I need to hand code each
> validator to check the range of the enum or is there another way?
> 
> Thanks,
> Rick Keiner
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the SNMP4J mailing list