You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by Christian Beikov <ch...@gmail.com> on 2014/09/17 18:11:53 UTC

Re: Exclude annotation

Is nobody interested in something like that? I would really like to 
discuss it and also contribute the implementation.

Mit freundlichen Grüßen,
------------------------------------------------------------------------
*Christian Beikov*
Am 25.08.2014 um 22:21 schrieb Christian Beikov:
> Hello guys!
>
> I implemented an extension that excludes a bean or producer only if a 
> bean for a user specified type exists.
> Here a little example:
>
> public class AImpl1 implement A { ... }
>
> @ExcludeIfExists(A.class)
> public class AImpl2 implement A { ... }
>
> When both classes are on the classpath, AImpl2 will be vetoed.
> When only AImpl2 is on the classpath, a bean will be created for it.
>
> This was something that I was missing when trying to use the Exclude 
> annotation of Deltaspike. Now I would like to know if you are 
> interested in such an extension. I can provide you the basic code, 
> which is actually not that trivial.
> I think many people would benefit from this extension. Especially the 
> servlet module could benefit from that too since it could replace 
> current usages of the Deltaspike qualifier on the producers with the 
> exclude annotation. Then the servlet module could provide beans for 
> the servlet resources on EE6 servers. On EE7 servers those beans would 
> be vetoed since EE7 servers already provides default beans for many 
> resources.
>
> I hope you like the idea and I can help get that into the next 
> deltaspike release.
> -- 
>
> Mit freundlichen Grüßen,
> ------------------------------------------------------------------------
> *Christian Beikov*


Re: Exclude annotation

Posted by Christian Beikov <ch...@gmail.com>.
You can find my current implementation on GitHub: 
https://github.com/Blazebit/blaze-utils/tree/master/blaze-ee-utils/src/main/java/com/blazebit/cdi/exclude

Mit freundlichen Grüßen,
------------------------------------------------------------------------
*Christian Beikov*
Am 17.09.2014 um 19:14 schrieb Jason Porter:
> Feel free to prototype something in GitHub (or elsewhere) and present the
> code.
>
> On Wed, Sep 17, 2014 at 10:11 AM, Christian Beikov <
> christian.beikov@gmail.com> wrote:
>
>> Is nobody interested in something like that? I would really like to
>> discuss it and also contribute the implementation.
>>
>> Mit freundlichen Grüßen,
>> ------------------------------------------------------------------------
>> *Christian Beikov*
>> Am 25.08.2014 um 22:21 schrieb Christian Beikov:
>>
>>   Hello guys!
>>> I implemented an extension that excludes a bean or producer only if a
>>> bean for a user specified type exists.
>>> Here a little example:
>>>
>>> public class AImpl1 implement A { ... }
>>>
>>> @ExcludeIfExists(A.class)
>>> public class AImpl2 implement A { ... }
>>>
>>> When both classes are on the classpath, AImpl2 will be vetoed.
>>> When only AImpl2 is on the classpath, a bean will be created for it.
>>>
>>> This was something that I was missing when trying to use the Exclude
>>> annotation of Deltaspike. Now I would like to know if you are interested in
>>> such an extension. I can provide you the basic code, which is actually not
>>> that trivial.
>>> I think many people would benefit from this extension. Especially the
>>> servlet module could benefit from that too since it could replace current
>>> usages of the Deltaspike qualifier on the producers with the exclude
>>> annotation. Then the servlet module could provide beans for the servlet
>>> resources on EE6 servers. On EE7 servers those beans would be vetoed since
>>> EE7 servers already provides default beans for many resources.
>>>
>>> I hope you like the idea and I can help get that into the next deltaspike
>>> release.
>>> --
>>>
>>> Mit freundlichen Grüßen,
>>> ------------------------------------------------------------------------
>>> *Christian Beikov*
>>>
>>
>


Re: Exclude annotation

