[seam-dev] Extending weld-extensions generic beans

Jordan Ganoff jganoff at gmail.com
Mon Apr 12 10:22:49 EDT 2010


Something like this would be great for the JMS project as I have a similar
issue when trying to inject MessageProducer/MessageConsumers that depend on
specific destinations.

On Mon, Apr 12, 2010 at 9:51 AM, Stuart Douglas <stuart at baileyroberts.com.au
> wrote:

> After talking with Tihomir over the last few days about the seam-drools
> module I think that there is base functionality that is missing that belongs
> in weld-extensions as it is similar to the existing generic bean code.
>
> I will use an example from the drools module to outline the problem:
>
> The drools module has a DroolsConfiguration object that contains
> configuration, this can be installed via XML and there can be multiple
> DroolsConfigrations per app. for every DroolsConfiguration several object
> need to be produced e.g. KnowledgeBase, StatefullKnowledgeSession and a
> KnowledgeRuntimeLogger.
>
> currently we would need to do something like this:
>
> < d:DroolsConfiguration>
>  <app:SomeQualifier>
>  ...configuration
> </d:DroolsConfiguration>
>
>
> <d:KnowlegdeBaseProducer>
>  <d:producerMethod>
>    <app:SomeQualifier>
>    <s:parameters>
>      <d:DroolsConfiguration>
>       <s:Inject/>
>       <app:SomeQualifier/>
>     </d:DroolsConfiguration>
>    </s:parameters>
>  </d:producerMethod>
> </d:KnowlegdeBaseProducer >
>
> ...same for StatefullKnowledgeSession, StatelessKnowledgeSession,
> KnowledgeRuntimeLogger etc.
>
> and wire up a producer like that for every object being created from the
> DroolsConfiguration. This is not good. The user should be able to just wire
> up the configuration and the rest of the beans should be created
> automatically. I think we should be able to do something like this:
>
> @Generic(DroolsConfiguration.class)
> class KnowledgeBaseProducer
> {
>  @Produces
>  @GenericQualifiers
>  public KnowledgeBase producerMethod(@Inject @GenericQualifiers
> DroolsConfiguration config )
>  {
>   //do stuff
>  }
>
> }
>
> @Generic tell the extensions to register a new KnowledgeBaseProducer bean
> for every DroolsConfiguration found.
> @GenericQualifiers is replaced with the qualifiers on the
> DroolsConfiguration object when the bean is added.
>
> This means that all an end user has to do is wire up a single
> DroolsConfiguration object and everything just works.
>
> Does this sound like a good idea? Is there anything I have overlooked?
>
> Stuart
>
>
>
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev
>



-- 
Jordan Ganoff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/seam-dev/attachments/20100412/2e3ffd8a/attachment.html 


More information about the seam-dev mailing list