1. /*
  2. * @(#)file SnmpMibHandler.java
  3. * @(#)author Sun Microsystems, Inc.
  4. * @(#)version 4.23
  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. */
  11. package com.sun.jmx.snmp.agent;
  12. // java imports
  13. //
  14. import java.util.Vector;
  15. import java.io.IOException;
  16. // jmx imports
  17. //
  18. import com.sun.jmx.snmp.SnmpOid;
  19. import com.sun.jmx.snmp.SnmpStatusException;
  20. /**
  21. * The logical link between an SNMP MIB and the SNMP communication stack.
  22. *
  23. * <p><b>This API is a Sun Microsystems internal API and is subject
  24. * to change without notice.</b></p>
  25. * @version 4.23 12/19/03
  26. * @author Sun Microsystems, Inc
  27. */
  28. public interface SnmpMibHandler {
  29. /**
  30. * Adds a new MIB in the SNMP MIB handler.
  31. * This method is called automatically by {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptor(SnmpMibHandler)} and
  32. * {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptorName(ObjectName)} and should not be called directly.
  33. *
  34. * @param mib The MIB to add.
  35. *
  36. * @return A reference on the SNMP MIB handler.
  37. *
  38. * @exception IllegalArgumentException If the parameter is null.
  39. */
  40. public SnmpMibHandler addMib(SnmpMibAgent mib) throws IllegalArgumentException;
  41. /**
  42. * Adds a new MIB in the SNMP MIB handler.
  43. *
  44. * @param mib The MIB to add.
  45. * @param oids The array of oid used to add the mib. Each oid is a root oid for the mib.
  46. * @return A reference on the SNMP MIB handler.
  47. *
  48. * @exception IllegalArgumentException If the parameter is null.
  49. *
  50. * @since 1.5
  51. */
  52. public SnmpMibHandler addMib(SnmpMibAgent mib, SnmpOid[] oids) throws IllegalArgumentException;
  53. /**
  54. * Adds a new contextualized MIB in the SNMP MIB handler.
  55. *
  56. * @param mib The MIB to add.
  57. * @param contextName The MIB context name. If null is passed, will be registered in the default context.
  58. *
  59. * @return A reference to the SNMP MIB handler.
  60. *
  61. * @exception IllegalArgumentException If the parameter is null.
  62. *
  63. * @since 1.5
  64. */
  65. public SnmpMibHandler addMib(SnmpMibAgent mib, String contextName)
  66. throws IllegalArgumentException;
  67. /**
  68. * Adds a new contextualized MIB in the SNMP MIB handler.
  69. *
  70. * @param mib The MIB to add.
  71. * @param contextName The MIB context name. If null is passed, will be registered in the default context.
  72. * @param oids The array of oid used to add the mib. Each oid is a root oid for the mib.
  73. *
  74. * @return A reference to the SNMP MIB handler.
  75. *
  76. * @exception IllegalArgumentException If the parameter is null.
  77. *
  78. * @since 1.5
  79. */
  80. public SnmpMibHandler addMib(SnmpMibAgent mib, String contextName, SnmpOid[] oids)
  81. throws IllegalArgumentException;
  82. /**
  83. * Removes the specified MIB from the SNMP protocol adaptor.
  84. * This method is called automatically by {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptor(SnmpMibHandler)} and
  85. * {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptorName(ObjectName)} and should not be called directly.
  86. *
  87. * @param mib The MIB to be removed.
  88. *
  89. * @return <CODE>true</CODE> if the specified <CODE>mib</CODE> was a MIB included in the SNMP MIB handler,
  90. * <CODE>false</CODE> otherwise.
  91. */
  92. public boolean removeMib(SnmpMibAgent mib);
  93. /**
  94. * Removes the specified MIB from the SNMP protocol adaptor.
  95. * This method is called automatically by {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptor(SnmpMibHandler)} and
  96. * {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptorName(ObjectName)} and should not be called directly.
  97. *
  98. * @param mib The MIB to be removed.
  99. * @param oids The oid the MIB was previously registered for.
  100. * @return <CODE>true</CODE> if the specified <CODE>mib</CODE> was a MIB included in the SNMP MIB handler,
  101. * <CODE>false</CODE> otherwise.
  102. *
  103. * @since 1.5
  104. */
  105. public boolean removeMib(SnmpMibAgent mib, SnmpOid[] oids);
  106. /**
  107. * Removes the specified MIB from the SNMP protocol adaptor.
  108. *
  109. * @param mib The MIB to be removed.
  110. * @param contextName The context name used at registration time.
  111. *
  112. * @return <CODE>true</CODE> if the specified <CODE>mib</CODE> was a MIB included in the SNMP MIB handler,
  113. * <CODE>false</CODE> otherwise.
  114. *
  115. * @since 1.5
  116. */
  117. public boolean removeMib(SnmpMibAgent mib, String contextName);
  118. /**
  119. * Removes the specified MIB from the SNMP protocol adaptor.
  120. *
  121. * @param mib The MIB to be removed.
  122. * @param contextName The context name used at registration time.
  123. * @param oids The oid the MIB was previously registered for.
  124. * @return <CODE>true</CODE> if the specified <CODE>mib</CODE> was a MIB included in the SNMP MIB handler,
  125. * <CODE>false</CODE> otherwise.
  126. *
  127. * @since 1.5
  128. */
  129. public boolean removeMib(SnmpMibAgent mib, String contextName, SnmpOid[] oids);
  130. }