Posted by Christian Beikov <ch...@gmail.com>.
I am not familiar with that feature. Could you maybe post a link or 
point out what issues arised?
I had a problem in the beginning, because CDI 1.1 by default didn't 
allow calling BeanManager#getBeans() before the 
AfterDeploymentValidation event was fired. Because of that I am 
currently gathering all beans myself. Other than that, I couldn't think 
of any problems I had.
The extension is tested with OpenEJB and therefore also with OWB. I 
haven't let my JUnit tests run with Weld, but I deployed the extension 
successfully to Wildfly so I assume it works with other versions too.

Mit freundlichen Grüßen,
------------------------------------------------------------------------
*Christian Beikov*
Am 17.09.2014 um 22:51 schrieb John D. Ament:
> It's almost like the requires feature from seam.  I think there was a
> portability issue w/ OWB.
>
> On Wed, Sep 17, 2014 at 3:58 PM, Thomas Andraschko <
> andraschko.thomas@gmail.com> wrote:
>
>> I understand the use-case but i don't like the name.
>> If you use @ExcludeIfExists, you mark it as default implementation if no
>> other impl is on the classpath.
>>
>> Maybe something like @DefaultImplementation would fit it better.
>>
>>
>> 2014-09-17 19:14 GMT+02:00 Jason Porter <li...@gmail.com>:
>>
>>> Feel free to prototype something in GitHub (or elsewhere) and present the
>>> code.
>>>
>>> On Wed, Sep 17, 2014 at 10:11 AM, Christian Beikov <
>>> christian.beikov@gmail.com> wrote:
>>>
>>>> Is nobody interested in something like that? I would really like to
>>>> discuss it and also contribute the implementation.
>>>>
>>>> Mit freundlichen Grüßen,
>>>>
>> ------------------------------------------------------------------------
>>>> *Christian Beikov*
>>>> Am 25.08.2014 um 22:21 schrieb Christian Beikov:
>>>>
>>>>   Hello guys!
>>>>> I implemented an extension that excludes a bean or producer only if a
>>>>> bean for a user specified type exists.
>>>>> Here a little example:
>>>>>
>>>>> public class AImpl1 implement A { ... }
>>>>>
>>>>> @ExcludeIfExists(A.class)
>>>>> public class AImpl2 implement A { ... }
>>>>>
>>>>> When both classes are on the classpath, AImpl2 will be vetoed.
>>>>> When only AImpl2 is on the classpath, a bean will be created for it.
>>>>>
>>>>> This was something that I was missing when trying to use the Exclude
>>>>> annotation of Deltaspike. Now I would like to know if you are
>>> interested in
>>>>> such an extension. I can provide you the basic code, which is actually
>>> not
>>>>> that trivial.
>>>>> I think many people would benefit from this extension. Especially the
>>>>> servlet module could benefit from that too since it could replace
>>> current
>>>>> usages of the Deltaspike qualifier on the producers with the exclude
>>>>> annotation. Then the servlet module could provide beans for the
>> servlet
>>>>> resources on EE6 servers. On EE7 servers those beans would be vetoed
>>> since
>>>>> EE7 servers already provides default beans for many resources.
>>>>>
>>>>> I hope you like the idea and I can help get that into the next
>>> deltaspike
>>>>> release.
>>>>> --
>>>>>
>>>>> Mit freundlichen Grüßen,
>>>>>
>> ------------------------------------------------------------------------
>>>>> *Christian Beikov*
>>>>>
>>>>
>>>
>>> --
>>> Jason Porter
>>> http://en.gravatar.com/lightguardjp
>>>


Re: Exclude annotation

Posted by "John D. Ament" <jo...@gmail.com>.
It's almost like the requires feature from seam.  I think there was a
portability issue w/ OWB.

On Wed, Sep 17, 2014 at 3:58 PM, Thomas Andraschko <
andraschko.thomas@gmail.com> wrote:

