1. /*
  2. * @(#)file SnmpMibSubRequest.java
  3. * @(#)author Sun Microsystems, Inc.
  4. * @(#)version 1.13
  5. * @(#)date 04/09/15
  6. *
  7. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  8. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  9. */
  10. package com.sun.jmx.snmp.agent;
  11. import java.util.Enumeration;
  12. import java.util.Vector;
  13. import com.sun.jmx.snmp.SnmpVarBind;
  14. import com.sun.jmx.snmp.SnmpStatusException;
  15. import com.sun.jmx.snmp.SnmpOid;
  16. // import com.sun.jmx.snmp.SnmpIndex;
  17. /**
  18. * This interface models an SNMP sub request to be performed on a specific
  19. * SNMP MIB node. The node involved can be either an SNMP group, an SNMP table,
  20. * or an SNMP table entry (conceptual row). The conceptual row may or may not
  21. * already exist. If the row did not exist at the time when the request
  22. * was received, the <CODE>isNewEntry()</CODE> method will return <CODE>
  23. * true</CODE>.
  24. * <p>
  25. * Objects implementing this interface will be allocated by the SNMP engine.
  26. * You will never need to implement this interface. You will only use it.
  27. * </p>
  28. * <p><b>This API is a Sun Microsystems internal API and is subject
  29. * to change without notice.</b></p>
  30. */
  31. public interface SnmpMibSubRequest extends SnmpMibRequest {
  32. /**
  33. * Return the list of varbind to be handled by the SNMP MIB node.
  34. * <p>
  35. * <b>Note:</b> <ul>
  36. * <i>In case of SET operation, if this node is a table row which
  37. * contains a control variable (as identified by the table's
  38. * isRowStatus() method) the control variable will not
  39. * be included in this list: it will be obtained by calling
  40. * getRowStatusVarBind(). This will allow you to handle the control
  41. * variable specifically.</i><br>
  42. * You will never need to worry about this unless you need to
  43. * implement a non standard mechanism for handling row
  44. * creation and deletion.
  45. * </ul>
  46. * <p>
  47. * @return The elements of the enumeration are instances of
  48. * {@link com.sun.jmx.snmp.SnmpVarBind}
  49. */
  50. public Enumeration getElements();
  51. /**
  52. * Return the list of varbind to be handled by the SNMP MIB node.
  53. * <p>
  54. * <b>Note:</b> <ul>
  55. * <i>In case of SET operation, if this node is a table row which
  56. * contains a control variable (as identified by the table's
  57. * isRowStatus() method) the control variable will not
  58. * be included in this list: it will be obtained by calling
  59. * getRowStatusVarBind(). This will allow you to handle the control
  60. * variable specifically.</i><br>
  61. * You will never need to worry about this unless you need to
  62. * implement a non standard mechanism for handling row
  63. * creation and deletion.
  64. * </ul>
  65. * <p>
  66. * @return The elements of the vector are instances of
  67. * {@link com.sun.jmx.snmp.SnmpVarBind}
  68. */
  69. public Vector getSubList();
  70. /**
  71. * Return the part of the OID identifying the table entry involved.
  72. * <p>
  73. *
  74. * @return {@link com.sun.jmx.snmp.SnmpOid} or <CODE>null</CODE>
  75. * if the request is not directed to an entry.
  76. */
  77. public SnmpOid getEntryOid();
  78. /**
  79. * Indicate whether the entry involved is a new entry.
  80. * This method will return <CODE>true</CODE> if the entry was not
  81. * found when the request was processed. As a consequence, <CODE>
  82. * true</CODE> means that either the entry does not exist yet,
  83. * or it has been created while processing this request.
  84. * The result of this method is only significant when an entry
  85. * is involved.
  86. *
  87. * <p>
  88. * @return <CODE>true</CODE> If the entry did not exist,
  89. * or <CODE>false</CODE> if the entry involved was found.
  90. */
  91. public boolean isNewEntry();
  92. /**
  93. * Return the varbind that holds the RowStatus variable.
  94. * It corresponds to the varbind that was identified by
  95. * the <code>isRowStatus()</code> method generated by mibgen
  96. * on {@link com.sun.jmx.snmp.agent.SnmpMibTable} derivatives.
  97. * <ul><li>In SMIv2, it is the varbind which contains the columnar
  98. * object implementing the RowStatus TEXTUAL-CONVENTION.</li>
  99. * <li>In SMIv1 nothing special is generated</li>
  100. * <ul>You may however subclass the generated table metadata
  101. * class in order to provide your own implementation of
  102. * isRowStatus(), getRowAction(), isRowReady() and
  103. * setRowStatus()
  104. * (see {@link com.sun.jmx.snmp.agent.SnmpMibTable}).</ul>
  105. * </ul>
  106. * <p>
  107. * @return a varbind that serves to control the table modification.
  108. * <code>null</code> means that no such varbind could be
  109. * identified.<br>
  110. * <b>Note:</b><i>The runtime will only try to identify
  111. * the RowStatus varbind when processing an
  112. * SNMP SET request. In this case, the identified
  113. * varbind will not be included in the set of varbinds
  114. * returned by getSubList() and getElements().
  115. * </i>
  116. *
  117. **/
  118. public SnmpVarBind getRowStatusVarBind();
  119. /**
  120. * This method should be called when a status exception needs to
  121. * be raised for a given varbind of an SNMP GET request. This method
  122. * performs all the necessary conversions (SNMPv1 <=> SNMPv2) and
  123. * propagates the exception if needed:
  124. * If the version is SNMP v1, the exception is propagated.
  125. * If the version is SNMP v2, the exception is stored in the varbind.
  126. * This method also takes care of setting the correct value of the
  127. * index field.
  128. * <p>
  129. *
  130. * @param varbind The varbind for which the exception is
  131. * registered. Note that this varbind <b>must</b> have
  132. * been obtained from the enumeration returned by
  133. * <CODE>getElements()</CODE>, or from the vector
  134. * returned by <CODE>getSubList()</CODE>
  135. *
  136. * @param exception The exception to be registered for the given varbind.
  137. *
  138. */
  139. public void registerGetException(SnmpVarBind varbind,
  140. SnmpStatusException exception)
  141. throws SnmpStatusException;
  142. /**
  143. * This method should be called when a status exception needs to
  144. * be raised for a given varbind of an SNMP SET request. This method
  145. * performs all the necessary conversions (SNMPv1 <=> SNMPv2) and
  146. * propagates the exception if needed.
  147. * This method also takes care of setting the correct value of the
  148. * index field.
  149. * <p>
  150. *
  151. * @param varbind The varbind for which the exception is
  152. * registered. Note that this varbind <b>must</b> have
  153. * been obtained from the enumeration returned by
  154. * <CODE>getElements()</CODE>, or from the vector
  155. * returned by <CODE>getSubList()</CODE>
  156. *
  157. * @param exception The exception to be registered for the given varbind.
  158. *
  159. */
  160. public void registerSetException(SnmpVarBind varbind,
  161. SnmpStatusException exception)
  162. throws SnmpStatusException;
  163. /**
  164. * This method should be called when a status exception needs to
  165. * be raised when checking a given varbind for an SNMP SET request.
  166. * This method performs all the necessary conversions (SNMPv1 <=>
  167. * SNMPv2) and propagates the exception if needed.
  168. * This method also takes care of setting the correct value of the
  169. * index field.
  170. * <p>
  171. *
  172. * @param varbind The varbind for which the exception is
  173. * registered. Note that this varbind <b>must</b> have
  174. * been obtained from the enumeration returned by
  175. * <CODE>getElements()</CODE>, or from the vector
  176. * returned by <CODE>getSubList()</CODE>
  177. *
  178. * @param exception The exception to be registered for the given varbind.
  179. *
  180. */
  181. public void registerCheckException(SnmpVarBind varbind,
  182. SnmpStatusException exception)
  183. throws SnmpStatusException;
  184. }