<div dir="ltr">Hi Ales,<div><br></div><div>Thanks for reply, I ll try to elaborate bit more. Simple example of what I am trying to do (besides figuring out how it all works together) is this:</div><div>I am trying to create custom subsystem with deployment processor that will pick up any ear or war deployed, if that deployment contains say class A with let say my own annotation @SomeServiceContext on attribute SomeService someService, it will create instance of class SomeService for that deployment. Idea then is when this class A is instantiated I want the attribute someService to be initialized with SomeService class created for this deploymen. </div>
<div>More less this might be viewed as very simple implementation of my own injection, reason is purely learning, I am aware that Weld does all this for us already. This is more along the lines - figure out how weld does it in the wildfly.</div>
<div><br></div><div>From the examples that I have followed, I am able to create subsystem, and detect if deployment contains my annotation. What I was trying to ask is what would be the best way to proceed from here, few options that came to my mind are:</div>
<div><br></div><div> 1. Service in my subsystem might bind SomeService for this deployment into jndi, and I could use weld extensions to process classes with my @SomeServiceContext annotation to inject correct value of SomeService prepared for that deployment during deploy of the application</div>
<div><br></div><div>or</div><div><br></div><div>2. More complicated option, might be to somehow modify the bytecode of the class A, for example append as last line of default constructor of class A code that will set the attribute SomeService someService to the value that service in my subsystem created for this deployment.</div>
<div><br></div><div><br></div><div><br></div><div>Option 2 is far more complicated and interesting to me, as from my naive thinking this might be similar even to how weld is implemented, find all annotated classes, and modify the their bytecode to inject correct values when they are instantiated, combined with wildfly subsystem and deployers.</div>
<div><br></div><div><br></div><div>Regards,</div><div>Dejan</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div> </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Nov 21, 2013 at 1:59 PM, Ales Justin <span dir="ltr"><<a href="mailto:ales.justin@gmail.com" target="_blank">ales.justin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div>What exactly are you trying to do -- a bit confusing description?</div><div>Or, from what I can understand, a simple ClassFileTransformer could do the trick for you.</div><div><br></div>
<div>-Ales</div><div><br></div><div><div><div class="h5"><div>On 20 Nov 2013, at 15:59, Dejan Kitic <<a href="mailto:kdejan@gmail.com" target="_blank">kdejan@gmail.com</a>> wrote:</div><br></div></div><blockquote type="cite">
<div><div class="h5"><div dir="ltr">Hi,<div><br></div><div>First of all my apologies, if I am asking the question in wrong place, though my gut feeling tells me that people on this list would know the most about this matter.</div>
<div> </div><div>
I am trying to write my own subsystem, and have wrote most of it, using <a href="https://docs.jboss.org/author/display/AS72/Extending+JBoss+AS+7" target="_blank">https://docs.jboss.org/author/display/AS72/Extending+JBoss+AS+7</a> and maven archtype there.</div>
<div><br></div><div>I have my own annotation, which user can add onto the attribute of EJB or CDI bean, and deployment processor for my subsystem finds all classes with this annotation. </div><div>From my understanding inside deployment processor executed during Phase.PARSE, getAttachment(Attachments.ANNOTATION_INDEX) will enable me to find all classes with my annotation, without loading the classes (jandex).</div>
<div><br></div><div>After finding them all, I am trying to modify the class to inject instance to that annotated field with value that has been created in my subsystem for that deployment.</div><div><br></div><div>I think options are to rely on Weld, or modify bytecode to set this field with my value stored in my subsystem when class is instantiated. </div>
<div>If I change phase </div><div><br></div><div>Am I going in the right direction with this, what would be recommended way to do something like this? Any pointers would be welcome.</div><div><br></div><div>Regards,</div>
<div>Dejan</div></div></div></div>
_______________________________________________<br>wildfly-dev mailing list<br><a href="mailto:wildfly-dev@lists.jboss.org" target="_blank">wildfly-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/wildfly-dev</a><br>
</blockquote></div><br></div><br>_______________________________________________<br>
wildfly-dev mailing list<br>
<a href="mailto:wildfly-dev@lists.jboss.org">wildfly-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/wildfly-dev</a><br>
<br></blockquote></div><br></div>