> I understand the use-case but i don't like the name.
> If you use @ExcludeIfExists, you mark it as default implementation if no
> other impl is on the classpath.
>
> Maybe something like @DefaultImplementation would fit it better.
>
>
> 2014-09-17 19:14 GMT+02:00 Jason Porter <li...@gmail.com>:
>
> > Feel free to prototype something in GitHub (or elsewhere) and present the
> > code.
> >
> > On Wed, Sep 17, 2014 at 10:11 AM, Christian Beikov <
> > christian.beikov@gmail.com> wrote:
> >
> > > Is nobody interested in something like that? I would really like to
> > > discuss it and also contribute the implementation.
> > >
> > > Mit freundlichen Grüßen,
> > >
> ------------------------------------------------------------------------
> > > *Christian Beikov*
> > > Am 25.08.2014 um 22:21 schrieb Christian Beikov:
> > >
> > >  Hello guys!
> > >>
> > >> I implemented an extension that excludes a bean or producer only if a
> > >> bean for a user specified type exists.
> > >> Here a little example:
> > >>
> > >> public class AImpl1 implement A { ... }
> > >>
> > >> @ExcludeIfExists(A.class)
> > >> public class AImpl2 implement A { ... }
> > >>
> > >> When both classes are on the classpath, AImpl2 will be vetoed.
> > >> When only AImpl2 is on the classpath, a bean will be created for it.
> > >>
> > >> This was something that I was missing when trying to use the Exclude
> > >> annotation of Deltaspike. Now I would like to know if you are
> > interested in
> > >> such an extension. I can provide you the basic code, which is actually
> > not
> > >> that trivial.
> > >> I think many people would benefit from this extension. Especially the
> > >> servlet module could benefit from that too since it could replace
> > current
> > >> usages of the Deltaspike qualifier on the producers with the exclude
> > >> annotation. Then the servlet module could provide beans for the
> servlet
> > >> resources on EE6 servers. On EE7 servers those beans would be vetoed
> > since
> > >> EE7 servers already provides default beans for many resources.
> > >>
> > >> I hope you like the idea and I can help get that into the next
> > deltaspike
> > >> release.
> > >> --
> > >>
> > >> Mit freundlichen Grüßen,
> > >>
> ------------------------------------------------------------------------
> > >> *Christian Beikov*
> > >>
> > >
> > >
> >
> >
> > --
> > Jason Porter
> > http://en.gravatar.com/lightguardjp
> >
>

Re: Exclude annotation

Posted by Gerhard Petracek <ge...@gmail.com>.
i agree with thomas. we need to merge it with @Exclude or we find a
different name.
however, before adding it, we have to ensure that it is portable.

regards,
gerhard



2014-09-17 22:58 GMT+02:00 Christian Beikov <ch...@gmail.com>:

> The annotation can also be applied on producers and I am not sure if
> @DefaultImplementation would fit then.
>
> Mit freundlichen Grüßen,
> ------------------------------------------------------------------------
> *Christian Beikov*
> Am 17.09.2014 um 21:58 schrieb Thomas Andraschko:
>
>  I understand the use-case but i don't like the name.
>> If you use @ExcludeIfExists, you mark it as default implementation if no
>> other impl is on the classpath.
>>
>> Maybe something like @DefaultImplementation would fit it better.
>>
>>
>> 2014-09-17 19:14 GMT+02:00 Jason Porter <li...@gmail.com>:
>>
>>  Feel free to prototype something in GitHub (or elsewhere) and present the
>>> code.
>>>
>>> On Wed, Sep 17, 2014 at 10:11 AM, Christian Beikov <
>>> christian.beikov@gmail.com> wrote:
>>>
>>>  Is nobody interested in something like that? I would really like to
>>>> discuss it and also contribute the implementation.
>>>>
>>>> Mit freundlichen Grüßen,
>>>> ------------------------------------------------------------
>>>> ------------
>>>> *Christian Beikov*
>>>> Am 25.08.2014 um 22:21 schrieb Christian Beikov:
>>>>
>>>>   Hello guys!
>>>>
>>>>> I implemented an extension that excludes a bean or producer only if a
>>>>> bean for a user specified type exists.
>>>>> Here a little example:
>>>>>
>>>>> public class AImpl1 implement A { ... }
>>>>>
>>>>> @ExcludeIfExists(A.class)
>>>>> public class AImpl2 implement A { ... }
>>>>>
>>>>> When both classes are on the classpath, AImpl2 will be vetoed.
>>>>> When only AImpl2 is on the classpath, a bean will be created for it.
>>>>>
>>>>> This was something that I was missing when trying to use the Exclude
>>>>> annotation of Deltaspike. Now I would like to know if you are
>>>>>
>>>> interested in
>>>
>>>> such an extension. I can provide you the basic code, which is actually
>>>>>
>>>> not
>>>
>>>> that trivial.
>>>>> I think many people would benefit from this extension. Especially the
>>>>> servlet module could benefit from that too since it could replace
>>>>>
>>>> current
>>>
>>>> usages of the Deltaspike qualifier on the producers with the exclude
>>>>> annotation. Then the servlet module could provide beans for the servlet
>>>>> resources on EE6 servers. On EE7 servers those beans would be vetoed
>>>>>
>>>> since
>>>
>>>> EE7 servers already provides default beans for many resources.
>>>>>
>>>>> I hope you like the idea and I can help get that into the next
>>>>>
>>>> deltaspike
>>>
>>>> release.
>>>>> --
>>>>>
>>>>> Mit freundlichen Grüßen,
>>>>> ------------------------------------------------------------
>>>>> ------------
>>>>> *Christian Beikov*
>>>>>
>>>>>
>>>>
>>> --
>>> Jason Porter
>>> http://en.gravatar.com/lightguardjp
>>>
>>>
>

