1. /*
  2. * @(#)TraceDestination.java 1.14 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.jmx.trace;
  8. import java.io.IOException;
  9. /**
  10. * Defines the methods that a trace destination must implement.
  11. *
  12. * @since 1.5
  13. * @since.unbundled JMX RI 1.2
  14. */
  15. public interface TraceDestination {
  16. /**
  17. * Verify whether the specified info level and the info type are
  18. * selected by a listener.
  19. *
  20. * <P>It is strongly recommended to call this method before sending
  21. * information to this Trace class.
  22. *
  23. * @param level the level of trace information.
  24. * @param type the type of the trace information.
  25. */
  26. public boolean isSelected(int level, int type);
  27. /**
  28. * Send a new information to this Trace destination
  29. *
  30. * @param level the level of trace information to be sent.
  31. * @param type the type of trace information to be sent.
  32. * @param className the name of the class from which the trace
  33. * information is from.
  34. * @param methodName the name of the method from which the trace
  35. * information is from.
  36. * @param info the trace information to be sent.
  37. * @return false if the level and the type are not selected.
  38. */
  39. public boolean send(int level,
  40. int type,
  41. String className,
  42. String methodName,
  43. String info);
  44. /**
  45. * Send an exception to this Trace class.
  46. *
  47. * @param level the level of trace information to be sent.
  48. * @param type the type of trace information to be sent.
  49. * @param className the name of the class from which the trace
  50. * information is from.
  51. * @param methodName the name of the method from which the trace
  52. * information is from.
  53. * @param exception exception sent as the trace information.
  54. */
  55. public boolean send(int level,
  56. int type,
  57. String className,
  58. String methodName,
  59. Throwable exception);
  60. /**
  61. * Reset the trace destination.
  62. * The behaviour of this method is implementation dependent.
  63. * It could be used, for instance, to (re)initialize the traces
  64. * according to some default System properties, or to flush
  65. * (empty) the log file, etc...
  66. **/
  67. public void reset() throws IOException;
  68. }