Re: [aspectwerkz-user] help with aspect not weaved

Alexandre Vasseur <[email protected]> Tue, 5 Jul 2005 15:58:14 +0200
Newsgroups gmane.comp.java.aspectwerkz.user
Message-ID <[email protected]>
Hi Borislav

There is a bug in the deployer that leads to ignoring the given
deployment-model in this cases (ie we read the xml and override it
with annotation instead of doing it the other way)
I 'll fix it for 2.1, but yes it is a supported feature.

Note that if ever you plan to use 2 different aspect models for the
same aspect class deployed, you 'll need to use an aspect name=... in
the XML, so that the system can handle them differently.
The same thing can thus be used now, to somehow bypass the bug:

try that (or equivalent, the important thing here is the name='...' attribute

        Deployer.deploy(Aspect.class,
                "<aspect class='pack.Aspect' name='pack.Aspect_1'
deployment-model='perClass'>" +
                "   <advice name='decorate' type='around'
bind-to='execution(* pack.TargetHelper.some*(..))'/>" +
                "</aspect>",
                s1,
                loader
        );

        Deployer.deploy(Aspect.class,
                "<aspect class='pack.Aspect' name='pack.Aspect_2'
deployment-model='perClass'>" +
                "   <advice name='decorate' type='around'
bind-to='execution(* pack.TargetStack.some*(..))'/>" +
                "</aspect>",
                s2,
                loader
        );


Alex





On 6/24/05, [email protected] <[email protected]> wrote:
> Hello,
> 
> Thanks a lot for the help! It worked now.
> 
> I have one question for hot deployments of aspects though, for Alex et al.: is it possible to do a hot deployment on a perClass basis at least (if not perInstance). For instance I have the following in aop.xml:
> 
>     <deployment-scope name="allMethods" expression="execution(* com.ubs.firc.credit.jrisk2003_2.dataaccess.prion.core.prion.ejbPrionEJBHelper.*(..))"/>
>     <deployment-scope name="toString" expression="execution(String *.toString())"/>
> 
> and then, I programmatically create the XML for the aspects that I want to deploy perClass:
> 
> xmlDef="<aspect class='test.com.ubs.firc.support.aspect.GenericMethodDecorator' deployment-model='perClass'> " +
>     "<pointcut name='prionHelper' expression='execution(* com.ubs.firc.credit.jrisk2003_2.dataaccess.prion.core.prion.ejbPrionEJBHelper.*(..))'/>" +
>     "<advice name='decorate' type='around' bind-to='prionHelper'/>" +
> "</aspect>";
> 
> h1 = Deployer.deploy(GenericMethodDecorator.class, xmlDef, scope1);
> 
> xmlDef="<aspect class='test.com.ubs.firc.support.aspect.GenericMethodDecorator' deployment-model='perClass'> " +
>     "<pointcut name='bla' expression='execution(* net.appl.jrisk.util.ErrorStack.toString())'/>" +
>     "<advice name='decorate' type='around' bind-to='bla'/>" +
> "</aspect>";
> 
> h2 = Deployer.deploy(GenericMethodDecorator.class, xmlDef, scope2);
> 
> So I'm hoping to deploy two separate instances of the GenericMethodDecorator aspect, one for the ejbPrionEJBHelper and another for the ErrorStack class. However, a singleton instance is attached to both of them. Is what I'm attempting to do supported at all? Or should I implement this contextual behavior (dependent on the target class) in my aspect by examining JoinPoint instances..?
> 
> Thanks,
> Boris
> 
> |-----Original Message-----
> |From: Michael Haupt [mailto:[email protected]]
> |Sent: Thursday, June 23, 2005 2:34 PM
> |To: [email protected]
> |Cc: Iordanov, Borislav; [email protected]
> |Subject: RE: [aspectwerkz-user] help with aspect not weaved
> |
> |
> |Hi,
> |
> |
> |Borislav Iordanov wrote:
> |> However, the class
> |> JRiskSecurity_1__2130939767_1948679980___AW_JoinPoint is
> |nowhere to be
> |> found... :(
> |
> |
> |I used to have the same problem until someone on this friendly
> |and helpful
> |mailing list :-) told me to modify the
> |classorg.codehaus.aspectwerkz.transform.inlining.compiler.Abstr
> |actJoinPointCompiler,
> |namely to set its member DUMP_JIT_CLASSES to true. After
> |recompiling that
> |class (and updating the JAR), it should work, and JoinPoint
> |classes should
> |be dumped.
> |
> |Best,
> |
> |
> |Michael Haupt
> |
> |
> |
> |
> |
> 
> Visit our website at http://www.ubs.com
> 
> This message contains confidential information and is intended only
> for the individual named.  If you are not the named addressee you
> should not disseminate, distribute or copy this e-mail.  Please
> notify the sender immediately by e-mail if you have received this
> e-mail by mistake and delete this e-mail from your system.
> 
> E-mail transmission cannot be guaranteed to be secure or error-free
> as information could be intercepted, corrupted, lost, destroyed,
> arrive late or incomplete, or contain viruses.  The sender therefore
> does not accept liability for any errors or omissions in the contents
> of this message which arise as a result of e-mail transmission.  If
> verification is required please request a hard-copy version.  This
> message is provided for informational purposes and should not be
> construed as a solicitation or offer to buy or sell any securities or
> related financial instruments.
> 
>