Re: Exclude annotation

Posted by Christian Beikov <ch...@gmail.com>.
The annotation can also be applied on producers and I am not sure if 
@DefaultImplementation would fit then.

Mit freundlichen Grüßen,
------------------------------------------------------------------------
*Christian Beikov*
Am 17.09.2014 um 21:58 schrieb Thomas Andraschko:
> I understand the use-case but i don't like the name.
> If you use @ExcludeIfExists, you mark it as default implementation if no
> other impl is on the classpath.
>
> Maybe something like @DefaultImplementation would fit it better.
>
>
> 2014-09-17 19:14 GMT+02:00 Jason Porter <li...@gmail.com>:
>
>> Feel free to prototype something in GitHub (or elsewhere) and present the
>> code.
>>
>> On Wed, Sep 17, 2014 at 10:11 AM, Christian Beikov <
>> christian.beikov@gmail.com> wrote:
>>
>>> Is nobody interested in something like that? I would really like to
>>> discuss it and also contribute the implementation.
>>>
>>> Mit freundlichen Grüßen,
>>> ------------------------------------------------------------------------
>>> *Christian Beikov*
>>> Am 25.08.2014 um 22:21 schrieb Christian Beikov:
>>>
>>>   Hello guys!
>>>> I implemented an extension that excludes a bean or producer only if a
>>>> bean for a user specified type exists.
>>>> Here a little example:
>>>>
>>>> public class AImpl1 implement A { ... }
>>>>
>>>> @ExcludeIfExists(A.class)
>>>> public class AImpl2 implement A { ... }
>>>>
>>>> When both classes are on the classpath, AImpl2 will be vetoed.
>>>> When only AImpl2 is on the classpath, a bean will be created for it.
>>>>
>>>> This was something that I was missing when trying to use the Exclude
>>>> annotation of Deltaspike. Now I would like to know if you are
>> interested in
>>>> such an extension. I can provide you the basic code, which is actually
>> not
>>>> that trivial.
>>>> I think many people would benefit from this extension. Especially the
>>>> servlet module could benefit from that too since it could replace
>> current
>>>> usages of the Deltaspike qualifier on the producers with the exclude
>>>> annotation. Then the servlet module could provide beans for the servlet
>>>> resources on EE6 servers. On EE7 servers those beans would be vetoed
>> since
>>>> EE7 servers already provides default beans for many resources.
>>>>
>>>> I hope you like the idea and I can help get that into the next
>> deltaspike
>>>> release.
>>>> --
>>>>
>>>> Mit freundlichen Grüßen,
>>>> ------------------------------------------------------------------------
>>>> *Christian Beikov*
>>>>
>>>
>>
>> --
>> Jason Porter
>> http://en.gravatar.com/lightguardjp
>>


Re: Exclude annotation

