Hello, I'm curious about whether people think the way these "functions" work is a good design and if it should be kept this way or changed. I hacked it together pretty quickly because it was a small, fun project, but I don't want to start going down a road that will be painful to support in the future.
To address an enhancement request, I added support for two "functions" (kinda) on generic index resource labels: http://bugzilla.opennms.org/show_bug.cgi?id=2467 One is of the form "${index:<start>-<end>}" which will select a portion of an index for a generic resource. The <start> and <end> parts are indexes both starting at zero and either can be omitted, but not both. A shorthand for "<num>-<num>" where both numbers are the same is just to specify the number. In the specific example above, an index is of the form "0.21.109.80.9.66.4", where the first six octets are a MAC address, and the last octet is an interface ID. So, ${index:6} would select the interface ID (it's the seventh octet, but remember that things are indexed by zero). I thought about using the form "subIndex(<sub-symbol>, <start>, <end>), but it started to get a little confusing about what I should do if I wanted to omit one or more of the arguments (but I guess I could always require a start and make the end optional). It might be good to restructure it this way to make it like the next feature. The other feature is of the form "hex(<sub-symbol>)", which assumes that the evaluation of the sub-symbol is a dotted integer string, and it's converted to a hex string, perfect for a MAC address. The sub-symbol is any other symbol that is recognized as a generic index expression, such as "index", the new form of "index:6", or whatever. Together, they can be used with a resource label expression like this: "MAC Address ${hex(index:0-5)} on interface ${index:6}" ... to create a resource label for the index "0.21.109.80.9.66.4" of "MAC Address 00:15:6D:50:09:42 on interface 4". What do you think? - djg ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Please read the OpenNMS Mailing List FAQ: http://www.opennms.org/index.php/Mailing_List_FAQ opennms-devel mailing list To *unsubscribe* or change your subscription options, see the bottom of this page: https://lists.sourceforge.net/lists/listinfo/opennms-devel