User development,
A new message was posted in the thread "VDF doesn't do component
composition":
http://community.jboss.org/message/519411#519411
Author : Adrian Brock
Profile :
http://community.jboss.org/people/adrian@jboss.org
Message:
--------------------------------------------------------------
You've missed one of design assumptions of components.
The original idea of components is that they are 1-1 mapping with the ControllerContexts
inside the MC.
There are a number of places that use that assumption, i.e. that the component unit's
name is the same as what the ControllerContext is
going to be.
The two most obvious ones are:
1) get*Scope() and get*MetaData()
which will return the same MDR context that will be used by the MC for that instance.
Of course in your example you are using the BeanMetaDataBuilder.addAnnotation() so the
fact that your
deployment component has a different ScopeKey and hence a different MDR context to what
the MC will use is a hidden problem,
you don't use it in the deployment layer - but somebody else might?
You could in fact fix this with a setScope() call, but you couldn't if there was more
than one bean instance in the component.
2) IncompleteDeploymentException (IDE)
In order for the IDE to print out what dependencies are missing for a deployment, it needs
to know the ControllerContext names.
It does this by collecting the Component DeploymentUnit's names in Component Deployers
that specify this, e.g. BeanMetaDataDeployer
or see setUseUnitName() in AbstractRealDeployer.
I guess this could be changed such that instead of setUseUnitName(), the
BeanMetaDataDeployer could directly invoke
DeploymentUnit.addControllerContextName() using the ControllerContext.getName() it just
created.
There could be other places that use this assumption?
CONCLUSION
You can see from the above, that the assumption could be removed and you get what you
want.
But it would only apply to a limited number of cases. e.g. where your component
doesn't already have a BeanMetaData attachment.
If two independent people wanted to augment a component with different BeanMetaDatas
there's simply no way of doing that without
stepping on each other toes.
So creating a new component makes more sense, if you don't want strange things to
happen when users write their own deployers that
try to do similar things - especially if they copy your deployer as an example. :-)
--------------------------------------------------------------
To reply to this message visit the message page:
http://community.jboss.org/message/519411#519411