[jboss-as7-dev] Do new model attributes require manual setup of transformers?

Jaikiran Pai jpai at redhat.com
Tue Mar 5 09:23:49 EST 2013


I've been trying to implement a new feature which requires the addition 
of a new model attribute for the EJB3 subsystem root resource. This 
model attribute is supposed to be "mandatory" (i.e. non-nullable at 
model level and "required" at xml level). All works fine without 
bringing into picture older versions of the model. Now while testing 
with older versions of the model and compatibility, things start failing 
for obvious reasons- the older model handlers, parsers etc... have no 
clue about this new attribute. I'm aware that that's where the 
transformers come into picture and I've setup an appropriate transformer 
that is supposed to handle this scenario. But, the transformers tests in 
EJB3SubsystemUnitTestCase fails for different test methods. I had to dig 
a bit into the code to figure out that one of the failures had to do 
with the test case itself rather than the new code.

One part of the problem and the main reason why I decided to ask this 
via a mail instead of over IRC is because, I've been having a difficult 
time with the transformer APIs and its usage. On a higher level I 
(think) I do understand what the transformers are supposed to do and how 
to deal with individual attribute/resource changes when multiple 
versions of the model come into picture. But when it comes to wiring the 
right transformers at the right place in the code or figuring out what 
such places are or even debugging failing tests, I find it not so 
straightforward to understand what's going on. Perhaps it's just that I 
am not yet used to those APIs. To be honest, with whatever transformer 
code I've added, although it seems to work to a certain extent, I'm not 
confident about the code I'm adding - I've been just looking at other 
places and copying over the code wherever appropriate.

So back to the original issue and the related question - would it be 
possible to "automate" this process of plugging in these transformers? 
In this specific case, for example, I think almost all (there maybe be 
exceptions) subsystems and resources introducing a new attribute in the 
higher model would expect that that attribute to be ignored (I'm not 
using the term discarded or rejected because I am not 100% sure I 
understand the difference yet :) ) by lower versions of the model. So 
instead of me trying to figure out where to plugin these transformers, 
would it be possible to *dynamically* generate these transformers for 
some of these cases? That way I wouldn't have to deal with these for 
every new attribute and instead be assured that this would be handled 
centrally at some place?

P.S: If someone wants to take a look at the (failing WIP) code that I'm 
talking about, then let me know, I can push my code to github. I wanted 
to keep this mail to be broader than just this specific failing case.

-Jaikiran


More information about the jboss-as7-dev mailing list