How to show msg when attribute change fails?

Help
2006-03-13
2013-05-02
  • The Cuillivo
    The Cuillivo
    2006-03-13

    I’m trying to show an error message in JManage when an mbean attribute change raises an exception.

    For example, when you run mbean operations through JManage, you can return a String that will be shown as the operation output. Using this mechanism, when something wrong happens with the invocation, you can give some details using the output. But, when you change an mbean attribute, there’s no such “output”. So, when an attribute is changed and an unsuitable value is provided (like when you expect a number and a letter is entered), you don’t have the same facility to show some kind of error message.

    Any suggestions in how I can display a descriptive text about the failed attribute change through JManage and the JMX API?

    Thanks in advance.

     
    • Rakesh Kalra
      Rakesh Kalra
      2006-03-14

      Unfortunately, JMX API doesn't really cover validation errors.

      I think throwing an exception may not be a good idea from setXXX() method. The best thing may be to silently ignore such a set operation.

      jManage should be enhanced to look at the old and new attribute values, and then show an error message if the attribute value didn't change.

      What are you thoughts on this?

      Regards,
      Rakesh

       
      • The Cuillivo
        The Cuillivo
        2006-03-14

        Yes, I think you’re right. I’ll better handle the error without throwing the exception. Though, a workaround to the message displaying problem could be having a read-only String attribute in all your Mbeans that shows some kind of status message related to the last change it was made on the Mbean. It’s not very elegant but it’s a way to overcome the lack of a proper error displaying functionality.

        Having that feature you talked about in jManage would be great. Any future plans to add it?

        Thanks a lot for your help.

        All the best,
        Carlos