1. /*
  2. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  3. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  4. */
  5. package javax.resource.cci;
  6. import javax.resource.ResourceException;
  7. /**ResourceWarning provides information on warnings related to
  8. * execution of an interaction with an EIS. Warnings are silently
  9. * chained to the object whose method caused it to be reported.
  10. *
  11. * @see Interaction#getWarnings
  12. */
  13. public class ResourceWarning extends ResourceException {
  14. /**
  15. * Constructs a fully-specified <code>ResourceWarning</code> object
  16. * initialized with the given values.
  17. *
  18. * @param reason description of the warning
  19. * @param errorcode a string specifying the vendor specific
  20. * error code
  21. */
  22. public ResourceWarning(String reason, String errorCode) {
  23. super(reason, errorCode);
  24. }
  25. /**
  26. * Constructs an <code>ResourceWarning</code> object
  27. * with the given value for a reason; errorCode defaults to
  28. * null.
  29. *
  30. * @param reason description of the warning
  31. **/
  32. public ResourceWarning(String reason) {
  33. super(reason);
  34. }
  35. /**
  36. * Retrieves the warning chained to this <code>ResourceWarning</code>
  37. * object.
  38. *
  39. * @return next ResourceWarning in the chain; null if none
  40. */
  41. public ResourceWarning getLinkedWarning() {
  42. try {
  43. return ((ResourceWarning)getLinkedException());
  44. }
  45. catch (ClassCastException ex) {
  46. return null;
  47. }
  48. }
  49. /**
  50. * Adds an <code>ResourceWarning</code> object to the end of the chain.
  51. *
  52. * @param warning ResourceWarning added to the chain
  53. */
  54. public void setLinkedWarning(ResourceWarning warning) {
  55. setLinkedException(warning);
  56. }
  57. }