Jumping in here as we (GateIn) have also had to add a CDI extension
through a subsytem and it felt "hackish". There were two issues that we
ran into while doing this.
1) There didn't seem to be a way to add a module to the portlet
application (war) and have it picked up by the DUP that creates the
ServicesAttachment. This is the only thing that weld looks at when
processing CDI extensions.
2) There was no way to add our CDI extension manually to the
ServicesAttachment for weld to pick up.
So we ended up adding it manually to the
WeldAttachments.PORTABLE_EXTENSIONS and we actually have three (yes
three) deployment processors to add one CDI extension module to a
portlet application. From my point of view it would be a lot safer if we
were able to add the CDI extension in our susbsystem as if it was added
as a jar to WEB-INF/lib. Then everything would have been picked up
automagically and our dependency on ordering of DUP's and available
attachments would be completely avoided.
I would say at the least, having the ability to add it to the
ServicesAttachment might be helpful here.
- Nick
On 05/21/2013 02:14 PM, Brian Stansberry wrote:
I don't understand all the details behind this, but in case it
helps I
do know WeldDeploymentMarker is going to be moved to the EE subsystem.
See [1] in [2].
[1]
https://github.com/wildfly/wildfly/pull/4486/files#diff-9
[2]
https://github.com/wildfly/wildfly/pull/4486
On 5/21/13 12:58 PM, Paul Robinson wrote:
> Stuart,
>
> The problem with this approach is that I need to introduce a dependency
> on org.jboss.as:jboss-as-weld, which depends
> on org.jboss.as:jboss-as-transactions. This introduces a cyclic
> dependency. org.jboss.as:jboss-as-weld is needed for
> the WeldDeploymentMarker and to use WeldAttachments.PORTABLE_EXTENSIONS.
>
>> You can do this for every deployment, if beans.xml is not present it
>> won't do anything
> I assume this is done by the three tests at the top of the deploy
> method? Therefore, I would need to use WeldDeploymentMarker.
>
>> you basically just need to attach it
>> under org.jboss.as.weld.deployment.WeldAttachments#PORTABLE_EXTENSIONS
>> for the top level deployment.
> Again, I can't do this without access
> to WeldAttachments.PORTABLE_EXTENSIONS.
>
> To break this cycle, I think I would need to create a new maven module
> and subsytem called, for example, transactions-cdi. This seems a bit
> over-kill. Is there an alternative you can think of?
>
> Thanks,
>
> Paul.
>
>
> On 14 May 2013, at 10:15, Stuart Douglas <sdouglas(a)redhat.com
> <mailto:sdouglas@redhat.com>> wrote:
>
>> Registering it in a DUP in the transactions subsystem is fine.
>>
>> Have a look in
>>
org.jboss.as.weld.deployment.processors.WeldPortableExtensionProcessor#loadAttachments
>> for an example of what you need to do, you basically just need to
>> attach it under
>> org.jboss.as.weld.deployment.WeldAttachments#PORTABLE_EXTENSIONS for
>> the top level deployment.
>>
>> You can do this for every deployment, if beans.xml is not present it
>> won't do anything.
>>
>> Stuart
>>
>> Paul Robinson wrote:
>>> Stuart (wildfly-dev in CC too)
>>>
>>> I'm implementing JTA 1.2, and part of it is to develop a new CDI
>>> context. I'm currently registering that via an Extension in the
>>> javax.enterprise.inject.spi.Extension file. The problem with this is
>>> that this is a burden on the application developer. Alternatively, I
>>> could register it in a DUP in the transactions subsytem. I'd probably
>>> have to register it for every deployment, as I don't think I can detect
>>> if it's needed.
>>>
>>> @pmuir said that you would probably know what I should do.
>>>
>>> Thanks,
>>>
>>> Paul.
>>> --
>>> Paul Robinson
>>> Web Service Transactions Lead
>>> paul.robinson(a)redhat.com <mailto:paul.robinson@redhat.com>
>>> <mailto:paul.robinson@redhat.com>
>>>
>>> JBoss, a Division of Red Hat
>>> Registered in England and Wales under Company Registration No. 03798903
>>> Directors: Michael Cunningham (USA), Brendan Lane (Ireland), Matt Parson
>>> (USA), Charlie Peters (USA)
>>>
> --
> Paul Robinson
> Web Service Transactions Lead
> paul.robinson(a)redhat.com <mailto:paul.robinson@redhat.com>
>
> JBoss, a Division of Red Hat
> Registered in England and Wales under Company Registration No. 03798903
> Directors: Michael Cunningham (USA), Brendan Lane (Ireland), Matt Parson
> (USA), Charlie Peters (USA)
>
>
>
> _______________________________________________
> wildfly-dev mailing list
> wildfly-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/wildfly-dev
>