• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

AOP in JEE

 
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to trigger processes when certain functionality is executed in a JEE or Java application. I know about servlet filters and I use them when specific Servlets are called. But what about POJO's?

Here are some examples of what I would like to do:
When a DAO is about to be called, a process to trace parameters going into a stored procedure executes.
An exception occurs and is pushed to the stack, a process detects this and logs the error.
A global variable is changed by a side door process. Another process detects this and does some re initialization.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure you can easily add AOP to POJOs, but entities and stateless/stateful/singleton beans aren't that hard. For entities, you can attach entity listeners. Those are limited to triggers before and after JPA events such as updating, persisting, etc. For beans you can add interceptors that can add functionality, or even completely skip executing a bean method.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic