Class ValidateCallbackProxy

Object
com.tailf.dp.annotations.ValidateCallbackProxy
All Implemented Interfaces:
DpValpointCallback

public class ValidateCallbackProxy extends Object implements DpValpointCallback
Callback proxy for Validation Callbacks. Implements the DpValpointCallback interface and delegates calls to the registered callback POJO with annotated methods
Since:
3.2.0
  • Constructor Details

    • ValidateCallbackProxy

      public ValidateCallbackProxy(Object backupObject, String callPoint)
      Constructor for Callback proxys. Used internally.
      Parameters:
      backupObject - registered callback POJO
      callPoint - string describing the callpoint for this callback
  • Method Details

    • getBackupObject

      public Object getBackupObject()
      Retrieve the callback POJO
      Returns:
      Object registered callback object
    • getCallPoint

      public String getCallPoint()
      Retrieve the callback callpoint
      Returns:
      callpoint string
    • addActionMethod

      public void addActionMethod(String name, Method method)
      Add callback action method to proxy
      Parameters:
      name - canonical action name
      method - registered callback method
    • addActionCapability

      public void addActionCapability(ValidateCBType valCBType)
      Add action capability from annotated callType used to register capabilities on the server
      Parameters:
      valCBType - action type
    • validate

      public void validate(DpTrans trans, ConfObject[] kp, ConfValue newval) throws DpCallbackException, DpCallbackWarningException
      Description copied from interface: DpValpointCallback
      The validate() callback should validate the values and throw a DpCallbackException if the validation fails. There is also a possibility to throw a DpCallbackWarningException with message set to a string describing the warning. The warnings will get propagated to the transaction engine, and depending on where the transaction originates, ConfD/NCS may or may not act on the warnings. If the transaction originates from the CLI or the Web UI, ConfD/NCS will interactively present the user with a choice - whereby the transaction can be aborted.

      If the transaction originates from NETCONF - which does not have any interactive capabilities, the warnings are ignored. The warnings are primarily intended to alert inexperienced users that attempt to make - dangerous - configuration changes. There can be multiple warnings from multiple validation points in the same transaction.

      Specified by:
      validate in interface DpValpointCallback
      Parameters:
      trans - The transaction
      kp - The keypath
      newval - The new value to validate
      Throws:
      DpCallbackException - If the validation fails
      DpCallbackWarningException - If a warning should be propagated to the originator of the transaction.
    • valpoint

      public String valpoint()
      Description copied from interface: DpValpointCallback
      The name of the valpoint.
      Specified by:
      valpoint in interface DpValpointCallback
    • getValidateCallbackProxys

      public static ValidateCallbackProxy[] getValidateCallbackProxys(Object obj) throws DpCallbackException
      Get array of proxy objects from registered POJO callback. Used internally at callback registration
      Parameters:
      obj - registered Callback POJO
      Returns:
      array of ValidateCallbackProxy
      Throws:
      DpCallbackException