1. /*
  2. * @(#)file SnmpMibAgentMBean.java
  3. * @(#)author Sun Microsystems, Inc.
  4. * @(#)version 1.24
  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. // jmx imports
  16. //
  17. import javax.management.MBeanServer;
  18. import javax.management.ObjectName;
  19. import javax.management.MalformedObjectNameException;
  20. import javax.management.InstanceNotFoundException;
  21. import javax.management.ServiceNotFoundException;
  22. import com.sun.jmx.snmp.SnmpOid;
  23. import com.sun.jmx.snmp.SnmpStatusException;
  24. /**
  25. * Exposes the remote management interface of the <CODE>SnmpMibAgent</CODE> MBean.
  26. *
  27. * <p><b>This API is a Sun Microsystems internal API and is subject
  28. * to change without notice.</b></p>
  29. * @version 1.24 12/19/03
  30. * @author Sun Microsystems, Inc
  31. */
  32. public interface SnmpMibAgentMBean {
  33. // PUBLIC METHODS
  34. //---------------
  35. /**
  36. * Processes a <CODE>get</CODE> operation.
  37. * This method must not be called from remote.
  38. *
  39. * @param req The SnmpMibRequest object holding the list of variables to
  40. * be retrieved. This list is composed of
  41. * <CODE>SnmpVarBind</CODE> objects.
  42. *
  43. * @exception SnmpStatusException An error occured during the operation.
  44. * @see SnmpMibAgent#get(SnmpMibRequest)
  45. */
  46. public void get(SnmpMibRequest req) throws SnmpStatusException;
  47. /**
  48. * Processes a <CODE>getNext</CODE> operation.
  49. * This method must not be called from remote.
  50. *
  51. * @param req The SnmpMibRequest object holding the list of variables to
  52. * be retrieved. This list is composed of
  53. * <CODE>SnmpVarBind</CODE> objects.
  54. *
  55. * @exception SnmpStatusException An error occured during the operation.
  56. * @see SnmpMibAgent#getNext(SnmpMibRequest)
  57. */
  58. public void getNext(SnmpMibRequest req) throws SnmpStatusException;
  59. /**
  60. * Processes a <CODE>getBulk</CODE> operation.
  61. * This method must not be called from remote.
  62. *
  63. * @param req The SnmpMibRequest object holding the list of variables to
  64. * be retrieved. This list is composed of
  65. * <CODE>SnmpVarBind</CODE> objects.
  66. *
  67. * @param nonRepeat The number of variables, starting with the first
  68. * variable in the variable-bindings, for which a single
  69. * lexicographic successor is requested.
  70. *
  71. * @param maxRepeat The number of lexicographic successors requested
  72. * for each of the last R variables. R is the number of variables
  73. * following the first <CODE>nonRepeat</CODE> variables for which
  74. * multiple lexicographic successors are requested.
  75. *
  76. * @exception SnmpStatusException An error occured during the operation.
  77. * @see SnmpMibAgent#getBulk(SnmpMibRequest,int,int)
  78. */
  79. public void getBulk(SnmpMibRequest req, int nonRepeat, int maxRepeat)
  80. throws SnmpStatusException;
  81. /**
  82. * Processes a <CODE>set</CODE> operation.
  83. * This method must not be called from remote.
  84. *
  85. * @param req The SnmpMibRequest object holding the list of variables to
  86. * be set. This list is composed of
  87. * <CODE>SnmpVarBind</CODE> objects.
  88. *
  89. * @exception SnmpStatusException An error occured during the operation.
  90. * @see SnmpMibAgent#set(SnmpMibRequest)
  91. */
  92. public void set(SnmpMibRequest req) throws SnmpStatusException;
  93. /**
  94. * Checks if a <CODE>set</CODE> operation can be performed.
  95. * If the operation cannot be performed, the method should emit a
  96. * <CODE>SnmpStatusException</CODE>.
  97. *
  98. * @param req The SnmpMibRequest object holding the list of variables to
  99. * be set. This list is composed of
  100. * <CODE>SnmpVarBind</CODE> objects.
  101. *
  102. * @exception SnmpStatusException The <CODE>set</CODE> operation
  103. * cannot be performed.
  104. * @see SnmpMibAgent#check(SnmpMibRequest)
  105. */
  106. public void check(SnmpMibRequest req) throws SnmpStatusException;
  107. // GETTERS AND SETTERS
  108. //--------------------
  109. /**
  110. * Gets the reference to the MBean server in which the SNMP MIB is
  111. * registered.
  112. *
  113. * @return The MBean server or null if the MIB is not registered in any
  114. * MBean server.
  115. */
  116. public MBeanServer getMBeanServer();
  117. /**
  118. * Gets the reference to the SNMP protocol adaptor to which the MIB is
  119. * bound.
  120. * <BR>This method is used for accessing the SNMP MIB handler property
  121. * of the SNMP MIB agent in case of a standalone agent.
  122. *
  123. * @return The SNMP MIB handler.
  124. */
  125. public SnmpMibHandler getSnmpAdaptor();
  126. /**
  127. * Sets the reference to the SNMP protocol adaptor through which the
  128. * MIB will be SNMP accessible and add this new MIB in the SNMP MIB
  129. * handler.
  130. * <BR>This method is used for setting the SNMP MIB handler property of
  131. * the SNMP MIB agent in case of a standalone agent.
  132. *
  133. * @param stack The SNMP MIB handler.
  134. */
  135. public void setSnmpAdaptor(SnmpMibHandler stack);
  136. /**
  137. * Sets the reference to the SNMP protocol adaptor through which the MIB
  138. * will be SNMP accessible and add this new MIB in the SNMP MIB handler.
  139. * This method is to be called to set a specific agent to a specific OID.
  140. * This can be useful when dealing with MIB overlapping.
  141. * Some OID can be implemented in more than one MIB. In this case, the
  142. * OID nearer agent will be used on SNMP operations.
  143. * @param stack The SNMP MIB handler.
  144. * @param oids The set of OIDs this agent implements.
  145. *
  146. * @since 1.5
  147. */
  148. public void setSnmpAdaptor(SnmpMibHandler stack, SnmpOid[] oids);
  149. /**
  150. * Sets the reference to the SNMP protocol adaptor through which the MIB
  151. * will be SNMP accessible and add this new MIB in the SNMP MIB handler.
  152. * Adds a new contextualized MIB in the SNMP MIB handler.
  153. *
  154. * @param stack The SNMP MIB handler.
  155. * @param contextName The MIB context name. If null is passed, will be
  156. * registered in the default context.
  157. *
  158. * @exception IllegalArgumentException If the parameter is null.
  159. *
  160. * @since 1.5
  161. */
  162. public void setSnmpAdaptor(SnmpMibHandler stack, String contextName);
  163. /**
  164. * Sets the reference to the SNMP protocol adaptor through which the MIB
  165. * will be SNMP accessible and adds this new MIB in the SNMP MIB handler.
  166. * Adds a new contextualized MIB in the SNMP MIB handler.
  167. *
  168. * @param stack The SNMP MIB handler.
  169. * @param contextName The MIB context name. If null is passed, will be
  170. * registered in the default context.
  171. * @param oids The set of OIDs this agent implements.
  172. * @exception IllegalArgumentException If the parameter is null.
  173. *
  174. * @since 1.5
  175. */
  176. public void setSnmpAdaptor(SnmpMibHandler stack,
  177. String contextName,
  178. SnmpOid[] oids);
  179. /**
  180. * Gets the object name of the SNMP protocol adaptor to which the MIB is
  181. * bound.
  182. *
  183. * @return The name of the SNMP protocol adaptor.
  184. */
  185. public ObjectName getSnmpAdaptorName();
  186. /**
  187. * Sets the reference to the SNMP protocol adaptor through which the MIB
  188. * will be SNMP accessible and add this new MIB in the SNMP MIB handler
  189. * associated to the specified <CODE>name</CODE>.
  190. *
  191. * @param name The object name of the SNMP MIB handler.
  192. *
  193. * @exception InstanceNotFoundException The MBean does not exist in the
  194. * MBean server.
  195. * @exception ServiceNotFoundException This SNMP MIB is not registered
  196. * in the MBean server or the requested service is not supported.
  197. */
  198. public void setSnmpAdaptorName(ObjectName name)
  199. throws InstanceNotFoundException, ServiceNotFoundException;
  200. /**
  201. * Sets the reference to the SNMP protocol adaptor through which the MIB
  202. * will be SNMP accessible and add this new MIB in the SNMP MIB handler
  203. * associated to the specified <CODE>name</CODE>.
  204. * This method is to be called to set a specific agent to a specific OID.
  205. * This can be useful when dealing with MIB overlapping.
  206. * Some OID can be implemented in more than one MIB. In this case, the
  207. * OID nearer agent will be used on SNMP operations.
  208. * @param name The name of the SNMP protocol adaptor.
  209. * @param oids The set of OIDs this agent implements.
  210. * @exception InstanceNotFoundException The SNMP protocol adaptor does
  211. * not exist in the MBean server.
  212. *
  213. * @exception ServiceNotFoundException This SNMP MIB is not registered
  214. * in the MBean server or the requested service is not supported.
  215. *
  216. * @since 1.5
  217. */
  218. public void setSnmpAdaptorName(ObjectName name, SnmpOid[] oids)
  219. throws InstanceNotFoundException, ServiceNotFoundException;
  220. /**
  221. * Sets the reference to the SNMP protocol adaptor through which the MIB
  222. * will be SNMP accessible and add this new MIB in the SNMP MIB handler
  223. * associated to the specified <CODE>name</CODE>.
  224. *
  225. * @param name The name of the SNMP protocol adaptor.
  226. * @param contextName The MIB context name. If null is passed, will be
  227. * registered in the default context.
  228. * @exception InstanceNotFoundException The SNMP protocol adaptor does
  229. * not exist in the MBean server.
  230. *
  231. * @exception ServiceNotFoundException This SNMP MIB is not registered
  232. * in the MBean server or the requested service is not supported.
  233. *
  234. * @since 1.5
  235. */
  236. public void setSnmpAdaptorName(ObjectName name, String contextName)
  237. throws InstanceNotFoundException, ServiceNotFoundException;
  238. /**
  239. * Sets the reference to the SNMP protocol adaptor through which the MIB
  240. * will be SNMP accessible and add this new MIB in the SNMP MIB handler
  241. * associated to the specified <CODE>name</CODE>.
  242. *
  243. * @param name The name of the SNMP protocol adaptor.
  244. * @param contextName The MIB context name. If null is passed, will be
  245. * registered in the default context.
  246. * @param oids The set of OIDs this agent implements.
  247. * @exception InstanceNotFoundException The SNMP protocol adaptor does
  248. * not exist in the MBean server.
  249. *
  250. * @exception ServiceNotFoundException This SNMP MIB is not registered
  251. * in the MBean server or the requested service is not supported.
  252. *
  253. * @since 1.5
  254. */
  255. public void setSnmpAdaptorName(ObjectName name,
  256. String contextName,
  257. SnmpOid[] oids)
  258. throws InstanceNotFoundException, ServiceNotFoundException;
  259. /**
  260. * Indicates whether or not the MIB module is bound to a SNMP protocol
  261. * adaptor.
  262. * As a reminder, only bound MIBs can be accessed through SNMP protocol
  263. * adaptor.
  264. *
  265. * @return <CODE>true</CODE> if the MIB module is bound,
  266. * <CODE>false</CODE> otherwise.
  267. */
  268. public boolean getBindingState();
  269. /**
  270. * Gets the MIB name.
  271. *
  272. * @return The MIB name.
  273. */
  274. public String getMibName();
  275. }