incubator-deltaspike-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gerhard Petracek <gerhard.petra...@gmail.com>
Subject Re: Need a @Typed for custom project stage (documentation and test class issue)
Date Wed, 01 Feb 2012 08:09:40 GMT
hi rudy,

yes - that's also an additional disadvantage of using @Exclude >internally<
(in general).

we can:
 a) add a new extension class for it
 b) veto them before the de-/activation-check. (we can do that because it
doesn't make sense to deactivate this behaviour since every alternative
approach would lead to the same result in this special case.)

regards,
gerhard



2012/2/1 Rudy De Busscher <rdebusscher@gmail.com>

> @Exclude: But the ExcludeExtension can be deactivated.  In doing so, you
> could end up with errors on your custom project stage suddenly.
>  Not transparent to user, I guess.
>
> So we need an Extension then where we can do the veto of the ProjectStages
> (and in the future possibly other types of classes).  But we don't
> have one for the moment. (We have the BeanManagerProvider but I don't like
> mixing 'things' out of convenience)
>
> So we have to answer following questions:
> 1) Create an extension (not deactivatable) to veto certain types like
> ProjectStages
> 2) Core-api is the location for such an extension, in my opinion
>
>
> Rudy
>
> On 1 February 2012 06:56, Christian Kaltepoth <christian@kaltepoth.de
> >wrote:
>
> > +1 for automatically vetoing custom project stages. This eliminates a
> > possible pitfall for users if they forget the @Typed annotation.
> >
> > Christian
> >
> > 2012/2/1 Peter Muir <pmuir@redhat.com>:
> > > +1 to gerhards approach.
> > >
> > > --
> > > Pete Muir
> > > http://in.relation.to/Bloggers/Pete
> > >
> > > On 31 Jan 2012, at 14:30, Gerhard Petracek <gerhard.petracek@gmail.com
> >
> > wrote:
> > >
> > >> hi rudy,
> > >>
> > >> thx! imo it's the right time to restart this discussion.
> > >>
> > >> mark prefers to use @Typed() for custom project-stages (@mark please
> > >> correct me if i mix it up with a different discussion).
> > >> but i don't really see the need for it. we just can veto project-stage
> > >> classes, because the result is the same and users don't have to care
> > >> about @Typed()
> > >>
> > >> regards,
> > >> gerhard
> > >>
> > >>
> > >>
> > >> 2012/1/31 Rudy De Busscher <rdebusscher@gmail.com>
> > >>
> > >>> Hi all,
> > >>>
> > >>> During testing of the forge deltaspike plugin, I came across a small
> > >>> documentation problem (I hope it is that) regarding the custom
> project
> > >>> stage.
> > >>>
> > >>> When the plugin generates the Java class as this
> > >>>
> > >>> public class CustomProjectStageHolder implements ProjectStageHolder
> > >>> {
> > >>>   public static final class CustomProjectStage extends ProjectStage
> > >>>   {
> > >>>       private static final long serialVersionUID =
> > 1029094387976167179L;
> > >>>   }
> > >>>
> > >>>   public static final CustomProjectStage CustomProjectStage = new
> > >>> CustomProjectStage();
> > >>> }
> > >>>
> > >>> and puts the correct value in the
> > >>>
> > >>>
> >
> META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolder.
> > >>>
> > >>> I get the following WELD error when starting up the application:
> > (Glassfish
> > >>> 3.1.1, Glassfish 3.1.2 b19 [promoted build], JBoss 7.1.0.CR1b]
> > >>>
> > >>> *WELD-001409 Ambiguous dependencies for type [ProjectStage] with
> > qualifiers
> > >>> [@Default] at injection point [[field] @Inject private
> > >>> org.apache.deltaspike.demo.HelloWorld.projectStage]. Possible
> > dependencies
> > >>> [[Producer Method [ProjectStage] with qualifiers [@Any @Default]
> > declared
> > >>> as [[method] @Produces @Dependent @Default public
> > >>>
> > org.apache.deltaspike.core.util.ProjectStageProducer.getProjectStage()],
> > >>> Producer Method [ProjectStage] with qualifiers [@Any @Default]
> > declared as
> > >>> [[method] @Produces @Dependent @Default public
> > >>>
> > org.apache.deltaspike.core.util.ProjectStageProducer.getProjectStage()],
> > >>> Managed Bean [class
> > >>> be.rubus.forge.deltaspike.test.projectstage.RudyHolder$Rudy] with
> > >>> qualifiers [@Any @Default]]*
> > >>>
> > >>> The error goes away by annotating the CustomProjectStage with @Typed.
> > >>>
> > >>> - Looking at the default project stages defined in class
> > >>> org.apache.deltaspike.core.api.projectstage.ProjectStage, they are
> also
> > >>> excluded as CDI.
> > >>> - Within the core-impl tests, there is also a custom project stage
> > >>>
> > >>>
> >
> (org.apache.deltaspike.test.core.api.projectstage.TestProjectStages.CustomProjectStage)
> > >>> but without the @Typed(). But it seems never used in an integration
> > test.
> > >>> So that's why there is no problem with it.
> > >>>
> > >>> So do you all agree that
> > >>> 1) I adopt the documentation in adding the @Typed annotation
> > >>> 2) Add the @Typed annotation at the test
> > >>> class
> > >>>
> >
> org.apache.deltaspike.test.core.api.projectstage.TestProjectStages.CustomProjectStage.
> > >>> Although not needed, it is good for uniformity.
> > >>>
> > >>> Regards
> > >>> Rudy
> > >>>
> > >>> --
> > >>> Rudy De Busscher
> > >>> http://www.c4j.be
> > >>>
> >
> >
> >
> > --
> > Christian Kaltepoth
> > Blog: http://chkal.blogspot.com/
> > Twitter: http://twitter.com/chkal
> >
>
>
>
> --
> Rudy De Busscher
> http://www.c4j.be
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message