1. /*
  2. * @(#)file SnmpGenericMetaServer.java
  3. * @(#)author Sun Microsystems, Inc.
  4. * @(#)version 1.7
  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. // jmx imports
  12. //
  13. import com.sun.jmx.snmp.SnmpValue;
  14. import com.sun.jmx.snmp.SnmpStatusException;
  15. /**
  16. * <p>
  17. * This interface defines the methods that must be implemented by an
  18. * SNMP metadata object that needs to interact with an
  19. * {@link com.sun.jmx.snmp.agent.SnmpGenericObjectServer} object.
  20. * </p>
  21. *
  22. * <p>
  23. * All these methods are usually generated by <code>mibgen</code> when
  24. * run in generic-metadata mode.
  25. * </p>
  26. *
  27. * <p><b><i>
  28. * This interface is used internally between the generated Metadata and
  29. * the SNMP runtime and you shouldn't need to worry about it, because
  30. * you will never have to use it directly.
  31. * </b></i></p>
  32. *
  33. * <p><b>This API is a Sun Microsystems internal API and is subject
  34. * to change without notice.</b></p>
  35. **/
  36. public interface SnmpGenericMetaServer {
  37. /**
  38. * Construct an attribute value (as returned by Attribute::getValue())
  39. * from an SnmpValue. The returned attribute value can be used to
  40. * construct an Attribute object.
  41. *
  42. * @param id The OID arc identifying the variable for which the
  43. * value is constructed.
  44. * @param value The SnmpValue from which the Attribute::value will be
  45. * constructed.
  46. * @return The attribute value built from the given <code>value</code>.
  47. * @exception SnmpStatusException if the attribute value cannot be built
  48. * from the given SnmpValue <code>value</code>.
  49. *
  50. */
  51. Object buildAttributeValue(long id, SnmpValue value)
  52. throws SnmpStatusException;
  53. /**
  54. * Construct an SnmpValue from an Attribute value as returned by
  55. * Attribute::getValue().
  56. *
  57. * @param id The OID arc identifying the variable for which the
  58. * value is constructed.
  59. * @param value The attribute value as returned by Attribute::getValue().
  60. *
  61. * @return The SnmpValue built from the given <code>value</code>.
  62. * @exception SnmpStatusException if the SnmpValue cannot be built from
  63. * the given <code>value</code>.
  64. **/
  65. SnmpValue buildSnmpValue(long id, Object value)
  66. throws SnmpStatusException;
  67. /**
  68. * Return the name of the attribute corresponding to the
  69. * SNMP variable identified by the given <code>id</code>.
  70. *
  71. * @param id The OID arc identifying the variable.
  72. *
  73. * @return The name of the variable identified by the given
  74. * <code>id</code>.
  75. *
  76. * @exception SnmpStatusException if the given <code>id</code> does not
  77. * correspond to a known variable.
  78. */
  79. String getAttributeName(long id)
  80. throws SnmpStatusException;
  81. /**
  82. * Check the access rights for a SET operation.
  83. *
  84. * @param x The new requested value.
  85. * @param id The OID arc identifying the variable for which the SET is
  86. * requested.
  87. * @param data A contextual object containing user-data.
  88. * This object is allocated through the <code>
  89. * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}</code>
  90. * for each incoming SNMP request.
  91. * @exception SnmpStatusException if the SET operation must be rejected.
  92. */
  93. void checkSetAccess(SnmpValue x, long id, Object data)
  94. throws SnmpStatusException;
  95. /**
  96. * Check the access rights for a GET operation.
  97. *
  98. * @param id The OID arc identifying the variable for which the SET is
  99. * requested.
  100. * @param data A contextual object containing user-data.
  101. * This object is allocated through the <code>
  102. * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}</code>
  103. * for each incoming SNMP request.
  104. * @exception SnmpStatusException if the SET operation must be rejected.
  105. */
  106. void checkGetAccess(long id, Object data)
  107. throws SnmpStatusException;
  108. }