Resource Subcategories - Simplified

Stefan Negrea snegrea at redhat.com
Thu Apr 17 20:38:38 UTC 2014


Hello Everybody,

I've been working for a while on adding resource subcategories to the AS7 plugin to simplify the resource tree. While on surface this would be simple change, just add subcategories to the plugin descriptor, the change is very very complicated. The current subcategory design is outdated due to the addition of the run-inside (multiple parents) feature. I've been trying to fix the current subcategory design from different angles but none worked so far. Mazz helped me along with reviews to my design progressions. This morning while on a call with Mazz, we had a small epiphany, let's solve everything by completely removing the current implementation.

So here are the changes that I am currently working on:
1) Do not require parent resources to pre-declare all subcategories for children. This was done today with a top level <subcategories> tag. 
2) The <subcategories> tag will be deprecated for the next release and will eventually be dropped in subsequent releases. 
3) While deprecated, just ignore the <subcategories> tag.
4) The subcategories will be declared only the resources themselves via the subCategory attribute 
5) For hierarchical categories allow a pipe delimited syntax  subCategory="Subsystems|Test"
6) In the UI apply use the camel case syntax to make it more readable, TestSubsystems = Test Subsystems
7) Drop the entire subcategories entities and related tables. For now deprecated, and later completely remove the functionality.
8) Work on a database migration task to fold subcategories text into the resource types.
9) Update current RHQ plugins to remove the <subcategories> tag.

Why the changes:
1) The current implementation is almost unused, none of the complicated structure is fully taken advantage of.
2) The current implementation is broken in so many ways, the run-inside really made the design obsolete and almost unfixable.
3) The current validation for subcategories (= they are declared on the parent) is really not needed. The only the actual resources that is placed on a subcategory needs to know about the subcategory.
4) The UI operates under the assumptions of a the simplified model. If a resource belongs to a category then create the UI resource tree accordingly.
5) Simple plugin structures makes it easy for community members to implement/fix plugins.

Removing the current subcategory implementation is relatively easy because very little is actually used; it is mostly a liability. There were a couple of fixes applied over time around transactional boundaries that made the code very brittle. And after all this is done there is absolutely no change from a user perspective. 


To summarize the change:
1) Deprecate <subcategories> tag 
2) Drop <subcategories> tag in future releases
2) Subcategories are set only via subCategory attribute
3) Pipe delimit hierarchies of subcategories and use camel case to improve legibility
4) Clean backend and existing plugins completely
5) No change for the users


BZ:
https://bugzilla.redhat.com/show_bug.cgi?id=1069545

Working pull request:
https://github.com/rhq-project/rhq/pull/22



Thank you,
Stefan Negrea

Software Engineer



More information about the rhq-devel mailing list