RE: [aspectwerkz-user] Hot deployment questions
"Vincent Massol" <[email protected]>
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <[email protected]> |
Thanks Alex (and yes, I'll try using deployment scopes from now on ;-)). Could my comments below be taken into account to improve the http://aspectwerkz.codehaus.org/dynamic_aop.html page? Thanks -Vincent > -----Original Message----- > From: Alexandre Vasseur [mailto:[email protected]] > Sent: lundi 11 avril 2005 10:16 > To: [email protected] > Subject: Re: [aspectwerkz-user] Hot deployment questions > > In your case you were (as you understood) calling the deployer API > before the actual classes that are affected by the aspects were > exposed to the weaver ie loaded by the VM. > > In that case, indeed, this seems to work but you can have side effect > and thus you should see that as : configuring the load time weaving > programmatically. > > f.e. if you would write something like: > > // want to hot deploy for Class Foo.class > // lets write some silly log... > out.println("Lets deploy to Foo.* " : + Foo.class.getName()); > iterate Foo.class.method to see which one is public > print the method name : print(..method[i].getName()); > // this silly log has actually trigger the class loading hence the > class is loaded and this schema is not ready for hot deployment.. > > // now lets deploy > Deployer.deploy(... .. to all public method of Foo.class) > > // lets test > ==> looks like not deployed at all... > > Alex > > > > On Apr 11, 2005 10:05 AM, Vincent Massol <[email protected]> wrote: > > Hi Alex, > > > > > -----Original Message----- > > > From: Alexandre Vasseur [mailto:[email protected]] > > > Sent: lundi 11 avril 2005 09:36 > > > To: [email protected] > > > Subject: Re: [aspectwerkz-user] Hot deployment questions > > > > [snip] > > > > > 1/ accessing the definition model to get the scope > > > should be : > > > DeploymentScope scope = > > > SystemDefinitionCONTAINER.getDefinitionFor(loader, > > > systemId).getDeploymentScope("toString"); > > > No new() - that would not do anything. > > > > Ok cool, then http://aspectwerkz.codehaus.org/dynamic_aop.html needs to > be > > fixed. > > > > BTW you mentioned last time that you would fix it to make it clear that > > aop.xml was required. That said, I've found that it works without > aop.xml > > (at least in some cases), see below. > > > > Also, the "Deployment scopes" section is not clear where it says that > the > > scope can be defined in aop.xml or in an annotation: > > > > - The sentence " They are needed due to the fact that no JVMs today > support > > schema redefinition when redefining your classes." should be improved to > > better explain what it means. > > > > - It should be more clearly stated whether defining the deployment scope > in > > the code also requires an aop.xml file or not. > > > > > 2/ aop.xml is mandatory in all cases > > > > My example works without an aop.xml file... :-) I'd really like to know > when > > an aop.xml file is required and when it isn't. It seems that if you > don't > > use a deployment scope it might not be required? > > > > > If the scope is defined as an annotation, ie in an aspect, then it is > > > mandatory to declare the aspect in aop.xml > > > > Ok. I haven't tried this yet. This is should be clearly documented in > > http://aspectwerkz.codehaus.org/dynamic_aop.html > > > > > > Thus it seems possible not to have anything defined in aop.xml. Thus > > > > something like this would work, right? > > > > > > > > <aspectwerkz> > > > > <system id="cactus2"/> > > > > </aspectwerkz> > > > > > > > > > > No, won't work (nothing would be prepared for the scope to be further > > > used) > > > > It did work but probably because I was not using a deployment scope and > that > > probably worked only because the hot deployment is done before my weaved > are > > loaded. > > > > So I think you're right in the general case where a deployment scope is > > required, then an aop.xml file is required. > > > > > > 3/ Would it also work if I have a generic deployment scope such as: > > > > > > > > <aspectwerkz> > > > > <system id="cactus2"> > > > > <deployment-scope name="allcode" expression="within(..)"/> > > > > </system> > > > > </aspectwerkz> > > > > > > > > > > 3/ generic scope is supported (and that s the motivation of it: allow > > > deployment to a subset of that scope upon user/app needs but thus > > > under control by the deployer) > > > Yes, very generic scope should work. The idea there would be to deploy > > > to a subset of this wide scope > > > > Ok, cool. Actually this syntax did not work but I'll try again with > another > > syntax. > > > > [snip] > > > > > Should we write a more comprehensice tutorial on that ? > > > > I think improving the http://aspectwerkz.codehaus.org/dynamic_aop.html > page > > would help a lot :-) > > > > It's a complex topic (with lots of options) and wherever I look > > (documentation, blog posts, etc) there are lots of ambiguous statements. > In > > other words I was not able to find a single document that clearly > described > > all the possibilities and the required configuration. > > > > Thanks > > -Vincent > > > >