Posted by Thomas Andraschko <an...@gmail.com>.
I understand the use-case but i don't like the name.
If you use @ExcludeIfExists, you mark it as default implementation if no
other impl is on the classpath.

Maybe something like @DefaultImplementation would fit it better.


2014-09-17 19:14 GMT+02:00 Jason Porter <li...@gmail.com>:

> Feel free to prototype something in GitHub (or elsewhere) and present the
> code.
>
> On Wed, Sep 17, 2014 at 10:11 AM, Christian Beikov <
> christian.beikov@gmail.com> wrote:
>
> > Is nobody interested in something like that? I would really like to
> > discuss it and also contribute the implementation.
> >
> > Mit freundlichen Grüßen,
> > ------------------------------------------------------------------------
> > *Christian Beikov*
> > Am 25.08.2014 um 22:21 schrieb Christian Beikov:
> >
> >  Hello guys!
> >>
> >> I implemented an extension that excludes a bean or producer only if a
> >> bean for a user specified type exists.
> >> Here a little example:
> >>
> >> public class AImpl1 implement A { ... }
> >>
> >> @ExcludeIfExists(A.class)
> >> public class AImpl2 implement A { ... }
> >>
> >> When both classes are on the classpath, AImpl2 will be vetoed.
> >> When only AImpl2 is on the classpath, a bean will be created for it.
> >>
> >> This was something that I was missing when trying to use the Exclude
> >> annotation of Deltaspike. Now I would like to know if you are
> interested in
> >> such an extension. I can provide you the basic code, which is actually
> not
> >> that trivial.
> >> I think many people would benefit from this extension. Especially the
> >> servlet module could benefit from that too since it could replace
> current
> >> usages of the Deltaspike qualifier on the producers with the exclude
> >> annotation. Then the servlet module could provide beans for the servlet
> >> resources on EE6 servers. On EE7 servers those beans would be vetoed
> since
> >> EE7 servers already provides default beans for many resources.
> >>
> >> I hope you like the idea and I can help get that into the next
> deltaspike
> >> release.
> >> --
> >>
> >> Mit freundlichen Grüßen,
> >> ------------------------------------------------------------------------
> >> *Christian Beikov*
> >>
> >
> >
>
>
> --
> Jason Porter
> http://en.gravatar.com/lightguardjp
>

Re: Exclude annotation

Posted by Jason Porter <li...@gmail.com>.
Feel free to prototype something in GitHub (or elsewhere) and present the
code.

On Wed, Sep 17, 2014 at 10:11 AM, Christian Beikov <
christian.beikov@gmail.com> wrote:

> Is nobody interested in something like that? I would really like to
> discuss it and also contribute the implementation.
>
> Mit freundlichen Grüßen,
> ------------------------------------------------------------------------
> *Christian Beikov*
> Am 25.08.2014 um 22:21 schrieb Christian Beikov:
>
>  Hello guys!
>>
>> I implemented an extension that excludes a bean or producer only if a
>> bean for a user specified type exists.
>> Here a little example:
>>
>> public class AImpl1 implement A { ... }
>>
>> @ExcludeIfExists(A.class)
>> public class AImpl2 implement A { ... }
>>
>> When both classes are on the classpath, AImpl2 will be vetoed.
>> When only AImpl2 is on the classpath, a bean will be created for it.
>>
>> This was something that I was missing when trying to use the Exclude
>> annotation of Deltaspike. Now I would like to know if you are interested in
>> such an extension. I can provide you the basic code, which is actually not
>> that trivial.
>> I think many people would benefit from this extension. Especially the
>> servlet module could benefit from that too since it could replace current
>> usages of the Deltaspike qualifier on the producers with the exclude
>> annotation. Then the servlet module could provide beans for the servlet
>> resources on EE6 servers. On EE7 servers those beans would be vetoed since
>> EE7 servers already provides default beans for many resources.
>>
>> I hope you like the idea and I can help get that into the next deltaspike
>> release.
>> --
>>
>> Mit freundlichen Grüßen,
>> ------------------------------------------------------------------------
>> *Christian Beikov*
>>
>
>


-- 
Jason Porter
http://en.gravatar.com/lightguardjp