Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Re:aspectj-users Digest, Vol 20, Issue 32

Sometimes i will need to completely remove the try/catch block via an aspect.
 
Thanks for your help!
De: aspectj-users-bounces@xxxxxxxxxxx
Para: aspectj-users@xxxxxxxxxxx
Cópia:
Data: Thu, 12 Oct 2006 06:06:35 -0400 (EDT)
Assunto: aspectj-users Digest, Vol 20, Issue 32
> Send aspectj-users mailing list submissions to
> aspectj-users@xxxxxxxxxxx
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> or, via email, send a message with subject or body 'help' to
> aspectj-users-request@xxxxxxxxxxx
>
> You can reach the person managing the list at
> aspectj-users-owner@xxxxxxxxxxx
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of aspectj-users digest..."
>
>
> Today's Topics:
>
> 1. Re: Re: Aspect and Exception Handle (Arjun Singh)
> 2. Re: Load time weaving and classpath! (Matthew Webster)
> 3. Re: weaving into Eclipse classes (Matthew Webster)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 11 Oct 2006 15:09:54 -0700
> From: "Arjun Singh"
> Subject: Re: [aspectj-users] Re: Aspect and Exception Handle
> To: aspectj-users@xxxxxxxxxxx
> Message-ID:
>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi,
>
> If you have a situation like this:
>
> class Foo {
> public void boo() {
> try {
> ...
> }
> catch(Exception e) {
> ...
> }
> }
> }
>
> and you would like to advise the handler, you could have an advice
> that is something like the following:
>
> before(Foo foo, Exception e): handler(Exception) && within(Foo)
> && args(e) && this(foo) {
> ...
> }
>
> You would then have access to the class via the foo object. Is this
> what you are looking for? Or did you want to completely remove the
> try/catch block via an aspect?
>
> On 10/11/06, Washington Correia wrote:
> > Hi ! This is the sample code that i sad in the early message.I hope for your
> > helps.
> >
> > // Method in the Class
> >
> >
> > public void jMenuFileCon_actionPerformed(ActionEvent e) {
> >
> > ....
> >
> > if(result == CaixaLogon.OK_OPTION){
> >
> > if (System.getSecurityManager() == null) {
> >
> > System.setSecurityManager(new RMISecurityManager());
> >
> > }
> >
> > try {
> >
> > UnicastRemoteObject.exportObject(this);
> >
> > myServerObject = (IJogo) Naming.lookup("rmi://" + servidor.getText() +
> > "/Serv");
> >
> > Logon.setEnabled(true);
> >
> > jMenuFileCon.setEnabled(false);
> >
> > }
> >
> > catch (RemoteException ex2) {
> >
> > message = "Erro ao Iniciar Conex?o";
> >
> > title = "Servidor Indispon?vel ! :-(" ;
> >
> > CaixaLogon.showMessageDialog(contentPane,message,title,CaixaLogon.NO_OPTION);
> >
> > }
> >
> > catch (MalformedURLException ex2) {
> >
> > message = "Erro ao Iniciar Conex?o";
> >
> > title = "Servidor Indispon?vel ! :-(" ;
> >
> > CaixaLogon.showMessageDialog(contentPane,message,title,CaixaLogon.NO_OPTION);
> >
> > }
> >
> > catch (NotBoundException ex2) {
> >
> > message = "Erro ao Iniciar Conex?o";
> >
> > title = "Servidor Indispon?vel ! :-(" ;
> >
> > CaixaLogon.showMessageDialog(contentPane,message,title,CaixaLogon.NO_OPTION);
> >
> > }
> >
> > ...../////////////////////// end class
> >
> > }
> >
> > // Aspect to replace the catch block.
> >
> > public aspect HandlerTeste {
> >
> >
> >
> > pointcut erro(): call(*
> > ClassName.jMenuFileCon_actionPerformed(..));
> >
> >
> >
> > pointcut erro(): handler(MalformedURLException+);
> >
> > before(ClassName cl): erro() && target(cl){
> >
> > // to have access to variables in the class like message,title and
> > Caixa.Logon to replace the bloc catch to // aspect
> >
> > System.out.println("Tratamento de runtimeexceptio !!");
> >
> > System.out.println("Trate o erro aqui !!");
> >
> > }
> >
> >
> >
> > }
> >
> >
> > Thanks !
> >
> >
> > Regards,
> >
> > ____________________________
> > Washington Costa P. Correia
> > CTA/ITA/IEC
> >
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> >
> >
>
>
> ------------------------------
>
> Message: 2
> Date: Thu, 12 Oct 2006 10:37:51 +0100
> From: Matthew Webster
> Subject: Re: [aspectj-users] Load time weaving and classpath!
> To: aspectj-users@xxxxxxxxxxx
> Message-ID:
>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Michael,
>
> There should be no difference in the dependencies of an aspect between
> compile-time and load-time weaving. If you weave a class with aspect A
> that needs dependency D then D must be on the classpath. I don't quite
> understand why you have to do anything different for LTW. Perhaps it
> relates to the way you have enabled LTW under JDK 1.4 where the -javaagent
> is not available.
>
> Matthew Webster
> AOSD Project
> Java Technology Centre, MP146
> IBM Hursley Park, Winchester, SO21 2JN, England
> Telephone: +44 196 2816139 (external) 246139 (internal)
> Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
> http://w3.hursley.ibm.com/~websterm/
>
>
>
> Michael Dempfle
> Sent by: aspectj-users-bounces@xxxxxxxxxxx
> 11/10/2006 13:54
> Please respond to
> aspectj-users@xxxxxxxxxxx
>
>
> To
> aspectj-users@xxxxxxxxxxx
> cc
>
> Subject
> [aspectj-users] Load time weaving and classpath!
>
>
>
>
>
>
> Hello,
>
> We are using AspectJ in our project to get debug information at may
> places and this aspects do have a lot of imports because
> they do fetch lots of specific data inside the aspects.
>
> We now starting to change our performance measurement setup to Load Time
> Weaving - means that our points where we want
> to measure time are added dynamically - the debug part ist still added
> at compile time.
>
> The compile time aspects are reweavable and I have an aop.xml where they
> are defined again.
>
> We are running OAS (jdk 1.4.2) that is normally started with -jar
> oc4j.jar and all other jar files from our applications
> are added automatically to the cp.
> My big problem is that when I change to LTW I have to add every single
> jar file that is imported into any of the aspects
> to the classpath of the server (and this has quite some implications
> because e.g. log4j is not initialized properly then).
>
> Is there a way that the aspectj compiler does NOT load the aspects that
> are defined at startup. I think it has to load it right now
> because it has to read the join points where the aspects have to be
> used ...
> Would this be still the case if the join points are defined in the xml?
> I don't know if the classloader does load the aspects no matter
> what.
>
> Any more details in this area would be great.
>
> Thanks,
> Michael
>
>
> @Ron: Glassbox on OAS with jdk 1.4.2 is still in my mind - but we still
> have problem to get our system properly running..
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://eclipse.org/pipermail/aspectj-users/attachments/20061012/facf2e78/attachment.html
>
> ------------------------------
>
> Message: 3
> Date: Thu, 12 Oct 2006 11:08:47 +0100
> From: Matthew Webster
> Subject: Re: [aspectj-users] weaving into Eclipse classes
> To: aspectj-users@xxxxxxxxxxx
> Message-ID:
>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Daniel,
>
> In the Package Explorer view simply select "Import > Plug-in Development >
> Plug-ins and Fragments". To keep the plug-in up-to-date you wound normally
> select "Import As: Binary projects with linked content" but that's no good
> if you are weaving. You will need to refresh the code if it changes.
>
> Matthew Webster
> AOSD Project
> Java Technology Centre, MP146
> IBM Hursley Park, Winchester, SO21 2JN, England
> Telephone: +44 196 2816139 (external) 246139 (internal)
> Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
> http://w3.hursley.ibm.com/~websterm/
>
>
>
> "Daniel Mahler"
> Sent by: aspectj-users-bounces@xxxxxxxxxxx
> 11/10/2006 20:24
> Please respond to
> aspectj-users@xxxxxxxxxxx
>
>
> To
> aspectj-users@xxxxxxxxxxx
> cc
>
> Subject
> Re: [aspectj-users] weaving into Eclipse classes
>
>
>
>
>
>
> Matthew,
>
> That sounds promising, where can I find
> more information about binary plugins.
> Most docs I have seen mention it,
> but do not say much about it.
> Is there a way to keep your imported plugin automatically
> in sync with your imported plug-in?
> ie if I binary import the EMF plugin
> and the upgrade the installed EMF
> I would like the EMF in my workspace to get upgraded.
>
> thanks
> Daniel
>
> On 10/10/06, Matthew Webster wrote:
> > Davi,
> >
> > Another approach is to import the binary plug-in(s) you would like to
> > weave into you workspace and use binary weaving. You can then use the
> > woven versions in a runtime workbench. What is your target environment?
> >
> > Matthew Webster
> > AOSD Project
> > Java Technology Centre, MP146
> > IBM Hursley Park, Winchester, SO21 2JN, England
> > Telephone: +44 196 2816139 (external) 246139 (internal)
> > Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
> > http://w3.hursley.ibm.com/~websterm/
> >
> >
> >
> > "Arjun Singh"
> > Sent by: aspectj-users-bounces@xxxxxxxxxxx
> > 09/10/2006 23:05
> > Please respond to
> > aspectj-users@xxxxxxxxxxx
> >
> >
> > To
> > aspectj-users@xxxxxxxxxxx
> > cc
> >
> > Subject
> > Re: [aspectj-users] weaving into Eclipse classes
> >
> >
> >
> >
> >
> >
> > Hi Davi,
> >
> > So if I understand things correctly, you would like to weave
> > additional methods from your plugin into classes in the
> > org.eclipse.jdt.core project.
> >
> > I know of a way that might work for you. You could use the ajc
> > compiler (either via the command line or from one of the ajc ant
> > tasks) with the inpath, outjar, and classpath options. However, I
> > have tried to weave into the org.eclipse.jdt.core project before, and
> > I received a code size too big error (see
> > http://dev.eclipse.org/mhonarc/lists/aspectj-users/msg06484.html for
> > more information). So to get around that, you would need to do some
> > refactoring of that project - you would have to break up the classes
> > that produced the code size too big error. Also if your methods make
> > use of some type that cannot be resolved based on the project's
> > manifest file, you may need to update that file.
> >
> > Of course the easiest way to achieve your goal would be to check out
> > the org.eclipse.jdt.core project from the eclipse cvs repository, make
> > your additions by editing the code, build the project, and then deploy
> > the plugin. But I suppose this might not work for you, depending on
> > what your methods are.
> >
> > As far as I can understand, Mahler (in
> > http://dev.eclipse.org/mhonarc/lists/aspectj-users/msg06414.html )
> > wanted to weave advice into classes defined in his own plugin, which
> > seems like a different situation than yours.
> >
> > Arjun
> >
> > On 10/9/06, Davi Pires wrote:
> > > Arjun,
> > >
> > > Thanks. I'll take a look at AJEER and see if it helps.
> > >
> > > However, from those threads I read, it seems to be possible to weave
> > into
> > > other plugins without using any special technology. And that would be
> > the
> > > best choice, undoubtedly, but I can't figure out how it can be done.
> > >
> > > Perhaps Mr. Mahler himself could show me the way...
> > >
> > > Thanks for the help.
> > >
> > > Davi Pires
> > >
> > >
> > >
> > >
> > > On 10/6/06, Arjun Singh wrote:
> > > > Each plugin has its own classloader. According the the aspectj
> > > > developer guide, load time weaving is done in the context of a class
> > > > loader. A class loader can only weave classes that it defines, not
> > > > classes loaded by other class loaders. So I believe that is why an
> > > > aspect in your plugin is not woven into any of the eclipse plugins.
> > > > AJEER defines specialized classloaders that somehow address this.
> > > >
> > > > Hope that helps,
> > > > Arjun
> > > >
> > > > On 10/6/06, Davi Pires < inhodpr@xxxxxxxxx> wrote:
> > > > > Not really, actually.
> > > > >
> > > > > In the second thread, Mahler says:
> > > > > > I now know that one cannot apply aspects within Eclipse code
> > > > > > without using something like AJEER (or AOSGI when it becomes
> > > available).
> > > > > >
> > > > >
> > > > > And that's precisely what I don't know.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On 10/6/06, Arjun Singh wrote:
> > > > > > Hi Davi,
> > > > > >
> > > > > > There are two related threads that might help you:
> > > > > >
> > > > > >
> > > > >
> > > http://dev.eclipse.org/mhonarc/lists/aspectj-users/msg06409.html
> > > > > >
> > > > >
> > > http://dev.eclipse.org/mhonarc/lists/aspectj-users/msg06414.html
> > > > > >
> > > > > > After reading those, do you have any questions?
> > > > > >
> > > > > > Arjun
> > > > > >
> > > > > > On 10/6/06, Davi Pires < inhodpr@xxxxxxxxx> wrote:
> > > > > > > Hi all,
> > > > > > >
> > > > > > > I'm writing an Eclipse plugin that tries to use AspectJ to
> weave
> > > some
> > > > > > > methods into the classes of Eclipse AST, which are in the
> > package
> > > > > > > org.eclipse.jdt.core.dom.
> > > > > > >
> > > > > > > However, I don't understand the warning I get from the
> compiler,
> > > saying
> > > > > that
> > > > > > > "the type is not exposed to the weaver". I have the plugins in
> > the
> > > > > > > dependencies list of my plugin, and I thought the load time
> > weaver
> > > could
> > > > > > >
> > > > > > > Anyone can show me a way to get around this (if there is any)?
> > > > > > >
> > > > > > > Thanks.
> > > > > > >
> > > > > > > Davi Pires
> > > > > > >
> > > > > > > _______________________________________________
> > > > > > > aspectj-users mailing list
> > > > > > > aspectj-users@xxxxxxxxxxx
> > > > > > >
> > > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > _______________________________________________
> > > > > > aspectj-users mailing list
> > > > > > aspectj-users@xxxxxxxxxxx
> > > > > >
> > > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > > > > >
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > aspectj-users mailing list
> > > > > aspectj-users@xxxxxxxxxxx
> > > > > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > > > >
> > > > >
> > > > >
> > > > _______________________________________________
> > > > aspectj-users mailing list
> > > > aspectj-users@xxxxxxxxxxx
> > > > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > > >
> > >
> > >
> > > _______________________________________________
> > > aspectj-users mailing list
> > > aspectj-users@xxxxxxxxxxx
> > > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > >
> > >
> > >
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> >
> >
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://eclipse.org/pipermail/aspectj-users/attachments/20061012/86707b7b/attachment.html
>
> ------------------------------
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
> End of aspectj-users Digest, Vol 20, Issue 32
> *********************************************
>
> Esta mensagem foi verificada pelo E-mail Protegido Terra.
> Scan engine: McAfee VirusScan / Atualizado em 11/10/2006 / Vers?o: 4.4.00/4871
> Proteja o seu e-mail Terra: http://mail.terra.com.br/
 
 
Atenciosamente,
____________________________
Washington Costa P. Correia
CTA/ITA/IEC

Back to the top