<br><br><div class="gmail_quote">On Thu, Mar 24, 2011 at 8:05 AM, Marek Śmigielski <span dir="ltr">&lt;<a href="mailto:marek.smigielski@gmail.com">marek.smigielski@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div><div></div><div class="h5">On Thu, Mar 24, 2011 at 1:14 PM, Pete Muir &lt;<a href="mailto:pmuir@redhat.com">pmuir@redhat.com</a>&gt; wrote:<br>
&gt;<br>
&gt; On 23 Mar 2011, at 21:55, Marek Śmigielski wrote:<br>
&gt;<br>
&gt;&gt; On Wed, Mar 23, 2011 at 9:54 PM, Clint Popetz &lt;<a href="mailto:cpopetz@gmail.com">cpopetz@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Wed, Mar 23, 2011 at 3:02 PM, Marek Śmigielski<br>
&gt;&gt;&gt; &lt;<a href="mailto:marek.smigielski@gmail.com">marek.smigielski@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Hi,<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; In last few day I have deeply thought over wicket modul features<br>
&gt;&gt;&gt;&gt; essential to fully integrate with wicket framework. In wicket<br>
&gt;&gt;&gt;&gt; architecture there is idea of model as a state bean. Its quite<br>
&gt;&gt;&gt;&gt; different in terms of live cycle from scopes provided by CDI.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; 1. It is page scope (in some cirumstances more than one http request)<br>
&gt;&gt;&gt;&gt; 2. It is serialized after each request and store in session or disk.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Wicket modules misses integration throught model object with wicket<br>
&gt;&gt;&gt;&gt; architecture so I&#39;ve developed some integration with it. The idea is<br>
&gt;&gt;&gt;&gt; that you can achieve CDI beans exactly in the same way like in JSF,<br>
&gt;&gt;&gt;&gt; through expressionLanguage. So you can inject any named or other el<br>
&gt;&gt;&gt;&gt; bean via:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;   @Inject @ModelExpression(&quot;#{nameBean}&quot;)<br>
&gt;&gt;&gt;&gt;   private SeamModel&lt;String&gt; label;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; and later use it on your page directly:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Label label = new Label(&quot;headerLabel&quot;, headerLabelModel);<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; or wrap it by other wicket model:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;   @Inject @ModelExpression(&quot;#{registartion}&quot;)<br>
&gt;&gt;&gt;&gt;   private SeamModel&lt;Registartion&gt; registartion;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Form registrationForm = new Form(&quot;registartionForm&quot;, new<br>
&gt;&gt;&gt;&gt; CompoundPropertyModel(registartion));<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; and later use it on whole form.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I&#39;m not sure what benefit this provides.  The wicket page instance is<br>
&gt;&gt;&gt; already a scope, if you wanted something specific to the page, you could<br>
&gt;&gt;&gt; just add it as a field to the page or component.  And EL as a referencing<br>
&gt;&gt;&gt; mechanism is a little too JSF-esque (weakly bound, not refactoring safe) to<br>
&gt;&gt;&gt; be well suited to a wicket integration layer.<br>
&gt;&gt; I think that it&#39;s worth to have some way of injection components<br>
&gt;&gt; straight to wicket model beans. Duplication of the fields between<br>
&gt;&gt; wicket page and request component (or any scope component) in my<br>
&gt;&gt; opinion is unnecessary. I agree that EL and wicket concept don&#39;t fit<br>
&gt;&gt; well, but I haven&#39;t had any other idea how to inject a bean to wicket<br>
&gt;&gt; page wrapped with Model interface without EL. Now I realize that if I<br>
&gt;&gt; can get actualType of class form injection point, I can also resolve<br>
&gt;&gt; targeted bean in typesafe way. SeamModel bean may be very similar to<br>
&gt;&gt; InstanceImpl class from weld core. What do you think?<br>
&gt;<br>
&gt; You mean you need to know the generic type of the injection point?<br>
&gt;<br>
&gt;   protected static Type getFacadeType(InjectionPoint injectionPoint)<br>
&gt;   {<br>
&gt;      Type genericType = injectionPoint.getType();<br>
&gt;      if (genericType instanceof ParameterizedType )<br>
&gt;      {<br>
&gt;         return ((ParameterizedType) genericType).getActualTypeArguments()[0];<br>
&gt;      }<br>
&gt;      else<br>
&gt;      {<br>
&gt;         throw new IllegalStateException(TYPE_PARAMETER_MUST_BE_CONCRETE, injectionPoint);<br>
&gt;      }<br>
&gt;   }<br>
&gt;<br>
&gt; Does that.<br>
&gt;<br>
&gt; I would be very against introducing EL into Wicket, it completely removes a key benefit of Wicket.<br>
&gt;<br>
</div></div>I understand problem with EL and Wicket. I have modified the way<br>
SeamModel(wrapper over actual bean that implements IModel) is produced<br>
by throwing out qualifier with EL. I have Implemented SeamModel get<br>
wrapped bean method, based on get method of InstanceImpl class and<br>
this one works as expected. I can now inject bean like that:<br>
<br>
@Inject<br>
SeamModel&lt;Registration&gt; registration;<br>
<br>
<br>
but when I have any other qualifier besides @Inject,<br>
<br>
@Inject @UserRegistraion<br>
SeamModel&lt;Registration&gt; registration;<br>
<br>
CDI search for SeamModel bean with this qualifier and throws<br>
unsatisfied dependency injection. What I try to achive is to have<br>
posibilty to inject SeamModel in exactly the same way that Instance<br>
component is injected or to have producer method which satisfied all<br>
qualifiers.<br>
<div><div></div><div class="h5"><br></div></div></blockquote><div><br></div><div>Do you have a fork on github I can check out?  Because I&#39;m still not clear on what is being done.  What gets injected when you inject &quot;registration&quot; above.  Does it store its injection point data and use that to lookup the bean through the BeanManager api on each call to Model.getObject()?</div>

<div><br></div><div>-Clint</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="h5">
<br>
<br>
&gt;&gt;<br>
&gt;&gt; As to benefits, besides saving few lines of code on each page, you get<br>
&gt;&gt; very safe way of injection beans from any CDI scopes. Injecting<br>
&gt;&gt; request scope beans into a page isn&#39;t safe at all and for some<br>
&gt;&gt; developers can be not natural. The same applies to situation when your<br>
&gt;&gt; conversation scope timeouts or was destroyed. If you injected that<br>
&gt;&gt; bean into wicket page it will hold reference to your object and cause<br>
&gt;&gt; unstable behavior.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; As I follow seam 3 for some time now I understand that this is time<br>
&gt;&gt;&gt;&gt; for bugfix rather than adding new features. Is it possible to merge<br>
&gt;&gt;&gt;&gt; this code before final realese?<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Second feature is rather small and not soo excited as previous one.<br>
&gt;&gt;&gt;&gt; I&#39;ve prepared possiblity to inject ResourceStreamLocator. Deafault is<br>
&gt;&gt;&gt;&gt; exactly the same as in wicket but I had also developed alternative<br>
&gt;&gt;&gt;&gt; one, which enables throught configuration to change the place where<br>
&gt;&gt;&gt;&gt; html file are stored. In my opinion it&#39;s also simplification.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;  Wicket already has a way to register resource stream locators, I don&#39;t see<br>
&gt;&gt;&gt; why we need a yet another way to do it.  Can you elaborate?<br>
&gt;&gt; It depends how many features would you like to have in wicket module.<br>
&gt;&gt; But as I review why I put it in wicket module instead of my project (I<br>
&gt;&gt; wrote it a month ago), I can&#39;t find any strong arguments. It would be<br>
&gt;&gt; better to have wicket module as simple as possible so forget about it.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; -Clint<br>
&gt;&gt;<br>
&gt;&gt; Marek Smigielski<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; seam-dev mailing list<br>
&gt;&gt; <a href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/seam-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/seam-dev</a><br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Clint Popetz<br><a href="http://42lines.net">http://42lines.net</a><br>Scalable Web Application Development<br>